*** empty log message ***
This commit is contained in:
parent
682b23bcb0
commit
05416b4118
2 changed files with 44 additions and 0 deletions
15
src/queueElemClose.c
Normal file
15
src/queueElemClose.c
Normal file
|
@ -0,0 +1,15 @@
|
|||
#include "libnazgul.h"
|
||||
|
||||
int msgQueueElemClose(msgQueueElem * queueElem){
|
||||
msgQueueElemId qId;
|
||||
strcpy(qId,queueElem->id);
|
||||
|
||||
if (munmap(queueElem,sizeof(msgQueueElem)) < 0){
|
||||
NZG_ERROR("unmap",qId);
|
||||
goto ERROR;
|
||||
}
|
||||
|
||||
return 0;
|
||||
ERROR:
|
||||
return -1;
|
||||
}
|
29
src/queueElemOpen.c
Normal file
29
src/queueElemOpen.c
Normal file
|
@ -0,0 +1,29 @@
|
|||
#include "libnazgul.h"
|
||||
#include "ids.h"
|
||||
|
||||
void * msgQueueElemOpen(msgQueueElemId queueElemId){
|
||||
int queueElemFd;
|
||||
void * queueElemAddr;
|
||||
|
||||
queueElemFd=shm_open(queueElemId,O_RDWR,SHM_DEFAULT_MODE);
|
||||
if (queueElemFd == -1 ) {
|
||||
NZG_ERROR("shm_open : msgQueue open",queueElemId);
|
||||
goto ERROR;
|
||||
}
|
||||
|
||||
queueElemAddr=mmap(NULL,
|
||||
sizeof(msgQueueElem),
|
||||
PROT_READ|PROT_WRITE,
|
||||
MAP_SHARED,
|
||||
queueElemFd,
|
||||
0);
|
||||
if( queueElemAddr == MAP_FAILED ) {
|
||||
NZG_ERROR("mmap",queueElemId);
|
||||
goto ERROR;
|
||||
}
|
||||
|
||||
close(queueElemFd);
|
||||
return queueElemAddr;
|
||||
ERROR:
|
||||
return NULL;
|
||||
}
|
Loading…
Reference in a new issue