31 lines
622 B
C
31 lines
622 B
C
#include "libnazgul.h"
|
|
#include "ids.h"
|
|
|
|
void * msgPoolDataTabOpen(msgSpace * space){
|
|
int poolDataTabFd;
|
|
void * poolDataTabAddr;
|
|
|
|
poolDataTabFd=shm_open(space->poolDataTabId,
|
|
O_RDWR,
|
|
MSGSPACE_DEFAULT_MODE);
|
|
if (poolDataTabFd == -1 ) {
|
|
NZG_ERROR("shm_open",space->poolDataTabId);
|
|
goto ERROR;
|
|
}
|
|
|
|
|
|
poolDataTabAddr = mmap( NULL, (space->poolNb) * sizeof( msgPoolData ),
|
|
PROT_READ | PROT_WRITE,
|
|
MAP_SHARED, poolDataTabFd, 0 );
|
|
|
|
if( poolDataTabAddr == MAP_FAILED) {
|
|
NZG_ERROR("mmap",space->poolDataTabId);
|
|
goto ERROR;
|
|
}
|
|
|
|
close(poolDataTabFd);
|
|
|
|
return poolDataTabAddr;
|
|
ERROR:
|
|
return NULL;
|
|
}
|