2004-02-22 22:00:23 +00:00
|
|
|
#include <wait.h>
|
2004-02-22 17:39:08 +00:00
|
|
|
#include "libnazgul.h"
|
2004-02-17 16:43:47 +00:00
|
|
|
|
|
|
|
int main(void) {
|
2004-02-19 09:57:25 +00:00
|
|
|
// msgSpace mS=0;
|
|
|
|
|
|
|
|
msgSpaceId testId;
|
|
|
|
msgSpace * mSPAC;
|
2004-02-22 17:49:02 +00:00
|
|
|
msgPool poolInfos[3];
|
2004-02-22 15:29:36 +00:00
|
|
|
char * montext;
|
2004-02-19 09:57:25 +00:00
|
|
|
|
2004-02-19 23:00:12 +00:00
|
|
|
poolInfos[0].bufferNb=4;
|
|
|
|
poolInfos[0].bufferSize=200;
|
|
|
|
|
2004-02-22 15:29:36 +00:00
|
|
|
poolInfos[1].bufferNb=5;
|
|
|
|
poolInfos[1].bufferSize=250;
|
2004-02-22 17:49:02 +00:00
|
|
|
|
2004-02-23 16:22:44 +00:00
|
|
|
poolInfos[2].bufferNb=5;
|
2004-02-22 18:09:05 +00:00
|
|
|
poolInfos[2].bufferSize=280;
|
2004-02-19 23:00:12 +00:00
|
|
|
|
2004-02-23 18:02:19 +00:00
|
|
|
sprintf(testId,"test%d",(int)getuid());
|
2004-02-19 18:26:46 +00:00
|
|
|
printf("RequestedId: %s\n",testId);
|
2004-02-25 09:10:13 +00:00
|
|
|
printf("Void size: %d\n",sizeof(void));
|
2004-02-22 17:49:02 +00:00
|
|
|
mSPAC=msgSpaceCreate(testId,0,3,poolInfos);
|
2004-02-25 10:32:41 +00:00
|
|
|
if (mSPAC ==NULL) {
|
|
|
|
NZG_ERROR("msgSpaceCreate",testId);
|
|
|
|
exit(0);
|
|
|
|
}
|
|
|
|
|
2004-02-22 22:00:23 +00:00
|
|
|
pid_t pid=fork();
|
2004-02-22 15:29:36 +00:00
|
|
|
|
2004-02-22 22:00:23 +00:00
|
|
|
|
|
|
|
|
|
|
|
if (pid ==0){
|
|
|
|
mSPAC=msgSpaceOpen(testId);
|
|
|
|
sleep(2);
|
|
|
|
montext=msgAllocate(mSPAC,2,180,0);
|
|
|
|
sleep(2);
|
|
|
|
montext=msgAllocate(mSPAC,2,170,0);
|
|
|
|
sleep(2);
|
|
|
|
montext=msgAllocate(mSPAC,2,270,0);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
mSPAC=msgSpaceOpen(testId);
|
|
|
|
montext=msgAllocate(mSPAC,2,280,0);
|
2004-02-23 18:24:08 +00:00
|
|
|
*montext=42;
|
2004-02-23 18:27:27 +00:00
|
|
|
printf("### test Valeur0 %d ###\n",(int)*montext);
|
2004-02-25 09:10:13 +00:00
|
|
|
//sleep(2);
|
2004-02-22 22:00:23 +00:00
|
|
|
montext=msgAllocate(mSPAC,2,270,0);
|
2004-02-23 18:27:27 +00:00
|
|
|
*montext=17;
|
|
|
|
printf("### test Valeur1 %d ###\n",(int)*montext);
|
2004-02-22 22:00:23 +00:00
|
|
|
sleep(2);
|
|
|
|
montext=msgAllocate(mSPAC,2,270,0);
|
2004-02-23 16:22:44 +00:00
|
|
|
msgFree(mSPAC,(void *)montext);
|
2004-02-22 22:00:23 +00:00
|
|
|
//msgFree(mSPAC,(void *)montext);
|
|
|
|
//msgFree(mSPAC,(void *)montext);
|
|
|
|
wait(NULL);
|
|
|
|
msgSpaceDelete(testId);
|
|
|
|
}
|
2004-02-17 16:43:47 +00:00
|
|
|
return 0;
|
|
|
|
}
|