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 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241
|
.\" 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>
.\" Modified Sun Feb 18 01:59:29 2001 by Andries E. Brouwer <aeb@cwi.nl>
.\" Modified, 27 May 2004, Michael Kerrisk <mtk-manpages@gmx.net>
.\" Added notes on CAP_IPC_OWNER requirement
.\" Modified, 17 Jun 2004, Michael Kerrisk <mtk-manpages@gmx.net>
.\" Added notes on CAP_SYS_ADMIN requirement for IPC_SET and IPC_RMID
.\" Modified, 11 Nov 2004, Michael Kerrisk <mtk-manpages@gmx.net>
.\" Language and formatting clean-ups
.\" Added msqid_ds and ipc_perm structure definitions
.\"
.\" Japanese Version Copyright (c) 1997 HANATAKA Shinya
.\" all rights reserved.
.\" Translated Sun Feb 23 16:49:10 JST 1997
.\" by HANATAKA Shinya <hanataka@abyss.rim.or.jp>
.\" Updated & Modified Mon Jun 4 01:13:06 JST 2001
.\" by Yuichi SATO <ysato@h4.dion.ne.jp>
.\" Updated & Modified Sat Jul 6 04:27:59 JST 2002 by Yuichi SATO
.\" Updated & Modified Fri Dec 31 07:46:49 JST 2004
.\" by Yuichi SATO <ysato444@yahoo.co.jp>
.\"
.\"WORD: message å
.\"WORD: queue 塼
.\"WORD: member С
.\"WORD: structure ¤
.\"WORD: effective user-ID ¸桼ID
.\"WORD: creator
.\"WORD: owner ͭ
.\"
.TH MSGCTL 2 2004-11-10 "Linux 2.6.9" "Linux Programmer's Manual"
.SH ̾
msgctl \- å
.SH
.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
.BR msgctl ()
ϥå塼̻
.I msqid
ǻꤵ줿å塼 (message queue) Ф
.I cmd
ǻꤵ줿Ԥʤ
.PP
.I msqid_ds
ǡ¤Τ <sys/msg.h> ǰʲΤ褦Ƥ:
.nf
.in +4n
struct msqid_ds {
struct ipc_perm msg_perm; /* ͭȵ */
time_t msg_stime; /* Ǹ msgsnd() λ */
time_t msg_rtime; /* Ǹ msgrcv() λ */
time_t msg_ctime; /* ǸѹԤ줿 */
unsigned long __msg_cbytes; /* 塼ˤ븽ߤΥХȿ
(ɸǤϤʤ) */
msgqnum_t msg_qnum; /* 塼ˤ븽ߤ
åο */
msglen_t msg_qbytes; /* 塼˵ĤƤ
Хȿ */
pid_t msg_lspid; /* Ǹ msgsnd() PID */
pid_t msg_lrpid; /* Ǹ msgrcv() PID */
};
.in -4n
.fi
.PP
.I ipc_perm
¤Τ <sys/ipc.h> ǰʲΤ褦Ƥ
(Ĵ줿եɤ
.B IPC_SET
ȤäǽǤ):
.PP
.nf
.in +4n
struct ipc_perm {
key_t key; /* msgget() Ϳ륭 */
uid_t \fBuid\fP; /* ͭԤμ¸ UID */
gid_t \fBgid\fP; /* ͭԤμ¸ GID */
uid_t cuid; /* Ԥμ¸ UID */
gid_t cgid; /* Ԥμ¸ GID */
unsigned short \fBmode\fP; /* */
unsigned short seq; /* ֹ */
};
.in -4n
.fi
.PP
.I cmd
Ȥͭͤ:
.TP
.B IPC_STAT
.I msqid
˴ϢŤ줿å塼ǡ¤Τ顢ݥ
.I buf
ؤ
.I msqid_ds
¤Τ˾ԡ롣
ƤӽФ¦ϥå塼Фɤ߹ߵĤäƤʤФʤʤ
.TP
.B IPC_SET
ݥ
.I buf
ؤ
.I msqid_ds
¤ΤΥСͤå塼˴ϢŤ줿
ͥ롦ǡ¤Τ˽ߡ
.I msg_ctime
С롣
¤ΤΥСΤΤʲ˼:
.IR msg_qbytes ,
.IR msg_perm.uid ,
.IR msg_perm.gid ,
.I msg_perm.mode
(β 9 ӥå)
ƤӽФץμ¸桼 ID å塼νͭ
.RI ( msg_perm.uid )
ޤϺ
.RI ( msg_perm.cuid )
Ȱפ뤫ƤӽФ¤ʤФʤʤ
.I msg_qbytes
ƥࡦѥ
.B MSGMNB
ĶꤹˤϡŬڤʸ (Linux Ǥ
.B CAP_IPC_RESOURCE
ѥӥƥ (capability)) ɬפǤ롣
.TP
.B IPC_RMID
å塼˺롣
Ʊˤι¤Τɤ߽Ԥ֤ˤäץΤ롣
(顼֤ꡢ
.I errno
.B EIDRM
ꤵ)
ƤӽФץˤϡŬڤʸ¤ʤФʤʤ
⤷ϸƤӽФץμ¸桼 ID
å塼κԤޤϽͭԤμ¸桼 ID ǤʤФʤʤ
.SH ֤
0 ֤롣
Ǥʤ \-1 ֤졢
.I errno
Υ顼褦ꤵ롣
.SH 顼
Ԥ硢
.I errno
ϰʲͤΤɤ줫Ĥꤵ:
.TP 11
.B EACCES
.I cmd
.B IPC_STAT
ޤ
.B MSG_STAT
ƤӽФץå塼
.IR msqid
Фɤ߹ߵĤäƤ餺
.B CAP_IPC_OWNER
ѥӥƥäƤʤ
.TP
.B EFAULT
.I cmd
.B IPC_SET
.B IPC_STAT
ǡݥ
.I buf
ǻؤƤ륢ɥ쥹ǽǤʤ
.TP
.B EIDRM
å塼줿
.TP
.B EINVAL
.I cmd
ޤ
.IR msqid
ͤꤵ줿
.TP
.B EPERM
.I cmd
.B IPC_SET
.B IPC_RMID
Ǥ뤬ƤӽФץμ¸桼 ID å塼
.RI ( msg_perm.cuid
ȤƸĤ)
ޤ
.RI ( msg_perm.uid
ȤƸĤ) ͭԤǤʤ
ĸƤӽФץ˸ (Linux Ǥ
.B CAP_SYS_ADMIN
ѥӥƥ) ʤ
.SH
\fIstruct msqid_ds\fP ¿Υեɤϡ
Linux 2.2 ǤûäLinux 2.4 ǤĹʤä
ˤϡglibc-2.1.91 ʹߤδĶ
ƥѥ뤹нʬǤ롣
ͥϿθƤӽФȸŤθƤӽФ
.I cmd
IPC_64 ե饰Ƕ̤롣
.SH
SVr4, SVID. SVID ˤ EIDRM 顼ˤĤƤεҤϤʤ
.SH Ϣ
.BR msgget (2),
.BR msgrcv (2),
.BR msgsnd (2),
.BR ipc (5),
.BR capabilities (7)
|