HP 3000 Manuals

msgctl [ MPE/iX Developer's Kit Reference Manual Volume II ] MPE/iX 5.0 Documentation


MPE/iX Developer's Kit Reference Manual Volume II

msgctl 

Provides message control operations.

Syntax 

     #include <sys/types.h>
     #include <sys/ipc.h>
     #include <sys/msg.h>
     int msgctl (int msqid, int cmd, struct msqid_ds *buffer);

Parameters 

msqid      Passes a message queue identifier returned by a call to
           msgget().

cmd        Passes a command defining the control operation to perform.
           Valid commands are defined in the "Description" section below.

buffer     Passes a pointer to a buffer of type struct msqid_ds (defined
           in the <sys/msg.h> header).  Operations on the buffer are
           defined by cmd.  Refer to the "Description" section below.

Return Values 

0          Success.

-1         An error occurred, and errno is set to indicate the error
           condition.

Description 

The msgctl() function provides message control operations on the message
queue and data structure associated with msqid.  Control operations are
defined by the cmd parameter.  Following are valid commands to be passed
in cmd:

IPC_RMID   Deallocate the message queue identifier specified by msqid and
           purge the message queue and data structure associated with it.
           The calling process must have either [REV BEG]MPE/iX SM
           capability[REV END], or be the owner or creator of msqid (have
           an effective user ID equal to the value of either the
           msg_perm.uid (owner) or msg_perm.cuid (creator) fields in the
           data structure associated with msqid).

IPC_SET    Copy data from the following fields of the msqid_ds structure
           pointed to by buffer to the corresponding fields in the data
           structure associated with msqid:
              *   msg_perm.uid (owner user ID)
              *   msg_perm.gid (owner group ID)
              *   Low order 9 bits of msg_perm.mode
              *   msg_qbytes

           The calling process must have either [REV BEG]MPE/iX SM
           capability[REV END] or an effective user ID equal to the value
           of either the msg_perm.uid or msg_perm.cuid fields in the data
           structure associated with msqid.  The caller must have [REV
           BEG]MPE/iX SM capability[REV END] to increase the value of the
           msg_qbytes field of the data structure associated with msqid.

IPC_STAT   Copy all data from the structure associated with msqid to the
           data structure pointed to by buffer.

Implementation Considerations 

None.

Errors 

If an error occurs, errno is set to one of the following values.

EACCES            CAUSE           cmd specifies IPC_STAT and the calling process does
                                  not have read permission.

                  ACTION          Ensure that the calling process has read permission
                                  for the msqid.

EFAULT            CAUSE           The system detected a NULL or bad address in
                                  attempting to use the buffer argument.

                  ACTION          Check to see if the pointer is correctly initialized.

EINVAL            CAUSE           msqid is not a valid message queue identifier, or cmd 
                                  is not a valid command.

                  ACTION          Check that the msqid parameter is valid and the
                                  associated message queue has not been removed, or
                                  that cmd is valid.

EPERM             CAUSE           One of the following:

                                     *   cmd specifies IPC_RMID or IPC_SET and the
                                         calling process does not have either [REV
                                         BEG]MPE/iX SM capability[REV END] or an
                                         effective user ID equal to the value of either
                                         the msg_perm.uid or msg_perm.cuid fields in
                                         the data structure associated with msqid.

                                     *   cmd specifies IPC_SET and the calling process
                                         tried to increase the value of msg_qbytes
                                         without having [REV BEG]MPE/iX SM
                                         capability[REV END].

                  ACTION          Ensure that the calling process has the appropriate
                                  effective user ID or capability required to perform
                                  the requested command.

ESYSERR           CAUSE           An operating system error occurred that does not map
                                  directly to any of the above errors.

                  ACTION          Examine the MPE/iX process error stack for the type
                                  of system error.

See Also 

msgget(), msgrcv(), msgsnd(), SVID2 (Section 12)



MPE/iX 5.0 Documentation