From 1998fd2c57112dac1f54b893b0a1e8bf55e1fcd7 Mon Sep 17 00:00:00 2001 From: Akihiro MOTOKI Date: Thu, 31 May 2012 04:03:57 +0900 Subject: [PATCH] (split) LDP: draft snapshots from latest ja.po(s). --- draft/man3/get_nprocs_conf.3 | 84 +++++++++++++++++++++ draft/man3/pthread_setcancelstate.3 | 145 ++++++++++++++++++++++++++++++++++++ draft/man3/pthread_setconcurrency.3 | 95 +++++++++++++++++++++++ draft/man7/libc.7 | 85 +++++++++++++++++++++ 4 files changed, 409 insertions(+) create mode 100644 draft/man3/get_nprocs_conf.3 create mode 100644 draft/man3/pthread_setcancelstate.3 create mode 100644 draft/man3/pthread_setconcurrency.3 create mode 100644 draft/man7/libc.7 diff --git a/draft/man3/get_nprocs_conf.3 b/draft/man3/get_nprocs_conf.3 new file mode 100644 index 00000000..eaec55f7 --- /dev/null +++ b/draft/man3/get_nprocs_conf.3 @@ -0,0 +1,84 @@ + +.\" Copyright (c) 2012, Petr Benas +.\" and Copyright (c) 2012, Michael Kerrisk +.\" +.\" 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. +.\"******************************************************************* +.\" +.\" This file was generated with po4a. Translate the source file. +.\" +.\"******************************************************************* +.TH GET_NPROCS 3 2012\-03\-20 GNU "Linux Programmer's Manual" +.SH 名前 +get_nprocs, get_nprocs_conf \- プロセッサ数を取得する +.SH 書式 +\fB#include \fP +.sp +\fBint get_nprocs(void);\fP +.br +\fBint get_nprocs_conf(void);\fP +.SH 説明 +\fBget_nprocs_conf\fP() 関数は、オペレーティングシステムで +設定されているプロセッサ数を返す。 + +\fBget_nprocs\fP() 関数は、システムで現在利用可能なプロセッサ数を返す。 +(例えば、ホットプラグが可能なシステムでは) +オフラインになっているプロセッサがある場合があるので、 +この数は \fBget_nprocs_conf\fP() が返す数より小さい場合がある。 +.SH 返り値 +「説明」の節で説明した通りである。 +.SH 準拠 +これらの関数は GNU による拡張である。 +.SH 注意 +.\" glibc 2.15 +これらの関数の現在の実装はかなりコストがかかる実装になっている。 +関数が呼ばれる度に \fI/sys\fP ファイルシステム内のファイルをオープンして +解析するようになっているからである。 + +以下の \fBsysconf\fP(3) の呼び出しで、このページに書かれている関数を使った +場合に返されるのと同じ情報を得ることができる。 +.nf + + np = sysconf(_SC_NPROCESSORS_CONF); /* processors configured */ + np = sysconf(_SC_NPROCESSORS_ONLN); /* processors available */ +.fi +.SH 例 +以下の例は、 \fBget_nprocs\fP() と \fBget_nprocs_conf\fP() が +どのように利用できるかを示すものである。 + +.nf +#include +#include + +int +main(int argc, char *argv[]) +{ + printf("This system has %d processors configured and " + "%d processors available.\en", + get_nprocs_conf(), get_nprocs()); + return 0; +} +.fi + +.SH この文書について +この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 3.41 の一部 +である。プロジェクトの説明とバグ報告に関する情報は +http://www.kernel.org/doc/man\-pages/ に書かれている。 diff --git a/draft/man3/pthread_setcancelstate.3 b/draft/man3/pthread_setcancelstate.3 new file mode 100644 index 00000000..bce61dd4 --- /dev/null +++ b/draft/man3/pthread_setcancelstate.3 @@ -0,0 +1,145 @@ +.\" Copyright (c) 2008 Linux Foundation, written by Michael Kerrisk +.\" +.\" +.\" 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. +.\" +.\"******************************************************************* +.\" +.\" This file was generated with po4a. Translate the source file. +.\" +.\"******************************************************************* +.TH PTHREAD_SETCANCELSTATE 3 2008\-11\-24 Linux "Linux Programmer's Manual" +.SH 名前 +pthread_setcancelstate, pthread_setcanceltype \- cancelability state と +type を設定する +.SH 書式 +.nf +\fB#include \fP + +\fBint pthread_setcancelstate(int \fP\fIstate\fP\fB, int *\fP\fIoldstate\fP\fB);\fP +\fBint pthread_setcanceltype(int \fP\fItype\fP\fB, int *\fP\fIoldtype\fP\fB);\fP +.sp +\fI\-pthread\fP でコンパイルしてリンクする。 +.fi +.SH 説明 +\fBpthread_setcancelstate\fP() は、呼び出したスレッドの +cancelability state に \fIstate\fP で指定された値を設定する。 +変更前のスレッドの cancelability state は +\fIoldstate\fP が指すバッファで返される。 +\fIstate\fP 引き数には以下の値のいずれか一つを指定しなければならない。 +.TP +\fBPTHREAD_CANCEL_ENABLE\fP +スレッドは取り消し可能 (cancelable) である。 +これが全ての新しく作成されるスレッドでのデフォルトの cancelability +state である。これには最初のスレッドも含まれる。 +スレッドの cancelability type により、取り消し可能なスレッドが +取り消し要求にいつ反応するかが決まる。 +.TP +\fBPTHREAD_CANCEL_DISABLE\fP +スレッドは取り消しできない。取り消し要求を受信した際は、 +取り消し可能に設定されるまでその要求はブロックされる。 +.PP +\fBpthread_setcanceltype\fP() は、呼び出したスレッドの +cancelability type に \fItype\fP で指定された値を設定する。 +変更前のスレッドの cancelability type は +\fIoldtype\fP が指すバッファで返される。 +\fItype\fP 引き数には以下の値のいずれか一つを指定しなければならない。 +.TP +\fBPTHREAD_CANCEL_DEFERRED\fP +そのスレッドが次に取り消しポイント (cancellation point) の関数を +呼び出すまで取り消し要求が遅延される。これが全ての新しく作成される +スレッドでのデフォルトの cancellation type である。 +これには最初のスレッドも含まれる。 +.TP +\fBPTHREAD_CANCEL_ASYNCHRONOUS\fP +スレッドはいつでも取り消すことができる (通常はすぐにキャンセルされるが、 +システムがそのことを保証しているわけではない)。 +.PP +これらの関数により実行される「設定と取得」操作 (set\-and\-get operation) は、 +同じ関数を呼び出したプロセス内の他のスレッドがあっても、 +アトミックに行われる。 +.SH 返り値 +成功すると、これらの関数は 0 を返す。 +エラーの場合、0 以外のエラー番号を返す。 +.SH エラー +\fBpthread_setcancelstate\fP() は以下のエラーで失敗する場合がある。 +.TP +\fBEINVAL\fP +\fIstate\fP に無効な値が指定された。 +.PP +\fBpthread_setcanceltype\fP() は以下のエラーで失敗する場合がある。 +.TP +\fBEINVAL\fP +.\" .SH VERSIONS +.\" Available since glibc 2.0 +\fItype\fP に無効な値が指定された。 +.SH 準拠 +POSIX.1\-2001. +.SH 注意 +スレッドが取り消された場合に何が起こるかの詳細については +\fBpthread_cancel\fP(3) を参照。 + +取り消し要求により中断されてはならない重要なアクションをスレッドが +実行する場合、短い時間だけ cancelability を無効にするのは有用である。 +長い時間 cancelability を無効にしたり、長い時間停止 (block) される +可能性のある操作の前後で cancelability を無効にしたりする際には +注意すること。なぜなら、無効にしてしまうと、キャンセル要求に対して +スレッドが応答しない状態になってしまうからである。 + +cancelability type を \fBPTHREAD_CANCEL_ASYNCHRONOUS\fP に設定して役に立つ +ことはめったにない。スレッドは\fIいつでも\fPキャンセルすることができること +になるので、スレッドが安全にリソースの確保 (例えば \fBmalloc\fP(3) で +メモリを割り当てる) や mutex、セマフォ、ロックなどの獲得を行うことがで +きない。アプリケーションは、スレッドがキャンセルされる際に、これらのリ +ソースがどのような状態にあるかを知る術はないので、リソースの確保が安全 +ではなくなる。つまり、キャンセルが起こったのが、リソースの確保前なのか、 +確保中なのか、確保後なのかが分からない。さらに、関数呼び出しの最中に +キャンセルが発生すると、いくつかの内部データ構造 (例えば、\fBmalloc\fP(3) +関連の関数が管理している未使用ブロックのリンクリスト) が一貫性のない +状態のままになってしまう可能性がある。その結果、クリーンアップハンドラ +が役に立たないものになってしまう。 +非同期で安全にキャンセルできる関数は \fIasync\-cancel\-safe functions\fP と +呼ばれる。 POSIX.1\-2001 で、非同期で安全にキャンセルできるように求めら +れている関数は \fBpthread_cancel\fP(3), \fBpthread_setcancelstate\fP(), +\fBpthread_setcanceltype\fP() だけである。一般的には、それ以外のライブラリ +関数は、非同期にキャンセルできるスレッドから安全に呼び出すことはできな +い。非同期でのキャンセルが有効な数少ない状況としては、純粋に計算だけを +行うループに入っているスレッドをキャンセルするといった場面がある。 + +.\" It looks like at least Solaris, FreeBSD and Tru64 support this. +Linux のスレッド実装では、 \fBpthread_setcancelstate\fP() の \fIoldstate\fP +引き数に NULL を指定することを認めている。 NULL が指定された場合、 +変更前の cancelability state の情報が呼び出し側に返されない。 +他の多くの実装でも \fIoldstate\fP 引き数に NULL を指定することを認めて +いるが、 POSIX.1\-2001 ではこの点については規定されていない。 +したがって、移植性が必要なアプリケーションでは常に \fIoldstate\fP に +NULL 以外の値を指定するようにすべきである。 +\fBpthread_setcanceltype\fP() の \fIoldtype\fP 引き数についても、 +全く同じことが言える。 +.SH 例 +\fBpthread_cancel\fP(3) を参照。 +.SH 関連項目 +\fBpthread_cancel\fP(3), \fBpthread_cleanup_push\fP(3), \fBpthread_testcancel\fP(3), +\fBpthreads\fP(7) +.SH この文書について +この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 3.41 の一部 +である。プロジェクトの説明とバグ報告に関する情報は +http://www.kernel.org/doc/man\-pages/ に書かれている。 diff --git a/draft/man3/pthread_setconcurrency.3 b/draft/man3/pthread_setconcurrency.3 new file mode 100644 index 00000000..24b7f006 --- /dev/null +++ b/draft/man3/pthread_setconcurrency.3 @@ -0,0 +1,95 @@ +.\" Copyright (c) 2009 Michael Kerrisk, +.\" +.\" 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. +.\" +.\"******************************************************************* +.\" +.\" This file was generated with po4a. Translate the source file. +.\" +.\"******************************************************************* +.TH PTHREAD_SETCONCURRENCY 3 2009\-04\-10 Linux "Linux Programmer's Manual" +.SH 名前 +pthread_setconcurrency, pthread_getconcurrency \- 並列処理レベルの設定/取得を行う +.SH 書式 +.nf +\fB#include \fP + +\fBint pthread_setconcurrency(int \fP\fInew_level\fP\fB);\fP +\fBint pthread_getconcurrency(void);\fP +.sp +\fI\-pthread\fP でコンパイルしてリンクする。 +.fi +.SH 説明 +\fBpthread_setconcurrency\fP() 関数は、アプリケーションが希望する +並列処理レベル (concurrency level) をスレッド実装に通知する。 +希望する並列処理レベルは \fInew_level\fP で指定する。 +スレッド実装はこの情報を参考情報として利用する。 +POSIX.1 では、 \fBpthread_setconcurrency\fP() の呼び出した結果、 +どのような並列度になるべきかは規定されていない。 + +\fInew_level\fP に 0 を指定すると、スレッド実装は並列処理レベルを +実装側で適切とみなしたレベルに設定するようになる。 + +\fBpthread_getconcurrency\fP() は、このプロセスの concurrency level +の現在値を返す。 +.SH 返り値 +成功すると、 \fBpthread_setconcurrency\fP() は 0 を返す。 +エラーの場合、 0 以外のエラー番号を返す。 + +\fBpthread_getconcurrency\fP() は常に成功し、最後の +\fBpthread_getconcurrency\fP() の呼び出しで設定された +concurrency level を返す。 \fBpthread_getconcurrency\fP() が +それまでに一度も呼び出されていない場合は 0 が返る。 +.SH エラー +\fBpthread_setconcurrency\fP() は以下のエラーで失敗する場合がある。 +.TP +\fBEINVAL\fP +\fInew_level\fP が負である。 +.PP +POSIX.1\-2001 には、エラー \fBEAGAIN\fP も記載されている +(「\fInew_level\fP に指定された値を適用すると、システムリソースが +超過してしまう」)。 +.SH バージョン +これらの関数は glibc バージョン 2.1 以降で利用できる。 +.SH 準拠 +POSIX.1\-2001. +.SH 注意 +デフォルトの concurrency level は 0 である。 + +並列処理レベルが意味を持つのは M:N スレッド実装の場合のみである。 +M:N スレッド実装では、ある瞬間において、あるプロセスのユーザレベルスレッ +ドの集合のサブ集合が、そのサブ集合のサイズよりも少ない数のカーネルの +スケジューリング実体 (kernel\-scheduling entity) に結び付けられる。 +並列処理レベルを設定すると、そのアプリケーションの効率的な実行に必要な +カーネルのスケジューリング実体の数のヒントを、アプリケーションはシステ +ムに伝えることができる。 + +LinuxThreads と NPTL のどちらも 1:1 スレッド実装であり、 +並列処理レベルを設定しても何の意味もない。 +言い換えると、 Linux では、これらの関数は、 +他のシステムとの互換性のためだけに存在し、 +プログラムの実行には何の影響も与えないということである。 +.SH 関連項目 +\fBpthread_attr_setscope\fP(3), \fBpthreads\fP(7) +.SH この文書について +この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 3.41 の一部 +である。プロジェクトの説明とバグ報告に関する情報は +http://www.kernel.org/doc/man\-pages/ に書かれている。 diff --git a/draft/man7/libc.7 b/draft/man7/libc.7 new file mode 100644 index 00000000..69af646d --- /dev/null +++ b/draft/man7/libc.7 @@ -0,0 +1,85 @@ +.\" Copyright (c) 2009 Linux Foundation, written by Michael Kerrisk +.\" +.\" +.\" 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. +.\" +.\"******************************************************************* +.\" +.\" This file was generated with po4a. Translate the source file. +.\" +.\"******************************************************************* +.TH LIBC 7 2009\-01\-13 Linux "Linux Programmer's Manual" +.SH 名前 +libc \- Linux の標準 C ライブラリの概要 +.SH 説明 +"libc" という用語は、一般には「標準 C ライブラリ」の短縮表現として +使われている。標準 C ライブラリは、全ての C 言語プログラム (や時には他 +の言語のプログラム) が使用することができる標準関数のライブラリである。 +いくつかの歴史的な理由 (下記参照) から、標準 C ライブラリを意味する +"libc" という用語は Linux ではいくらか曖昧さのある用語となっている。 +.SS glibc +Linux で群を抜いて広く使われている C ライブラリは GNU C ライブラリ +(\fIhttp://www.gnu.org/software/libc/\fP) であり、しばしば \fIglibc\fP と +呼ばれる。全ての主要な Linux ディストリビューションで現在使われている +C ライブラリである。 +この C ライブラリの詳細が \fIman\-pages\fP プロジェクトの一連のページ +(主にマニュアルのセクション 3) に記載されている。 +glibc のドキュメントは glibc のマニュアルにもあり、 +\fIinfo libc\fP コマンドで参照できる。 +glibc リリース 1.0 は 1992 年 9 月に作成された (それ以前に 0.x リリース +があった)。glibc の次のメジャーリリースは 2.0 であり、1997 年の初頭に +リリースされた。 + +パス名 \fI/lib/libc.so.6\fP (もしくは同様のパス名) は、通常は +glibc ライブラリがある場所を指すシンボリックリンクである。 +このパス名を実行すると、glibc はシステムにインストールされた +バージョンの glibc に関する様々な情報を表示する。 +.SS "Linux libc" +1990 年代の初めから中頃にかけて、しばらくの間 \fILinux libc\fP が存在した。 +Linux libc は、glibc 1.x から分かれたもので、当時の glibc の開発が +Linux の要望を満たしていないと感じたLinux 開発者が作成した。しばしば、 +このライブラリは (分かりにくいが) 単に "libc" と呼ばれていた。Linux +libc はメジャーバージョン 2, 3, 4, 5 がリリースされた(各リリースには多 +くのマイナーバージョンもあった)。しばらくの間、 Linux libc は多くの +Linux ディストリビューションの標準 C ライブラリであった。しかしながら、 +Linux libc の活動の元々の動機とは裏腹に、glibc 2.0 がリリースされる頃ま +でには、glibc は明らかに Linux libc よりも優れたものになっており、 程な +くして Linux libc を使っていた全ての主要な Linux ディストリビューション +が glibc に切り替えた。 (この切り替えは 10 年以上前に行われたので、 +\fIman\-pages\fP プロジェクトではもはや Linux libc の詳細に関する記載には +気を使っていない。しかしながら、マニュアルページによっては Linux libc +に関する情報の名残、特に \fIlibc4\fP や \fIlibc5\fP への言及、が残っており、 +歴史を見ることができる。) +.SS "他の C ライブラリ" +あまり広くは使われていないが、Linux 用の他の C ライブラリがいくつかある。 +これらのライブラリは、一般的には、機能とメモリ使用量の両方の面で glibc +より小さく、通常は小さなバイナリを作成することを目的としており、 +おそらく組み込み Linux システム用の開発に焦点を当てたものである。 +このようなライブラリとしては、\fIuClibc\fP (\fIhttp://www.uclibc.org/\fP) や +\fIdietlibc\fP (\fIhttp://www.fefe.de/dietlibc/\fP) がある。 +一般論としては、\fIman\-pages\fP プロジェクトでは +これらのライブラリの詳細はカバーされていない。 +.SH 関連項目 +\fBsyscalls\fP(2), \fBfeature_test_macros\fP(7), \fBman\-pages\fP(7), \fBstandards\fP(7) +.SH この文書について +この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 3.41 の一部 +である。プロジェクトの説明とバグ報告に関する情報は +http://www.kernel.org/doc/man\-pages/ に書かれている。 -- 2.11.0