l3.libnazgul/src/queueElemCreate.c

28 lines
573 B
C
Raw Normal View History

2004-02-23 21:01:59 +00:00
#include "libnazgul.h"
#include "ids.h"
int msgQueueElemCreate(msgQueueId queueId,int counter){
2004-02-23 21:16:05 +00:00
msgQueueElemId queueElemId;
msgQueueElemIdIntern(queueElemId,queueId,counter);
int queueElemFd;
queueElemFd=shm_open(queueElemId,
O_RDWR|O_CREAT|O_EXCL|O_TRUNC,
SHM_DEFAULT_MODE);
if (queueElemFd == -1 ) {
NZG_ERROR("shm_open : msgQueueElem creation",queueElemId);
goto ERROR;
}
if (ftruncate(queueElemFd, sizeof(msgQueueElem)) < 0){
NZG_ERROR("ftruncate", queueElemId);
goto ERROR;
}
close(queueElem_Fd);
return 0;
ERROR:
return -1;
2004-02-23 21:01:59 +00:00
}