l3.libnazgul/src/nzg_poolDelete.c

51 lines
1.3 KiB
C
Raw Normal View History

2004-02-22 13:11:17 +00:00
#include "libnazgul.h"
#include "nzg_ids.h"
int msgPoolDelete(
msgSpaceId spaceId,
2004-02-22 13:37:04 +00:00
int poolIdx
2004-02-22 13:11:17 +00:00
) {
msgPoolId poolId;
msgBufferInfoTabId bufferInfoTabId;
msgPoolSemId poolRessourceSemId;
2004-02-22 13:37:04 +00:00
/* suppression des infos sur buffers DEBUT */
2004-02-22 13:11:17 +00:00
if (msgBufferInfoTabIdIntern(bufferInfoTabId,spaceId,poolIdx) == -1){
fprintf( stderr, "msgPoolId creation failed for id %s\n", (char*)poolId );
return -1;
}
2004-02-22 13:37:04 +00:00
if (shm_unlink(bufferInfoTabId) <0 ) {
fprintf( stderr, "msgInfoTab : %s deletion failed: %s\n",bufferInfoTabId,
2004-02-22 13:11:17 +00:00
strerror( errno ) );
return -1;
}
2004-02-22 13:37:04 +00:00
/* suppression des infos sur buffers FIN */
2004-02-22 13:11:17 +00:00
2004-02-22 13:37:04 +00:00
/* suppression des buffers DEBUT */
2004-02-22 13:11:17 +00:00
if (msgPoolIdIntern(poolId,spaceId,poolIdx) == -1){
fprintf( stderr, "msgPoolId creation failed for id %s\n", (char*)poolId );
return -1;
}
2004-02-22 13:37:04 +00:00
if (shm_unlink(poolId) <0 ) {
fprintf( stderr, "msgPool : %s deletion failed: %s\n",poolId,
2004-02-22 13:11:17 +00:00
strerror( errno ) );
return -1;
}
2004-02-22 13:37:04 +00:00
/* suppression des buffers FIN */
/* suppression de la s<>maphore */
2004-02-22 13:11:17 +00:00
if (msgPoolSemIdIntern(poolRessourceSemId,spaceId,poolIdx) == -1){
fprintf( stderr, "msgPoolId creation failed for id %s\n",
(char*)poolRessourceSemId );
return -1;
}
// on met un semaphore sur le pool
2004-02-22 13:37:04 +00:00
sem_unlink(poolRessourceSemId);
2004-02-22 13:11:17 +00:00
//TODO: verrifier les erreurs sur l'ouverture de la sem
return 0;
}