1msgctl(2) System Calls msgctl(2)
2
3
4
6 msgctl - 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 provides a variety of message control operations
16 as specified by cmd. The following cmds are available:
17
18 IPC_STAT Place the current value of each member of the data struc‐
19 ture associated with msqid into the structure pointed to by
20 buf. The contents of this structure are defined in
21 Intro(2).
22
23
24 IPC_SET Set the value of the following members of the data struc‐
25 ture associated with msqid to the corresponding value found
26 in the structure pointed to by buf:
27
28 msg_perm.uid
29 msg_perm.gid
30 msg_perm.mode /* access permission bits only */
31 msg_qbytes
32
33 This command can be executed only by a process that has
34 either the {PRIV_IPC_OWNER} privilege or an effective user
35 ID equal to the value of msg_perm.cuid or msg_perm.uid in
36 the data structure associated with msqid. Only a process
37 with the {PRIV_SYS_IPC_CONFIG} privilege can raise the
38 value of msg_qbytes.
39
40
41 IPC_RMID Remove the message queue identifier specified by msqid from
42 the system and destroy the message queue and data structure
43 associated with it. This cmd can only be executed by a
44 process that has an effective user ID either with appropri‐
45 ate privileges asserted in the effective set or equal to
46 the value of msg_perm.cuid or msg_perm.uid in the data
47 structure associated with msqid. The buf argument is
48 ignored.
49
50
52 Upon successful completion, msgctl() returns 0. Otherwise, it returns
53 −1 and sets errno to indicate the error.
54
56 The msgctl() function will fail if:
57
58 EACCES The cmd argument is IPC_STAT and operation permission is
59 denied to the calling process (see Intro(2)).
60
61
62 EFAULT The buf argument points to an illegal address.
63
64
65 EINVAL The msqid argument is not a valid message queue identi‐
66 fier; or the cmd argument is not a valid command or is
67 IPC_SET and msg_perm.uid or msg_perm.gid is not valid.
68
69
70 EOVERFLOW The cmd argument is IPC_STAT and uid or gid is too large
71 to be stored in the structure pointed to by buf.
72
73
74 EPERM The cmd argument is IPC_RMID or IPC_SET, the
75 {PRIV_SYS_IPC_OWNER} privilege is not asserted in the
76 effective set of the calling process, and is not equal to
77 the value of msg_perm.cuid or msg_perm.uid in the data
78 structure associated with msqid.
79
80 The cmd argument is IPC_SET, an attempt is being made to
81 increase to the value of msg_qbytes, and the
82 {PRIV_SYS_IPC_CONFIG} privilege is not asserted in the
83 effective set of the calling process.
84
85
87 See attributes(5) for descriptions of the following attributes:
88
89
90
91
92 ┌─────────────────────────────┬─────────────────────────────┐
93 │ ATTRIBUTE TYPE │ ATTRIBUTE VALUE │
94 ├─────────────────────────────┼─────────────────────────────┤
95 │Interface Stability │Standard │
96 └─────────────────────────────┴─────────────────────────────┘
97
99 Intro(2), msgget(2), msgrcv(2), msgsnd(2), attributes(5), privi‐
100 leges(5), standards(5)
101
102
103
104SunOS 5.11 22 Mar 2004 msgctl(2)