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