X-Git-Url: http://git.osdn.net/view?a=blobdiff_plain;f=draft%2Fman2%2Fgetpriority.2;h=ddf9999327f07334bc6197339100899894a36630;hb=ad24a8da2d0555b45e75db36ccc1b56d01cc68e6;hp=b9884005e6594383bef24c6a73a3fcbbf926c425;hpb=4a0386e39e89bfc6e52c4cd5372b1a0d9c9bf08c;p=linuxjm%2FLDP_man-pages.git diff --git a/draft/man2/getpriority.2 b/draft/man2/getpriority.2 index b9884005..ddf99993 100644 --- a/draft/man2/getpriority.2 +++ b/draft/man2/getpriority.2 @@ -1,6 +1,7 @@ .\" Copyright (c) 1980, 1991 The Regents of the University of California. .\" All rights reserved. .\" +.\" %%%LICENSE_START(BSD_4_CLAUSE_UCB) .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: @@ -28,6 +29,7 @@ .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. +.\" %%%LICENSE_END .\" .\" @(#)getpriority.2 6.9 (Berkeley) 3/10/91 .\" @@ -43,353 +45,96 @@ .\" 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 -.SH ̾Á° -.\"O getpriority, setpriority \- get/set program scheduling priority -getpriority, setpriority \- ¥×¥í¥°¥é¥à¤Î¥¹¥±¥¸¥å¡¼¥ê¥ó¥°¤ÎÍ¥ÀèÅÙ¤ò¼èÆÀ/ÀßÄꤹ¤ë -.\"O .SH SYNOPSIS -.SH ½ñ¼° -.B #include +.\"******************************************************************* +.TH GETPRIORITY 2 2013\-02\-12 Linux "Linux Programmer's Manual" +.SH 名前 +getpriority, setpriority \- プログラムのスケジューリングの優先度を取得/設定する +.SH 書式 +\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 -.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) ¤Î -¼èÆÀ¤äÀßÄê¤ò¤½¤ì¤¾¤ì¹Ô¤¦¡£ +\fBint setpriority(int \fP\fIwhich\fP\fB, int \fP\fIwho\fP\fB, int \fP\fIprio\fP\fB);\fP +.SH 説明 +システムコール \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" -.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 -.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 -¤Ç»ØÄꤵ¤ì¤¿¥×¥í¥»¥¹¤¬Â¸ºß¤·¤Ê¤¤¡£ +\fBgetpriority\fP() コールは指定したプロセスの中の最も高い優先度 (数値的には最小の値) を返す。 \fBsetpriority\fP() +コールは指定したプロセス全ての優先度を指定した値に設定する。 優先度を今より小さい値に設定できるのはスーパーユーザーだけである。 +.SH 返り値 +\fBgetpriority\fP() は成功した場合にも \-1 の値を返す可能性があるので、 呼び出しの前に外部変数の \fIerrno\fP +をクリアし、呼び出しの後に返り値の \-1 が正当な値か エラーかを判別する必要がある。 \fBsetpriority\fP() コールはエラーがなければ 0 +を返し、エラーがあれば \-1 を返す。 +.SH エラー +.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) -¤ò»²¾È¡£ -.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" -.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 -.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 ÃͤÏÊݸ¤µ¤ì¤ë¡£ +上記のものに加えて \fBsetpriority\fP() では以下のエラーがある: +.TP +\fBEACCES\fP +呼び出し元がプロセスの優先度を下げようとしたが、必要な特権を 持っていなかった (Linux の場合、 \fBCAP_SYS_NICE\fP +ケーパビリティがなかった)。 Linux 2.6.12 以降では、呼び出し元が、あるプロセスの優先度を、 変更対象のプロセスのリソース +\fBRLIMIT_NICE\fP のソフトリミットの範囲外に設定しようとした場合にのみ、 このエラーが発生する。詳細は \fBgetrlimit\fP(2) +を参照。 +.TP +\fBEPERM\fP +プロセスは見つかったが、そのプロセスの実効 (effective) UID が 呼び出し元の実効UID にも実 (real) UID にも一致せず、 +呼び出し元が特権も持っていなかった (Linux の場合、 \fBCAP_SYS_NICE\fP ケーパビリティがなかった)。 以下の「注意」も参照のこと。 +.SH 準拠 +SVr4, 4.4BSD (これらの関数は 4.2BSD で最初に登場した), POSIX.1\-2001. +.SH 注意 +\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 ¤òɬÍפȤ¹¤ë¥¢¥×¥ê¥±¡¼¥·¥ç¥ó (Î㤨¤Ð -¥ª¡¼¥Ç¥£¥ª¡¦¥¢¥×¥ê¥±¡¼¥·¥ç¥ó) ¤Ë 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 ¤Ç¤¢¤ë¡£ +いくつかのシステムでは、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" -.SH ´ØÏ¢¹àÌÜ -.BR nice (1), -.BR renice (1), -.BR fork (2), -.BR capabilities (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 +現在では \fI\fP をインクルードする必要はないが、インクルードすれば移植性を高めることができる (実際には +\fI\fP で \fIrusage\fP 構造体が定義されているが、そのフィールドで使用されている +\fIstruct timeval\fP 型は \fI\fP で定義されている)。 +.SH バグ +POSIX では nice 値はプロセス単位の設定となっている。 一方、 現在の POSIX スレッドの Linux/NPTL 実装では、 nice +値はスレッド単位の属性である。 同じプロセスの別々のスレッドが異なる nice 値を持つ場合がある。 移植性が必要なアプリケーションではこの Linux +の動作を前提するのは避けるべきである。 Linux の動作は将来標準に準拠した動作になるかもしれない。 +.SH 関連項目 +\fBnice\fP(1), \fBrenice\fP(1), \fBfork\fP(2), \fBcapabilities\fP(7) + +Linux カーネルのソースツリー内の \fIDocumentation/scheduler/sched\-nice\-design.txt\fP (Linux +2.6.23 以降) +.SH この文書について +この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 3.52 の一部 +である。プロジェクトの説明とバグ報告に関する情報は +http://www.kernel.org/doc/man\-pages/ に書かれている。