aboutsummaryrefslogtreecommitdiffstats
path: root/man-pages-posix-2003/man3p/msgctl.3p
blob: fbe43f2d8b2044aabcddc35f29c04794f9845835 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
.\" Copyright (c) 2001-2003 The Open Group, All Rights Reserved 
.TH "MSGCTL" 3P 2003 "IEEE/The Open Group" "POSIX Programmer's Manual"
.\" msgctl 
.SH PROLOG
This manual page is part of the POSIX Programmer's Manual.
The Linux implementation of this interface may differ (consult
the corresponding Linux manual page for details of Linux behavior),
or the interface may not be implemented on Linux.
.SH NAME
msgctl \- XSI message control operations
.SH SYNOPSIS
.LP
\fB#include <sys/msg.h>
.br
.sp
int msgctl(int\fP \fImsqid\fP\fB, int\fP \fIcmd\fP\fB, struct msqid_ds
*\fP\fIbuf\fP\fB); \fP
\fB
.br
\fP
.SH DESCRIPTION
.LP
The \fImsgctl\fP() function operates on XSI message queues (see the
Base Definitions volume of IEEE\ Std\ 1003.1-2001,
Section 3.224, Message Queue). It is unspecified whether this function
interoperates with the realtime interprocess communication facilities
defined in \fIRealtime\fP .
.LP
The \fImsgctl\fP() function shall provide message control operations
as specified by \fIcmd\fP. The following values for
\fIcmd\fP, and the message control operations they specify, are:
.TP 7
IPC_STAT
Place the current value of each member of the \fBmsqid_ds\fP data
structure associated with \fImsqid\fP into the structure
pointed to by \fIbuf\fP. The contents of this structure are defined
in \fI<sys/msg.h>\fP.
.TP 7
IPC_SET
Set the value of the following members of the \fBmsqid_ds\fP data
structure associated with \fImsqid\fP to the corresponding
value found in the structure pointed to by \fIbuf\fP: 
.sp
.RS
.nf

\fBmsg_perm.uid
msg_perm.gid
msg_perm.mode
msg_qbytes
\fP
.fi
.RE
.LP
IPC_SET can only be executed by a process with appropriate privileges
or that has an effective user ID equal to the value of
\fBmsg_perm.cuid\fP or \fBmsg_perm.uid\fP in the \fBmsqid_ds\fP data
structure associated with \fImsqid\fP. Only a process with
appropriate privileges can raise the value of \fBmsg_qbytes\fP.
.TP 7
IPC_RMID
Remove the message queue identifier specified by \fImsqid\fP from
the system and destroy the message queue and \fBmsqid_ds\fP
data structure associated with it. IPC_RMD can only be executed by
a process with appropriate privileges or one that has an
effective user ID equal to the value of \fBmsg_perm.cuid\fP or \fBmsg_perm.uid\fP
in the \fBmsqid_ds\fP data structure
associated with \fImsqid\fP.
.sp
.SH RETURN VALUE
.LP
Upon successful completion, \fImsgctl\fP() shall return 0; otherwise,
it shall return -1 and set \fIerrno\fP to indicate the
error.
.SH ERRORS
.LP
The \fImsgctl\fP() function shall fail if:
.TP 7
.B EACCES
The argument \fIcmd\fP is IPC_STAT and the calling process does not
have read permission; see \fIXSI Interprocess Communication\fP .
.TP 7
.B EINVAL
The value of \fImsqid\fP is not a valid message queue identifier;
or the value of \fIcmd\fP is not a valid command.
.TP 7
.B EPERM
The argument \fIcmd\fP is IPC_RMID or IPC_SET and the effective user
ID of the calling process is not equal to that of a
process with appropriate privileges and it is not equal to the value
of \fBmsg_perm.cuid\fP or \fBmsg_perm.uid\fP in the data
structure associated with \fImsqid\fP.
.TP 7
.B EPERM
The argument \fIcmd\fP is IPC_SET, an attempt is being made to increase
to the value of \fBmsg_qbytes\fP, and the effective
user ID of the calling process does not have appropriate privileges.
.sp
.LP
\fIThe following sections are informative.\fP
.SH EXAMPLES
.LP
None.
.SH APPLICATION USAGE
.LP
The POSIX Realtime Extension defines alternative interfaces for interprocess
communication (IPC). Application developers who
need to use IPC should design their applications so that modules using
the IPC routines described in \fIXSI Interprocess Communication\fP
can be easily modified to use the alternative
interfaces.
.SH RATIONALE
.LP
None.
.SH FUTURE DIRECTIONS
.LP
None.
.SH SEE ALSO
.LP
\fIXSI Interprocess Communication\fP, \fIRealtime\fP, \fImq_close\fP(),
\fImq_getattr\fP(), \fImq_notify\fP(), \fImq_open\fP(), \fImq_receive\fP(),
\fImq_send\fP(), \fImq_setattr\fP(), \fImq_unlink\fP(), \fImsgget\fP(),
\fImsgrcv\fP(),
\fImsgsnd\fP(), the Base Definitions volume of IEEE\ Std\ 1003.1-2001,
\fI<sys/msg.h>\fP
.SH COPYRIGHT
Portions of this text are reprinted and reproduced in electronic form
from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
-- Portable Operating System Interface (POSIX), The Open Group Base
Specifications Issue 6, Copyright (C) 2001-2003 by the Institute of
Electrical and Electronics Engineers, Inc and The Open Group. In the
event of any discrepancy between this version and the original IEEE and
The Open Group Standard, the original IEEE and The Open Group Standard
is the referee document. The original Standard can be obtained online at
http://www.opengroup.org/unix/online.html .