1 /* $NetBSD: msg.h,v 1.4 1994/06/29 06:44:43 cgd Exp $ */
4 * SVID compatible msg.h file
6 * Author: Daniel Boulet
8 * Copyright 1993 Daniel Boulet and RTMX Inc.
10 * This system call was implemented by Daniel Boulet under contract from RTMX.
12 * Redistribution and use in source forms, with and without modification,
13 * are permitted provided that this entire comment appears intact.
15 * Redistribution in binary form may occur without any restrictions.
16 * Obviously, it would be nice if you gave credit where credit is due
17 * but requiring it would be too onerous.
19 * This software is provided ``AS IS'' without any warranties of any kind.
25 #include <sys/cdefs.h>
26 #include <sys/_types.h>
27 #ifdef _WANT_SYSVMSG_INTERNALS
28 #define _WANT_SYSVIPC_INTERNALS
33 * The MSG_NOERROR identifier value, the msqid_ds struct and the msg struct
34 * are as defined by the SV API Intel 386 Processor Supplement.
37 #define MSG_NOERROR 010000 /* don't complain about too long msgs */
39 typedef unsigned long msglen_t;
40 typedef unsigned long msgqnum_t;
42 #ifndef _PID_T_DECLARED
43 typedef __pid_t pid_t;
44 #define _PID_T_DECLARED
47 #ifndef _SIZE_T_DECLARED
48 typedef __size_t size_t;
49 #define _SIZE_T_DECLARED
52 #ifndef _SSIZE_T_DECLARED
53 typedef __ssize_t ssize_t;
54 #define _SSIZE_T_DECLARED
57 #ifndef _TIME_T_DECLARED
58 typedef __time_t time_t;
59 #define _TIME_T_DECLARED
62 #if defined(COMPAT_FREEBSD4) || defined(COMPAT_FREEBSD5) || \
63 defined(COMPAT_FREEBSD6) || defined(COMPAT_FREEBSD7)
65 struct ipc_perm_old msg_perm; /* msg queue permission bits */
66 struct msg *__msg_first; /* first message in the queue */
67 struct msg *__msg_last; /* last message in the queue */
68 msglen_t msg_cbytes; /* number of bytes in use on the queue */
69 msgqnum_t msg_qnum; /* number of msgs in the queue */
70 msglen_t msg_qbytes; /* max # of bytes on the queue */
71 pid_t msg_lspid; /* pid of last msgsnd() */
72 pid_t msg_lrpid; /* pid of last msgrcv() */
73 time_t msg_stime; /* time of last msgsnd() */
75 time_t msg_rtime; /* time of last msgrcv() */
77 time_t msg_ctime; /* time of last msgctl() */
84 * XXX there seems to be no prefix reserved for this header, so the name
85 * "msg" in "struct msg" and the names of all of the nonstandard members
86 * are namespace pollution.
90 struct ipc_perm msg_perm; /* msg queue permission bits */
91 struct msg *__msg_first; /* first message in the queue */
92 struct msg *__msg_last; /* last message in the queue */
93 msglen_t msg_cbytes; /* number of bytes in use on the queue */
94 msgqnum_t msg_qnum; /* number of msgs in the queue */
95 msglen_t msg_qbytes; /* max # of bytes on the queue */
96 pid_t msg_lspid; /* pid of last msgsnd() */
97 pid_t msg_lrpid; /* pid of last msgrcv() */
98 time_t msg_stime; /* time of last msgsnd() */
99 time_t msg_rtime; /* time of last msgrcv() */
100 time_t msg_ctime; /* time of last msgctl() */
105 struct msg *msg_next; /* next msg in the chain */
106 long msg_type; /* type of this message */
107 /* >0 -> type of this message */
108 /* 0 -> free header */
109 u_short msg_ts; /* size of this message */
110 short msg_spot; /* location of start of msg in buffer */
111 struct label *label; /* MAC Framework label */
115 #if defined(_KERNEL) || defined(_WANT_SYSVMSG_INTERNALS)
117 * Based on the configuration parameters described in an SVR2 (yes, two)
118 * config(1m) man page.
120 * Each message is broken up and stored in segments that are msgssz bytes
121 * long. For efficiency reasons, this should be a power of two. Also,
122 * it doesn't make sense if it is less than 8 or greater than about 256.
123 * Consequently, msginit in kern/sysv_msg.c checks that msgssz is a power of
124 * two between 8 and 1024 inclusive (and panic's if it isn't).
127 int msgmax; /* max chars in a message */
128 int msgmni; /* max message queue identifiers */
129 int msgmnb; /* max chars in a queue */
130 int msgtql; /* max messages in system */
131 int msgssz; /* size of a message segment (see note) */
132 int msgseg; /* number of message segments */
136 * Kernel wrapper for the user-level structure.
138 struct msqid_kernel {
140 * Data structure exposed to user space.
145 * Kernel-private components of the message queue.
147 struct label *label; /* MAC label */
148 struct ucred *cred; /* creator's credentials */
153 extern struct msginfo msginfo;
158 int msgctl(int, int, struct msqid_ds *);
159 int msgget(key_t, int);
160 ssize_t msgrcv(int, void *, size_t, long, int);
161 int msgsnd(int, const void *, size_t, int);
163 int msgsys(int, ...);
166 #endif /* !_KERNEL */
168 #endif /* !_SYS_MSG_H_ */