50 lines
1.3 KiB
C
50 lines
1.3 KiB
C
#include "libnazgul.h"
|
|
#include "nzg_ids.h"
|
|
|
|
int msgPoolDelete(
|
|
msgSpaceId spaceId,
|
|
int poolIdx
|
|
) {
|
|
|
|
msgPoolId poolId;
|
|
msgBufferInfoTabId bufferInfoTabId;
|
|
msgPoolSemId poolRessourceSemId;
|
|
|
|
|
|
/* suppression des infos sur buffers DEBUT */
|
|
if (msgBufferInfoTabIdIntern(bufferInfoTabId,spaceId,poolIdx) == -1){
|
|
fprintf( stderr, "msgPoolId creation failed for id %s\n", (char*)poolId );
|
|
return -1;
|
|
}
|
|
|
|
if (shm_unlink(bufferInfoTabId) <0 ) {
|
|
fprintf( stderr, "msgInfoTab : %s deletion failed: %s\n",bufferInfoTabId,
|
|
strerror( errno ) );
|
|
return -1;
|
|
}
|
|
/* suppression des infos sur buffers FIN */
|
|
|
|
/* suppression des buffers DEBUT */
|
|
if (msgPoolIdIntern(poolId,spaceId,poolIdx) == -1){
|
|
fprintf( stderr, "msgPoolId creation failed for id %s\n", (char*)poolId );
|
|
return -1;
|
|
}
|
|
if (shm_unlink(poolId) <0 ) {
|
|
fprintf( stderr, "msgPool : %s deletion failed: %s\n",poolId,
|
|
strerror( errno ) );
|
|
return -1;
|
|
}
|
|
/* suppression des buffers FIN */
|
|
|
|
/* suppression de la sémaphore */
|
|
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
|
|
sem_unlink(poolRessourceSemId);
|
|
//TODO: verrifier les erreurs sur l'ouverture de la sem
|
|
|
|
return 0;
|
|
}
|