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

39 lines
882 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 );
int msgSpaceDelete(msgSpaceId externId){
fprintf(stderr,"Deleting msgSpace with id : %s\n",externId);
//int shmId;
msgSpaceId nzgId;
msgSpace * space;
if (msgSpaceIdIntern(nzgId,externId) == -1){
//TODO: message d'erreur
return -1;
}
space = msgSpaceOpen(externId);
/* TODO: supprimer chaque pool */
int i;
for (i=0;i<space->poolNb;i++){
msgPoolDelete(externId,i);
}
printf("openned successfully !\n");
printf("Unlinking DataTab... ");
if (shm_unlink(space->poolDataTabId) < 0){
perror("shm_unlink");
return -1;
}
printf("ok\n");
if (shm_unlink(nzgId)<0){
perror("shm_unlink");
return -1;
};
return 0;
}