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