msgsnd(2) DG/UX 4.30 msgsnd(2)
NAME
msgsnd - Send a message.
SYNOPSIS
#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/msg.h>
int msgsnd (msqid, msgp, msgsz, msgflg)
int msqid;
struct msgbuf *msgp;
int msgsz;
int msgflg;
PARAMETERS
msqid A message queue identifier.
msgp The message buffer of the message to be sent.
msgsz The size in bytes of the <mtext> portion of
the message buffer.
msgflg A set of flags modifying the action of
msgsnd.
DESCRIPTION
Msgsnd sends a message to the queue associated with the
message queue identifier specified by <msqid>. <msgp>
points to the user's message buffer containing a message
type used for message selection, and the text of the
message. <msgsz> is the length of the message. It can range
from 0 to a configurable system-imposed maximum.
<msgflg> specifies the action to be taken if either the
number of bytes already on the queue after this message is
added would exceed the maximum queue size, or the total
number of messages on all queues system-wide is equal to the
system-imposed limit. If either of these conditions hold,
the following actions are taken:
* If the IPC_NOWAIT bit of <msgflg> is set, the message
will not be sent and the calling process will return
immediately.
* If the IPC_NOWAIT bit of <msgflg> is clear, the calling
process will be suspended until:
* the condition responsible for the suspension no longer
exists, in which case, the operation is successful,
Licensed material--property of copyright holder(s) Page 1
msgsnd(2) DG/UX 4.30 msgsnd(2)
* <msqid> is removed from the system, in which case,
msgsnd will return with the error condition EIDRM, or
* the calling process receives a signal that is to be
caught, in which case, msgsnd will return with the
error condition EINTR.
If msgsnd fails, no message is sent and the message queue is
unchanged. Upon successful completion, the message queue
attributes are changed as follows:
* The number of messages on the queue (msg_qnum) is
incremented.
* The number of bytes on the queue (msg_cbytes) is
increased by the size of the <mtext> portion of the
message being sent.
* The process id of the last process performing a msgsnd
operation (msg_lspid) is set to the calling process.
* The most recent time a msgsnd operation was performed
(msg_stime) is set to the current time.
ACCESS CONTROL
Write access to the message queue is required.
RETURN VALUE
0 Completed successfully.
-1 An error occurred. Errno is set to indicate
the error.
EXCEPTIONS
Errno may be set to one of the following error codes:
EINVAL <msqid> is not a valid message queue
identifier.
EINVAL Message type is less than 1.
EINVAL <msgsz> is less than zero or greater than the
system-imposed limit.
EACCES Write permission is denied to the calling
process.
Licensed material--property of copyright holder(s) Page 2
msgsnd(2) DG/UX 4.30 msgsnd(2)
EAGAIN The message cannot be sent for some reason
and the IPC_NOWAIT bit of <msgflg> is set.
EFAULT <msgp> is an illegal address.
EIDRM <msqid> was removed from the system while the
calling process was suspended by msgsnd.
EINTR The calling process received a signal that
was set to be caught while suspended by
msgsnd.
SEE ALSO
intro(2), ipcrm(1), ipcs(1), msgctl(2), msgget(2),
msgrcv(2), signal(2).
Licensed material--property of copyright holder(s) Page 3