examples/PIPS/opencmessagequeuelibraryex/engine/src/msgqdelete.c

00001 
00010 #include <errno.h>
00011 #include <sys/msg.h>
00012 #include <sys/sem.h>
00013 #include "MsgQInternal.h"
00014 
00015 
00016 /*******************************************************************************
00017 * MsgQDelete (qName, err)
00018 * Description: Function for deleting a message queue
00019 ********************************************************************************/
00020 
00021 EXPORT_C int MsgQDelete(ULONG qName, int* err)
00022 {
00023         MSGQ_INFO*               pMsgQInfo;
00024         int              hashRmErr;
00025 
00026         if ((pMsgQInfo = MsgQTableLookup(qName)) != NULL) {
00027                 if (semctl(pMsgQInfo->semId,0,IPC_RMID,0) == 0) {
00028                         if (msgctl(pMsgQInfo->qId,IPC_RMID,0) == 0) {
00029                                 if (RemoveFromMsqQTable(pMsgQInfo->qName, &hashRmErr) == OK) {
00030                                         DeleteFromMsgQTable(qName);
00031                                         *err = OK;
00032                                         return (OK);
00033                                 }
00034                                 else
00035                                         *err = hashRmErr;
00036                         }
00037                         else 
00038                                 *err = errno;
00039                 }
00040                 else
00041                         *err = errno;
00042         }
00043         else
00044                 *err = KMsgQLibQIdErr;
00045 
00046         return(ERROR);
00047 }
00048 

Generated by  doxygen 1.6.2