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 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166
|
.\" Copyright 1993 Giorgio Ciucci (giorgio@crcc.it)
.\"
.\" Permission is granted to make and distribute verbatim copies of this
.\" manual provided the copyright notice and this permission notice are
.\" preserved on all copies.
.\"
.\" Permission is granted to copy and distribute modified versions of this
.\" manual under the conditions for verbatim copying, provided that the
.\" entire resulting derived work is distributed under the terms of a
.\" permission notice identical to this one
.\"
.\" Since the Linux kernel and libraries are constantly changing, this
.\" manual page may be incorrect or out-of-date. The author(s) assume no
.\" responsibility for errors or omissions, or for damages resulting from
.\" the use of the information contained herein. The author(s) may not
.\" have taken the same level of care in the production of this manual,
.\" which is licensed free of charge, as they might when working
.\" professionally.
.\"
.\" Formatted or processed versions of this manual, if unaccompanied by
.\" the source, must acknowledge the copyright and authors of this work.
.\"
.\" Modified Tue Oct 22 08:11:14 EDT 1996 by Eric S. Raymond <esr@thyrsus.com>
.TH MSGCTL 2 "November 1, 1993" "Linux 0.99.13" "Linux Programmer's Manual"
.SH NAME
msgctl \- message control operations
.SH SYNOPSIS
.nf
.B
# include <sys/types.h>
.B
# include <sys/ipc.h>
.B
# include <sys/msg.h>
.fi
.sp
.BI "int msgctl ( int " msqid ",
.BI "int " cmd ,
.BI "struct msqid_ds *" buf " )"
.SH DESCRIPTION
The function performs the control operation specified by
.I cmd
on the message queue with identifier
.IR msqid .
Legal values for
.I cmd
are:
.TP 12
.B IPC_STAT
Copy info from the message queue data structure
into the structure pointed to by
.IR buf .
The user must have read access privileges on the message queue.
.TP
.B IPC_SET
Write the values of some members of the
.B msqid_ds
structure pointed to by
.I buf
to the message queue data structure, updating also its
.B msg_ctime
member.
Considered members from the user supplied
.B "struct msqid_ds"
pointed to by
.I buf
are
.nf
.sp
.ft B
msg_perm.uid
msg_perm.gid
msg_perm.mode \fR/* only lowest 9-bits */\fP
msg_qbytes
.fi
.ft R
.sp
The calling process effective user\-ID must be one among super\-user,
creator or owner of the message queue.
Only the super\-user can raise the
.B msg_qbytes
value beyond the system parameter
.BR MSGMNB .
.TP
.B IPC_RMID
Remove immediately the message queue and its data structures
awakening all waiting reader and writer processes (with an error
return and
.B errno
set to
.BR EIDRM ).
The calling process effective user\-ID must be one among super\-user,
creator or owner of the message queue.
.SH "RETURN VALUE"
If successful, the return value will be
.BR 0 ,
otherwise
.B \-1
with
.B errno
indicating the error.
.SH ERRORS
For a failing return,
.B errno
will be set to one among the following values:
.TP 11
.B EACCES
The argument
.I cmd
is equal to
.B IPC_STAT
but the calling process has no read access permissions on the message queue
.IR msqid .
.TP
.B EFAULT
The argument
.I cmd
has value
.B IPC_SET
or
.B IPC_STAT
but the address pointed to by
.I buf
isn't accessible.
.TP
.B EIDRM
The message queue was removed.
.TP
.B EINVAL
Invalid value for
.I cmd
or
.IR msqid .
.TP
.B EPERM
The argument
.I cmd
has value
.B IPC_SET
or
.B IPC_RMID
but the calling process effective user\-ID has insufficient
privileges to execute the command.
Note this is also the case of a non super\-user process
trying to increase the
.B msg_qbytes
value beyond the value specified by the system parameter
.BR MSGMNB .
.SH NOTES
The
.BR IPC_INFO ,
.BR MSG_STAT
and
.B MSG_INFO
control calls are used by the
.BR ipcs (8)
program to provide information on allocated resources.
In the future these can be modified as needed or moved to a proc file system
interface.
.SH "CONFORMING TO"
SVr4, SVID. SVID dies not document the EIDRM error condition.
.SH "SEE ALSO"
.BR ipc (5),
.BR msgget (2),
.BR msgsnd (2),
.BR msgrcv (2)
|