#include <sys/msg.h>
sys/msg.h
$NetBSD: msg.h,v 1.4 1994/06/29 06:44:43 cgd Exp $
typedefmsgqnum_t
[XSI] Used for the number of messages in the message queue
typedef unsigned long msgqnum_t
typedefmsglen_t
[XSI] Used for the number of bytes allowed in a message queue
typedef unsigned long msglen_t
macroMSG_NOERROR
Possible values for the fifth parameter to msgrcv(), in addition to the
IPC_NOWAIT flag, which is permitted.
#define MSG_NOERROR 010000
[XSI] No error if big message
macromsqid_ds
#define msqid_ds __msqid_ds_new
struct__msqid_ds_new
| struct ipc_perm | msg_perm | [XSI] msg queue permissions |
| __int32_t | msg_first | RESERVED: kernel use only |
| __int32_t | msg_last | RESERVED: kernel use only |
| msglen_t | msg_cbytes | # of bytes on the queue |
| msgqnum_t | msg_qnum | [XSI] number of msgs on the queue |
| msglen_t | msg_qbytes | [XSI] max bytes on the queue |
| pid_t | msg_lspid | [XSI] pid of last msgsnd() |
| pid_t | msg_lrpid | [XSI] pid of last msgrcv() |
| time_t | msg_stime | [XSI] time of last msgsnd() |
| __int32_t | msg_pad1 | RESERVED: DO NOT USE |
| time_t | msg_rtime | [XSI] time of last msgrcv() |
| __int32_t | msg_pad2 | RESERVED: DO NOT USE |
| time_t | msg_ctime | [XSI] time of last msgctl() |
| __int32_t | msg_pad3 | RESERVED: DO NOT USE |
| __int32_t[4] | msg_pad4 | RESERVED: DO NOT USE |
structmsg
| struct msg * | msg_next | next msg in the chain |
| long | msg_type | type of this message |
| unsigned short | msg_ts | >0 -> type of this message 0 -> free header size of this message |
| short | msg_spot | location of msg start in buffer |
| struct label * | label | MAC label |
structmymsg
Example structure describing a message whose address is to be passed as
the second argument to the functions msgrcv() and msgsnd(). The only
actual hard requirement is that the first field be of type long, and
contain the message type. The user is encouraged to define their own
application specific structure; this definition is included solely for
backward compatability with existing source code.
| long | mtype | message type (+ve integer) |
| char[1] | mtext | message body |
structmsginfo
Based on the configuration parameters described in an SVR2 (yes, two)
config(1m) man page.
Each message is broken up and stored in segments that are msgssz bytes
long. For efficiency reasons, this should be a power of two. Also,
it doesn't make sense if it is less than 8 or greater than about 256.
Consequently, msginit in kern/sysv_msg.c checks that msgssz is a power of
two between 8 and 1024 inclusive (and panic's if it isn't).
| int | msgmax | max chars in a message |
| int | msgmni | max message queue identifiers |
| int | msgmnb | max chars in a queue |
| int | msgtql | max messages in system |
| int | msgssz | size of a message segment (see notes above) |
| int | msgseg | number of message segments |
functionmsgsys
int msgsys(int, ...)