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
|
.\" Copyright (c) 1993 Luigi P. Bai (lpb@softint.com) July 28, 1993
.\"
.\" 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 Wed Jul 28 11:03:24 1993, Rik Faith <faith@cs.unc.edu>
.\" Modified Sun Nov 28 16:43:30 1993, Rik Faith <faith@cs.unc.edu>
.\" with material from Giorgio Ciucci <giorgio@crcc.it>
.\" Portions Copyright 1993 Giorgio Ciucci <giorgio@crcc.it>
.\" Modified Fri Jan 31 17:24:31 1997 by Eric S. Raymond <esr@thyrsus.com>
.\" Modified Sun Feb 18 01:59:29 2001 by Andries Brouwer <aeb@cwi.nl>
.\"
.\" Japanese Version Copyright (c) 1997 HANATAKA Shinya
.\" all rights reserved.
.\" Translated Sat Mar 1 16:49:09 JST 1997
.\" by HANATAKA Shinya <hanataka@abyss.rim.or.jp>
.\" Updated & Modified Wed Jun 13 20:53:52 JST 2001
.\" by Yuichi SATO <ysato@h4.dion.ne.jp>
.\"
.\"WORD: shared memory ͭ
.\"WORD: segment
.\"WORD: owner ͭ
.\"WORD: group 롼
.\"WORD: creator
.\"WORD: super-user ѡ桼
.\"WORD: detach ʬΥ
.\"WORD: attach ղ
.\"WORD: swap å
.\"WORD: identifier ̻
.\"WORD: member С
.\"
.TH SHMCTL 2 "18 Feb 2001" "Linux 2.4.1" "Linux Programmer's Manual"
.SH ̾
shmctl \- ͭ (shared memory) 椹
.SH
.ad l
.B #include <sys/ipc.h>
.sp
.B #include <sys/shm.h>
.sp
.BI "int shmctl(int " shmid ", int " cmd ", struct shmid_ds *" buf );
.ad b
.SH
\fBshmctl()\fP ϥ桼ͭꡦȤξꡢ
ͭνͭ (owner)롼 (group)ӵ (permission)
ꤹ뤳ȤǤ롣
\fIshmid\fP ǻꤵ줿ȤˤĤƤξ
\fIshmid_ds\fP ¤Τ֤:
.PP
.in +0.5i
.nf
struct shmid_ds {
struct ipc_perm shm_perm; /* operation perms */
int shm_segsz; /* size of segment (bytes) */
time_t shm_atime; /* last attach time */
time_t shm_dtime; /* last detach time */
time_t shm_ctime; /* last change time */
unsigned short shm_cpid; /* pid of creator */
unsigned short shm_lpid; /* pid of last operator */
short shm_nattch; /* no. of current attaches */
/* the following are private */
unsigned short shm_npages; /* size of segment (pages) */
unsigned long *shm_pages;
struct shm_desc *attaches; /* descriptors for attaches */
};
.fi
.in -0.5i
.PP
\fIshm_perm\fP СƤ:
.PP
.in +0.5i
.nf
struct ipc_perm
{
key_t key;
\fBushort uid\fP; /* \fBowner\fP euid and egid */
\fBushort gid\fP;
ushort cuid; /* creator euid and egid */
ushort cgid;
\fBushort mode\fP; /* lower 9 bits of access modes */
ushort seq; /* sequence number */
};
.fi
.PP
ʲ \fIcmd\fP ѤǤ:
.br
.TP 12
.B IPC_STAT
ͭꡦȤ \fIbuf\fP Хåե˥ԡ뤿˻Ѥ롣
桼϶ͭꡦȤФ\fBɤ߹\fP
ǤʤФʤʤ
.TP
.B IPC_SET
桼 \fIshm_perms\fP եɤ
\fIuid\fP, \fIgid\fP, \fImode\fP С˹ԤäѹŬѤ뤿˻Ѥ롣
\fImode\fP ϲ 9 ӥåȤΤߤѤ롣
.I shm_ctime
롣
桼Ͻͭ (owner) (creator)
ѡ桼 (super-user) ǤʤФʤʤ
.TP
.B IPC_RMID
Ȥ˲ (destroy) ޡդΤ˻Ѥ롣
ºݤˤϺǸʬΥ (detach) Ԥʤ줿 (Ϣ
.I shmid_ds
¤Τ
.I shm_nattch
Сˤʤä) ˲롣
桼ϽͭԤԤѡ桼ǤʤФʤʤ
.PP
桼ϺǽŪˤϥȤ˺줺˲\fIʤФʤʤ\fP
ǤʤС˲ʤäڡϥå (swap) ˻Ĥ³롣
.PP
äơʲ \fIcmd\fP ǡ\fBѡ桼\fP
ͭꡦȤåפ뤳Ȥ˸ꡢǤǤ:
(Linux Τ)
.br
.TP 12
.B SHM_LOCK
ͭꡦȤåפ뤳Ȥ˸롣
桼ϥåǽˤʤä˥åᤷڡ
¸ߤ뤳ȤǧʤФʤʤ
.TP
.B SHM_UNLOCK
ͭꡦȤåסȤ뤳Ȥǽˤ롣
.PP
.BR IPC_INFO ,
.BR SHM_STAT ,
.B SHM_INFO
楳
.BR ipcs (8)
ץˤäƳƤ줿ˤĤƤξ뤿˻Ѥ롣
ŪˤϤ proc ե롦ƥࡦե
ѤΤ˽뤫⤷ʤ
.PP
.SH ƥࡦ
.TP
.B fork()
.B fork()
θˡҥץղ (attach) 줿ͭꡦȤѾ롣
.TP
.B exec()
.B exec()
θˡƤղä줿ͭꡦȤʬΥ (detach)
(˲Ϥʤ)
.TP
.B exit()
.B exit()
ˤơƤղä줿ͭꡦȤʬΥ (˲Ϥʤ)
.PP
.SH ֤
0 ֤顼ξ \-1 ֤
.SH 顼
顼ξ
.B errno
ʲΤɤ줫ꤵ:
.TP 12
.B EACCES
\fBIPC_STAT\fP ᤵ졢\fIshm_perm.modes\fP
.I shmid
ؤɤ߹ߥƤʤä֤롣
.TP
.B EFAULT
.I cmd
.B IPC_SET
.B IPC_STAT
ꤵ줿
.I buf
ǻؤƤ륢ɥ쥹˥Ǥʤ
.TP
.B EINVAL
\fIshmid\fP ͭʼ̻ (identifier) Ǥʤ
\fIcmd\fP ͭʥޥɤǤʤ֤롣
.TP
.B EIDRM
\fIshmid\fP (remove) 줿̻ҤؤƤ֤롣
.TP
.B EPERM
\fBIPC_SET\fP \fBIPC_RMID\fP ߤ졢
桼ͭԤǤԤǤ⥹ѡ桼Ǥʤ
桼롼פ¾ԤȤƵĤƤʤ֤롣
.SH
\fI¤ shmid_ds\fP ¿Υեɤϡ
Linux 2.2 ǤûäLinux 2.4 ǤĹʤä
ˤϡglibc-2.1.91 ʹߤδĶ
ƥѥ뤹нʬǤ롣
ͥϿθƤӽФȸŤθƤӽФ
.I cmd
IPC_64 ե饰Ƕ̤롣
.SH
SVr4, SVID. SVr4 ˤ¾ EINVAL, ENOENT, ENOSPC, ENOMEM,
EEXIST 顼ˤĤƤεҤ롣
SVr4 SVID ˤ EIDRM 顼ˤĤƤεҤϤʤ
.SH Ϣ
.BR shmget (2),
.BR shmop (2)
|