From ea0e6c110a1eadf583a5536d6012a32f9dc5356d Mon Sep 17 00:00:00 2001 From: Akihiro MOTOKI Date: Mon, 25 Mar 2013 20:12:21 +0900 Subject: [PATCH] (split) LDP: Update draft and release pages (semaphore and unistd) --- draft/man2/getdomainname.2 | 97 +++++++++++++++++++ draft/man2/idle.2 | 64 +++++++++++++ draft/man3/getcwd.3 | 153 +++++++++++++++++++++++++++++ draft/man3/getlogin.3 | 136 ++++++++++++++++++++++++++ draft/man3/sem_close.3 | 61 ++++++++++++ draft/man3/sem_destroy.3 | 67 +++++++++++++ draft/man3/sem_getvalue.3 | 63 ++++++++++++ draft/man3/sem_init.3 | 77 +++++++++++++++ draft/man3/sem_open.3 | 105 ++++++++++++++++++++ draft/man3/sem_post.3 | 67 +++++++++++++ draft/man3/sem_unlink.3 | 65 +++++++++++++ draft/man3/sem_wait.3 | 212 ++++++++++++++++++++++++++++++++++++++++ draft/man3/sleep.3 | 57 +++++++++++ draft/man3/sysconf.3 | 213 +++++++++++++++++++++++++++++++++++++++++ release/man2/get_thread_area.2 | 2 +- release/man2/getdomainname.2 | 5 +- release/man2/idle.2 | 2 +- release/man2/ioperm.2 | 2 +- release/man2/semctl.2 | 3 +- release/man2/semop.2 | 95 ++++++++---------- release/man2/set_thread_area.2 | 2 +- release/man2/syscalls.2 | 28 +++--- release/man3/getcwd.3 | 2 +- release/man3/getlogin.3 | 15 ++- release/man3/lockf.3 | 2 +- release/man3/sem_close.3 | 2 +- release/man3/sem_destroy.3 | 2 +- release/man3/sem_getvalue.3 | 2 +- release/man3/sem_init.3 | 2 +- release/man3/sem_open.3 | 2 +- release/man3/sem_post.3 | 2 +- release/man3/sem_unlink.3 | 2 +- release/man3/sem_wait.3 | 2 +- release/man3/sleep.3 | 2 +- release/man3/sysconf.3 | 19 ++-- 35 files changed, 1523 insertions(+), 109 deletions(-) create mode 100644 draft/man2/getdomainname.2 create mode 100644 draft/man2/idle.2 create mode 100644 draft/man3/getcwd.3 create mode 100644 draft/man3/getlogin.3 create mode 100644 draft/man3/sem_close.3 create mode 100644 draft/man3/sem_destroy.3 create mode 100644 draft/man3/sem_getvalue.3 create mode 100644 draft/man3/sem_init.3 create mode 100644 draft/man3/sem_open.3 create mode 100644 draft/man3/sem_post.3 create mode 100644 draft/man3/sem_unlink.3 create mode 100644 draft/man3/sem_wait.3 create mode 100644 draft/man3/sleep.3 create mode 100644 draft/man3/sysconf.3 diff --git a/draft/man2/getdomainname.2 b/draft/man2/getdomainname.2 new file mode 100644 index 00000000..fe21f37c --- /dev/null +++ b/draft/man2/getdomainname.2 @@ -0,0 +1,97 @@ +.\" Copyright 1993 Rickard E. Faith (faith@cs.unc.edu) +.\" +.\" %%%LICENSE_START(VERBATIM) +.\" 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. +.\" %%%LICENSE_END +.\" +.\" Modified 1997-08-25 by Nicolás Lichtmaier +.\" Modified 2004-06-17 by Michael Kerrisk +.\" Modified 2008-11-27 by mtk +.\" +.\"******************************************************************* +.\" +.\" This file was generated with po4a. Translate the source file. +.\" +.\"******************************************************************* +.TH GETDOMAINNAME 2 2012\-10\-25 Linux "Linux Programmer's Manual" +.SH 名前 +getdomainname, setdomainname \- NIS ドメイン名の取得・設定をする +.SH 書式 +\fB#include \fP +.sp +\fBint getdomainname(char *\fP\fIname\fP\fB, size_t \fP\fIlen\fP\fB);\fP +.br +\fBint setdomainname(const char *\fP\fIname\fP\fB, size_t \fP\fIlen\fP\fB);\fP +.sp +.in -4n +glibc 向けの機能検査マクロの要件 (\fBfeature_test_macros\fP(7) 参照): +.in +.sp +.ad l +\fBgetdomainname\fP(), \fBsetdomainname\fP(): +.RS 4 +_BSD_SOURCE || (_XOPEN_SOURCE && _XOPEN_SOURCE\ <\ 500) +.RE +.ad +.SH 説明 +これらの関数は、ホストシステムの NIS ドメイン名を取得・変更するために使われる。 + +\fBsetdomainname\fP() は、ドメイン名を、文字配列 \fIname\fP で指定された値に設定する。 引き数 \fIlen\fP には、 +\fIname\fP のバイト数を指定する (そのため、 \fIname\fP では文字列終端の NULL バイトは必要ない)。 + +\fBgetdomainname\fP() は、NULL 終端されたドメイン名を、 \fIlen\fP バイトの長さの文字配列 \fIname\fP に格納して返す。 +NULL 終端されたドメイン名が \fIlen\fP バイトより長い場合、 \fBgetdomainname\fP() は、(glibc では) 始めの +\fIlen\fP バイトを返し、(libc では) エラーとなる。 +.SH 返り値 +成功した場合は 0 が返される。エラーの場合は \-1 が返され、 \fIerrno\fP が適切に設定される。 +.SH エラー +\fBsetdomainname\fP() は以下のエラーで失敗する可能性がある。 +.TP +\fBEFAULT\fP +\fIname\fP がユーザアドレス空間の外を指した。 +.TP +\fBEINVAL\fP +\fIlen\fP が負であるか、長すぎる。 +.TP +\fBEPERM\fP +\fBsetdomainname\fP() において、呼び出した人に特権がない (Linux では \fBCAP_SYS_ADMIN\fP ケーパビリティ +(capability) がない)。 +.PP +\fBgetdomainname\fP() は以下のエラーで失敗する可能性がある。 +.TP +\fBEINVAL\fP +libc での \fBgetdomainname\fP() において、 \fIname\fP が NULL ポインタであるか、 \fIlen\fP バイトより長い。 +.SH 準拠 +.\" But they appear on most systems... +POSIX では、これら関数は定義されていない。 +.SH 注意 +Linux 1.0 以降では、ドメイン名の長さの上限は 終端の NULL バイトを含めて 64 バイトである。 もっと古いカーネルでは 8 +バイトであった。 + +(x86 を含む) Linux のほとんどのアーキテクチャでは、 \fBgetdomainname\fP() というシステムコールは存在しない。 +その代わり、glibc で \fBgetdomainname\fP() がライブラリ関数として実装されており、この関数は \fBuname\fP(2) +の呼び出しで返された \fIdomainname\fP フィールドのコピーを返す。 +.SH 関連項目 +\fBgethostname\fP(2), \fBsethostname\fP(2), \fBuname\fP(2) +.SH この文書について +この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 3.50 の一部 +である。プロジェクトの説明とバグ報告に関する情報は +http://www.kernel.org/doc/man\-pages/ に書かれている。 diff --git a/draft/man2/idle.2 b/draft/man2/idle.2 new file mode 100644 index 00000000..40f2c960 --- /dev/null +++ b/draft/man2/idle.2 @@ -0,0 +1,64 @@ +.\" Copyright 1993 Rickard E. Faith (faith@cs.unc.edu) +.\" Portions extracted from linux/mm/swap.c: +.\" Copyright (C) 1991, 1992 Linus Torvalds +.\" +.\" %%%LICENSE_START(VERBATIM) +.\" 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. +.\" %%%LICENSE_END +.\" +.\" Modified 21 Aug 1994 by Michael Chastain : +.\" Added text about calling restriction (new in kernel 1.1.20 I believe). +.\" N.B. calling "idle" from user process used to hang process! +.\" Modified Thu Oct 31 14:41:15 1996 by Eric S. Raymond +.\" " +.\"******************************************************************* +.\" +.\" This file was generated with po4a. Translate the source file. +.\" +.\"******************************************************************* +.TH IDLE 2 2012\-12\-31 Linux "Linux Programmer's Manual" +.SH 名前 +idle \- ID 0 のプロセスをアイドル状態にする +.SH 書式 +\fB#include \fP +.sp +\fBint idle(void);\fP +.SH 説明 +\fBidle\fP() はブートストラップ時に使用される、内部システムコールである。 +プロセスのページをスワップ可能に設定し、優先度を下げ、メインのスケジュー ル処理のためのループへ移行する。 従って \fBidle\fP() は +return することはない。 +.PP +ID 0 のプロセスのみが \fBidle\fP() を使用することができる。 他のユーザープロセスはたとえそれがスーパーユーザー権限を持っていたとして も +\fBEPERM\fP を受け取る。 +.SH 返り値 +\fBidle\fP() ID 0 のプロセスに対しては return しない。それ以外のユーザープロセスには 常に \-1 を返す。 +.SH エラー +.TP +\fBEPERM\fP +ユーザプロセスに対しては、常にこのエラーとなる。 +.SH バージョン +Linux 2.3.13 以降では、もはやこのシステムコールは存在しない。 +.SH 準拠 +この関数は Linux 特有であり、移植を意図したプログラムでは 使用すべきでない。 +.SH この文書について +この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 3.50 の一部 +である。プロジェクトの説明とバグ報告に関する情報は +http://www.kernel.org/doc/man\-pages/ に書かれている。 diff --git a/draft/man3/getcwd.3 b/draft/man3/getcwd.3 new file mode 100644 index 00000000..e6e84b04 --- /dev/null +++ b/draft/man3/getcwd.3 @@ -0,0 +1,153 @@ +.\" Copyright (c) 1993 by Thomas Koenig (ig25@rz.uni-karlsruhe.de) +.\" +.\" %%%LICENSE_START(VERBATIM) +.\" 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. +.\" %%%LICENSE_END +.\" +.\" Modified Wed Jul 21 22:35:42 1993 by Rik Faith (faith@cs.unc.edu) +.\" Modified 18 Mar 1996 by Martin Schulze (joey@infodrom.north.de): +.\" Corrected description of getwd(). +.\" Modified Sat Aug 21 12:32:12 MET 1999 by aeb - applied fix by aj +.\" Modified Mon Dec 11 13:32:51 MET 2000 by aeb +.\" Modified Thu Apr 22 03:49:15 CEST 2002 by Roger Luethi +.\" +.\"******************************************************************* +.\" +.\" This file was generated with po4a. Translate the source file. +.\" +.\"******************************************************************* +.TH GETCWD 3 2010\-09\-20 GNU "Linux Programmer's Manual" +.SH 名前 +getcwd, getwd, get_current_dir_name \- カレントワーキングディレクトリ名の取得 +.SH 書式 +.nf +\fB#include \fP +.sp +\fBchar *getcwd(char *\fP\fIbuf\fP\fB, size_t \fP\fIsize\fP\fB);\fP +.sp +\fBchar *getwd(char *\fP\fIbuf\fP\fB);\fP +.sp +\fBchar *get_current_dir_name(void);\fP +.fi +.sp +.in -4n +glibc 向けの機能検査マクロの要件 (\fBfeature_test_macros\fP(7) 参照): +.sp +.in +\fBget_current_dir_name\fP(): +.RS +_GNU_SOURCE +.RE +.sp +\fBgetwd\fP(): +.ad l +.RS 4 +.PD 0 +.TP 4 +glibc 2.12 以降: +.nf +_BSD_SOURCE || + (_XOPEN_SOURCE\ >=\ 500 || + _XOPEN_SOURCE\ &&\ _XOPEN_SOURCE_EXTENDED) && + !(_POSIX_C_SOURCE\ >=\ 200809L || _XOPEN_SOURCE\ >=\ 700) +.TP 4 +.fi +glibc 2.12 より前: _BSD_SOURCE || _XOPEN_SOURCE\ >=\ 500 || _XOPEN_SOURCE\ &&\ _XOPEN_SOURCE_EXTENDED +.PD +.RE +.ad b +.SH 説明 +これらの関数は、呼び出したプロセスのカレントワーキングディレクトリの 絶対パス名 (absolute pathname) が入った文字列を返す。 +返される文字列は NULL で終端される。 パス名は関数の結果として返され、引数 \fIbuf\fP がある場合は \fIbuf\fP 経由でも返される。 + +\fBgetcwd\fP() 関数はカレントワーキングディレクトリの絶対パス名を \fIbuf\fP で示された \fIsize\fP 長の配列にコピーする。 +.PP +終端の NULL バイトも含めた、カレントワーキングディレクトリの 絶対パス名の長さが \fIsize\fP バイトを超えている場合は、返り値として NULL +が返り \fIerrno\fP に \fBERANGE\fP がセットされる。 アプリケーションはこのエラーをチェックし、 +必要に応じてより長いバッファを用意すべきである。 +.PP +POSIX.1\-2001 標準の拡張として、 Linux (libc4, libc5, glibc) では \fIbuf\fP が NULL の場合、 +\fBgetcwd\fP() は必要なバッファを \fBmalloc\fP(3) を用いて動的に割り当てる。 この場合、 \fIsize\fP が 0 +の場合を除き、バッファの長さは \fIsize\fP となる。 \fIsize\fP が 0 の場合には必要な大きさが確保される。 呼び出し側で、返されたバッファを +\fBfree\fP(3) すべきである。 + +\fBget_current_dir_name\fP() はカレントワーキングディレクトリの絶対パス名を収めるのに 十分な大きさの配列を +\fBmalloc\fP(3) で獲得する。環境変数 \fBPWD\fP が設定されておりその値が正しければ、その値が返される。 呼び出し側で、返されたバッファを +\fBfree\fP(3) すべきである。 + +\fBgetwd\fP() は \fBmalloc\fP(3) によるメモリ獲得を一切行なわない。 \fIbuf\fP 引数は少なくとも \fBPATH_MAX\fP +バイトの長さを持つ配列へのポインタである必要がある。 終端の NULL バイトも含めた、カレントワーキングディレクトリの 絶対パス名の長さが +\fBPATH_MAX\fP バイトを超えている場合、 NULL が返され、 \fIerrno\fP に \fBENAMETOOLONG\fP が設定される。 +(システムによっては、 \fBPATH_MAX\fP は必ずしもコンパイル時に決まる定数ではない点に注意すること。 +また、ファイルシステムに依存する場合もある。 \fBpathconf\fP(3) を参照。) 移植性とセキュリティ上の理由から、 \fBgetwd\fP() +の利用は推奨されない。 +.SH 返り値 +成功すると、これらの関数はカレントワーキングディレクトリの絶対パス名 が入った文字列へのポインタを返す。 \fBgetcwd\fP() と +\fBgetwd\fP() の場合、返り値は \fIbuf\fP と同じ値になる。 + +失敗した場合、これらの関数は NULL を返し、 \fIerrno\fP にエラーを示す値を設定する。 \fIbuf\fP が指す配列の内容は未定義である。 +.SH エラー +.TP +\fBEACCES\fP +ファイル名の構成要素に対する読み込みあるいは検索の権限がない。 +.TP +\fBEFAULT\fP +\fIbuf\fP が不正なアドレスを指している。 +.TP +\fBEINVAL\fP +\fIsize\fP 引数が 0 かつ、 \fIbuf\fP 引数が NULL ポインタでない。 +.TP +\fBEINVAL\fP +\fBgetwd\fP(): \fIbuf\fP が NULL である。 +.TP +\fBENAMETOOLONG\fP +\fBgetwd\fP(): 絶対パス名が入った NULL 終端された文字列の長さが \fBPATH_MAX\fP バイトを超えている。 +.TP +\fBENOENT\fP +カレントワーキングディレクトリが削除されている。 +.TP +\fBERANGE\fP +\fIsize\fP 引数の値がワーキングディレクトリの絶対パス名の長さより小さい。 長さには文字列の終端バイトも含まれる。 +より大きい配列を確保してもう一度実行する必要がある。 +.SH 準拠 +\fBgetcwd\fP() は POSIX.1\-2001 に準拠している。 POSIX.1\-2001 は、 \fIbuf\fP が NULL の場合の +\fBgetcwd\fP() の動作を規定しないままとしている。 + +\fBgetwd\fP() は POSIX.1\-2001 に存在しているが、「過去の名残(LEGACY)」とされている。 POSIX.1\-2008 では、 +\fBgetwd\fP() の仕様が削除されている。 代わりに \fBgetcwd\fP() を使うこと。 POSIX.1\-2001 は \fBgetwd\fP() +に関するエラーを定義していない。 + +\fBget_current_dir_name\fP() は GNU 拡張である。 +.SH 注意 +Linux では (2.1.92 以降)、 \fBgetcwd\fP() はシステムコールである。 古いシステムでは \fI/proc/self/cwd\fP +を参照する。 システムコールも proc ファイルシステムもない場合、 一般的な実装が呼び出される。 この場合においてのみ、(Linux では) +この関数は \fBEACCES\fP で失敗する可能性がある。 +.LP +これらの関数はしばしばカレントワーキングディレクトリの位置を保存し、 後で戻ってくるために利用される。 未使用のファイルディスクリプタが十分ある場合は、 +現在のディレクトリ (".") を開いて \fBfchdir\fP(2) を呼び出すほうが普通は高速で信頼性がある。 特に Linux +以外のプラットフォームの場合はそうである。 +.SH 関連項目 +\fBchdir\fP(2), \fBfchdir\fP(2), \fBopen\fP(2), \fBunlink\fP(2), \fBfree\fP(3), +\fBmalloc\fP(3) +.SH この文書について +この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 3.50 の一部 +である。プロジェクトの説明とバグ報告に関する情報は +http://www.kernel.org/doc/man\-pages/ に書かれている。 diff --git a/draft/man3/getlogin.3 b/draft/man3/getlogin.3 new file mode 100644 index 00000000..985fc7ac --- /dev/null +++ b/draft/man3/getlogin.3 @@ -0,0 +1,136 @@ +.\" Copyright 1995 James R. Van Zandt +.\" +.\" %%%LICENSE_START(VERBATIM) +.\" 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. +.\" %%%LICENSE_END +.\" +.\" Changed Tue Sep 19 01:49:29 1995, aeb: moved from man2 to man3 +.\" added ref to /etc/utmp, added BUGS section, etc. +.\" modified 2003 Walter Harms, aeb - added getlogin_r, note on stdin use +.\"******************************************************************* +.\" +.\" This file was generated with po4a. Translate the source file. +.\" +.\"******************************************************************* +.TH GETLOGIN 3 2008\-06\-29 GNU "Linux Programmer's Manual" +.SH 名前 +getlogin, getlogin_r, cuserid \- ユーザー名を取得する +.SH 書式 +\fB#include \fP +.sp +\fBchar *getlogin(void);\fP +.br +\fBint getlogin_r(char *\fP\fIbuf\fP\fB, size_t \fP\fIbufsize\fP\fB);\fP +.sp +\fB#include \fP +.sp +\fBchar *cuserid(char *\fP\fIstring\fP\fB);\fP +.sp +.in -4n +glibc 向けの機能検査マクロの要件 (\fBfeature_test_macros\fP(7) 参照): +.in +.sp +\fBgetlogin_r\fP(): _REENTRANT || _POSIX_C_SOURCE\ >=\ 199506L +.br +\fBcuserid\fP(): _XOPEN_SOURCE +.SH 説明 +\fBgetlogin\fP() は、現在のプロセスの制御端末にログインしているユーザー名の文字列への ポインタを返す。ユーザー名が決定できない場合は +NULL ポインタを返す。 文字列は静的領域に割り当てられており、この後でこの関数や \fBcuserid\fP() +が呼び出された際に上書きされることがある。 +.PP +\fBgetlogin_r\fP() は、上記の同じユーザ名を、大きさ \fIbufsize\fP の配列 \fIbuf\fP に入れて返す。 +.PP +\fBcuserid\fP() は、現在のプロセスの実効ユーザーID に対応するユーザー名の 文字列へのポインタを返す。 \fIstring\fP が NULL +ポインタ以外の場合、\fIstring\fP は少なくとも \fBL_cuserid\fP 文字を保持できる配列でなければならない。 \fIstring\fP が +NULL ポインタの場合には、静的領域に置かれた文字列への ポインタが返される。この文字列は静的領域に割り当てられており、後で この関数や +\fBgetlogin\fP() が呼び出された際に上書きされることがある。 +.PP +マクロ \fBL_cuserid\fP は integer の定数で、ユーザー名を保持するために 必要な配列の長さを示す。 \fBL_cuserid\fP は +\fBstdio.h\fP で宣言されて いる。 +.PP +これらの関数を使うと、プログラムを実行しているユーザー (\fBcuserid\fP()) や このセッションにログインしているユーザー +(\fBgetlogin\fP()) を明確に特定することができる (ただし set\-user\-ID プログラムでは、状況が違うこともある)。 +.PP +たいていの目的では、ユーザーの特定には環境変数 \fBLOGNAME\fP を調べ るほうが便利である。LOGNAME 変数はユーザーが自由に設定できるので +より柔軟な対応が可能になる。 +.SH 返り値 +\fBgetlogin\fP() は成功した場合はユーザ名へのポインタを返し、失敗した場合は NULL を返す。 \fBgetlogin_r\fP() +は成功すると 0 を返し、失敗すると 0 以外を返す。 +.SH エラー +POSIX では以下のエラーが規定されている: +.TP +\fBEMFILE\fP +呼び出し元プロセスがオープンしているファイル数がすでにプロセスあたりの 上限に達している。 +.TP +\fBENFILE\fP +システム全体でオープンしているファイル数がすでに上限に達している。 +.TP +\fBENXIO\fP +呼び出し元プロセスには制御端末がない。 +.TP +\fBERANGE\fP +(getlogin_r) (終端の NULL バイトも含めた) ユーザ名の長さが \fIbufsize\fP よりも長い。 +.LP +Linux/glibc には以下のエラーもある。 +.TP +\fBENOENT\fP +utmp ファイルに対応するエントリがなかった。 +.TP +\fBENOMEM\fP +passwd 構造体を割り当てるのに十分なメモリがない。 +.TP +\fBENOTTY\fP +標準入力が端末を参照していない (「バグ」の節を参照)。 +.SH ファイル +.TP +\fI/etc/passwd\fP +パスワードデータベースのファイル +.TP +\fI/var/run/utmp\fP +(伝統的には \fI/etc/utmp\fP が使われている; libc の中には \fI/var/adm/utmp\fP を使うものもある) +.SH 準拠 +\fBgetlogin\fP() と \fBgetlogin_r\fP() は POSIX.1\-2001 で規定されている。 + +System V にも \fBcuserid\fP() があるが、 これは実効ユーザー ID ではなく、実ユーザー ID を使用する。 +\fBcuserid\fP() 関数は 1988 年版の POSIX には含まれていたが、 1990 年版では削除された。 SUSv2 +に存在したが、POSIX.1\-2001 で削除された。 +.LP +OpenBSD には \fBgetlogin\fP() と \fBsetlogin\fP() があり、 セッションに対応したユーザ名がある。制御端末がない +セッションの場合であっても、対応するユーザ名がある。 +.SH バグ +残念ながら、 \fBgetlogin\fP() をだますのはそれほど難しいことではない。別のプログラムが utmp ファイルを +壊してしまうと、全く動作しないこともある。またログイン名の最初の 8 文字 +しか返さないことも多い。また、プログラムの制御端末に現在ログインしているユーザーは、プログラムを実行したユーザーでない場合もある。 +セキュリティの絡む用途には \fBgetlogin\fP() を用いるべきではない。 +.LP +glibc は POSIX 仕様には従っておらず、 \fI/dev/tty\fP ではなく \fI標準入力 (stdin)\fP を使う。これはバグである。 +(SunOS 5.8 や HP\-UX 11.11 や FreeBSD 4.8 といった他の最近のシステムはいずれも、 \fI標準入力\fP +がリダイレクトされた場合でもログイン名を返す。) +.LP +\fBcuserid\fP() が何を行っているのか、実際のところを知っている者は誰もいない; 移植性が求められるプログラムでは \fBcuserid\fP() +は使うべきではない。 というかどんなプログラムでも使うべきではない: 代わりに \fIgetpwuid(geteuid())\fP を用いるべきである +(これが意図していることならば、だが)。 \fBcuserid\fP() は「使わない」こと。 +.SH 関連項目 +\fBgeteuid\fP(2), \fBgetuid\fP(2), \fButmp\fP(5) +.SH この文書について +この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 3.50 の一部 +である。プロジェクトの説明とバグ報告に関する情報は +http://www.kernel.org/doc/man\-pages/ に書かれている。 diff --git a/draft/man3/sem_close.3 b/draft/man3/sem_close.3 new file mode 100644 index 00000000..4de01fa1 --- /dev/null +++ b/draft/man3/sem_close.3 @@ -0,0 +1,61 @@ +.\" t +.\" Copyright (C) 2006 Michael Kerrisk +.\" +.\" %%%LICENSE_START(VERBATIM) +.\" 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. +.\" %%%LICENSE_END +.\" +.\"******************************************************************* +.\" +.\" This file was generated with po4a. Translate the source file. +.\" +.\"******************************************************************* +.TH SEM_CLOSE 3 2012\-05\-13 Linux "Linux Programmer's Manual" +.SH 名前 +sem_close \- 名前付きセマフォをクローズする +.SH 書式 +.nf +\fB#include \fP +.sp +\fBint sem_close(sem_t *\fP\fIsem\fP\fB);\fP +.fi +.sp +\fI\-pthread\fP とリンクする。 +.SH 説明 +\fBsem_close\fP() は \fIsem\fP が参照する名前付きセマフォをクローズし、 このセマフォ用に呼び出し元プロセスにシステムが割り当てていた +リソースを解放できるようにする。 +.SH 返り値 +成功すると、 \fBsem_close\fP() は 0 を返す。エラーの場合、\-1 を返し、 \fIerrno\fP にエラーを示す値をセットする。 +.SH エラー +.TP +\fBEINVAL\fP +\fIsem\fP は有効なセマフォではない。 +.SH 準拠 +POSIX.1\-2001. +.SH 注意 +オープンされたすべての名前付きセマフォは、プロセス終了時、もしくは \fBexecve\fP(2) 実行時に自動的にクローズされる。 +.SH 関連項目 +\fBsem_getvalue\fP(3), \fBsem_open\fP(3), \fBsem_post\fP(3), \fBsem_unlink\fP(3), +\fBsem_wait\fP(3), \fBsem_overview\fP(7) +.SH この文書について +この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 3.50 の一部 +である。プロジェクトの説明とバグ報告に関する情報は +http://www.kernel.org/doc/man\-pages/ に書かれている。 diff --git a/draft/man3/sem_destroy.3 b/draft/man3/sem_destroy.3 new file mode 100644 index 00000000..380f27f3 --- /dev/null +++ b/draft/man3/sem_destroy.3 @@ -0,0 +1,67 @@ +.\" t +.\" Copyright (C) 2006 Michael Kerrisk +.\" +.\" %%%LICENSE_START(VERBATIM) +.\" 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. +.\" %%%LICENSE_END +.\" +.\"******************************************************************* +.\" +.\" This file was generated with po4a. Translate the source file. +.\" +.\"******************************************************************* +.TH SEM_DESTROY 3 2012\-05\-13 Linux "Linux Programmer's Manual" +.SH 名前 +sem_destroy \- 名前なしセマフォを破棄する +.SH 書式 +.nf +\fB#include \fP +.sp +\fBint sem_destroy(sem_t *\fP\fIsem\fP\fB);\fP +.fi +.sp +\fI\-pthread\fP とリンクする。 +.SH 説明 +\fBsem_destroy\fP() は \fIsem\fP が指すアドレスにある名前なしセマフォを破棄する。 + +\fBsem_destroy\fP() を使って破棄するのは、 \fBsem_init\fP(3) で初期化したセマフォだけにすべきである。 + +他のプロセスやスレッドが (\fBsem_wait\fP(3) で) 待ち状態になっているセマフォを破棄した場合の挙動は定義されていない。 + +すでに破棄されたセマフォを、 \fBsem_init\fP(3) を使って再初期化される前に使用した場合、その結果は未定義である。 +.SH 返り値 +成功すると、 \fBsem_destroy\fP() は 0 を返す。エラーの場合、\-1 を返し、 \fIerrno\fP にエラーを示す値をセットする。 +.SH エラー +.TP +\fBEINVAL\fP +\fIsem\fP は有効なセマフォではない。 +.SH 準拠 +POSIX.1\-2001. +.SH 注意 +.\" But not on NPTL, where sem_destroy () is a no-op.. +名前なしセマフォは、そのセマフォが置かれているメモリが解放される前に、 \fBsem_destroy\fP() +を使って破棄しておくべきである。これを行わなかった場合、実装によっては リソースのリークが起こりえる。 +.SH 関連項目 +\fBsem_init\fP(3), \fBsem_post\fP(3), \fBsem_wait\fP(3), \fBsem_overview\fP(7) +.SH この文書について +この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 3.50 の一部 +である。プロジェクトの説明とバグ報告に関する情報は +http://www.kernel.org/doc/man\-pages/ に書かれている。 diff --git a/draft/man3/sem_getvalue.3 b/draft/man3/sem_getvalue.3 new file mode 100644 index 00000000..4fcc3312 --- /dev/null +++ b/draft/man3/sem_getvalue.3 @@ -0,0 +1,63 @@ +.\" t +.\" Copyright (C) 2006 Michael Kerrisk +.\" +.\" %%%LICENSE_START(VERBATIM) +.\" 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. +.\" %%%LICENSE_END +.\" +.\"******************************************************************* +.\" +.\" This file was generated with po4a. Translate the source file. +.\" +.\"******************************************************************* +.TH SEM_GETVALUE 3 2012\-05\-13 Linux "Linux Programmer's Manual" +.SH 名前 +sem_getvalue \- セマフォの値を取得する +.SH 書式 +.nf +\fB#include \fP +.sp +\fBint sem_getvalue(sem_t *\fP\fIsem\fP\fB, int *\fP\fIsval\fP\fB);\fP +.fi +.sp +\fI\-pthread\fP とリンクする。 +.SH 説明 +\fBsem_getvalue\fP() は、 \fIsem\fP が指すセマフォの現在の値を \fIsval\fP で指す整数に格納する。 + +POSIX.1\-2001 によると、 1つ以上のプロセスかスレッドが \fBsem_wait\fP(3) でセマフォのロック待ちで停止している場合、 +\fIsval\fP で返される値は 0 もしくは負の値のいずれかとなる。 負の値の場合、その絶対値は \fBsem_wait\fP(3) +で現在停止しているプロセスかスレッドの合計数に等しい。 Linux は前者の動作 (0 を返す動作) を採用している。 +.SH 返り値 +成功すると、 \fBsem_getvalue\fP() は 0 を返す。エラーの場合、\-1 を返し、 \fIerrno\fP にエラーを示す値をセットする。 +.SH エラー +.TP +\fBEINVAL\fP +\fIsem\fP は有効なセマフォではない。 +.SH 準拠 +POSIX.1\-2001. +.SH 注意 +\fBsem_getvalue\fP() が返るときには、すでにセマフォの値は変化している可能性がある。 +.SH 関連項目 +\fBsem_post\fP(3), \fBsem_wait\fP(3), \fBsem_overview\fP(7) +.SH この文書について +この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 3.50 の一部 +である。プロジェクトの説明とバグ報告に関する情報は +http://www.kernel.org/doc/man\-pages/ に書かれている。 diff --git a/draft/man3/sem_init.3 b/draft/man3/sem_init.3 new file mode 100644 index 00000000..17cf1672 --- /dev/null +++ b/draft/man3/sem_init.3 @@ -0,0 +1,77 @@ +.\" t +.\" Copyright (C) 2006 Michael Kerrisk +.\" +.\" %%%LICENSE_START(VERBATIM) +.\" 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. +.\" %%%LICENSE_END +.\" +.\"******************************************************************* +.\" +.\" This file was generated with po4a. Translate the source file. +.\" +.\"******************************************************************* +.TH SEM_INIT 3 2012\-05\-13 Linux "Linux Programmer's Manual" +.SH 名前 +sem_init \- 名前なしセマフォを初期化する +.SH 書式 +.nf +\fB#include \fP +.sp +\fBint sem_init(sem_t *\fP\fIsem\fP\fB, int \fP\fIpshared\fP\fB, unsigned int \fP\fIvalue\fP\fB);\fP +.fi +.sp +\fI\-pthread\fP とリンクする。 +.SH 説明 +\fBsem_init\fP() は、 \fIsem\fP が指すアドレスにある名前なしセマフォを初期化する。 \fIvalue\fP +引き数はそのセマフォの初期値を指定する。 + +\fIpshared\fP 引き数は、このセマフォがプロセス内のスレッド間で共有されるのか、 プロセス間で共有されるのか、を示す。 + +\fIpshared\fP が 0 の場合、セマフォはプロセス内のスレッド間で共有される。 セマフォはすべてのスレッドから参照可能なアドレスに配置すべきである +(例えば、大域変数や、ヒープ上に動的に割り当てられた変数など)。 + +\fIpshared\fP が 0 以外の場合、セマフォはプロセス間で共有される。セマフォは 共有メモリ領域に配置すべきである +(\fBshm_open\fP(3), \fBmmap\fP(2), \fBshmget\fP(2) 参照)。 (\fBfork\fP(2) +で生成された子プロセスは親プロセスのメモリマッピングを継承するため、 子プロセスもセマフォにアクセスできる。) +共有メモリ領域にアクセスできるプロセスならば、どのプロセスでも \fBsem_post\fP(3) や \fBsem_wait\fP(3) +などを使ってセマフォを操作できる。 + +すでに初期化済のセマフォを初期化した場合の挙動は定義されていない。 +.SH 返り値 +成功すると、 \fBsem_init\fP() は 0 を返す。エラーの場合、\-1 を返し、 \fIerrno\fP にエラーを示す値をセットする。 +.SH エラー +.TP +\fBEINVAL\fP +\fIvalue\fP が \fBSEM_VALUE_MAX\fP を超えている。 +.TP +\fBENOSYS\fP +\fIpshared\fP が 0 以外だが、システムがプロセス共有セマフォをサポートしていない (\fBsem_overview\fP(7) 参照)。 +.SH 準拠 +POSIX.1\-2001. +.SH 注意 +妙なことに、POSIX.1\-2001 は \fBsem_init\fP() が成功した場合に返すべき値を規定していない。 POSIX.1\-2008 +ではこれが修正され、成功時には 0 を返すことが規定された。 +.SH 関連項目 +\fBsem_destroy\fP(3), \fBsem_post\fP(3), \fBsem_wait\fP(3), \fBsem_overview\fP(7) +.SH この文書について +この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 3.50 の一部 +である。プロジェクトの説明とバグ報告に関する情報は +http://www.kernel.org/doc/man\-pages/ に書かれている。 diff --git a/draft/man3/sem_open.3 b/draft/man3/sem_open.3 new file mode 100644 index 00000000..24bdb9e8 --- /dev/null +++ b/draft/man3/sem_open.3 @@ -0,0 +1,105 @@ +.\" t +.\" Copyright (C) 2006 Michael Kerrisk +.\" +.\" %%%LICENSE_START(VERBATIM) +.\" 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. +.\" %%%LICENSE_END +.\" +.\"******************************************************************* +.\" +.\" This file was generated with po4a. Translate the source file. +.\" +.\"******************************************************************* +.TH SEM_OPEN 3 2012\-05\-13 Linux "Linux Programmer's Manual" +.SH 名前 +sem_open \- 名前付きセマフォを初期化し、オープンする +.SH 書式 +.nf +\fB#include \fP /* For O_* constants */ +\fB#include \fP /* For mode constants */ +\fB#include \fP +.sp +\fBsem_t *sem_open(const char *\fP\fIname\fP\fB, int \fP\fIoflag\fP\fB);\fP +\fBsem_t *sem_open(const char *\fP\fIname\fP\fB, int \fP\fIoflag\fP\fB, \fP +\fB mode_t \fP\fImode\fP\fB, unsigned int \fP\fIvalue\fP\fB);\fP +.fi +.sp +\fI\-pthread\fP とリンクする。 +.SH 説明 +\fBsem_open\fP() は、新規の POSIX セマフォを作成するか、既存のセマフォのオープンを行う。 セマフォは \fIname\fP で識別される。 +\fIname\fP の構成の詳細は \fBsem_overview\fP(7) を参照。 + +.\" In reality the file system IDs are used on Linux. +\fIoflag\fP 引き数には、 \fBsem_open\fP() の動作を制御するフラグを指定する (oflag の値の定義は +\fI\fP のインクルードにより得られる)。 \fIoflag\fP に \fBO_CREAT\fP +が指定されると、まだ存在しない場合にはそのセマフォが作成される。 セマフォの所有者 (ユーザ ID)、グループ所有権 (グループ ID) には、 +それぞれ呼び出し元プロセスの実効 UID、実効 GID が設定される。 \fIoflag\fP に \fBO_CREAT\fP と \fBO_EXCL\fP +の両方が指定された場合、指定された名前 \fIname\fP のセマフォがすでに存在するとエラーが返される。 +.PP +\fIoflag\fP に \fBO_CREAT\fP を指定する場合、さらに引き数が 2 つ必要である。 \fImode\fP 引き数は、 \fBopen\fP(2) +と同じように、新しいセマフォに設定されるアクセス許可 (permission) を 指定する。許可設定はプロセスの umask でマスクされる +(許可ビットのシンボル定義は \fI\fP のインクルードにより得られる)。 +セマフォにアクセスしようとするユーザは、読み出し許可と書き込み許可の 両方を得る必要がある。 \fIvalue\fP +引き数は新しいセマフォの初期値を指定する。 \fBO_CREAT\fP が指定され、指定した名前 \fIname\fP のセマフォがすでに存在する場合、 +\fImode\fP と \fIvalue\fP は無視される。 +.SH 返り値 +成功すると、 \fBsem_open\fP() は新しいセマフォのアドレスを返す。 このアドレスは他のセマフォ関連の関数を呼び出す際に使用される。 +エラーの場合、 \fBsem_open\fP() は \fBSEM_FAILED\fP を返し、 \fIerrno\fP にエラーを示す値をセットする。 +.SH エラー +.TP +\fBEACCES\fP +そのセマフォが存在するが、呼び出し元にはそのセマフォをオープンする 許可がない。 +.TP +\fBEEXIST\fP +\fIoflag\fP に \fBO_CREAT\fP と \fBO_EXCL\fP の両方が指定されたが、 \fIname\fP という名前のセマフォはすでに存在する。 +.TP +\fBEINVAL\fP +\fIvalue\fP が \fBSEM_VALUE_MAX\fP よりも大きい。 +.TP +\fBEINVAL\fP +\fIname\fP が "/" だけで構成され、その後ろに他の文字が続いていなかった。 +.TP +\fBEMFILE\fP +オープンされたファイル数がすでにそのプロセスにおける上限に達している。 +.TP +\fBENAMETOOLONG\fP +\fIname\fP が長すぎる。 +.TP +\fBENFILE\fP +オープンされたファイル総数がシステム全体での上限に達している。 +.TP +\fBENOENT\fP +.\" this error can occur if we have a name of the (nonportable) form +.\" /dir/name, and the directory /dev/shm/dir does not exist. +\fIoflag\fP に \fBO_CREAT\fP フラグが指定されておらず、 \fIname\fP という名前のセマフォも存在しない。 または、 +\fBO_CREAT\fP が指定されたが、 \fIname\fP が適切な形式ではなかった。 +.TP +\fBENOMEM\fP +十分なメモリがない。 +.SH 準拠 +POSIX.1\-2001. +.SH 関連項目 +\fBsem_close\fP(3), \fBsem_getvalue\fP(3), \fBsem_post\fP(3), \fBsem_unlink\fP(3), +\fBsem_wait\fP(3), \fBsem_overview\fP(7) +.SH この文書について +この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 3.50 の一部 +である。プロジェクトの説明とバグ報告に関する情報は +http://www.kernel.org/doc/man\-pages/ に書かれている。 diff --git a/draft/man3/sem_post.3 b/draft/man3/sem_post.3 new file mode 100644 index 00000000..2f2bee83 --- /dev/null +++ b/draft/man3/sem_post.3 @@ -0,0 +1,67 @@ +.\" t +.\" Copyright (C) 2006 Michael Kerrisk +.\" +.\" %%%LICENSE_START(VERBATIM) +.\" 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. +.\" %%%LICENSE_END +.\" +.\"******************************************************************* +.\" +.\" This file was generated with po4a. Translate the source file. +.\" +.\"******************************************************************* +.TH SEM_POST 3 2012\-05\-13 Linux "Linux Programmer's Manual" +.SH 名前 +sem_post \- セマフォのロックを解除する +.SH 書式 +.nf +\fB#include \fP +.sp +\fBint sem_post(sem_t *\fP\fIsem\fP\fB);\fP +.fi +.sp +\fI\-pthread\fP とリンクする。 +.SH 説明 +\fBsem_post\fP() は、 \fIsem\fP が指すセマフォの値を 1 増やす (ロックを解除する)。その結果、 セマフォの値は 0 +より大きな値に変化し、 \fBsem_wait\fP(3) で停止している別のプロセスやスレッドが呼び起こされ、 セマフォをロックできるようになる。 +.SH 返り値 +成功すると、 \fBsem_post\fP() は 0 を返す。エラーの場合、セマフォの値は変更せずに、 \-1 を返し、 \fIerrno\fP +にエラーを示す値をセットする。 +.SH エラー +.TP +\fBEINVAL\fP +\fIsem\fP は有効なセマフォではない。 +.TP +\fBEOVERFLOW\fP +.\" Added in POSIX.1-2008 TC1 (Austin Interpretation 213) +一つのセマフォで使用できる最大値を超えてしまうところであった。 +.SH 準拠 +POSIX.1\-2001. +.SH 注意 +\fBsem_post\fP() は async\-signal\-safe である。 つまり、シグナルハンドラの中でも安全に呼び出すことができる。 +.SH 例 +\fBsem_wait\fP(3) 参照。 +.SH 関連項目 +\fBsem_getvalue\fP(3), \fBsem_wait\fP(3), \fBsem_overview\fP(7) +.SH この文書について +この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 3.50 の一部 +である。プロジェクトの説明とバグ報告に関する情報は +http://www.kernel.org/doc/man\-pages/ に書かれている。 diff --git a/draft/man3/sem_unlink.3 b/draft/man3/sem_unlink.3 new file mode 100644 index 00000000..ccd83795 --- /dev/null +++ b/draft/man3/sem_unlink.3 @@ -0,0 +1,65 @@ +.\" t +.\" Copyright (C) 2006 Michael Kerrisk +.\" +.\" %%%LICENSE_START(VERBATIM) +.\" 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. +.\" %%%LICENSE_END +.\" +.\"******************************************************************* +.\" +.\" This file was generated with po4a. Translate the source file. +.\" +.\"******************************************************************* +.TH SEM_UNLINK 3 2012\-05\-13 Linux "Linux Programmer's Manual" +.SH 名前 +sem_unlink \- 名前付きセマフォを削除する +.SH 書式 +.nf +\fB#include \fP +.sp +\fBint sem_unlink(const char *\fP\fIname\fP\fB);\fP +.fi +.sp +\fI\-pthread\fP とリンクする。 +.SH 説明 +\fBsem_unlink\fP() は、 \fIname\fP で参照される名前付きセマフォを削除する。 セマフォの名前は直ちに削除される。 +このセマフォをオープンしている他のすべてのプロセスがセマフォを 閉じて初めてセマフォの削除が行われる。 +.SH 返り値 +成功すると、 \fBsem_unlink\fP() は 0 を返す。エラーの場合、\-1 を返し、 \fIerrno\fP にエラーを示す値をセットする。 +.SH エラー +.TP +\fBEACCES\fP +呼び出し元にはこのセマフォを削除する許可がない。 +.TP +\fBENAMETOOLONG\fP +\fIname\fP が長すぎる。 +.TP +\fBENOENT\fP +指定された名前 \fIname\fP のセマフォが存在しない。 +.SH 準拠 +POSIX.1\-2001. +.SH 関連項目 +\fBsem_getvalue\fP(3), \fBsem_open\fP(3), \fBsem_post\fP(3), \fBsem_wait\fP(3), +\fBsem_overview\fP(7) +.SH この文書について +この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 3.50 の一部 +である。プロジェクトの説明とバグ報告に関する情報は +http://www.kernel.org/doc/man\-pages/ に書かれている。 diff --git a/draft/man3/sem_wait.3 b/draft/man3/sem_wait.3 new file mode 100644 index 00000000..8378a4f3 --- /dev/null +++ b/draft/man3/sem_wait.3 @@ -0,0 +1,212 @@ +.\" t +.\" Copyright (C) 2006 Michael Kerrisk +.\" +.\" %%%LICENSE_START(VERBATIM) +.\" 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. +.\" %%%LICENSE_END +.\" +.\"******************************************************************* +.\" +.\" This file was generated with po4a. Translate the source file. +.\" +.\"******************************************************************* +.TH SEM_WAIT 3 2012\-05\-13 Linux "Linux Programmer's Manual" +.SH 名前 +sem_wait, sem_timedwait, sem_trywait \- セマフォをロックする +.SH 書式 +.nf +\fB#include \fP +.sp +\fBint sem_wait(sem_t *\fP\fIsem\fP\fB);\fP +.sp +\fBint sem_trywait(sem_t *\fP\fIsem\fP\fB);\fP +.sp +\fBint sem_timedwait(sem_t *\fP\fIsem\fP\fB, const struct timespec *\fP\fIabs_timeout\fP\fB);\fP +.fi +.sp +\fI\-pthread\fP とリンクする。 +.sp +.in -4n +glibc 向けの機能検査マクロの要件 (\fBfeature_test_macros\fP(7) 参照): +.in +.sp +\fBsem_timedwait\fP(): _POSIX_C_SOURCE\ >=\ 200112L || _XOPEN_SOURCE\ >=\ 600 +.SH 説明 +\fBsem_wait\fP() は \fIsem\fP が指すセマフォの値を 1 減らす (ロックする)。 セマフォの値が 0 +より大きい場合、減算が実行され、関数は直ちに復帰する。 セマフォの現在値が 0 の場合には、減算を実行できるようになる (つまり、セマフォの値が 0 +より大きな値になる) まで、もしくは シグナルハンドラによって呼び出しが中断されるまで、 関数呼び出しは停止 (block) する。 + +\fBsem_trywait\fP() は \fBsem_wait\fP() と同じだが、セマフォ値の減算をすぐに実行できなかった場合に、 停止 (block) +するのではなくエラーで復帰する (\fIerrno\fP に \fBEAGAIN\fP がセットされる) 点が異なる。 + +\fBsem_timedwait\fP() は \fBsem_wait\fP() と同じだが、セマフォ値の減算をすぐに実行できなかった場合に +関数呼び出しが停止する時間の上限を \fIabs_timeout\fP で指定する点が異なる。 \fIabs_timeout\fP +引き数は、タイムアウト時刻を指定する構造体へのポインタである。 この構造体には、タイムアウト時刻を時刻紀元 (Epoch; 1970\-01\-01 +00:00:00 +0000 (UTC)) からの 経過時間 (秒+ナノ秒) で指定する。 構造体は以下のように定義されている: + +.nf +.in +4n +struct timespec { + time_t tv_sec; /* Seconds */ + long tv_nsec; /* Nanoseconds [0 .. 999999999] */ +}; +.in +.fi +.PP +関数呼び出し時点ですでにタイムアウトに指定した時刻が過ぎており、 かつセマフォをすぐにロックできなかった場合は、 \fBsem_timedwait\fP() +はタイムアウトエラー (\fIerrno\fP に \fBETIMEDOUT\fP がセットされる) で失敗する。 + +セマフォ操作がすぐに実行できるときは、 \fIabs_timeout\fP がどんな値であっても \fBsem_timedwait\fP() +が失敗することは決してない。さらにいうと、この場合には \fIabs_timeout\fP の正当性の検査は行われない。 +.SH 返り値 +成功すると、これらの関数は 0 を返す。 エラーの場合、セマフォの値を変更せずに、\-1 を返し、 \fIerrno\fP にエラーを示す値をセットする。 +.SH エラー +.TP +\fBEINTR\fP +呼び出しはシグナルハンドラにより中断された。 \fBsignal\fP(7) 参照。 +.TP +\fBEINVAL\fP +\fIsem\fP は有効なセマフォではない。 +.PP +\fBsem_trywait\fP() の場合には、上記に加えて以下のエラーも起こる。 +.TP +\fBEAGAIN\fP +停止 (block) せずにロック操作を完了できなかった (つまり、 セマフォの現在の値が 0 であった)。 +.PP +\fBsem_timedwait\fP() の場合、以下のエラーも起こる。 +.TP +\fBEINVAL\fP +\fIabs_timeout.tv_nsecs\fP の値が 0 未満、もしくは 1,000,000,000 以上である。 +.TP +\fBETIMEDOUT\fP +.\" POSIX.1-2001 also allows EDEADLK -- "A deadlock condition +.\" was detected", but this does not occur on Linux(?). +セマフォのロックに成功する前に時間切れとなった。 +.SH 準拠 +POSIX.1\-2001. +.SH 注意 +.\" sem_wait() is always interrupted on most other implementations, +.\" but on FreeBSD 5.4 SA_RESTART does cause restarting. +シグナルハンドラは、 \fBsigaction\fP(2) の \fBSA_RESTART\fP フラグを使用しているかどうかに関わらず、これらの関数の呼び出しが +停止している場合、シグナルハンドラにより常に中断される。 +.SH 例 +.PP +以下に示す (ちょっとした) プログラムは名前なしセマフォの操作を行う。 プログラムはコマンドライン引き数を 2 つ取る。 最初の引き数には、 +\fBSIGALRM\fP シグナルを生成するためのアラームタイマーの設定に使われる値を 秒単位で指定する。このシグナルハンドラは、 \fImain()\fP 内で +\fBsem_timedwait\fP() を使って待っているセマフォを、 \fBsem_post\fP(3) を使って加算する。 2番目の引き数には、 +\fBsem_timedwait\fP() に渡すタイムアウトまでの時間を秒単位で指定する。 + +.in +4n +.nf +$\fB ./a.out 2 3\fP +About to call sem_timedwait() +sem_post() from handler +sem_timedwait() succeeded +$\fB ./a.out 2 1\fP +About to call sem_timedwait() +sem_timedwait() timed out +.fi +.in +.SS プログラムのソース +\& +.nf +#include +#include +#include +#include +#include +#include +#include +#include + +sem_t sem; + +#define handle_error(msg) \e + do { perror(msg); exit(EXIT_FAILURE); } while (0) + +static void +handler(int sig) +{ + write(STDOUT_FILENO, "sem_post() from handler\en", 24); + if (sem_post(&sem) == \-1) { + write(STDERR_FILENO, "sem_post() failed\en", 18); + _exit(EXIT_FAILURE); + } +} + +int +main(int argc, char *argv[]) +{ + struct sigaction sa; + struct timespec ts; + int s; + + if (argc != 3) { + fprintf(stderr, "Usage: %s \en", + argv[0]); + exit(EXIT_FAILURE); + } + + if (sem_init(&sem, 0, 0) == \-1) + handle_error("sem_init"); + + /* Establish SIGALRM handler; set alarm timer using argv[1] */ + + sa.sa_handler = handler; + sigemptyset(&sa.sa_mask); + sa.sa_flags = 0; + if (sigaction(SIGALRM, &sa, NULL) == \-1) + handle_error("sigaction"); + + alarm(atoi(argv[1])); + + /* Calculate relative interval as current time plus + number of seconds given argv[2] */ + + if (clock_gettime(CLOCK_REALTIME, &ts) == \-1) + handle_error("clock_gettime"); + + ts.tv_sec += atoi(argv[2]); + + printf("main() about to call sem_timedwait()\en"); + while ((s = sem_timedwait(&sem, &ts)) == \-1 && errno == EINTR) + continue; /* Restart if interrupted by handler */ + + /* Check what happened */ + + if (s == \-1) { + if (errno == ETIMEDOUT) + printf("sem_timedwait() timed out\en"); + else + perror("sem_timedwait"); + } else + printf("sem_timedwait() succeeded\en"); + + exit((s == 0) ? EXIT_SUCCESS : EXIT_FAILURE); +} +.fi +.SH 関連項目 +\fBclock_gettime\fP(2), \fBsem_getvalue\fP(3), \fBsem_post\fP(3), \fBsem_overview\fP(7), +\fBtime\fP(7) +.SH この文書について +この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 3.50 の一部 +である。プロジェクトの説明とバグ報告に関する情報は +http://www.kernel.org/doc/man\-pages/ に書かれている。 diff --git a/draft/man3/sleep.3 b/draft/man3/sleep.3 new file mode 100644 index 00000000..c161e381 --- /dev/null +++ b/draft/man3/sleep.3 @@ -0,0 +1,57 @@ +.\" Copyright (c) 1993 by Thomas Koenig (ig25@rz.uni-karlsruhe.de) +.\" +.\" %%%LICENSE_START(VERBATIM) +.\" 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. +.\" %%%LICENSE_END +.\" +.\" Modified Sat Jul 24 18:16:02 1993 by Rik Faith (faith@cs.unc.edu) +.\"******************************************************************* +.\" +.\" This file was generated with po4a. Translate the source file. +.\" +.\"******************************************************************* +.TH SLEEP 3 2010\-02\-03 GNU "Linux Programmer's Manual" +.SH 名前 +sleep \- 指定の秒数の間だけ休止する +.SH 書式 +.nf +\fB#include \fP +.sp +\fBunsigned int sleep(unsigned int \fP\fIseconds\fP\fB);\fP +.fi +.SH 説明 +\fBsleep\fP() は、呼び出したスレッドを \fIseconds\fP 秒間または無視されないシグナルが到着するまで休止する。 +.SH 返り値 +要求された時間が過ぎた場合はゼロを返す。 呼び出しがシグナルハンドラーに割り込まれた場合は、 休止の残り時間を返す。 +.SH 準拠 +POSIX.1\-2001. +.SH バグ +\fBsleep\fP() は \fBSIGALRM\fP を用いて実装されている。そのため、 \fBalarm\fP(2) と \fBsleep\fP() +を混ぜて使用するのは、まずい考えである。 +.PP +休止中にシグナルハンドラーから \fBlongjmp\fP(3) を使用することや \fBSIGALRM\fP +のハンドリングを変更することは、定義されていない結果を生む。 +.SH 関連項目 +\fBalarm\fP(2), \fBnanosleep\fP(2), \fBsignal\fP(2), \fBsignal\fP(7) +.SH この文書について +この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 3.50 の一部 +である。プロジェクトの説明とバグ報告に関する情報は +http://www.kernel.org/doc/man\-pages/ に書かれている。 diff --git a/draft/man3/sysconf.3 b/draft/man3/sysconf.3 new file mode 100644 index 00000000..ba287e83 --- /dev/null +++ b/draft/man3/sysconf.3 @@ -0,0 +1,213 @@ +.\" Copyright (c) 1993 by Thomas Koenig (ig25@rz.uni-karlsruhe.de) +.\" +.\" %%%LICENSE_START(VERBATIM) +.\" 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. +.\" %%%LICENSE_END +.\" +.\" Modified Sat Jul 24 17:51:42 1993 by Rik Faith (faith@cs.unc.edu) +.\" Modified Tue Aug 17 11:42:20 1999 by Ariel Scolnicov (ariels@compugen.co.il) +.\"******************************************************************* +.\" +.\" This file was generated with po4a. Translate the source file. +.\" +.\"******************************************************************* +.TH SYSCONF 3 2013\-02\-12 GNU "Linux Programmer's Manual" +.SH 名前 +sysconf \- 動作中に設定情報を取得する +.SH 書式 +.nf +\fB#include \fP +.sp +\fBlong sysconf(int \fP\fIname\fP\fB);\fP +.fi +.SH 説明 +POSIX では、アプリケーションがコンパイル時や実行時に、 特定のオプションがサポートされているかや、 +設定可能な特定の定数や制限がどんな値かをテストすることができる。 +.LP +コンパイル時に行うには、 \fI\fP と \fI\fP +の両方もしくは一方をインクルードし、 特定のマクロの値を確認する。 +.LP +実行時には、ここで説明する関数 \fBsysconf\fP() を使って数値を問い合わせることができる。 ファイルが存在するファイルシステムに関する数値は、 +\fBfpathconf\fP(3) と \fBpathconf\fP(3) を使って確認できる。 文字列の値は \fBconfstr\fP(3) +を使って確認できる。 +.LP +.\" except that sysconf(_SC_OPEN_MAX) may change answer after a call +.\" to setrlimit( ) which changes the RLIMIT_NOFILE soft limit +これらの関数で取得される値は設定可能なシステム定数である。 これらはプロセスの生存期間の間は変化しない。 +.LP +.\" and 999 to indicate support for options no longer present in the latest +.\" standard. (?) +オプションを確認できるように、たいていは \fI\fP で定数 \fB_POSIX_FOO\fP が定義されている。 +定義されていないときは、実行時に問い合わせを行う必要がある。 その値が \-1 に定義されているときは、そのオプションはサポートされていない。 0 +に定義されているときは、関連する関数やヘッダファイルが存在するが、 どの程度サポートされているかは実行時に確認しなければならない。 \-1 でも 0 +でもない値に定義されているときは、そのオプションがサポート されている。通常は、そのオプションについて記載した POSIX の改訂年月 +を示す値になっている (例えば 200112L)。 glibc では 1 が設定されていると、そのオプションはサポートされているが、 POSIX +の改訂版がまだ発行されていないことを示す。 \fBsysconf\fP() の引き数には \fB_SC_FOO\fP を指定する。 オプションのリストについては +\fBposixoptions\fP(7) を参照のこと。 +.LP +変数や制限を確認できるように、たいていは、 \fI\fP で定数 \fB_FOO\fP が、 +\fI\fP で \fB_POSIX_FOO\fP が定義されている。 制限が規定されていない場合は定数は定義されない。 +定数が定義されているときには、その定数は保証できる値であり、 実際にはもっと大きな値がサポートされていることもある。 +アプリケーションがシステム毎に変化する値を利用したい場合には、 \fBsysconf\fP() を呼び出すことで実現できる。 \fBsysconf\fP() +の引き数には \fB_SC_FOO\fP を指定する。 +.SS "POSIX.1 変数" +変数名、その値を取得するのに使われる \fBsysconf\fP() のパラメータ名、簡単な説明を以下に示す。 +.LP +.\" [for the moment: only the things that are unconditionally present] +.\" .TP +.\" .BR AIO_LISTIO_MAX " - " _SC_AIO_LISTIO_MAX +.\" (if _POSIX_ASYNCHRONOUS_IO) +.\" Maximum number of I/O operations in a single list I/O call. +.\" Must not be less than _POSIX_AIO_LISTIO_MAX. +.\" .TP +.\" .BR AIO_MAX " - " _SC_AIO_MAX +.\" (if _POSIX_ASYNCHRONOUS_IO) +.\" Maximum number of outstanding asynchronous I/O operations. +.\" Must not be less than _POSIX_AIO_MAX. +.\" .TP +.\" .BR AIO_PRIO_DELTA_MAX " - " _SC_AIO_PRIO_DELTA_MAX +.\" (if _POSIX_ASYNCHRONOUS_IO) +.\" The maximum amount by which a process can decrease its +.\" asynchronous I/O priority level from its own scheduling priority. +.\" Must be nonnegative. +まず POSIX.1 互換の変数を示す。 +.TP +\fBARG_MAX\fP \- \fB_SC_ARG_MAX\fP +\fBexec\fP(3) 関数群の引き数の最大長。 \fB_POSIX_ARG_MAX\fP (4096) 未満であってはならない。 +.TP +\fBCHILD_MAX\fP \- \fB_SC_CHILD_MAX\fP +ユーザID あたりの同時に存在できるプロセスの最大数。 \fB_POSIX_CHILD_MAX\fP (25) 未満であってはならない。 +.TP +\fBHOST_NAME_MAX\fP \- \fB_SC_HOST_NAME_MAX\fP +\fBgethostname\fP(2) で返されるホスト名の最大長。末尾の NULL バイトは長さに含まれない。 +\fB_POSIX_HOST_NAME_MAX\fP (255) 未満であってはならない。 +.TP +\fBLOGIN_NAME_MAX\fP \- \fB_SC_LOGIN_NAME_MAX\fP +ログイン名の長さの最大値。末尾の NULL バイトも長さに含まれる。 \fB_POSIX_LOGIN_NAME_MAX\fP (9) 未満であってはならない。 +.TP +clock ticks \- \fB_SC_CLK_TCK\fP +1秒あたりのクロック・ティック数。 対応する変数は廃止された。この変数は当然ながら \fBCLK_TCK\fP と呼ばれていた。 (注意: マクロ +\fBCLOCKS_PER_SEC\fP からは情報は得られない: この値は 1000000 でなければならない) +.TP +\fBOPEN_MAX\fP \- \fB_SC_OPEN_MAX\fP +一つのプロセスが同時にオープンできるファイル数の上限。 \fB_POSIX_OPEN_MAX\fP (20) 未満であってはならない。 +.TP +\fBPAGESIZE\fP \- \fB_SC_PAGESIZE\fP +バイト単位でのページサイズ。 1 より小さくなってはならない。 (この代わりに PAGE_SIZE を使うシステムもある) +.TP +\fBRE_DUP_MAX\fP \- \fB_SC_RE_DUP_MAX\fP +\fBregexec\fP(3) と \fBregcomp\fP(3) で許容されている BRE (Basic Regular Expression; +基本正規表現) の繰り返し出現回数の最大値。 \fB_POSIX2_RE_DUP_MAX\fP (255) 未満であってはならない。 +.TP +\fBSTREAM_MAX\fP \- \fB_SC_STREAM_MAX\fP +一つのプロセスが同時にオープンできるストリーム数の上限。 定義されていた場合には、この値は標準 C マクロの \fBFOPEN_MAX\fP と同じである。 +\fB_POSIX_STREAM_MAX\fP (8) 未満であってはならない。 +.TP +\fBSYMLOOP_MAX\fP \- \fB_SC_SYMLOOP_MAX\fP +パス名の解決時に現れてもよいシンボリック・リンクの最大数。 この数を超えると、パス名解決時に \fBELOOP\fP が返される。 +\fB_POSIX_SYMLOOP_MAX\fP (8) 未満であってはならない。 +.TP +\fBTTY_NAME_MAX\fP \- \fB_SC_TTY_NAME_MAX\fP +端末デバイス名の最大長。長さには末尾の NULL バイトも含まれる。 \fB_POSIX_TTY_NAME_MAX\fP (9) 未満であってはならない。 +.TP +\fBTZNAME_MAX\fP \- \fB_SC_TZNAME_MAX\fP +タイムゾーン名として使えるバイト数の最大値。 \fB_POSIX_TZNAME_MAX\fP (6) 未満であってはならない。 +.TP +\fB_POSIX_VERSION\fP \- \fB_SC_VERSION\fP +POSIX.1 標準が承認された年月。 \fBYYYYMML\fP という書式である。 \fB199009L\fP という値は、1990年 9月 +改訂であることを示す。 +.SS "POSIX.2 変数" +次に、POSIX.2 の値を示す。 これらは各ユーティリティに対する制限を指定する。 +.TP +\fBBC_BASE_MAX\fP \- \fB_SC_BC_BASE_MAX\fP +\fBbc\fP(1) ユーティリティで許容される \fIobase\fP の最大値。 +.TP +\fBBC_DIM_MAX\fP \- \fB_SC_BC_DIM_MAX\fP +\fBbc\fP(1) で許容される一つの配列中の要素数の最大値。 +.TP +\fBBC_SCALE_MAX\fP \- \fB_SC_BC_SCALE_MAX\fP +\fBbc\fP(1) で許される \fIscale\fP の最大値。 +.TP +\fBBC_STRING_MAX\fP \- \fB_SC_BC_STRING_MAX\fP +\fBbc\fP(1) で許容される文字列の最大長。 +.TP +\fBCOLL_WEIGHTS_MAX\fP \- \fB_SC_COLL_WEIGHTS_MAX\fP +ロケール定義ファイル中の \fBLC_COLLATE order\fP キーワードのエントリに割り当て可能な重みの最大値。 +.TP +\fBEXPR_NEST_MAX\fP \- \fB_SC_EXPR_NEST_MAX\fP +\fBexpr\fP(1) において、括弧で入れ子にできる式の最大数。 +.TP +\fBLINE_MAX\fP \- \fB_SC_LINE_MAX\fP +ユーティリティの入力行の最大長。標準入力だけでなく、ファイルからの入力にも 適用される。長さには行の末尾の改行文字も含まれる。 +.TP +\fBRE_DUP_MAX\fP \- \fB_SC_RE_DUP_MAX\fP +正規表現で区間表記 (interval notation) \fB\e{m,n\e}\fP が使用されたときに許容される繰り返し出現回数の最大値。 +.TP +\fBPOSIX2_VERSION\fP \- \fB_SC_2_VERSION\fP +POSIX.2 標準のバージョン。YYYYMML という書式で表記される。 +.TP +\fBPOSIX2_C_DEV\fP \- \fB_SC_2_C_DEV\fP +POSIX.2 の C 言語開発機能がサポートされているかを示す。 +.TP +\fBPOSIX2_FORT_DEV\fP \- \fB_SC_2_FORT_DEV\fP +POSIX.2 の FORTRAN 開発ユーティリティがサポートされているかを示す。 +.TP +\fBPOSIX2_FORT_RUN\fP \- \fB_SC_2_FORT_RUN\fP +POSIX.2 の FORTRAN ランタイムユーティリティがサポートされているかを示す。 +.TP +\fB_POSIX2_LOCALEDEF\fP \- \fB_SC_2_LOCALEDEF\fP +\fBlocaledef\fP(1) を使った、POSIX.2 のロケールの作成をサポートしているかを示す。 +.TP +\fBPOSIX2_SW_DEV\fP \- \fB_SC_2_SW_DEV\fP +POSIX.2 ソフトウェア開発ユーティリティオプションがサポートされているかを示す。 +.PP +以下の値も存在するが、標準には含まれていない。 +.TP + \- \fB_SC_PHYS_PAGES\fP +物理メモリのページ数。 この値と \fB_SC_PAGESIZE\fP 値の積は桁溢れする可能性があるので注意すること。 +.TP + \- \fB_SC_AVPHYS_PAGES\fP +現在利用可能な物理メモリのページ数。 +.TP + \- \fB_SC_NPROCESSORS_CONF\fP +設定されたプロセッサ数。 +.TP + \- \fB_SC_NPROCESSORS_ONLN\fP +現在オンラインの (利用可能な) プロセッサ数。 +.SH 返り値 +\fIname\fP が不正な場合、\-1 が返され、 \fIerrno\fP に \fBEINVAL\fP が設定される。 +それ以外の場合、システムリソースの値が返り値として返され、 \fIerrno\fP は変更されない。問い合わせがオプションについてであれば、 +そのオプションが利用できるときは正の値が返され、 利用できないときは \-1 が返される。問い合わせが 制限について場合は、制限が設定されていないときに +\-1 が返される。 +.SH 準拠 +POSIX.1\-2001. +.SH バグ +\fBARG_MAX\fP を使うのは難しい、なぜなら、 \fBexec\fP(3) の引き数領域 (argument space) のうちどれくらいが +ユーザの環境変数によって使われるかは分からないからである。 +.PP +いくつかの返り値はとても大きくなることがある。これらを使って メモリの割り当てを行うのは適当ではない。 +.SH 関連項目 +\fBbc\fP(1), \fBexpr\fP(1), \fBgetconf\fP(1), \fBlocale\fP(1), \fBfpathconf\fP(3), +\fBpathconf\fP(3), \fBposixoptions\fP(7) +.SH この文書について +この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 3.50 の一部 +である。プロジェクトの説明とバグ報告に関する情報は +http://www.kernel.org/doc/man\-pages/ に書かれている。 diff --git a/release/man2/get_thread_area.2 b/release/man2/get_thread_area.2 index 2607e0b2..34cb2c1e 100644 --- a/release/man2/get_thread_area.2 +++ b/release/man2/get_thread_area.2 @@ -12,7 +12,7 @@ .\"******************************************************************* .TH GET_THREAD_AREA 2 2012\-07\-13 Linux "Linux Programmer's Manual" .SH 名前 -get_thread_area \- get a thread\-local storage (TLS) area +get_thread_area \- スレッド局所記憶 (TLS) 領域を取り出す .SH 書式 \fB#include \fP .br diff --git a/release/man2/getdomainname.2 b/release/man2/getdomainname.2 index 58e0142c..fe21f37c 100644 --- a/release/man2/getdomainname.2 +++ b/release/man2/getdomainname.2 @@ -33,7 +33,7 @@ .\"******************************************************************* .TH GETDOMAINNAME 2 2012\-10\-25 Linux "Linux Programmer's Manual" .SH 名前 -getdomainname, setdomainname \- get/set NIS domain name +getdomainname, setdomainname \- NIS ドメイン名の取得・設定をする .SH 書式 \fB#include \fP .sp @@ -52,8 +52,7 @@ _BSD_SOURCE || (_XOPEN_SOURCE && _XOPEN_SOURCE\ <\ 500) .RE .ad .SH 説明 -These functions are used to access or to change the NIS domain name of the -host system. +これらの関数は、ホストシステムの NIS ドメイン名を取得・変更するために使われる。 \fBsetdomainname\fP() は、ドメイン名を、文字配列 \fIname\fP で指定された値に設定する。 引き数 \fIlen\fP には、 \fIname\fP のバイト数を指定する (そのため、 \fIname\fP では文字列終端の NULL バイトは必要ない)。 diff --git a/release/man2/idle.2 b/release/man2/idle.2 index d2e25371..40f2c960 100644 --- a/release/man2/idle.2 +++ b/release/man2/idle.2 @@ -55,7 +55,7 @@ ID 0 のプロセスのみが \fBidle\fP() を使用することができる。 \fBEPERM\fP ユーザプロセスに対しては、常にこのエラーとなる。 .SH バージョン -Since Linux 2.3.13, this system call does not exist anymore. +Linux 2.3.13 以降では、もはやこのシステムコールは存在しない。 .SH 準拠 この関数は Linux 特有であり、移植を意図したプログラムでは 使用すべきでない。 .SH この文書について diff --git a/release/man2/ioperm.2 b/release/man2/ioperm.2 index 51c493b6..a49a4ae6 100644 --- a/release/man2/ioperm.2 +++ b/release/man2/ioperm.2 @@ -79,7 +79,7 @@ port access permissions to unprivileged programs. メモリ不足。 .TP \fBEPERM\fP -The calling thread has insufficient privilege. +呼び出し元スレッドに十分な権限がなかった。 .SH 準拠 \fBioperm\fP() は Linux 特有の関数であり、移植を意図したプログラムで 使用してはならない。 .SH 注意 diff --git a/release/man2/semctl.2 b/release/man2/semctl.2 index e70bba3f..273c98c7 100644 --- a/release/man2/semctl.2 +++ b/release/man2/semctl.2 @@ -86,8 +86,7 @@ struct semid_ds { .in .fi .PP -The \fIipc_perm\fP structure is defined as follows (the highlighted fields are -settable using \fBIPC_SET\fP): +\fIipc_perm\fP 構造体は以下のように定義されている (強調されたフィールドは \fBIPC_SET\fP を使って設定可能である): .PP .nf .in +4n diff --git a/release/man2/semop.2 b/release/man2/semop.2 index 7b827391..5f2f1cbd 100644 --- a/release/man2/semop.2 +++ b/release/man2/semop.2 @@ -62,10 +62,10 @@ glibc 向けの機能検査マクロの要件 (\fBfeature_test_macros\fP(7) 参 .sp .in +4n .nf -unsigned short semval; /* semaphore value */ -unsigned short semzcnt; /* # waiting for zero */ -unsigned short semncnt; /* # waiting for increase */ -pid_t sempid; /* ID of process that did last op */ +unsigned short semval; /* セマフォ値 */ +unsigned short semzcnt; /* ゼロを待つプロセス数 */ +unsigned short semncnt; /* 増加を待つプロセス数 */ +pid_t sempid; /* 最後に操作を行なったプロセスの ID */ .sp .in -4n .fi @@ -90,72 +90,60 @@ short sem_flg; /* 操作フラグ */ それぞれの操作はセマフォ集合の \fIsem_num\fP番目 のセマフォに対して実行される。セマフォ集合の最初のセマフォには 番号 0 が振られる。 そして操作は三種類あり、 \fIsem_op\fP の値で区別される。 .PP -If \fIsem_op\fP is a positive integer, the operation adds this value to the -semaphore value (\fIsemval\fP). Furthermore, if \fBSEM_UNDO\fP is specified for -this operation, the system updates the undo count (\fIsemadj\fP) for this -semaphore. This operation can always proceed\(emit never forces a thread to -wait. The calling process must have alter permission on the semaphore set. +\fIsem_op\fP が正の整数の場合、操作としてその値をセマフォの値 (\fIsemval\fP) に加える。さらにこの操作に \fBSEM_UNDO\fP +が指定されている場合は、システムはこのセマフォのアンドゥ数 (\fIsemadj\fP) を更新する。この操作は必ず実行でき、スレッドの停止は起こらない。 +呼び出し元プロセスは対象のセマフォ集合を変更する許可がなければならない。 .PP -If \fIsem_op\fP is zero, the process must have read permission on the semaphore -set. This is a "wait\-for\-zero" operation: if \fIsemval\fP is zero, the -operation can immediately proceed. Otherwise, if \fBIPC_NOWAIT\fP is specified -in \fIsem_flg\fP, \fBsemop\fP() fails with \fIerrno\fP set to \fBEAGAIN\fP (and none of -the operations in \fIsops\fP is performed). Otherwise \fIsemzcnt\fP (the count of -threads waiting until this semaphore's value becomes zero) is incremented -by one and the thread sleeps until one of the following occurs: +\fIsem_op\fP が 0 の場合、「ゼロまで待つ」操作である。この場合、プロセスは そのセマフォ集合に対する読み込み許可がなければならない。 +\fIsemval\fP が 0 ならば、操作は直ちに行われる。 \fIsemval\fP が 0 でない場合、 \fIsem_flg\fP に +\fBIPC_NOWAIT\fP が指定されていれば、 \fBsemop\fP() は失敗し、 \fBerrno\fP に \fBEAGAIN\fP が設定される (このとき +\fIsops\fP に対する操作は全く実行されない)。 \fIsem_flg\fP に \fBIPC_NOWAIT\fP が指定されていない場合、 \fIsemzcnt\fP +(セマフォ値が 0 になるのを待っているスレッドの数) を 1 増加させて、 以下のいずれかが起こるまでスレッドを停止 (sleep) する。 .IP \(bu 3 \fIsemval\fP が 0 になった: このとき \fIsemzcnt\fP の値は 1 減算される。 .IP \(bu セマフォ集合が削除された: このとき \fBsemop\fP() は失敗し、 \fIerrno\fP に \fBEIDRM\fP が設定される。 .IP \(bu -The calling thread catches a signal: the value of \fIsemzcnt\fP is decremented -and \fBsemop\fP() fails, with \fIerrno\fP set to \fBEINTR\fP. +呼び出し元スレッドがシグナルを捕獲した: このとき \fIsemzcnt\fP の値は 1 減算され、 \fBsemop\fP() は失敗し \fIerrno\fP に +\fBEINTR\fP が設定される。 .IP \(bu \fBsemtimedop\fP() の \fItimeout\fP で指定された制限時間が経過した: このとき \fBsemtimedop\fP() は失敗し、 \fIerrno\fP に \fBEAGAIN\fP が設定される。 .PP -If \fIsem_op\fP is less than zero, the process must have alter permission on -the semaphore set. If \fIsemval\fP is greater than or equal to the absolute -value of \fIsem_op\fP, the operation can proceed immediately: the absolute -value of \fIsem_op\fP is subtracted from \fIsemval\fP, and, if \fBSEM_UNDO\fP is -specified for this operation, the system updates the undo count (\fIsemadj\fP) -for this semaphore. If the absolute value of \fIsem_op\fP is greater than -\fIsemval\fP, and \fBIPC_NOWAIT\fP is specified in \fIsem_flg\fP, \fBsemop\fP() fails, -with \fIerrno\fP set to \fBEAGAIN\fP (and none of the operations in \fIsops\fP is -performed). Otherwise \fIsemncnt\fP (the counter of threads waiting for this -semaphore's value to increase) is incremented by one and the thread sleeps -until one of the following occurs: +\fIsem_op\fP が 0 未満の場合、プロセスにはそのセマフォ集合を変更する許可がなければ ならない。 \fIsemval\fP が \fIsem_op\fP +の絶対値以上の場合は、操作は直ちに実行される: \fIsemval\fP から \fIsem_op\fP の絶対値が減算される。 さらに、この操作に +\fBSEM_UNDO\fP が指定されている場合は、このセマフォのアンドゥ数 (\fIsemadj\fP) を更新する。 \fIsemval\fP が +\fIsem_op\fP の絶対値より小さく、 \fIsem_flg\fP に \fBIPC_NOWAIT\fP が指定された場合は、 \fBsemop\fP() は失敗し、 +\fIerrno\fP に \fBEAGAIN\fP が設定される (このとき \fIsops\fP の操作は全く実行されない)。 \fBIPC_WAIT\fP +が指定されていなければ、 \fIsemncnt\fP (このセマフォの値が増加するのを待っているスレッド数のカウンタ) を 1 +増加させて、以下のいずれかが起こるまでスレッドを停止 (sleep) する。 .IP \(bu 3 -\fIsemval\fP becomes greater than or equal to the absolute value of \fIsem_op\fP, -at which time the value of \fIsemncnt\fP is decremented, the absolute value of -\fIsem_op\fP is subtracted from \fIsemval\fP and, if \fBSEM_UNDO\fP is specified for -this operation, the system updates the undo count (\fIsemadj\fP) for this -semaphore. +\fIsemval\fP が \fIsem_op\fP の絶対値以上になった: このとき \fIsemncnt\fP が 1 減算され、 \fIsemval\fP から +\fIsem_op\fP の絶対値が引かれる。 この操作に \fBSEM_UNDO\fP が指定されていた場合にはこのセマフォのアンドゥ数 (\fIsemadj\fP) +も更新する。 .IP \(bu セマフォ集合がシステムから削除された: このとき \fBsemop\fP() は失敗し \fIerrno\fP に \fBEIDRM\fP が設定される。 .IP \(bu -The calling thread catches a signal: the value of \fIsemncnt\fP is decremented -and \fBsemop\fP() fails, with \fIerrno\fP set to \fBEINTR\fP. +呼び出したスレッドがシグナルを捕獲した: このとき \fIsemncnt\fP が 1 減算され、 \fBsemop\fP() は失敗し \fIerrno\fP に +\fBEINTR\fP が設定される。 .IP \(bu \fBsemtimedop\fP() の \fItimeout\fP で指定された制限時間が経過した: このとき \fBsemtimedop\fP() は失敗し、 \fIerrno\fP に \fBEAGAIN\fP が設定される。 .PP .\" and .\" .I sem_ctime -On successful completion, the \fIsempid\fP value for each semaphore specified -in the array pointed to by \fIsops\fP is set to the caller's process ID. In -addition, the \fIsem_otime\fP is set to the current time. +操作が成功した場合、 \fIsops\fP が指す配列によって操作対象となった各セマフォの \fIsempid\fP メンバーには呼び出し元のプロセス ID +が設定される。さらに \fIsem_otime\fP に現在時刻が設定される。 .PP -\fBsemtimedop\fP() behaves identically to \fBsemop\fP() except that in those -cases where the calling thread would sleep, the duration of that sleep is -limited by the amount of elapsed time specified by the \fItimespec\fP structure -whose address is passed in the \fItimeout\fP argument. (This sleep interval -will be rounded up to the system clock granularity, and kernel scheduling -delays mean that the interval may overrun by a small amount.) If the -specified time limit has been reached, \fBsemtimedop\fP() fails with \fIerrno\fP -set to \fBEAGAIN\fP (and none of the operations in \fIsops\fP is performed). If -the \fItimeout\fP argument is NULL, then \fBsemtimedop\fP() behaves exactly like -\fBsemop\fP(). +\fBsemtimedop\fP() 関数の振る舞いは \fBsemop\fP() と全く同じだが、呼び出し元 +スレッドが停止する場合、停止期間の上限が \fItimeout\fP 引き数の指す +\fItimespec\fP 構造体で指定された時間となる点だけが異なる (この停止期間は +システムクロックの粒度に切り上げられ、カーネルのスケジューリング遅延に +より、この停止期間は少しだけ長くなる可能性がある)。 +指定した制限時間に達した場合は、 \fBsemtimedop\fP() は失敗し、 \fIerrno\fP に +\fBEAGAIN\fP が設定される (このとき \fIsops\fP の操作は実行されない)。 +\fItimeout\fP 引き数が NULL の場合、 \fBsemtimedop\fP() 関数の振る舞いは +\fBsemop\fP() 関数と全く同じになる。 .SH 返り値 成功した場合、 \fBsemop\fP() と \fBsemtimedop\fP() は 0 を返す。そうでなければ \-1 を返し、 エラーを示す \fIerrno\fP を設定する。 @@ -182,8 +170,7 @@ the \fItimeout\fP argument is NULL, then \fBsemtimedop\fP() behaves exactly lik セマフォ集合が削除された。 .TP \fBEINTR\fP -While blocked in this system call, the thread caught a signal; see -\fBsignal\fP(7). +このシステムコールで停止している時にスレッドがシグナルを捕獲した。 \fBsingle\fP(7) 参照。 .TP \fBEINVAL\fP セマフォ集合が存在しないか、 \fIsemid\fP が 0 未満であるか、 \fInsops\fP が正の数でない。 @@ -247,10 +234,8 @@ such old systems may need to include these header files. .\" http://marc.theaimsgroup.com/?l=linux-kernel&m=110260821123863&w=2 .\" the fix: .\" http://marc.theaimsgroup.com/?l=linux-kernel&m=110261701025794&w=2 -In kernels 2.6.x, x <= 10, there is a bug that in some circumstances -prevents a thread that is waiting for a semaphore value to become zero from -being woken up when the value does actually become zero. This bug is fixed -in kernel 2.6.11. +カーネル 2.6.x (x <= 10) には、ある状況においてセマフォ値が 0 になるのを 待っているスレッドが、セマフォ値が実際に 0 +になったときに起床 (wake up) されない、というバグがある。このバグはカーネル 2.6.11 で修正されている。 .SH 例 以下の部分的なコードは、 セマフォ 0 の値が 0 になるのを待ってから、 セマフォの値を 1 加算する処理を、 \fBsemop\fP() を使ってアトミック (atomically) に行う。 diff --git a/release/man2/set_thread_area.2 b/release/man2/set_thread_area.2 index 431f3e83..03dee614 100644 --- a/release/man2/set_thread_area.2 +++ b/release/man2/set_thread_area.2 @@ -12,7 +12,7 @@ .\"******************************************************************* .TH SET_THREAD_AREA 2 2012\-07\-13 Linux "Linux Programmer's Manual" .SH 名前 -set_thread_area \- set a thread local storage (TLS) area +set_thread_area \- スレッド局所記憶 (TLS) 領域を設定する .SH 書式 \fB#include \fP .br diff --git a/release/man2/syscalls.2 b/release/man2/syscalls.2 index 44fd9550..e60b0f19 100644 --- a/release/man2/syscalls.2 +++ b/release/man2/syscalls.2 @@ -105,8 +105,8 @@ backport された。 この場合、システムコールが登場したバー .\" Looking at scripts/checksyscalls.sh in the kernel source is .\" instructive about x86 specifics. .\" -The list of system calls that are available as at kernel 3.5 (or in a few -cases only on older kernels) is as follows: +カーネル 3.5 で利用可能なシステムコールのリストを以下に示す +(それ以前のカーネルでだけ利用可能なものも少数だが含まれる): .ad l .TS l l l @@ -130,14 +130,13 @@ l l l. T} \fBbind\fP(2) 2.0 See notes on \fBsocketcall\fP(2) \fBbrk\fP(2) 1.0 -\fBcacheflush\fP(2) 1.2 Not on x86 +\fBcacheflush\fP(2) 1.2 x86 にはない \fBcapget\fP(2) 2.2 \fBcapset\fP(2) 2.2 \fBchdir\fP(2) 1.0 \fBchmod\fP(2) 1.0 \fBchown\fP(2) 2.2 T{ -See \fBchown\fP(2) for version details -T} +バージョン毎の詳細は \fBchown\fP(2) を参照。T} \fBchown32\fP(2) 2.4 \fBchroot\fP(2) 1.0 \fBclock_adjtime\fP(2) 2.6.39 @@ -264,8 +263,7 @@ T} \fBkeyctl\fP(2) 2.6.11 \fBkill\fP(2) 1.0 \fBlchown\fP(2) 1.0 T{ -See \fBchown\fP(2) for version details -T} +バージョン毎の詳細は \fBchown\fP(2) を参照。T} \fBlchown32\fP(2) 2.4 \fBlgetxattr\fP(2) 2.6; 2.4.18 \fBlink\fP(2) 1.0 @@ -328,24 +326,24 @@ T} \fBopen_by_handle_at\fP(2) 2.6.39 \fBopenat\fP(2) 2.6.16 \fBpause\fP(2) 1.0 -\fBpciconfig_iobase\fP(2) 2.2.15; 2.4 Not on x86 +\fBpciconfig_iobase\fP(2) 2.2.15; 2.4 x86 にはない .\" Alpha, PowerPC, ARM; not x86 -\fBpciconfig_read\fP(2) 2.0.26; 2.2 Not on x86 +\fBpciconfig_read\fP(2) 2.0.26; 2.2 x86 にはない .\" , PowerPC, ARM; not x86 -\fBpciconfig_write\fP(2) 2.0.26; 2.2 Not on x86 +\fBpciconfig_write\fP(2) 2.0.26; 2.2 x86 にはない .\" , PowerPC, ARM; not x86 \fBperf_event_open\fP(2) 2.6.31 T{ 2.6.31 では perf_counter_open() という名前であった; 2.6.32 で名称変更 T} \fBpersonality\fP(2) 1.2 -\fBperfctr\fP(2) 2.2 Sparc; removed in 2.6.34 +\fBperfctr\fP(2) 2.2 Sparc; 2.6.34 で削除 .\" commit c7d5a0050773e98d1094eaa9f2a1a793fafac300 removed perfctr() \fBperfmonctl\fP(2) 2.4 ia64 \fBpipe\fP(2) 1.0 \fBpipe2\fP(2) 2.6.27 \fBpivot_root\fP(2) 2.4 \fBpoll\fP(2) 2.0.36; 2.2 -\fBppc_rtas\fP(2) PowerPC only +\fBppc_rtas\fP(2) PowerPC のみ \fBppoll\fP(2) 2.6.16 \fBprctl\fP(2) 2.2 \fBpread64\fP(2) T{ @@ -540,9 +538,9 @@ T} .TE .ad .PP -On many platforms, including x86\-32, socket calls are all multiplexed (via -glibc wrapper functions) through \fBsocketcall\fP(2) and similarly System V -IPC calls are multiplexed through \fBipc\fP(2). +x86\-32 を含む多くのプラットフォームでは、ソケット関連のシステムコールは (glibc のラッパー関数を介してだが) すべて +\fBsocketcall\fP(2) 経由に多重されている。 同様に、System V IPC 関連のシステムコールは \fBipc\fP(2) +経由に多重されている。 .\" __NR_afs_syscall is 53 on Linux 2.6.22/i386 .\" __NR_break is 17 on Linux 2.6.22/i386 diff --git a/release/man3/getcwd.3 b/release/man3/getcwd.3 index b347b317..e6e84b04 100644 --- a/release/man3/getcwd.3 +++ b/release/man3/getcwd.3 @@ -36,7 +36,7 @@ .\"******************************************************************* .TH GETCWD 3 2010\-09\-20 GNU "Linux Programmer's Manual" .SH 名前 -getcwd, getwd, get_current_dir_name \- get current working directory +getcwd, getwd, get_current_dir_name \- カレントワーキングディレクトリ名の取得 .SH 書式 .nf \fB#include \fP diff --git a/release/man3/getlogin.3 b/release/man3/getlogin.3 index 91182d7d..985fc7ac 100644 --- a/release/man3/getlogin.3 +++ b/release/man3/getlogin.3 @@ -84,7 +84,7 @@ POSIX では以下のエラーが規定されている: システム全体でオープンしているファイル数がすでに上限に達している。 .TP \fBENXIO\fP -The calling process has no controlling terminal. +呼び出し元プロセスには制御端末がない。 .TP \fBERANGE\fP (getlogin_r) (終端の NULL バイトも含めた) ユーザ名の長さが \fIbufsize\fP よりも長い。 @@ -113,14 +113,13 @@ System V にも \fBcuserid\fP() があるが、 これは実効ユーザー ID \fBcuserid\fP() 関数は 1988 年版の POSIX には含まれていたが、 1990 年版では削除された。 SUSv2 に存在したが、POSIX.1\-2001 で削除された。 .LP -OpenBSD has \fBgetlogin\fP() and \fBsetlogin\fP(), and a username associated with -a session, even if it has no controlling terminal. +OpenBSD には \fBgetlogin\fP() と \fBsetlogin\fP() があり、 セッションに対応したユーザ名がある。制御端末がない +セッションの場合であっても、対応するユーザ名がある。 .SH バグ -Unfortunately, it is often rather easy to fool \fBgetlogin\fP(). Sometimes it -does not work at all, because some program messed up the utmp file. Often, -it gives only the first 8 characters of the login name. The user currently -logged in on the controlling terminal of our program need not be the user -who started it. Avoid \fBgetlogin\fP() for security\-related purposes. +残念ながら、 \fBgetlogin\fP() をだますのはそれほど難しいことではない。別のプログラムが utmp ファイルを +壊してしまうと、全く動作しないこともある。またログイン名の最初の 8 文字 +しか返さないことも多い。また、プログラムの制御端末に現在ログインしているユーザーは、プログラムを実行したユーザーでない場合もある。 +セキュリティの絡む用途には \fBgetlogin\fP() を用いるべきではない。 .LP glibc は POSIX 仕様には従っておらず、 \fI/dev/tty\fP ではなく \fI標準入力 (stdin)\fP を使う。これはバグである。 (SunOS 5.8 や HP\-UX 11.11 や FreeBSD 4.8 といった他の最近のシステムはいずれも、 \fI標準入力\fP diff --git a/release/man3/lockf.3 b/release/man3/lockf.3 index 585e408c..1ddfbdc5 100644 --- a/release/man3/lockf.3 +++ b/release/man3/lockf.3 @@ -92,7 +92,7 @@ Linux では、 \fBlockf\fP() は単に \fBfcntl\fP(2) のロックへのイ \fIfd\fP が書き込み可能なファイルディスクリプタでない。 .TP \fBEDEADLK\fP -The command was \fBF_LOCK\fP and this lock operation would cause a deadlock. +コマンドが \fBF_LOCK\fP であり、このロック操作を行うとデッドロックが発生してしまう。 .TP \fBEINVAL\fP \fIfd\fP に無効な操作が指定された。 diff --git a/release/man3/sem_close.3 b/release/man3/sem_close.3 index 21b6079d..4de01fa1 100644 --- a/release/man3/sem_close.3 +++ b/release/man3/sem_close.3 @@ -38,7 +38,7 @@ sem_close \- 名前付きセマフォをクローズする \fBint sem_close(sem_t *\fP\fIsem\fP\fB);\fP .fi .sp -Link with \fI\-pthread\fP. +\fI\-pthread\fP とリンクする。 .SH 説明 \fBsem_close\fP() は \fIsem\fP が参照する名前付きセマフォをクローズし、 このセマフォ用に呼び出し元プロセスにシステムが割り当てていた リソースを解放できるようにする。 diff --git a/release/man3/sem_destroy.3 b/release/man3/sem_destroy.3 index 3e81f072..380f27f3 100644 --- a/release/man3/sem_destroy.3 +++ b/release/man3/sem_destroy.3 @@ -38,7 +38,7 @@ sem_destroy \- 名前なしセマフォを破棄する \fBint sem_destroy(sem_t *\fP\fIsem\fP\fB);\fP .fi .sp -Link with \fI\-pthread\fP. +\fI\-pthread\fP とリンクする。 .SH 説明 \fBsem_destroy\fP() は \fIsem\fP が指すアドレスにある名前なしセマフォを破棄する。 diff --git a/release/man3/sem_getvalue.3 b/release/man3/sem_getvalue.3 index 2011d133..4fcc3312 100644 --- a/release/man3/sem_getvalue.3 +++ b/release/man3/sem_getvalue.3 @@ -38,7 +38,7 @@ sem_getvalue \- セマフォの値を取得する \fBint sem_getvalue(sem_t *\fP\fIsem\fP\fB, int *\fP\fIsval\fP\fB);\fP .fi .sp -Link with \fI\-pthread\fP. +\fI\-pthread\fP とリンクする。 .SH 説明 \fBsem_getvalue\fP() は、 \fIsem\fP が指すセマフォの現在の値を \fIsval\fP で指す整数に格納する。 diff --git a/release/man3/sem_init.3 b/release/man3/sem_init.3 index 0fc97d5e..17cf1672 100644 --- a/release/man3/sem_init.3 +++ b/release/man3/sem_init.3 @@ -38,7 +38,7 @@ sem_init \- 名前なしセマフォを初期化する \fBint sem_init(sem_t *\fP\fIsem\fP\fB, int \fP\fIpshared\fP\fB, unsigned int \fP\fIvalue\fP\fB);\fP .fi .sp -Link with \fI\-pthread\fP. +\fI\-pthread\fP とリンクする。 .SH 説明 \fBsem_init\fP() は、 \fIsem\fP が指すアドレスにある名前なしセマフォを初期化する。 \fIvalue\fP 引き数はそのセマフォの初期値を指定する。 diff --git a/release/man3/sem_open.3 b/release/man3/sem_open.3 index 37d4a0ba..24bdb9e8 100644 --- a/release/man3/sem_open.3 +++ b/release/man3/sem_open.3 @@ -42,7 +42,7 @@ sem_open \- 名前付きセマフォを初期化し、オープンする \fB mode_t \fP\fImode\fP\fB, unsigned int \fP\fIvalue\fP\fB);\fP .fi .sp -Link with \fI\-pthread\fP. +\fI\-pthread\fP とリンクする。 .SH 説明 \fBsem_open\fP() は、新規の POSIX セマフォを作成するか、既存のセマフォのオープンを行う。 セマフォは \fIname\fP で識別される。 \fIname\fP の構成の詳細は \fBsem_overview\fP(7) を参照。 diff --git a/release/man3/sem_post.3 b/release/man3/sem_post.3 index 81d54538..2f2bee83 100644 --- a/release/man3/sem_post.3 +++ b/release/man3/sem_post.3 @@ -38,7 +38,7 @@ sem_post \- セマフォのロックを解除する \fBint sem_post(sem_t *\fP\fIsem\fP\fB);\fP .fi .sp -Link with \fI\-pthread\fP. +\fI\-pthread\fP とリンクする。 .SH 説明 \fBsem_post\fP() は、 \fIsem\fP が指すセマフォの値を 1 増やす (ロックを解除する)。その結果、 セマフォの値は 0 より大きな値に変化し、 \fBsem_wait\fP(3) で停止している別のプロセスやスレッドが呼び起こされ、 セマフォをロックできるようになる。 diff --git a/release/man3/sem_unlink.3 b/release/man3/sem_unlink.3 index d139e1b3..ccd83795 100644 --- a/release/man3/sem_unlink.3 +++ b/release/man3/sem_unlink.3 @@ -38,7 +38,7 @@ sem_unlink \- 名前付きセマフォを削除する \fBint sem_unlink(const char *\fP\fIname\fP\fB);\fP .fi .sp -Link with \fI\-pthread\fP. +\fI\-pthread\fP とリンクする。 .SH 説明 \fBsem_unlink\fP() は、 \fIname\fP で参照される名前付きセマフォを削除する。 セマフォの名前は直ちに削除される。 このセマフォをオープンしている他のすべてのプロセスがセマフォを 閉じて初めてセマフォの削除が行われる。 diff --git a/release/man3/sem_wait.3 b/release/man3/sem_wait.3 index c1781f32..8378a4f3 100644 --- a/release/man3/sem_wait.3 +++ b/release/man3/sem_wait.3 @@ -42,7 +42,7 @@ sem_wait, sem_timedwait, sem_trywait \- セマフォをロックする \fBint sem_timedwait(sem_t *\fP\fIsem\fP\fB, const struct timespec *\fP\fIabs_timeout\fP\fB);\fP .fi .sp -Link with \fI\-pthread\fP. +\fI\-pthread\fP とリンクする。 .sp .in -4n glibc 向けの機能検査マクロの要件 (\fBfeature_test_macros\fP(7) 参照): diff --git a/release/man3/sleep.3 b/release/man3/sleep.3 index 8685d7be..c161e381 100644 --- a/release/man3/sleep.3 +++ b/release/man3/sleep.3 @@ -30,7 +30,7 @@ .\"******************************************************************* .TH SLEEP 3 2010\-02\-03 GNU "Linux Programmer's Manual" .SH 名前 -sleep \- sleep for the specified number of seconds +sleep \- 指定の秒数の間だけ休止する .SH 書式 .nf \fB#include \fP diff --git a/release/man3/sysconf.3 b/release/man3/sysconf.3 index 9afa5f01..ba287e83 100644 --- a/release/man3/sysconf.3 +++ b/release/man3/sysconf.3 @@ -31,7 +31,7 @@ .\"******************************************************************* .TH SYSCONF 3 2013\-02\-12 GNU "Linux Programmer's Manual" .SH 名前 -sysconf \- get configuration information at run time +sysconf \- 動作中に設定情報を取得する .SH 書式 .nf \fB#include \fP @@ -55,16 +55,13 @@ POSIX では、アプリケーションがコンパイル時や実行時に、 .LP .\" and 999 to indicate support for options no longer present in the latest .\" standard. (?) -For options, typically, there is a constant \fB_POSIX_FOO\fP that may be -defined in \fI\fP. If it is undefined, one should ask at run -time. If it is defined to \-1, then the option is not supported. If it is -defined to 0, then relevant functions and headers exist, but one has to ask -at run time what degree of support is available. If it is defined to a -value other than \-1 or 0, then the option is supported. Usually the value -(such as 200112L) indicates the year and month of the POSIX revision -describing the option. Glibc uses the value 1 to indicate support as long -as the POSIX revision has not been published yet. The \fBsysconf\fP() -argument will be \fB_SC_FOO\fP. For a list of options, see \fBposixoptions\fP(7). +オプションを確認できるように、たいていは \fI\fP で定数 \fB_POSIX_FOO\fP が定義されている。 +定義されていないときは、実行時に問い合わせを行う必要がある。 その値が \-1 に定義されているときは、そのオプションはサポートされていない。 0 +に定義されているときは、関連する関数やヘッダファイルが存在するが、 どの程度サポートされているかは実行時に確認しなければならない。 \-1 でも 0 +でもない値に定義されているときは、そのオプションがサポート されている。通常は、そのオプションについて記載した POSIX の改訂年月 +を示す値になっている (例えば 200112L)。 glibc では 1 が設定されていると、そのオプションはサポートされているが、 POSIX +の改訂版がまだ発行されていないことを示す。 \fBsysconf\fP() の引き数には \fB_SC_FOO\fP を指定する。 オプションのリストについては +\fBposixoptions\fP(7) を参照のこと。 .LP 変数や制限を確認できるように、たいていは、 \fI\fP で定数 \fB_FOO\fP が、 \fI\fP で \fB_POSIX_FOO\fP が定義されている。 制限が規定されていない場合は定数は定義されない。 -- 2.11.0