xref: /haiku/headers/posix/sys/msg.h (revision 7749d0bb0c358a3279b1b9cc76d8376e900130a5)
1 /*
2  * Copyright 2008-2010 Haiku Inc. All Rights Reserved.
3  * Distributed under the terms of the MIT License.
4  */
5 #ifndef _SYS_MSG_H
6 #define _SYS_MSG_H
7 
8 
9 #include <config/types.h>
10 
11 #include <sys/cdefs.h>
12 #include <sys/ipc.h>
13 #include <sys/types.h>
14 
15 typedef __haiku_uint32 msgqnum_t;
16 typedef __haiku_uint32 msglen_t;
17 
18 /* No error if big message */
19 #define MSG_NOERROR		010000
20 
21 struct msqid_ds {
22 	struct ipc_perm		msg_perm;	/* Operation permission structure */
23 	msgqnum_t			msg_qnum;	/* Number of messages currently on queue */
24 	msglen_t			msg_qbytes;	/* Max number of bytes allowed on queue */
25 	pid_t				msg_lspid;	/* PID of last msgsnd */
26 	pid_t				msg_lrpid;	/* PID of last msgrcv */
27 	time_t				msg_stime;	/* Time of last msgsnd */
28 	time_t				msg_rtime;	/* Time of last msgrcv */
29 	time_t				msg_ctime;	/* Time of last change */
30 };
31 
32 /* Structure used to send/receive a message */
33 struct msgbuf {
34 	long	mtype;		/* message type */
35 	char	mtext[1];	/* message text */
36 };
37 
38 __BEGIN_DECLS
39 
40 int			msgctl(int, int, struct msqid_ds *);
41 int			msgget(key_t, int);
42 ssize_t		msgrcv(int, void *, size_t, long, int);
43 int			msgsnd(int, const void *, size_t, int);
44 
45 __END_DECLS
46 
47 #endif	/* _SYS_MSG_H */
48