00001 #ifndef _MSG_Q_LIB_ 00002 #define _MSG_Q_LIB_ 00003 00004 /**********************************************/ 00005 /* msgQCreate: */ 00006 /* Only to be called by the receiving */ 00007 /* process. It's function is */ 00008 /* (1) Create a lock that tells other */ 00009 /* processes its still listening */ 00010 /* (2) Flush the queue if it has junk */ 00011 /* left in it. */ 00012 /* */ 00013 /* return values: 0 OK. */ 00014 /* -1 error */ 00015 /**********************************************/ 00016 int msgQCreate(int task, int nmsgs, int msglen); 00017 00018 00019 /**********************************************/ 00020 /* msgQSend: */ 00021 /* non-blocking call */ 00022 /* if test is set, tests for listener */ 00023 /* otherwise, not. */ 00024 /* */ 00025 /* return values: 0 OK. */ 00026 /* -1 error */ 00027 /**********************************************/ 00028 int msgQSend(int task, char *buff, int size, int *line_number=0); 00029 00030 /**********************************************/ 00031 /* msgQReceive: */ 00032 /* Blocking call */ 00033 /* return values: length of msg in bytes */ 00034 /* -1 error */ 00035 /**********************************************/ 00036 int msgQReceive(int task, char *buff, int size); 00037 00038 /**********************************************/ 00039 /* returns size of Q */ 00040 /**********************************************/ 00041 int msgQSize(int task); 00042 00043 /**********************************************/ 00044 /* returns messages in Q */ 00045 /* ********************************************/ 00046 int msgQUsed(int task); 00047 00048 /**********************************************/ 00049 /* returns free buffers in Q */ 00050 /**********************************************/ 00051 int msgQFree(int task); 00052 00053 /**********************************************/ 00054 /* Check if receiver exists for message queue */ 00055 /* Returns 0 if no task, */ 00056 /* pid if task... */ 00057 /**********************************************/ 00058 int msgQTest(int task); 00059 #endif
1.5.9