#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/msg.h>


int msgget (key, flags)      /*get message queue ID*/
key_t key;                   /*queue key - long*/
int flags;                   /*option flags*/
/*returns queue-ID or -1 on error*/


int msgsend (qid, buf, nbytes, flags)   /*send message to queue*/
int qid;                                /*queue-ID*/
struct msgbuf *buf;                     /*pointer to message*/
int nbytes;                             /*size of message*/
int flags;
/*returns 0 on success or -1 on error*/


int mssgrcv (qid, buf, nbytes, mtype, flags)  /*receive message*/
int qid;
struct msgbuf *buf;
int nbytes;
long mtype;
int flags;
/*returns number of bytes received or -1 on error*/


int msgctl (qid, cmd, sbuf)     /*control message queue*/
int qid;
int cmd;                        /*command*/
struct msqid_ds *sbuf;          /*pointer to status buffer*/
/*returns 0 on success or -1 on error*/

/****************************************************************************/

#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/sem.h>

int semget (key, nsems, flags)       /*get semaphore-set-ID*/
key_t key;                           /*semaphore-set-key*/
int nsems;                           /*number of semaphores*/
int flags;                           /*option flags*/
/*returns semaphore-set-ID or -1 on error*/


int semop (sid, ops, nops)           /*operate on semaphore-set*/
int sid;                             /*semaphore-set-ID*/
struct sembuf (*ops)[];              /*pointer to array of operations*/
int nops;                            /*number of operations*/
/*returns semaphore value prior to last operation or -1 on error*/


int semctl (sid, snum, cmd, arg)     /*control semaphore*/
int sid;
int snum;                            /*semaphore number*/
int cmd;                             /*command*/
char *arg;                           /*argument*/
/*returns value depending on command or -1 on error*/

/****************************************************************************/

#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/shm.h>

int shmget (key, nbytes, flags)       /*get shared memory segment-ID*/
key_t key;                            /*key - long*/
int nbytes;                           /*size of segment*/
int flags;                            /*option flags*/
/*returns segment-ID or -1 on error*/


char *shmat (segid, addr, flags)      /*attach segment*/
int segid;                            /*segment-ID*/
char *addr;                           /*desired address*/
int flags;
/*returns segment address or -1 on error*/


int shmdt (addr)                      /*detach segment;
char *addrs;                          /*segment address*/
/*returns 0 on success or -1 on error*/


int shmctl (segid, cmd, sbuf)         /*control segment*/
int segid;
int cmd;                              /*command*/
struct shmid_ds *sbuf;                /*pointer to status buffer*/
/*returns 0 on success or -1 on error*/

