l3.libnazgul/src/nzg_spaceOpen.c

27 lines
686 B
C
Raw Normal View History

2004-02-22 11:50:29 +00:00
#include "libnazgul.h"
#include "nzg_ids.h"
/* prototypes des fonctions annexes <20> ne pas exporter */
int msgSpaceIdIntern(msgSpaceId dest,const msgSpaceId src );
int msgPoolDataIdIntern(msgSpaceId dest,const msgSpaceId src );
msgSpace * msgSpaceOpen(msgSpaceId externId){
2004-02-22 11:50:29 +00:00
int shmFd;
msgSpaceId nzgId;
msgSpace * mSAddr;
if (msgSpaceIdIntern(nzgId,externId) < 0){
2004-02-22 11:50:29 +00:00
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());
2004-02-22 11:50:29 +00:00
return mSAddr;
}