25 lines
603 B
C
25 lines
603 B
C
#include "libnazgul.h"
|
|
#include "nzg_ids.h"
|
|
|
|
/* prototypes des fonctions annexes à ne pas exporter */
|
|
int msgSpaceIdIntern(msgSpaceId dest,const msgSpaceId src );
|
|
int msgPoolDataIdIntern(msgSpaceId dest,const msgSpaceId src );
|
|
|
|
|
|
msgSpace * msgSpaceOpen(msgSpaceId spaceId){
|
|
int shmFd;
|
|
msgSpaceId nzgId;
|
|
msgSpace * mSAddr;
|
|
if (msgSpaceIdIntern(nzgId,spaceId) < 0){
|
|
return NULL;
|
|
}
|
|
if ((shmFd=shm_open(nzgId,O_RDWR,MSGSPACE_DEFAULT_MODE)) < 0){
|
|
perror("shm_open");
|
|
return NULL;
|
|
}
|
|
mSAddr=mmap(NULL,sizeof(msgSpace),PROT_READ|PROT_WRITE,MAP_SHARED,shmFd,(off_t)0);
|
|
|
|
return mSAddr;
|
|
}
|
|
|
|
|