1 /* 2 * Copyright 2008, 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 #include <sys/cdefs.h> 9 #include <sys/ipc.h> 10 #include <sys/types.h> 11 12 typedef unsigned long msgqnum_t; 13 typedef unsigned long msglen_t; 14 15 /* No error if big message */ 16 #define MSG_NOERROR 010000 17 18 struct msqid_ds { 19 struct ipc_perm msg_perm; /* Operation permission structure */ 20 msgqnum_t msg_qnum; /* Number of messages currently on queue */ 21 msglen_t msg_qbytes; /* Max number of bytes allowed on queue */ 22 pid_t msg_lspid; /* PID of last msgsnd */ 23 pid_t msg_lrpid; /* PID of last msgrcv */ 24 time_t msg_stime; /* Time of last msgsnd */ 25 time_t msg_rtime; /* Time of last msgrcv */ 26 time_t msg_ctime; /* Time of last change */ 27 }; 28 29 /* Structure used to send/receive a message */ 30 struct msgbuf { 31 long mtype; /* message type */ 32 char mtext[1]; /* message text */ 33 }; 34 35 __BEGIN_DECLS 36 37 int msgctl(int, int, struct msqid_ds *); 38 int msgget(key_t, int); 39 ssize_t msgrcv(int, void *, size_t, long, int); 40 int msgsnd(int, const void *, size_t, int); 41 42 __END_DECLS 43 44 #endif /* _SYS_MSG_H */ 45