int msgsnd (int msqid, struct msgbuf *msgp, int msgsz, int msgflg);
msqid
: id obtained by a call to msgget.
msgsz
: size of msg text (mtext
) in bytes.
msgp
: message to be sent. (msgp->mtype must be positive).
msgflg
: IPC_NOWAIT.
The message text and type are stored in the internal msg
structure. msg_cbytes
, msg_qnum
, msg_lspid
,
and msg_stime
fields are updated. Readers waiting on the
queue are awakened.
Errors:
EACCES : Do not have write permission on queue.
EAGAIN : IPC_NOWAIT specified and queue is full.
EFAULT : msgp not accessible.
EIDRM : The message queue was removed.
EINTR : Full queue ... would have slept but ... was interrupted.
EINVAL : mtype < 1, msgsz > MSGMAX, msgsz < 0, msqid < 0 or unused.
ENOMEM : Could not allocate space for header and text.