/*
 * Interprocess Communication Control Structures
 */

/*
 * common flags
 */

#define IP_PERM	03			/* scope permission mask */
#define IP_ANY	0			/* system scope */
#define IP_UID	01			/* userid scope */
#define IP_GID	02			/* groupid scope */
#define IP_WANTED	0200		/* resource is desired */

struct ipaword
{	char	ip_flag;
	char	ip_id; };

/*
 * semaphore control
 */

#define PSEMI4	1			/* semi4 sleep priority */

#define S_TYPE	0100			/* semaphore type mask */
#define S_LU	0			/* lock-unlock type */
#define S_PV	0100			/* p-v type */

#define LOCK	0
#define UNLOCK	1
#define TLOCK	2
#define P	3
#define V	4
#define TEST	5
#define ASEMI	6
#define FSEMI	7

struct semi4s
{	int	sem_lock;
	int	sem_cnt;		/*use count */
	char	sem_flag;
	char	sem_id;			/* id for determining scope */
};

/*
 * message control
 */

#define PMSG	5			/* message sleep priority */
#define MAXMLEN	212			/* max message length in bytes */
#define MAXMSG	5			/* max number unreceived msgs per process */
#define MSGIO	02			/* tell iomove() this is msg */
#define MSGIN	0			/* same as B_WRITE */
#define MSGOUT	01			/* same as B_READ */

#define MDISAB	0
#define MENAB	1
#define MSEND	2
#define MSENDW	3
#define MRECV	4
#define MRECVW	5

struct msghdr
{	struct msghdr	*mq_forw;
	int	mq_size;
	int	mq_sender;
	int	mq_type;
};
struct msgqhdr
{	struct msghdr	*mq_forw;	/* note same position as in msghdr */
	struct msghdr	*mq_last;
	int	*mq_procp;
	char	mq_flag;
	char	mq_cnt;
};
