MSGCTL(3L)

NAME
msgctl - message control operations

SYNOPSIS
#include <message.h>

int msgctl (msqid, cmd, buf)
long msqid;
int cmd;
struct msqid_ds *buf;

DESCRIPTION
Msgctl provides a variety of message control operations as specified by cmd. The following cmds are available:

IPC_STAT
    Place the current value of each member of the data structure associated with msqid into the structure pointed to by buf.

IPC_SET
    Set the value of the following members of the data structure associated with msqid to the corresponding value found in the structure pointed to by buf:
        msg_qbytes
        cid
        state

    The creator process id can be changed. This is done so that when this process is deleted, the queue will be deleted with it.

IPC_RMID
    Remove the message queue identifier specified by msqid from the system and destroy the message queue and data structure associated with it. This can be executed by any process.

Msgctl will fail if one or more of the following are true:

    Msqid is not a valid message queue identifier.

    Cmd is not a valid command.

    Cmd is equal to IPC_SET and an attempt is being made to increase the value of msg_qbytes over MAX_BYTES (8192).

A side effect of msgctl is that it clears the MSG resource ready condition used by the wait and own resource functions.

  Return Value
Upon successful completion, a value of 0 is returned. Otherwise, a value of -1 is returned.

SEE ALSO
msgget(3L), msgop(3L), realtime(3R), resources(3R), structures(3R).