1MSGCTL(3P)                 POSIX Programmer's Manual                MSGCTL(3P)
2
3
4

PROLOG

6       This  manual  page is part of the POSIX Programmer's Manual.  The Linux
7       implementation of this interface may differ (consult the  corresponding
8       Linux  manual page for details of Linux behavior), or the interface may
9       not be implemented on Linux.
10

NAME

12       msgctl - XSI message control operations
13

SYNOPSIS

15       #include <sys/msg.h>
16
17       int msgctl(int msqid, int cmd, struct msqid_ds *buf);
18
19

DESCRIPTION

21       The msgctl() function operates on XSI message queues (see the Base Def‐
22       initions volume of IEEE Std 1003.1-2001, Section 3.224, Message Queue).
23       It is unspecified whether this function interoperates with the realtime
24       interprocess communication facilities defined in Realtime .
25
26       The msgctl() function shall provide message control operations as spec‐
27       ified by cmd. The following values for cmd,  and  the  message  control
28       operations they specify, are:
29
30       IPC_STAT
31              Place  the  current  value  of  each member of the msqid_ds data
32              structure associated with msqid into the structure pointed to by
33              buf. The contents of this structure are defined in <sys/msg.h>.
34
35       IPC_SET
36              Set  the  value  of  the  following members of the msqid_ds data
37              structure associated with msqid to the corresponding value found
38              in the structure pointed to by buf:
39
40
41              msg_perm.uid
42              msg_perm.gid
43              msg_perm.mode
44              msg_qbytes
45
46       IPC_SET  can  only be executed by a process with appropriate privileges
47       or that has an effective user ID equal to the value of msg_perm.cuid or
48       msg_perm.uid in the msqid_ds data structure associated with msqid. Only
49       a  process  with  appropriate  privileges  can  raise  the   value   of
50       msg_qbytes.
51
52       IPC_RMID
53              Remove  the message queue identifier specified by msqid from the
54              system and destroy the message queue and msqid_ds data structure
55              associated  with  it.  IPC_RMD can only be executed by a process
56              with appropriate privileges or one that has an effective user ID
57              equal  to  the  value  of  msg_perm.cuid  or msg_perm.uid in the
58              msqid_ds data structure associated with msqid.
59
60

RETURN VALUE

62       Upon successful completion, msgctl()  shall  return  0;  otherwise,  it
63       shall return -1 and set errno to indicate the error.
64

ERRORS

66       The msgctl() function shall fail if:
67
68       EACCES The  argument  cmd  is IPC_STAT and the calling process does not
69              have read permission; see XSI Interprocess Communication .
70
71       EINVAL The value of msqid is not a valid message queue  identifier;  or
72              the value of cmd is not a valid command.
73
74       EPERM  The  argument  cmd is IPC_RMID or IPC_SET and the effective user
75              ID of the calling process is not equal to that of a process with
76              appropriate  privileges  and  it  is  not  equal to the value of
77              msg_perm.cuid or msg_perm.uid in the data  structure  associated
78              with msqid.
79
80       EPERM  The  argument  cmd  is  IPC_SET,  an  attempt  is  being made to
81              increase to the value of msg_qbytes, and the effective  user  ID
82              of the calling process does not have appropriate privileges.
83
84
85       The following sections are informative.
86

EXAMPLES

88       None.
89

APPLICATION USAGE

91       The  POSIX Realtime Extension defines alternative interfaces for inter‐
92       process communication (IPC). Application developers who need to use IPC
93       should design their applications so that modules using the IPC routines
94       described in XSI Interprocess Communication can be easily  modified  to
95       use the alternative interfaces.
96

RATIONALE

98       None.
99

FUTURE DIRECTIONS

101       None.
102

SEE ALSO

104       XSI  Interprocess  Communication,  Realtime,  mq_close(), mq_getattr(),
105       mq_notify(),   mq_open(),   mq_receive(),   mq_send(),    mq_setattr(),
106       mq_unlink(),  msgget(), msgrcv(), msgsnd(), the Base Definitions volume
107       of IEEE Std 1003.1-2001, <sys/msg.h>
108
110       Portions of this text are reprinted and reproduced in  electronic  form
111       from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
112       -- Portable Operating System Interface (POSIX),  The  Open  Group  Base
113       Specifications  Issue  6,  Copyright  (C) 2001-2003 by the Institute of
114       Electrical and Electronics Engineers, Inc and The Open  Group.  In  the
115       event of any discrepancy between this version and the original IEEE and
116       The Open Group Standard, the original IEEE and The Open Group  Standard
117       is  the  referee document. The original Standard can be obtained online
118       at http://www.opengroup.org/unix/online.html .
119
120
121
122IEEE/The Open Group                  2003                           MSGCTL(3P)
Impressum