#include <sys/msg.h>

sys/msg.h Kernel.framework

$NetBSD: msg.h,v 1.4 1994/06/29 06:44:43 cgd Exp $
includes: sys/appleapiopts.h, sys/_types.h, sys/cdefs.h, sys/ipc.h, Kernel/sys/_types/_pid_t.h, Kernel/sys/_types/_time_t.h, sys/_types/_size_t.h, Kernel/sys/_types/_ssize_t.h, machine/types.h
10 macros · 6 structs · 6 typedefs · 5 variables

struct__msqid_ds_old

size 120, align 8
struct __ipc_perm_oldmsg_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

typedefuser_msgqnum_t

typedef user_ulong_t user_msgqnum_t

typedefuser64_msgqnum_t

typedef user64_ulong_t user64_msgqnum_t

typedefuser32_msgqnum_t

typedef user32_ulong_t user32_msgqnum_t

typedefuser_msglen_t

typedef user_ulong_t user_msglen_t

typedefuser64_msglen_t

typedef user64_ulong_t user64_msglen_t

typedefuser32_msglen_t

typedef user32_ulong_t user32_msglen_t

structuser_msqid_ds

kernel version
size 136, align 8
struct ipc_permmsg_perm[XSI] msg queue permissions
struct msg *msg_firstfirst message in the queue
struct msg *msg_lastlast message in the queue
user_msglen_tmsg_cbytes# of bytes on the queue
user_msgqnum_tmsg_qnum[XSI] number of msgs on the queue
user_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()
user_time_tmsg_stime[XSI] time of last msgsnd()
__int32_tmsg_pad1RESERVED: DO NOT USE
user_time_tmsg_rtime[XSI] time of last msgrcv()
__int32_tmsg_pad2RESERVED: DO NOT USE
user_time_tmsg_ctime[XSI] time of last msgctl()
__int32_tmsg_pad3RESERVED: DO NOT USE
__int32_t[4]msg_pad4

structuser64_msqid_ds

user64 version - this structure only has to be correct if compiled LP64, because the 32 bit kernel doesn't need it
size 116, align 1 · packed
struct ipc_permmsg_perm[XSI] msg queue permissions
__int32_tmsg_firstRESERVED: kernel use only
__int32_tmsg_lastRESERVED: kernel use only
user64_msglen_tmsg_cbytes# of bytes on the queue
user64_msgqnum_tmsg_qnum[XSI] number of msgs on the queue
user64_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()
user64_time_tmsg_stime[XSI] time of last msgsnd()
__int32_tmsg_pad1RESERVED: DO NOT USE
user64_time_tmsg_rtime[XSI] time of last msgrcv()
__int32_tmsg_pad2RESERVED: DO NOT USE
user64_time_tmsg_ctime[XSI] time of last msgctl()
__int32_tmsg_pad3RESERVED: DO NOT USE
__int32_t[4]msg_pad4

structuser32_msqid_ds

size 92, align 4
struct ipc_permmsg_perm[XSI] msg queue permissions
__int32_tmsg_firstRESERVED: kernel use only
__int32_tmsg_lastRESERVED: kernel use only
user32_msglen_tmsg_cbytes# of bytes on the queue
user32_msgqnum_tmsg_qnum[XSI] number of msgs on the queue
user32_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()
user32_time_tmsg_stime[XSI] time of last msgsnd()
__int32_tmsg_pad1RESERVED: DO NOT USE
user32_time_tmsg_rtime[XSI] time of last msgrcv()
__int32_tmsg_pad2RESERVED: DO NOT USE
user32_time_tmsg_ctime[XSI] time of last msgctl()
__int32_tmsg_pad3RESERVED: DO NOT USE
__int32_t[4]msg_pad4RESERVED: DO NOT USE

structmsqid_kernel

Kernel wrapper for the user-level structure
size 144, align 8
struct user_msqid_dsu
struct label *labelMAC framework label

variablemsginfo

extern struct msginfo msginfo

macroMSGSSZ

#define MSGSSZ 8
Each segment must be 2^N long

macroMSGSEG

#define MSGSEG 2048
must be less than 32767

macroMSGMAX

#define MSGMAX (MSGSSZ*MSGSEG)

macroMSGMNB

#define MSGMNB 2048
max # of bytes in a queue

macroMSGMNI

#define MSGMNI 40

macroMSGTQL

#define MSGTQL 40

macroMSQID

macros to convert between msqid_ds's and msqid's. (specific to this implementation)
#define MSQID(ix, ds) ((ix) & 0xffff | (((ds).msg_perm.seq << 16) & 0xffff0000))

macroMSQID_IX

#define MSQID_IX(id) ((id) & 0xffff)

macroMSQID_SEQ

#define MSQID_SEQ(id) (((id) >> 16) & 0xffff)

structmsgmap

Stuff allocated in machdep.h
size 2, align 2
shortnextnext segment in buffer

variablemsgpool

The following four externs really, really need to die; should be static
extern char *msgpool
MSGMAX byte long msg buffer pool

variablemsgmaps

extern struct msgmap *msgmaps
MSGSEG msgmap structures

variablemsghdrs

extern struct msg *msghdrs
MSGTQL msg headers

variablemsqids

extern struct msqid_kernel *msqids

macroMSG_LOCKED

#define MSG_LOCKED 01000
Is this msqid_ds locked?