l3.libnazgul/src/spaceListElemCreate.c
2020-03-03 23:46:32 +01:00

31 lines
651 B
C

#include "libnazgul.h"
#include "ids.h"
// cree un nouvel elemen
int msgSpaceListElemCreate(msgSpaceListElemId elemenListId,msgSpaceId spaceId){
int shmElemenList;
/*Creation de lid pour lespace de message*/
spaceListElemIdIntern(elemenListId,spaceId);
if ((shmElemenList=shm_open(elemenListId,
O_RDWR|O_CREAT|O_EXCL|O_TRUNC,
MSGSPACE_DEFAULT_MODE))==-1){
NZG_ERROR("shm_open:Space list creation",elemenListId);
goto ERROR;
}
if(ftruncate(shmElemenList,sizeof(elemenListId) ) <0) {
NZG_ERROR("ftruncate",elemenListId);
goto ERROR;
};
close (shmElemenList);
return 0;
ERROR:
return-1;
};