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 242 243 244 245 246 247 248 249 250 251 252
|
.\" Copyright 1993 Giorgio Ciucci <giorgio@crcc.it>
.\"
.\" Permission is granted to make and distribute verbatim copies of this
.\" manual provflags 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.
.\"
.\" Added correction due to Nick Duffek <nsd@bbc.com>, aeb, 960426
.\" Modified Wed Nov 6 04:00:31 1996 by Eric S. Raymond <esr@thyrsus.com>
.\" Modified, 8 Jan 2003, Michael Kerrisk, <mtk.manpages@gmail.com>
.\" Removed EIDRM from errors - that can't happen...
.\" Modified, 27 May 2004, Michael Kerrisk <mtk.manpages@gmail.com>
.\" Added notes on capability requirements
.\" Modified, 11 Nov 2004, Michael Kerrisk <mtk.manpages@gmail.com>
.\" Language and formatting clean-ups
.\" Added notes on /proc files
.\"
.\" Japanese Version Copyright (c) 1997 HANATAKA Shinya
.\" all rights reserved.
.\" Translated 1997-02-23, HANATAKA Shinya <hanataka@abyss.rim.or.jp>
.\" Modified 2003-07-03, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>
.\" Updated 2005-03-04, Akihiro MOTOKI
.\"
.\"WORD: message å
.\"WORD: queue 塼
.\"WORD: identifier ̻
.\"WORD: argument
.\"WORD: owner ͭ
.\"WORD: group 롼
.\"WORD: other ¾
.\"WORD: initialize
.\"WORD: effective user ID ¸桼ID
.\"WORD: effective group ID ¸롼ID
.\"WORD: current time
.\"WORD: destruction ˴
.\"WORD: policy
.\"
.TH MSGGET 2 2004-05-27 "Linux" "Linux Programmer's Manual"
.SH ̾
msgget \- å塼̻Ҥ
.SH
.nf
.B
#include <sys/types.h>
.B
#include <sys/ipc.h>
.B
#include <sys/msg.h>
.fi
.sp
.BI "int msgget(key_t " key ,
.BI "int " msgflg );
.SH
.BR msgget ()
ƥॳ
.I key
ͤбå塼μ̻Ҥ֤
.I key
ͤ
.B IPC_PRIVATE
ξ硢ޤ
.I key
.B IPC_PRIVATE
ǤʤƤ⡢
.I key
бå塼¸ߤ
.I msgflg
.B IPC_CREAT
ꤵƤ硢
å塼롣
.PP
.I msgflg
.B IPC_CREAT
.B IPC_EXCL
ξꤵ줿硢
.I key
бå塼¸ߤȡ
.BR msgget ()
ϼԤ
.I errno
.B EEXIST
ꤵ롣
(
.BR open (2)
.B O_CREAT | O_EXCL
ꤷưƱǤ)
.PP
å塼κˡ
.I msgflg
β 9 ӥåȤϡ
Υå塼ΥĤȤƻѤ롣
εĥӥåȤ
.BR open (2)
ΰ
.I mode
ƱƱ̣Ǥ롣
.BR creat (2)
ƥࡦΥĥѥƱǡƱ̣ġ
(â¹ (execute) ĤϻѤʤ)
.PP
Υå塼ݡ
.BR msgget ()
ƥࡦϥå塼Υǡ¤
.I msqid_ds
ʲΤ褦˽
.RI ( msqid_ds
ˤĤƤ
.BR msgctl (2)
):
.IP
.I msg_perm.cuid
.I msg_perm.uid
˸ƤӽФץμ¸ (effective) 桼ID ꤹ롣
.IP
.I msg_perm.cgid
.I msg_perm.gid
˸ƤӽФץμ¸ (effective) 롼ID ꤹ롣
.IP
.I msg_perm.mode
β 9 ӥåȤ
.I msgflg
β 9 ӥåȤꤹ롣
.IP
.IR msg_qnum ,
.IR msg_lspid ,
.IR msg_lrpid ,
.IR msg_stime ,
.I msg_rtime
0 ꤵ롣
.IP
.I msg_ctime
˸ߤλꤹ롣
.IP
.I msg_qbytes
ˡƥǷ줿å塼κ祵
.B MSGMNB
ꤹ롣
.PP
å塼Ǥ¸ߤϡĤθȡ
˴ (destruction) ޡʤγǧԤ롣
.SH ֤
硢֤ͤϥå塼̻ () Ȥʤ롣
Ԥ \-1 ֤졢
.I errno
ˤΥ顼롣
.SH 顼
Ԥ硢
.I errno
˰ʲͤΤ줫Ĥꤵ:
.TP 11
.B EACCES
.I key
бå塼¸ߤ뤬
ƤӽФץϤΥ塼Ф륢Ĥʤ
.B CAP_IPC_OWNER
ѥӥƥäƤʤ
.TP
.B EEXIST
.I key
бå塼¸ߤ
.I msgflg
.B IPC_CREAT
.B IPC_EXCL
ꤵƤ
.TP
.B ENOENT
.I key
бå塼¸ߤ
.I msgflg
.B IPC_CREAT
ꤵƤʤä
.TP
.B ENOMEM
å塼褦Ȥǡ¤Τ
Τ˽ʬʥ꤬ƥ¸ߤʤ
.TP
.B ENOSPC
å塼褦Ȥ
ƥΤΥå塼κ
.RB ( MSGMNI )
ĶƤޤ
.SH
SVr4, POSIX.1-2001.
.SH
.B IPC_PRIVATE
ϥե饰ǤϤʤ
.I key_t
Ǥ롣
̤ͤ
.I key
ȤƻѤ줿硢
.BR msgget ()
ƥॳ
.I msgflg
β 9 ӥåȰʳƤ̵뤷
() å塼롣
.PP
.BR msgget ()
ƥॳ˱ƶڤܤå塼λ
ƥȤƤ¤ʲ˼:
.TP 11
.B MSGMNI
ƥΤΥå塼κ: ˰¸
(Linux Ǥϡͤ
.I /proc/sys/kernel/msgmni
ͳǻȤꡢѹǤ)
.SS Linux Ǥ
Linux 2.3.20 ޤǤϡͽꤵƤå塼Ф
.BR msgget ()
Ԥ
.B EIDRM
顼Ȥ֤褦ˤʤäƤ
.SH Х
.B IPC_PRIVATE
Ȥ̾ΤϤ餯ԤǤ
.B IPC_NEW
ΤˤεǽɽƤ
.SH Ϣ
.BR msgctl (2),
.BR msgrcv (2),
.BR msgsnd (2),
.BR ftok (3),
.BR capabilities (7),
.BR mq_overview (7),
.BR svipc (7)
|