43 lines
912 B
C
43 lines
912 B
C
#include <wait.h>
|
|
#include "libnazgul.h"
|
|
|
|
int main(void) {
|
|
// msgSpace mS=0;
|
|
|
|
msgSpaceId testId;
|
|
msgSpace * mSPAC;
|
|
msgPool poolInfos[3];
|
|
char * montext;
|
|
|
|
poolInfos[0].bufferNb=4;
|
|
poolInfos[0].bufferSize=200;
|
|
|
|
poolInfos[1].bufferNb=5;
|
|
poolInfos[1].bufferSize=250;
|
|
|
|
sprintf(testId,"test%d",(int)getuid());
|
|
printf("RequestedId: %s\n",testId);
|
|
printf("Void size: %d\n",sizeof(void));
|
|
//creation de l'espace de messages
|
|
mSPAC=msgSpaceCreate(testId,1,2,poolInfos);
|
|
|
|
pid_t pid=fork();
|
|
|
|
if (pid ==0){
|
|
mSPAC=msgSpaceOpen(testId);
|
|
sleep(2);
|
|
printf("Get..."); fflush(stdout);
|
|
montext=msgGet(mSPAC,0,0);
|
|
printf("get-ok\n");
|
|
} else {
|
|
mSPAC=msgSpaceOpen(testId);
|
|
montext=msgAllocate(mSPAC,2,280,0);
|
|
*montext=42;
|
|
printf("### test Valeur0 %d ###\n",(int)*montext);
|
|
printf("Put..."); fflush(stdout);
|
|
msgPut(mSPAC,0,montext);
|
|
printf("put-ok\n");
|
|
//sleep(2);
|
|
}
|
|
return 0;
|
|
}
|