26 lines
682 B
C
26 lines
682 B
C
#include "libnazgul.h"
|
|
#include "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 externId){
|
|
int shmFd;
|
|
msgSpaceId nzgId;
|
|
msgSpace * mSAddr;
|
|
if (msgSpaceIdIntern(nzgId,externId) < 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);
|
|
|
|
printf( "OPEN: msgSpace mapped to 0x%08x in %d\n", (int)mSAddr,(int)getpid());
|
|
return mSAddr;
|
|
}
|
|
|
|
|