2020-03-03 22:17:08 +01:00
|
|
|
#ifdef _NZG_HPUX
|
|
|
|
#include <sys/wait.h>
|
|
|
|
#else
|
|
|
|
#include <wait.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "libnazgul.h"
|
|
|
|
|
2020-03-04 00:06:43 +01:00
|
|
|
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", (int)sizeof(void));
|
|
|
|
//creation de l'espace de messages
|
|
|
|
mSPAC = msgSpaceCreate(testId, 1, 2, poolInfos);
|
|
|
|
if (mSPAC == NULL) {
|
|
|
|
NZG_ERROR("msgSpaceCreate", testId);
|
|
|
|
exit(0);
|
|
|
|
}
|
|
|
|
|
|
|
|
printf("CREATION ------------------ ok\n");
|
|
|
|
|
|
|
|
mSPAC = msgSpaceOpen(testId);
|
2020-03-03 22:17:08 +01:00
|
|
|
|
|
|
|
/***** TEST 1 *****/
|
2020-03-04 00:06:43 +01:00
|
|
|
montext = msgAllocate(mSPAC, 1, 280, 0);
|
|
|
|
*montext = 42;
|
|
|
|
printf("### test Valeur0 %d ###\n", (int)*montext);
|
|
|
|
printf("Put...");
|
|
|
|
fflush(stdout);
|
|
|
|
msgPut(mSPAC, 0, montext);
|
|
|
|
printf("put-ok\n");
|
|
|
|
|
|
|
|
printf("Get...");
|
|
|
|
fflush(stdout);
|
|
|
|
montext = msgGet(mSPAC, 0, 0);
|
|
|
|
printf("get-ok\n");
|
|
|
|
printf("### test Reception %d ###\n", (int)*montext);
|
|
|
|
msgFree(mSPAC, montext);
|
2020-03-03 22:17:08 +01:00
|
|
|
/***** TEST 1 *****/
|
2020-03-04 00:06:43 +01:00
|
|
|
msgSpaceDelete(testId);
|
|
|
|
return 0;
|
2020-03-03 22:17:08 +01:00
|
|
|
}
|