1/*
2 * Copyright 2008-2012 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
15typedef __haiku_uint32 msgqnum_t;
16typedef __haiku_uint32 msglen_t;
17
18/* No error if big message */
19#define MSG_NOERROR		010000
20
21struct 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 */
33struct msgbuf {
34	long	mtype;		/* message type */
35	char	mtext[1];	/* message text */
36};
37
38__BEGIN_DECLS
39
40int			msgctl(int, int, struct msqid_ds *);
41int			msgget(key_t, int);
42ssize_t		msgrcv(int, void *, size_t, long, int);
43int			msgsnd(int, const void *, size_t, int);
44
45__END_DECLS
46
47#endif	/* _SYS_MSG_H */
48