msgctl()

perform message control operations 

Function


SYNOPSIS

#include <sys/msg.h>

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


DESCRIPTION

The msgctl() system call provides a variety of message control operations as specified by cmd. The following commands are available:

IPC_STAT 

Copies the current attributes of the message queue associated with msqid into the structure that buf points to.

IPC_SET 

Sets the attributes of the associated with msqid from the values found in the structure that buf points to:

	msg_perm.uid
	msg_perm.gid
	msg_perm.mode     /* only access permission bits */
	msg_perm.qbytes

This command can be executed only by a process that has an effective user ID equal to either that of super user, msg_perm.cuid, or msg_perm.uid. Only the super user can increase the value of msg_qbytes.

IPC_RMID 

Removes the message queue identifier specified by msqid from the system and destroys the message queue. This command can be executed only by a process that has an effective user ID equal to either that of super user, msg_perm.cuid, or msg_perm.uid.


PARAMETERS

msqid 

Is a unique positive integer, created by a msgget() call, that identifies a message queue and its associated data structure.

cmd 

Specifies a message control operation.

buf 

Points to a structure used for message queue data manipulation operations.


RETURN VALUES

If successful, msgctl() returns zero. On failure, msgctl() returns -1 and sets errno to one of the following values:

EACCES 

cmd is IPC_STAT and operation permission is denied to the calling process.

EFAULT 

buf is an invalid pointer.

EINVAL 

cmd is IPC_SET and msg_perm.uid or msg_perm.gid is not valid.

cmd is not a valid command.

msqid is not a valid message queue identifier.

EPERM 

cmd is IPC_RMID or IPC_SET and the effective user ID of the calling process is not equal to that of super user nor to the value of msg_perm.cuid or msg_perm.uid in the data structure associated with msqid.

cmd is IPC_SET and you are trying to increase msg_qbytes and the effective user ID of the calling process is not equal to that of super user.


CONFORMANCE

Unix 98.


MULTITHREAD SAFETY LEVEL

MT-Safe.


PORTING ISSUES

The effective user ID of the super-user account is 0 in the NuTCRACKER Platform environment. See Users and Groups under Security in the API-Specific Porting Issues chapter of the PTC MKS Toolkit UNIX to Windows Porting Guide for more information.


AVAILABILITY

PTC MKS Toolkit for Professional Developers
PTC MKS Toolkit for Professional Developers 64-Bit Edition
PTC MKS Toolkit for Enterprise Developers
PTC MKS Toolkit for Enterprise Developers 64-Bit Edition


SEE ALSO

Functions:
msgget(), msgrcv(), msgsnd()


PTC MKS Toolkit 10.3 Documentation Build 39.