X-Git-Url: http://git.osdn.net/view?p=linuxjm%2FLDP_man-pages.git;a=blobdiff_plain;f=draft%2Fman2%2Fgetpriority.2;h=7e0a0f100ff3c8e5297825ccbcdfdf5c0cb63688;hp=7f57f411b2e62230b7e488c69c1a88a5ca3862c2;hb=1d98b26905be2ad5ba08a94d65f57d872bae4f85;hpb=38394e00bdc712dc8637aada383aebb3a95a9cbf diff --git a/draft/man2/getpriority.2 b/draft/man2/getpriority.2 index 7f57f411..7e0a0f10 100644 --- a/draft/man2/getpriority.2 +++ b/draft/man2/getpriority.2 @@ -43,353 +43,88 @@ .\" FIXME Oct 2008: Denys Vlasenko is working on a PRIO_THREAD feature that .\" is likely to get included in mainline; this will need to be documented. .\" -.\" Japanese Version Copyright (c) 1997 HANATAKA Shinya -.\" all rights reserved. -.\" Translated 1997-02-22, HANATAKA Shinya -.\" Modified 2001-08-17, HANATAKA Shinya -.\" Modified 2001-10-18, Akihiro MOTOKI -.\" Updated 2001-12-13, Kentaro Shirakata -.\" Updated 2002-10-16, Kentaro Shirakata -.\" Updated 2005-02-24, Akihiro MOTOKI -.\" Updated 2005-10-07, Akihiro MOTOKI -.\" Updated 2008-08-04, Akihiro MOTOKI, LDP v3.05 +.\"******************************************************************* .\" -.\"WORD: scheduling スケジューリング -.\"WORD: piority 優先度 -.\"WORD: call コール -.\"WORD: user-ID UID -.\"WORD: process プロセス -.\"WORD: user ユーザー -.\"WORD: super user スーパー・ユーザー -.\"WORD: effective user-ID 実効UID -.\"WORD: real user-ID 実UID +.\" This file was generated with po4a. Translate the source file. .\" -.TH GETPRIORITY 2 2008-05-29 "Linux" "Linux Programmer's Manual" -.\"O .SH NAME +.\"******************************************************************* +.TH GETPRIORITY 2 2008\-05\-29 Linux "Linux Programmer's Manual" .SH 名前 -.\"O getpriority, setpriority \- get/set program scheduling priority getpriority, setpriority \- プログラムのスケジューリングの優先度を取得/設定する -.\"O .SH SYNOPSIS .SH 書式 -.B #include +\fB#include \fP .br -.B #include +\fB#include \fP .sp -.BI "int getpriority(int " which ", int " who ); +\fBint getpriority(int \fP\fIwhich\fP\fB, int \fP\fIwho\fP\fB);\fP .br -.BI "int setpriority(int " which ", int " who ", int " prio ); -.\"O .SH DESCRIPTION +\fBint setpriority(int \fP\fIwhich\fP\fB, int \fP\fIwho\fP\fB, int \fP\fIprio\fP\fB);\fP .SH 説明 -.\"O The scheduling priority of the process, process group, or user, as -.\"O indicated by -.\"O .I which -.\"O and -.\"O .I who -.\"O is obtained with the -.\"O .BR getpriority () -.\"O call and set with the -.\"O .BR setpriority () -.\"O call. -システムコール -.BR getpriority () -や -.BR setpriority () -は、 -.I which -と -.I who -で指定されたプロセス、プロセス・グループ、ユーザーの -スケジューリング優先度 (scheduling priority) の -取得や設定をそれぞれ行う。 +システムコール \fBgetpriority\fP() や \fBsetpriority\fP() は、 \fIwhich\fP と \fIwho\fP +で指定されたプロセス、プロセス・グループ、ユーザーの スケジューリング優先度 (scheduling priority) の 取得や設定をそれぞれ行う。 -.\"O The value -.\"O .I which -.\"O is one of -.\"O .BR PRIO_PROCESS , -.\"O .BR PRIO_PGRP , -.\"O or -.\"O .BR PRIO_USER , -.\"O and -.\"O .I who -.\"O is interpreted relative to -.\"O .I which -.\"O (a process identifier for -.\"O .BR PRIO_PROCESS , -.\"O process group -.\"O identifier for -.\"O .BR PRIO_PGRP , -.\"O and a user ID for -.\"O .BR PRIO_USER ). -.I which -の値は -.BR PRIO_PROCESS , -.BR PRIO_PGRP , -.BR PRIO_USER , -のどれか一つで、 -.I who -は -.I which -に応じて解釈される -.RB ( PRIO_PROCESS -だとプロセス識別子、 -.B PRIO_PGRP -だとプロセス・グループ識別子、 -.B PRIO_USER -だと UID (ユーザID) と解釈される)。 -.\"O A zero value for -.\"O .I who -.\"O denotes (respectively) the calling process, the process group of the -.\"O calling process, or the real user ID of the calling process. -.I who -がゼロならば、(それぞれ)呼び出したプロセス、 -呼び出したプロセスのプロセス・グループ、 -呼び出したプロセスの実UID を意味する。 -.\"O .I Prio -.\"O is a value in the range \-20 to 19 (but see the Notes below). -.\"O The default priority is 0; -.\"O lower priorities cause more favorable scheduling. -.I prio -は \-20 から 19 の範囲の値で (但し以下の注意の項を参照のこと)、 -デフォルトの優先度は 0 である; -小さな数字ほど、有利なスケジューリングとなる。 +\fIwhich\fP の値は \fBPRIO_PROCESS\fP, \fBPRIO_PGRP\fP, \fBPRIO_USER\fP, のどれか一つで、 \fIwho\fP は +\fIwhich\fP に応じて解釈される (\fBPRIO_PROCESS\fP だとプロセス識別子、 \fBPRIO_PGRP\fP だとプロセス・グループ識別子、 +\fBPRIO_USER\fP だと UID (ユーザID) と解釈される)。 \fIwho\fP がゼロならば、(それぞれ)呼び出したプロセス、 +呼び出したプロセスのプロセス・グループ、 呼び出したプロセスの実UID を意味する。 \fIprio\fP は \-20 から 19 の範囲の値で +(但し以下の注意の項を参照のこと)、 デフォルトの優先度は 0 である; 小さな数字ほど、有利なスケジューリングとなる。 -.\"O The -.\"O .BR getpriority () -.\"O call returns the highest priority (lowest numerical value) -.\"O enjoyed by any of the specified processes. -.\"O The -.\"O .BR setpriority () -.\"O call sets the priorities of all of the specified processes -.\"O to the specified value. -.\"O Only the superuser may lower priorities. -.BR getpriority () -コールは指定したプロセスの中の最も高い優先度 (数値的には最小の値) を返す。 -.BR setpriority () -コールは指定したプロセス全ての優先度を指定した値に設定する。 -優先度を今より小さい値に設定できるのはスーパー・ユーザーだけである。 -.\"O .SH "RETURN VALUE" +\fBgetpriority\fP() コールは指定したプロセスの中の最も高い優先度 (数値的には最小の値) を返す。 \fBsetpriority\fP() +コールは指定したプロセス全ての優先度を指定した値に設定する。 優先度を今より小さい値に設定できるのはスーパー・ユーザーだけである。 .SH 返り値 -.\"O Since -.\"O .BR getpriority () -.\"O can legitimately return the value \-1, it is necessary -.\"O to clear the external variable -.\"O .I errno -.\"O prior to the -.\"O call, then check it afterward to determine -.\"O if \-1 is an error or a legitimate value. -.\"O The -.\"O .BR setpriority () -.\"O call returns 0 if there is no error, or -.\"O \-1 if there is. -.BR getpriority () -は成功した場合にも \-1 の値を返す可能性があるので、 -呼び出しの前に外部変数の -.I errno -をクリアし、呼び出しの後に返り値の \-1 が正当な値か -エラーかを判別する必要がある。 -.BR setpriority () -コールはエラーがなければ 0 を返し、エラーがあれば \-1 を返す。 - -.\"O .SH ERRORS +\fBgetpriority\fP() は成功した場合にも \-1 の値を返す可能性があるので、 呼び出しの前に外部変数の \fIerrno\fP +をクリアし、呼び出しの後に返り値の \-1 が正当な値か エラーかを判別する必要がある。 \fBsetpriority\fP() コールはエラーがなければ 0 +を返し、エラーがあれば \-1 を返す。 .SH エラー -.TP -.B EINVAL -.\"O .I which -.\"O was not one of -.\"O .BR PRIO_PROCESS , -.\"O .BR PRIO_PGRP , -.\"O or -.\"O .BR PRIO_USER . -.I which -が -.BR PRIO_PROCESS , -.BR PRIO_PGRP , -.B PRIO_USER -のいずれでもない。 -.TP -.B ESRCH -.\"O No process was located using the -.\"O .I which -.\"O and -.\"O .I who -.\"O values specified. -.I which -と -.I who -で指定されたプロセスが存在しない。 +.TP +\fBEINVAL\fP +\fIwhich\fP が \fBPRIO_PROCESS\fP, \fBPRIO_PGRP\fP, \fBPRIO_USER\fP のいずれでもない。 +.TP +\fBESRCH\fP +\fIwhich\fP と \fIwho\fP で指定されたプロセスが存在しない。 .PP -.\"O In addition to the errors indicated above, -.\"O .BR setpriority () -.\"O may fail if: -上記のものに加えて -.BR setpriority () -では以下のエラーがある: -.TP -.B EACCES -.\"O The caller attempted to lower a process priority, but did not -.\"O have the required privilege (on Linux: did not have the -.\"O .B CAP_SYS_NICE -.\"O capability). -.\"O Since Linux 2.6.12, this error only occurs if the caller attempts -.\"O to set a process priority outside the range of the -.\"O .B RLIMIT_NICE -.\"O soft resource limit of the target process; see -.\"O .BR getrlimit (2) -.\"O for details. -呼び出し元がプロセスの優先度を下げようとしたが、必要な特権を -持っていなかった (Linux の場合、 -.B CAP_SYS_NICE -ケーパビリティがなかった)。 -Linux 2.6.12 以降では、呼び出し元が、あるプロセスの優先度を、 -変更対象のプロセスのリソース -.B RLIMIT_NICE -のソフト・リミットの範囲外に設定しようとした場合にのみ、 -このエラーが発生する。詳細は -.BR getrlimit (2) +上記のものに加えて \fBsetpriority\fP() では以下のエラーがある: +.TP +\fBEACCES\fP +呼び出し元がプロセスの優先度を下げようとしたが、必要な特権を 持っていなかった (Linux の場合、 \fBCAP_SYS_NICE\fP +ケーパビリティがなかった)。 Linux 2.6.12 以降では、呼び出し元が、あるプロセスの優先度を、 変更対象のプロセスのリソース +\fBRLIMIT_NICE\fP のソフト・リミットの範囲外に設定しようとした場合にのみ、 このエラーが発生する。詳細は \fBgetrlimit\fP(2) を参照。 -.TP -.B EPERM -.\"O A process was located, but its effective user ID did not match -.\"O either the effective or the real user ID of the caller, -.\"O and was not privileged (on Linux: did not have the -.\"O .B CAP_SYS_NICE -.\"O capability). -.\"O But see NOTES below. -プロセスは見つかったが、そのプロセスの実効 (effective) UID が -呼び出し元の実効UID にも実 (real) UID にも一致せず、 -呼び出し元が特権も持っていなかった (Linux の場合、 -.B CAP_SYS_NICE -ケーパビリティがなかった)。 -以下の「注意」も参照のこと。 -.\"O .SH "CONFORMING TO" +.TP +\fBEPERM\fP +プロセスは見つかったが、そのプロセスの実効 (effective) UID が 呼び出し元の実効UID にも実 (real) UID にも一致せず、 +呼び出し元が特権も持っていなかった (Linux の場合、 \fBCAP_SYS_NICE\fP ケーパビリティがなかった)。 以下の「注意」も参照のこと。 .SH 準拠 -.\"O SVr4, 4.4BSD (these function calls first appeared in 4.2BSD), -.\"O POSIX.1-2001. -SVr4, 4.4BSD (これらの関数は 4.2BSD で最初に登場した), -POSIX.1-2001. -.\"O .SH NOTES +SVr4, 4.4BSD (これらの関数は 4.2BSD で最初に登場した), POSIX.1\-2001. .SH 注意 -.\"O A child created by -.\"O .BR fork (2) -.\"O inherits its parent's nice value. -.\"O The nice value is preserved across -.\"O .BR execve (2). -.BR fork (2) -で作成された子プロセスは、 -親プロセスの nice 値を継承する。 -.BR execve (2) -の前後で nice 値は保存される。 +\fBfork\fP(2) で作成された子プロセスは、 親プロセスの nice 値を継承する。 \fBexecve\fP(2) の前後で nice +値は保存される。 -.\"O The degree to which their relative nice value affects the scheduling of -.\"O processes varies across UNIX systems, and, -.\"O on Linux, across kernel versions. -.\"O Starting with kernel 2.6.23, Linux adopted an algorithm that causes -.\"O relative differences in nice values to have a much stronger effect. -.\"O This causes very low nice values (+19) to truly provide little CPU -.\"O to a process whenever there is any other -.\"O higher priority load on the system, -.\"O and makes high nice values (\-20) deliver most of the CPU to applications -.\"O that require it (e.g., some audio applications). -相対的な nice 値の違いがプロセス間のスケジューリングにどの程度影響を与えるか -は、UNIX システム間で異なり、Linux ではカーネルバージョンにより異なる。 -Linux は、カーネル 2.6.23 以降で、nice 値の相対的な違いが、非常に強い影響を -与えるアルゴリズムを採用した。このアルゴリズムでは、 -他に優先度の高いものがシステムに存在する時には、 -非常に低い nice 値 (+19) ではプロセスに本当にほとんど CPU が割り当てられない。 -また、高い nice 値 (\-20) では CPU を必要とするアプリケーション (例えば +相対的な nice 値の違いがプロセス間のスケジューリングにどの程度影響を与えるか は、UNIX システム間で異なり、Linux +ではカーネルバージョンにより異なる。 Linux は、カーネル 2.6.23 以降で、nice 値の相対的な違いが、非常に強い影響を +与えるアルゴリズムを採用した。このアルゴリズムでは、 他に優先度の高いものがシステムに存在する時には、 非常に低い nice 値 (+19) +ではプロセスに本当にほとんど CPU が割り当てられない。 また、高い nice 値 (\-20) では CPU を必要とするアプリケーション (例えば オーディオ・アプリケーション) に CPU のほとんどが割り当てられる。 -.\"O The details on the condition for -.\"O .B EPERM -.\"O depend on the system. -.B EPERM -が発生する条件の詳細はシステムに依存する。 -.\"O The above description is what POSIX.1-2001 says, and seems to be followed on -.\"O all System V-like systems. -上記の説明は POSIX.1-2001 のものであり、全ての System V 風システムは -これに従っているようである。 -.\"O Linux kernels before 2.6.12 required the real or -.\"O effective user ID of the caller to match -.\"O the real user of the process \fIwho\fP (instead of its effective user ID). -2.6.12 より前の Linux カーネルでは、呼び出し元の実 UID または -実効 UID がプロセス \fIwho\fP の (実効 UID でなく) -実 UID に一致する必要がある。 -.\"O Linux 2.6.12 and later require -.\"O the effective user ID of the caller to match -.\"O the real or effective user ID of the process \fIwho\fP. -.\"O All BSD-like systems (SunOS 4.1.3, Ultrix 4.2, -.\"O 4.3BSD, FreeBSD 4.3, OpenBSD-2.5, ...) behave in the same -.\"O manner as Linux 2.6.12 and later. -Linux 2.6.12 以降では、呼び出し元の実行 UID がプロセス \fIwho\fP -の実 UID か実効 UID のいずれかと一致する必要がある。 -全ての BSD 風システム (SunOS 4.1.3, Ultrix 4.2, -4.3BSD, FreeBSD 4.3, OpenBSD-2.5等) は、 -Linux 2.6.12 以降と同じ動作をする。 +\fBEPERM\fP が発生する条件の詳細はシステムに依存する。 上記の説明は POSIX.1\-2001 のものであり、全ての System V +風システムは これに従っているようである。 2.6.12 より前の Linux カーネルでは、呼び出し元の実 UID または 実効 UID がプロセス +\fIwho\fP の (実効 UID でなく) 実 UID に一致する必要がある。 Linux 2.6.12 以降では、呼び出し元の実行 UID +がプロセス \fIwho\fP の実 UID か実効 UID のいずれかと一致する必要がある。 全ての BSD 風システム (SunOS 4.1.3, +Ultrix 4.2, 4.3BSD, FreeBSD 4.3, OpenBSD\-2.5等) は、 Linux 2.6.12 以降と同じ動作をする。 .LP -.\"O The actual priority range varies between kernel versions. -.\"O Linux before 1.3.36 had \-infinity..15. -.\"O Since kernel 1.3.43 Linux has the range \-20..19. -.\"O Within the kernel, nice values are actually represented -.\"O using the corresponding range 40..1 -.\"O (since negative numbers are error codes) and these are the values -.\"O employed by the -.\"O .BR setpriority () -.\"O and -.\"O .BR getpriority () -.\"O system calls. -.\"O The glibc wrapper functions for these system calls handle the -.\"O translations between the user-land and kernel representations -.\"O of the nice value according to the formula -.\"O .IR "unice\ =\ 20\ \-\ knice" . -実際の優先度の値の範囲はカーネルのバージョンによって異なる。 -1.3.36 より前の Linux では、優先度の範囲は負の無限大 〜 15 である。 -1.3.43 以降の Linux では、優先度の範囲は \-20 〜 19 である。 -カーネル内部では、nice 値は実際には 40 〜 1 の範囲を使って -表現されており (負の値はエラーコードとなるため)、こちらの値が -システムコール -.BR setpriority () -と -.BR getpriority () -で使用されている。 -glibc のこれらのシステムコールのラッパー関数において、nice 値の -ユーザ領域 (user-land) とカーネル表現の間の変換が行われる。 -変換式は以下の通り: -.I "unice\ =\ 20\ \-\ knice" +実際の優先度の値の範囲はカーネルのバージョンによって異なる。 1.3.36 より前の Linux では、優先度の範囲は負の無限大 〜 15 である。 +1.3.43 以降の Linux では、優先度の範囲は \-20 〜 19 である。 カーネル内部では、nice 値は実際には 40 〜 1 +の範囲を使って 表現されており (負の値はエラーコードとなるため)、こちらの値が システムコール \fBsetpriority\fP() と +\fBgetpriority\fP() で使用されている。 glibc のこれらのシステムコールのラッパー関数において、nice 値の ユーザ領域 +(user\-land) とカーネル表現の間の変換が行われる。 変換式は以下の通り: \fIunice\ =\ 20\ \-\ knice\fP .LP -.\"O On some systems, the range of nice values is \-20..20. いくつかのシステムでは、nice 値の範囲は \20 〜 20 である。 .LP -.\"O Including -.\"O .I -.\"O is not required these days, but increases portability. -.\"O (Indeed, -.\"O .I -.\"O defines the -.\"O .I rusage -.\"O structure with fields of type -.\"O .I struct timeval -.\"O defined in -.\"O .IR .) -現在では -.I -をインクルードする必要はないが、インクルードすれば移植性を高めることができる -(実際には -.I -で -.I rusage -構造体が定義されているが、そのフィールドで使用されている -.I struct timeval -型は -.I -で定義されている)。 -.\"O .SH "SEE ALSO" +現在では \fI\fP をインクルードする必要はないが、インクルードすれば移植性を高めることができる (実際には +\fI\fP で \fIrusage\fP 構造体が定義されているが、そのフィールドで使用されている +\fIstruct timeval\fP 型は \fI\fP で定義されている)。 .SH 関連項目 -.BR nice (1), -.BR renice (1), -.BR fork (2), -.BR capabilities (7) +\fBnice\fP(1), \fBrenice\fP(1), \fBfork\fP(2), \fBcapabilities\fP(7) .sp -.\"O .I Documentation/scheduler/sched-nice-design.txt -.\"O in the kernel source tree (since Linux 2.6.23). (Linux 2.6.23 以降の) カーネルのソースツリー内の -.I Documentation/scheduler/sched-nice-design.txt +\fIDocumentation/scheduler/sched\-nice\-design.txt\fP