I'm very pleased to announce the release of our new website and documentation using the new toolchain with Hugo and AsciiDoctor. To get more information about the new toolchain please read the FreeBSD Documentation Project Primer[1], Hugo docs[2] and AsciiDoctor docs[3]. Acknowledgment: Benedict Reuschling <bcr@> Glen Barber <gjb@> Hiroki Sato <hrs@> Li-Wen Hsu <lwhsu@> Sean Chittenden <seanc@> The FreeBSD Foundation [1] https://docs.FreeBSD.org/en/books/fdp-primer/ [2] https://gohugo.io/documentation/ [3] https://docs.asciidoctor.org/home/ Approved by: doceng, core
135 lines
4.4 KiB
Groff
135 lines
4.4 KiB
Groff
.\"
|
|
.\" Copyright (c) 1995 David Hovemeyer <daveho@infocom.com>
|
|
.\"
|
|
.\" All rights reserved.
|
|
.\"
|
|
.\" Redistribution and use in source and binary forms, with or without
|
|
.\" modification, are permitted provided that the following conditions
|
|
.\" are met:
|
|
.\" 1. Redistributions of source code must retain the above copyright
|
|
.\" notice, this list of conditions and the following disclaimer.
|
|
.\" 2. Redistributions in binary form must reproduce the above copyright
|
|
.\" notice, this list of conditions and the following disclaimer in the
|
|
.\" documentation and/or other materials provided with the distribution.
|
|
.\"
|
|
.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
|
|
.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
|
.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
|
.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
|
.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
|
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
.\"
|
|
.\" %FreeBSD: src/lib/libc/sys/shmctl.2,v 1.17 2004/07/02 23:52:13 ru Exp %
|
|
.\"
|
|
.\" $FreeBSD$
|
|
.Dd July 17, 1995
|
|
.Dt SHMCTL 2
|
|
.Os
|
|
.Sh 名称
|
|
.Nm shmctl
|
|
.Nd 共有メモリ制御
|
|
.Sh ライブラリ
|
|
.Lb libc
|
|
.Sh 書式
|
|
.In machine/param.h
|
|
.In sys/types.h
|
|
.In sys/ipc.h
|
|
.In sys/shm.h
|
|
.Ft int
|
|
.Fn shmctl "int shmid" "int cmd" "struct shmid_ds *buf"
|
|
.Sh 解説
|
|
.Fa shmid
|
|
によって指定された共有メモリセグメント上で
|
|
.Fa cmd
|
|
によって指定された処理を実行します:
|
|
.Bl -tag -width SHM_UNLOCKX
|
|
.It Dv IPC_STAT
|
|
.Fa "struct shmid_ds"
|
|
のセグメントを取得し、
|
|
.Fa buf
|
|
によって指定されたメモリにそれを保存します。
|
|
.\"
|
|
.\" XXX need to make sure that this is correct for FreeBSD
|
|
.\"
|
|
.It Dv IPC_SET
|
|
.Fa "struct shmid_ds"
|
|
セグメントの
|
|
.Fa shm_perm.uid ,
|
|
.Fa shm_perm.gid ,
|
|
および
|
|
.Fa shm_perm.mode
|
|
の各メンバを
|
|
.Fa buf
|
|
で指された構造体のメンバに変更します。
|
|
呼び出しプロセスの実効ユーザ ID は、
|
|
.Fa shm_perm.uid
|
|
または
|
|
.Fa shm_perm.cuid
|
|
のどちらかと一致するか、またはスーパユーザ特権を持っている必要があります。
|
|
.It Dv IPC_RMID
|
|
システムからセグメントを除去します。
|
|
セグメントにアタッチしたすべてのプロセスが終了するまで、除去は行われません。
|
|
しかし、いったん IPC_RMID 操作が実行されると、それ以降プロセスは
|
|
そのセグメントにアタッチすることを許されません。
|
|
操作が成功するためには、呼び出しプロセスの実効ユーザ ID が
|
|
.Fa shm_perm.uid
|
|
または
|
|
.Fa shm_perm.cuid
|
|
と一致するか、または呼び出しプロセスにスーパユーザ特権が必要です。
|
|
.\" .It Dv SHM_LOCK
|
|
.\" Locks the segment in memory. The calling process must have
|
|
.\" superuser privileges. Not implemented in FreeBSD.
|
|
.\" .It Dv SHM_UNLOCK
|
|
.\" Unlocks the segment from memory. The calling process must
|
|
.\" have superuser privileges. Not implemented in FreeBSD.
|
|
.El
|
|
.Pp
|
|
.Vt shmid_ds
|
|
構造体は次のように定義されます:
|
|
.\"
|
|
.\" I fiddled with the spaces a bit to make it fit well when viewed
|
|
.\" with nroff, but otherwise it's straight from sys/shm.h
|
|
.\"
|
|
.Bd -literal
|
|
struct shmid_ds {
|
|
struct ipc_perm shm_perm; /* 操作パーミッション構造体 */
|
|
int shm_segsz; /* セグメントのサイズ (バイト単位) */
|
|
pid_t shm_lpid; /* 最後の共有メモリ操作のプロセス ID */
|
|
pid_t shm_cpid; /* 作成者のプロセス ID */
|
|
short shm_nattch; /* 現在のアタッチの数 */
|
|
time_t shm_atime; /* 最後の shmat() の時刻 */
|
|
time_t shm_dtime; /* 最後の shmdt() の時刻 */
|
|
time_t shm_ctime; /* shmctl() による最後の変更の時刻 */
|
|
void *shm_internal; /* SystemV の愚行 */
|
|
};
|
|
.Ed
|
|
.Sh 戻り値
|
|
.Rv -std shmctl
|
|
.Sh エラー
|
|
.Fn shmctl
|
|
システムコールは次の場合に処理に失敗します:
|
|
.Bl -tag -width Er
|
|
.It Bq Er EINVAL
|
|
無効な操作、または
|
|
.Fa shmid
|
|
に指定された共有メモリセグメントが検出されませんでした。
|
|
.\"
|
|
.\" XXX I think the following is right: ipcperm() only returns EPERM
|
|
.\" when an attempt is made to modify (IPC_M) by a non-creator
|
|
.\" non-owner
|
|
.It Bq Er EPERM
|
|
呼び出しプロセスの実効ユーザ ID が、共有メモリセグメントの所有者
|
|
または作成者のユーザ ID と一致しません。
|
|
.It Bq Er EACCES
|
|
操作と共有メモリセグメントモードの間の不一致のために
|
|
パーミッションが拒絶されました。
|
|
.El
|
|
.Sh 関連項目
|
|
.Xr shmat 2 ,
|
|
.Xr shmdt 2 ,
|
|
.Xr shmget 2 ,
|
|
.Xr ftok 3
|