Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ msgsnd(2) — DG/UX 4.00

Media Vault

Software Library

Restoration Projects

Artifacts Sought



                                                                msgsnd(2)



        _________________________________________________________________
        msgsnd                                                System Call
        Send a message.
        _________________________________________________________________


        SYNTAX

        #include <sys/types.h>
        #include <sys/ipc.h>
        #include <sys/msg.h>

        int   msgsnd  (id, user_msg_ptr, size, flag)
        int             id;
        struct msgbuf   *user_msg_ptr;
        int             size;
        int             flag;


        PARAMETERS

        id             A message queue identifier.


        user_msg_ptr   The message buffer of the message to be sent.


        size           The size in bytes of the mtext portion of the
                       message buffer.


        flag           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 <id>.  <user_msg_ptr> points to the
        users message buffer containing a message type used for message
        selection, and the text of the message. <size> is the length of
        the message. It can range from 0 to a configurable system-imposed
        maximum.

        <flag> 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 <flag> is set, the message will not
             be sent and the calling process will return immediately.



        DG/UX 4.00                                                 Page 1
               Licensed material--property of copyright holder(s)





                                                                msgsnd(2)



        *    If the IPC_NOWAIT bit of <flag> 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,

        *    <id> 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         <id> is not a valid message queue identifier.




        DG/UX 4.00                                                 Page 2
               Licensed material--property of copyright holder(s)





                                                                msgsnd(2)



        EINVAL         Message type is less than 1.


        EINVAL         <size> is less than zero or greater than the
                       system-imposed limit.


        EACCES         Write permission is denied to the calling process.


        EAGAIN         The message cannot be sent for some reason and the
                       IPC_NOWAIT bit of <flag> is set.


        EFAULT         <user_msg_ptr> is an illegal address.


        EIDRM          <id> 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

        The related system calls:  msgctl, msgget, msgrcv, signal.
        The related manual section:  intro(2).

























        DG/UX 4.00                                                 Page 3
               Licensed material--property of copyright holder(s)



Typewritten Software • bear@typewritten.org • Edmonds, WA 98026