1 /* $FreeBSD: src/sys/sys/msg.h,v 1.10.2.1 2000/08/04 22:31:10 peter Exp $ */
2 /* $NetBSD: msg.h,v 1.4 1994/06/29 06:44:43 cgd Exp $ */
5 * SVID compatible msg.h file
7 * Author: Daniel Boulet
9 * Copyright 1993 Daniel Boulet and RTMX Inc.
11 * This system call was implemented by Daniel Boulet under contract from RTMX.
13 * Redistribution and use in source forms, with and without modification,
14 * are permitted provided that this entire comment appears intact.
16 * Redistribution in binary form may occur without any restrictions.
17 * Obviously, it would be nice if you gave credit where credit is due
18 * but requiring it would be too onerous.
20 * This software is provided ``AS IS'' without any warranties of any kind.
26 #include <sys/cdefs.h>
28 #include <machine/stdint.h>
31 * The MSG_NOERROR identifier value, the msqid_ds struct and the msg struct
32 * are as defined by the SV API Intel 386 Processor Supplement.
35 #define MSG_NOERROR 010000 /* don't complain about too long msgs */
37 typedef unsigned long msglen_t;
38 typedef unsigned long msgqnum_t;
40 #ifndef _PID_T_DECLARED
41 typedef __pid_t pid_t;
42 #define _PID_T_DECLARED
45 #ifndef _SIZE_T_DECLARED
46 typedef __size_t size_t;
47 #define _SIZE_T_DECLARED
50 #ifndef _SSIZE_T_DECLARED
51 typedef __ssize_t ssize_t;
52 #define _SSIZE_T_DECLARED
55 #ifndef _TIME_T_DECLARED
56 typedef __time_t time_t;
57 #define _TIME_T_DECLARED
60 /*!!! In the kernel implementation, both msg_first and msg_last
61 * have 'struct msg*' type.
62 * In the userland implementation, a pointer to a msg is useless
63 * because each message queue is mapped at different addresses in
64 * the process space address so my choice was to use indexes.
69 struct ipc_perm msg_perm; /* msg queue permission bits */
70 struct msg *msg_first; /* first message in the queue. */
71 struct msg *msg_last; /* last message in the queue. */
72 msglen_t msg_cbytes; /* number of bytes in use on the queue */
73 msgqnum_t msg_qnum; /* number of msgs in the queue */
74 msglen_t msg_qbytes; /* max # of bytes on the queue */
75 pid_t msg_lspid; /* pid of last msgsnd() */
76 pid_t msg_lrpid; /* pid of last msgrcv() */
77 time_t msg_stime; /* time of last msgsnd() */
79 time_t msg_rtime; /* time of last msgrcv() */
81 time_t msg_ctime; /* time of last msgctl() */
88 * Structure describing a message. The SVID doesn't suggest any
89 * particular name for this structure. There is a reference in the
90 * msgop man page that reads "The structure mymsg is an example of what
91 * this user defined buffer might look like, and includes the following
92 * members:". This sentence is followed by two lines equivalent
93 * to the mtype and mtext field declarations below. It isn't clear
94 * if "mymsg" refers to the naem of the structure type or the name of an
95 * instance of the structure...
98 long mtype; /* message type (+ve integer) */
99 char mtext[1]; /* message body */
103 #if defined(_KERNEL) || defined(_KERNEL_STRUCTURES)
106 * Based on the configuration parameters described in an SVR2 (yes, two)
107 * config(1m) man page.
109 * Each message is broken up and stored in segments that are msgssz bytes
110 * long. For efficiency reasons, this should be a power of two. Also,
111 * it doesn't make sense if it is less than 8 or greater than about 256.
112 * Consequently, msginit in kern/sysv_msg.c checks that msgssz is a power of
113 * two between 8 and 1024 inclusive (and panic's if it isn't).
116 int msgmax, /* max chars in a message */
117 msgmni, /* max message queue identifiers */
118 msgmnb, /* max chars in a queue */
119 msgtql, /* max messages in system */
120 msgssz, /* size of a message segment (see notes above) */
121 msgseg; /* number of message segments */
126 extern struct msginfo msginfo;
129 int msgctl(int, int, struct msqid_ds *);
130 int msgget(key_t, int);
131 int msgsnd(int, const void *, size_t, int);
132 int msgrcv(int, void *, size_t, long, int); /* XXX should return ssize_t */
136 #endif /* !_SYS_MSG_H_ */