1 /* local definitions needed by mq routines */ 2 3 #include <sys/msg.h> 4 #include <signal.h> 5 6 /* a message */ 7 typedef struct 8 { 9 unsigned int type; 10 char text[1]; 11 } MSG; 12 13 union semun { 14 int val; 15 struct semid_ds *buf; 16 unsigned short *array; 17 } arg; 18 19 /* 20 * One of these structures is malloced to describe any open message queue 21 * each time mq_open is called. 22 */ 23 24 struct libc_mq; 25 26 struct libc_mq { 27 int index; /* index of this message queue */ 28 int msgqid; /* value returned by msgget */ 29 int semid; /* semaphore id */ 30 int fd; /* fd of shared memory file */ 31 int oflag; /* original open flag used */ 32 int th; /* thread id for mq_notify */ 33 char *name; /* name used */ 34 MSG *wrbuf; /* msg write buffer */ 35 MSG *rdbuf; /* msg read buffer */ 36 struct mq_attr *attr; /* pointer to attribute structure */ 37 struct sigevent *sigevent; /* used for mq_notify */ 38 void (*cleanup_notify)(struct libc_mq *); /* also used for mq_notify */ 39 struct libc_mq *next; /* next info struct in hash table */ 40 }; 41 42 extern struct libc_mq *__find_mq (mqd_t mq); 43 extern void __cleanup_mq (mqd_t mq); 44 extern void __cleanup_mq_notify (struct libc_mq *ptr); 45 46 #define MSGQ_PREFIX "/dev/shm/__MSGQ__" 47 48