32 lines
582 B
C
32 lines
582 B
C
#include "libnazgul.h"
|
|
#include "ids.h"
|
|
|
|
void * msgSpaceListOpen(){
|
|
int listFd;
|
|
void * listAddr;
|
|
|
|
msgSpaceListId spaceListId;
|
|
strcpy(spaceListId,DEFAULT_MSGSPACELISTID);
|
|
|
|
listFd=shm_open(spaceListId,O_RDWR,SHM_DEFAULT_MODE);
|
|
if (listFd == -1 ) {
|
|
NZG_ERROR("shm_open : msgSpaceList open",spaceListId);
|
|
goto ERROR;
|
|
}
|
|
|
|
listAddr=mmap(NULL,
|
|
sizeof(msgSpaceList),
|
|
PROT_READ|PROT_WRITE,
|
|
MAP_SHARED,
|
|
listFd,
|
|
0);
|
|
if( listAddr == MAP_FAILED ) {
|
|
NZG_ERROR("mmap",spaceListId);
|
|
goto ERROR;
|
|
}
|
|
|
|
close(listFd);
|
|
return listAddr;
|
|
ERROR:
|
|
return NULL;
|
|
}
|