1MSGCTL(P) POSIX Programmer's Manual MSGCTL(P)
2
3
4
6 msgctl - XSI message control operations
7
9 #include <sys/msg.h>
10
11 int msgctl(int msqid, int cmd, struct msqid_ds *buf);
12
13
15 The msgctl() function operates on XSI message queues (see the Base Def‐
16 initions volume of IEEE Std 1003.1-2001, Section 3.224, Message Queue).
17 It is unspecified whether this function interoperates with the realtime
18 interprocess communication facilities defined in Realtime .
19
20 The msgctl() function shall provide message control operations as spec‐
21 ified by cmd. The following values for cmd, and the message control
22 operations they specify, are:
23
24 IPC_STAT
25 Place the current value of each member of the msqid_ds data
26 structure associated with msqid into the structure pointed to by
27 buf. The contents of this structure are defined in <sys/msg.h>.
28
29 IPC_SET
30 Set the value of the following members of the msqid_ds data
31 structure associated with msqid to the corresponding value found
32 in the structure pointed to by buf:
33
34
35 msg_perm.uid
36 msg_perm.gid
37 msg_perm.mode
38 msg_qbytes
39
40 IPC_SET can only be executed by a process with appropriate privileges
41 or that has an effective user ID equal to the value of msg_perm.cuid or
42 msg_perm.uid in the msqid_ds data structure associated with msqid. Only
43 a process with appropriate privileges can raise the value of
44 msg_qbytes.
45
46 IPC_RMID
47 Remove the message queue identifier specified by msqid from the
48 system and destroy the message queue and msqid_ds data structure
49 associated with it. IPC_RMD can only be executed by a process
50 with appropriate privileges or one that has an effective user ID
51 equal to the value of msg_perm.cuid or msg_perm.uid in the
52 msqid_ds data structure associated with msqid.
53
54
56 Upon successful completion, msgctl() shall return 0; otherwise, it
57 shall return -1 and set errno to indicate the error.
58
60 The msgctl() function shall fail if:
61
62 EACCES The argument cmd is IPC_STAT and the calling process does not
63 have read permission; see XSI Interprocess Communication .
64
65 EINVAL The value of msqid is not a valid message queue identifier; or
66 the value of cmd is not a valid command.
67
68 EPERM The argument cmd is IPC_RMID or IPC_SET and the effective user
69 ID of the calling process is not equal to that of a process with
70 appropriate privileges and it is not equal to the value of
71 msg_perm.cuid or msg_perm.uid in the data structure associated
72 with msqid.
73
74 EPERM The argument cmd is IPC_SET, an attempt is being made to
75 increase to the value of msg_qbytes, and the effective user ID
76 of the calling process does not have appropriate privileges.
77
78
79 The following sections are informative.
80
82 None.
83
85 The POSIX Realtime Extension defines alternative interfaces for inter‐
86 process communication (IPC). Application developers who need to use IPC
87 should design their applications so that modules using the IPC routines
88 described in XSI Interprocess Communication can be easily modified to
89 use the alternative interfaces.
90
92 None.
93
95 None.
96
98 XSI Interprocess Communication , Realtime , mq_close() , mq_getattr() ,
99 mq_notify() , mq_open() , mq_receive() , mq_send() , mq_setattr() ,
100 mq_unlink() , msgget() , msgrcv() , msgsnd() , the Base Definitions
101 volume of IEEE Std 1003.1-2001, <sys/msg.h>
102
104 Portions of this text are reprinted and reproduced in electronic form
105 from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
106 -- Portable Operating System Interface (POSIX), The Open Group Base
107 Specifications Issue 6, Copyright (C) 2001-2003 by the Institute of
108 Electrical and Electronics Engineers, Inc and The Open Group. In the
109 event of any discrepancy between this version and the original IEEE and
110 The Open Group Standard, the original IEEE and The Open Group Standard
111 is the referee document. The original Standard can be obtained online
112 at http://www.opengroup.org/unix/online.html .
113
114
115
116IEEE/The Open Group 2003 MSGCTL(P)