#include <sys/msg.h>

sys/msg.h

$NetBSD: msg.h,v 1.4 1994/06/29 06:44:43 cgd Exp $
5 functions · 4 structs · 2 typedefs · 2 macros

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

size 116, align 4
struct ipc_permmsg_perm[XSI] msg queue permissions
__int32_tmsg_firstRESERVED: kernel use only
__int32_tmsg_lastRESERVED: kernel use only
msglen_tmsg_cbytes# of bytes on the queue
msgqnum_tmsg_qnum[XSI] number of msgs on the queue
msglen_tmsg_qbytes[XSI] max bytes on the queue
pid_tmsg_lspid[XSI] pid of last msgsnd()
pid_tmsg_lrpid[XSI] pid of last msgrcv()
time_tmsg_stime[XSI] time of last msgsnd()
__int32_tmsg_pad1RESERVED: DO NOT USE
time_tmsg_rtime[XSI] time of last msgrcv()
__int32_tmsg_pad2RESERVED: DO NOT USE
time_tmsg_ctime[XSI] time of last msgctl()
__int32_tmsg_pad3RESERVED: DO NOT USE
__int32_t[4]msg_pad4RESERVED: DO NOT USE

structmsg

size 32, align 8
struct msg *msg_nextnext msg in the chain
longmsg_typetype of this message
unsigned shortmsg_ts>0 -> type of this message 0 -> free header size of this message
shortmsg_spotlocation of msg start in buffer
struct label *labelMAC 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.
size 16, align 8
longmtypemessage type (+ve integer)
char[1]mtextmessage 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).
size 24, align 4
intmsgmaxmax chars in a message
intmsgmnimax message queue identifiers
intmsgmnbmax chars in a queue
intmsgtqlmax messages in system
intmsgsszsize of a message segment (see notes above)
intmsgsegnumber of message segments

functionmsgsys

int msgsys(int, ...)

functionmsgctl

__DARWIN_ALIAS(msgctl)
int msgctl(int, int, struct msqid_ds *)

functionmsgget

int msgget(key_t, int)

functionmsgrcv

__DARWIN_ALIAS_C(msgrcv)
ssize_t msgrcv(int, void *, size_t, long, int)

functionmsgsnd

__DARWIN_ALIAS_C(msgsnd)
int msgsnd(int, const void *, size_t, int)