2004-02-25 18:51:33 +00:00
|
|
|
#include "libnazgul.h"
|
|
|
|
#include "ids.h"
|
|
|
|
|
2020-03-04 00:06:43 +01:00
|
|
|
void *msgSpaceListOpen()
|
|
|
|
{
|
|
|
|
int listFd;
|
|
|
|
void *listAddr;
|
2004-02-25 18:51:33 +00:00
|
|
|
|
2020-03-04 00:06:43 +01:00
|
|
|
msgSpaceListId spaceListId;
|
|
|
|
strcpy(spaceListId, DEFAULT_MSGSPACELISTID);
|
2004-02-25 21:28:11 +00:00
|
|
|
|
2020-03-04 00:06:43 +01:00
|
|
|
listFd = shm_open(spaceListId, O_RDWR, SHM_DEFAULT_MODE);
|
|
|
|
if (listFd == -1) {
|
|
|
|
NZG_ERROR("shm_open : msgSpaceList open", spaceListId);
|
|
|
|
goto ERROR;
|
|
|
|
}
|
2004-02-25 18:51:33 +00:00
|
|
|
|
2020-03-04 00:06:43 +01:00
|
|
|
listAddr = mmap(NULL,
|
|
|
|
sizeof(msgSpaceList),
|
|
|
|
PROT_READ | PROT_WRITE, MAP_SHARED, listFd, 0);
|
|
|
|
if (listAddr == MAP_FAILED) {
|
|
|
|
NZG_ERROR("mmap", spaceListId);
|
|
|
|
goto ERROR;
|
|
|
|
}
|
2004-02-25 18:51:33 +00:00
|
|
|
|
2020-03-04 00:06:43 +01:00
|
|
|
close(listFd);
|
|
|
|
return listAddr;
|
|
|
|
ERROR:
|
|
|
|
return NULL;
|
2004-02-25 18:51:33 +00:00
|
|
|
}
|