.\" Copyright (c) 1992 Drew Eckhardt , March 28, 1992 .\" .\" %%%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 by Michael Haardt .\" Modified 1993-07-24 by Rik Faith .\" Modified 1996-11-04 by Eric S. Raymond .\" Modified 2001-06-04 by aeb .\" Modified 2004-05-27 by Michael Kerrisk .\" .\"******************************************************************* .\" .\" This file was generated with po4a. Translate the source file. .\" .\"******************************************************************* .\" .\" Japanese Version Copyright (c) 1997 SUTO, Mitsuaki .\" all rights reserved. .\" Translated 1997-06-26, SUTO, Mitsuaki .\" Updated 2001-06-25, Kentaro Shirakata .\" Updated 2005-09-03, Akihiro MOTOKI .\" Updated 2005-10-07, Akihiro MOTOKI .\" .TH NICE 2 2014\-04\-28 Linux "Linux Programmer's Manual" .SH 名前 nice \- プロセスの優先度を変更する .SH 書式 \fB#include \fP .sp \fBint nice(int \fP\fIinc\fP\fB);\fP .sp .in -4n glibc 向けの機能検査マクロの要件 (\fBfeature_test_macros\fP(7) 参照): .in .sp \fBnice\fP(): _BSD_SOURCE || _SVID_SOURCE || _XOPEN_SOURCE .SH 説明 \fBnice\fP() は \fIinc\fP の値を \fBnice\fP を呼んだプロセスの nice 値に加える (nice 値が大きい数値ほど低い優先度を表す)。 負の数を指定する、つまり、以前よりも優先度を上げるという指定ができるのは スーパーユーザーだけである。 nice 値の範囲については \fBgetpriority\fP(2) で説明されている。 .SH 返り値 成功した場合、新しい nice 値が返る (但し、下記の「注意」を参照)。 失敗した場合 \-1 が返り、 \fIerrno\fP がエラーの内容に従って設定される。 .SH エラー .TP \fBEPERM\fP スーパーユーザー以外が \fIinc\fP に負の数値を指定して優先度を上げようとした。 呼び出し元のプロセスが \fIinc\fP に負の数値を指定して優先度を上げようとしたが、 十分な権限を持っていなかった。 Linux では \fBCAP_SYS_NICE\fP ケーパビリティが必要である。 (\fBsetrlimit\fP(2) のリソース上限 \fBRLIMIT_NICE\fP に関する議論も参照のこと)。 .SH 準拠 SVr4, 4.3BSD, POSIX.1\-2001. しかし、Linux と (2.2.4より古い) (g)libc では返り値は標準と異なる。 詳細は以下を参照のこと。 SVr4 には他に \fBEINVAL\fP エラーコードについての記述がある。 .SH 注意 SUSv2 と POSIX 1003.1\-2003 では、 \fBnice\fP() は新しい nice 値を返すと規定されている。 一方、Linux システムコールと (2.2.4 より古い) (g)libc ライブラリ関数は 成功時に 0 を返す。新しい nice 値は \fBgetpriority\fP(2) を使って取得できる。 glibc 2.2.4 以降では、 \fBnice\fP() は \fBgetpriority\fP(2) を呼び出すライブラリ関数として実装されており、 呼び出し元に返す新しい nice 値を \fBgetpriority\fP(2) を呼び出して取得するようになっている。 この実装では、正常な動作でも \-1 が返される可能性がある。 確実にエラーを検出するためには、 呼び出しの前に \fIerrno\fP に 0 を設定し、 \fBnice\fP() が \-1 を返したときに errno をチェックすると良い。 .SH 関連項目 \fBnice\fP(1), \fBrenice\fP(1), \fBfork\fP(2), \fBgetpriority\fP(2), \fBsetpriority\fP(2), \fBcapabilities\fP(7), \fBsched\fP(7) .SH この文書について この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 3.79 の一部 である。プロジェクトの説明とバグ報告に関する情報は http://www.kernel.org/doc/man\-pages/ に書かれている。