OSDN Git Service

(split) LDP: Release pages for LDP v3.39.
[linuxjm/LDP_man-pages.git] / release / man2 / nice.2
1 .\" Hey Emacs! This file is -*- nroff -*- source.
2 .\"
3 .\" Copyright (c) 1992 Drew Eckhardt <drew@cs.colorado.edu>, March 28, 1992
4 .\"
5 .\" Permission is granted to make and distribute verbatim copies of this
6 .\" manual provided the copyright notice and this permission notice are
7 .\" preserved on all copies.
8 .\"
9 .\" Permission is granted to copy and distribute modified versions of this
10 .\" manual under the conditions for verbatim copying, provided that the
11 .\" entire resulting derived work is distributed under the terms of a
12 .\" permission notice identical to this one.
13 .\"
14 .\" Since the Linux kernel and libraries are constantly changing, this
15 .\" manual page may be incorrect or out-of-date.  The author(s) assume no
16 .\" responsibility for errors or omissions, or for damages resulting from
17 .\" the use of the information contained herein.  The author(s) may not
18 .\" have taken the same level of care in the production of this manual,
19 .\" which is licensed free of charge, as they might when working
20 .\" professionally.
21 .\"
22 .\" Formatted or processed versions of this manual, if unaccompanied by
23 .\" the source, must acknowledge the copyright and authors of this work.
24 .\"
25 .\" Modified by Michael Haardt <michael@moria.de>
26 .\" Modified 1993-07-24 by Rik Faith <faith@cs.unc.edu>
27 .\" Modified 1996-11-04 by Eric S. Raymond <esr@thyrsus.com>
28 .\" Modified 2001-06-04 by aeb
29 .\" Modified 2004-05-27 by Michael Kerrisk <mtk.manpages@gmail.com>
30 .\"
31 .\"*******************************************************************
32 .\"
33 .\" This file was generated with po4a. Translate the source file.
34 .\"
35 .\"*******************************************************************
36 .TH NICE 2 2007\-07\-26 Linux "Linux Programmer's Manual"
37 .SH 名前
38 nice \- プロセスの優先度を変更する
39 .SH 書式
40 \fB#include <unistd.h>\fP
41 .sp
42 \fBint nice(int \fP\fIinc\fP\fB);\fP
43 .sp
44 .in -4n
45 glibc 向けの機能検査マクロの要件 (\fBfeature_test_macros\fP(7)  参照):
46 .in
47 .sp
48 \fBnice\fP(): _BSD_SOURCE || _SVID_SOURCE || _XOPEN_SOURCE
49 .SH 説明
50 \fBnice\fP()  は \fIinc\fP の値を \fBnice\fP を呼んだプロセスの nice 値に加える (nice
51 値が大きい数値ほど低い優先度を表す)。 負の数を指定する、つまり、以前よりも優先度を上げるという指定ができるのは スーパーユーザーだけである。 nice
52 値の範囲については \fBgetpriority\fP(2)  で説明されている。
53 .SH 返り値
54 成功した場合、新しい nice 値が返る (但し、下記の「注意」を参照)。 失敗した場合 \-1 が返り、 \fIerrno\fP
55 がエラーの内容に従って設定される。
56 .SH エラー
57 .TP 
58 \fBEPERM\fP
59 スーパーユーザー以外が \fIinc\fP に負の数値を指定して優先度を上げようとした。 呼び出し元のプロセスが \fIinc\fP
60 に負の数値を指定して優先度を上げようとしたが、 十分な権限を持っていなかった。 Linux では \fBCAP_SYS_NICE\fP
61 ケーパビリティが必要である。 (\fBsetrlimit\fP(2)  のリソース上限 \fBRLIMIT_NICE\fP に関する議論も参照のこと)。
62 .SH 準拠
63 SVr4, 4.3BSD, POSIX.1\-2001.  しかし、Linux と (2.2.4より古い) (g)libc では返り値は標準と異なる。
64 詳細は以下を参照のこと。 SVr4 には他に \fBEINVAL\fP エラーコードについての記述がある。
65 .SH 注意
66 SUSv2 と POSIX 1003.1\-2003 では、 \fBnice\fP()  は新しい nice 値を返すと規定されている。 一方、Linux
67 システムコールと (2.2.4 より古い) (g)libc ライブラリ関数は 成功時に 0 を返す。新しい nice 値は
68 \fBgetpriority\fP(2)  を使って取得できる。
69
70 glibc 2.2.4 以降では、 \fBnice\fP()  は \fBgetpriority\fP(2)  を呼び出すライブラリ関数として実装されており、
71 呼び出し元に返す新しい nice 値を \fBgetpriority\fP(2)  を呼び出して取得するようになっている。 この実装では、正常な動作でも \-1
72 が返される可能性がある。 確実にエラーを検出するためには、 呼び出しの前に \fIerrno\fP に 0 を設定し、 \fBnice\fP()  が \-1
73 を返したときに errno をチェックすると良い。
74 .SH 関連項目
75 \fBnice\fP(1), \fBrenice\fP(1), \fBfork\fP(2), \fBgetpriority\fP(2), \fBsetpriority\fP(2),
76 \fBcapabilities\fP(7)