*** empty log message ***

This commit is contained in:
glenux 2004-02-25 12:46:46 +00:00
parent 4abbd7c00f
commit 2296a0f77d
4 changed files with 60 additions and 1 deletions

View file

@ -13,6 +13,8 @@ int msgBufferDetachProc(
printf("Detaching %d,%d\n",poolIndex,bufferIndex);
//récuperer l'ID du BufferInfoTab;
strcpy(bufferInfoTabId, poolDataTabAddr[poolIndex].bufferInfoTabId);
bufferInfoTabFd=shm_open(bufferInfoTabId,O_RDWR,SHM_DEFAULT_MODE);

View file

@ -40,10 +40,19 @@ void * msgGet(msgSpace * space,int queueIndex,int option){
poolDataTab=msgPoolDataTabOpen(space);
// mapper le buffer dans l'espace mémoire du processus
resultAddr=msgBufferMap(poolDataTab,oldElem->poolIndex,oldElem->bufferIndex);
// attacher au buffer...
if (msgBufferAttachProc(poolDataTab,
oldElem->poolIndex,
oldElem->bufferIndex,
resultAddr) <0){
NZG_ERROR("msgBufferAttachProc",oldElemId);
goto ERROR;
}
msgPoolDataTabClose(space,poolDataTab);
// attacher au buffer...
// fermer la file
msgQueueClose(queue);

48
test/put_get_multi.c Normal file
View file

@ -0,0 +1,48 @@
#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);
if (mSPAC ==NULL) {
NZG_ERROR("msgSpaceCreate",testId);
exit(0);
}
printf("CREATION ------------------ ok\n");
pid_t pid=fork();
if (pid==0){
sleep(2);
mSPAC=msgSpaceOpen(testId);
montext=msgAllocate(mSPAC,1,280,0);
*montext=42;
printf("### test Valeur0 %d ###\n",(int)*montext);
printf("Put1..."); fflush(stdout);
msgPut(mSPAC,0,montext);
printf("put1-ok\n");
} else {
mSPAC=msgSpaceOpen(testId);
printf("Get..."); fflush(stdout);
montext=msgGet(mSPAC,0,0);
printf("get-ok\n");
printf("### test Reception %d ###\n",(int)*montext);
msgFree(mSPAC,montext);
}
return 0;
}