sched_setparam

Section: System Calls (2)
Updated: 2026-02-08
Index JM Home Page roff page
 

名前

sched_setparam, sched_getparam - スケジューリングパラメーターの設定と取得を行なう  

ライブラリ

標準 C ライブラリ (libc,~-lc)  

書式

#include <sched.h>

int sched_setparam(pid_t pid, const struct sched_param *param);
int sched_getparam(pid_t pid, struct sched_param *param);

struct sched_param {
    ...
    int sched_priority;
    ...
};
 

説明

sched_setparam() sets the scheduling parameters associated with the scheduling policy for the thread whose thread ID is specified in pid. If pid is zero, then the parameters of the calling thread are set. The interpretation of the argument param depends on the scheduling policy of the thread identified by pid. See sched(7) for a description of the scheduling policies supported under Linux.

sched_getparam() は pid で指定されたスレッドのスケジューリングパラメーターを取得する。 pid が 0 ならば、呼び出し元のスレッドのパラメーターを取得する。

sched_setparam() はスレッドのスケジューリング方針における param の妥当性をチェックする。 param->sched_priority の値は sched_get_priority_min(2) と sched_get_priority_max(2) の範囲に入っていなければならない。

スケジューリングの優先度と方針に関連する特権とリソース制限の 議論に関しては sched(7) を参照のこと。

sched_setparam() と sched_getparam() が使用できる POSIX システムでは、 <unistd.h> に _POSIX_PRIORITY_SCHEDULING が定義されている。  

返り値

On success, sched_setparam() and sched_getparam() return 0. On error, -1 is returned, and errno is set to indicate the error.  

エラー

EINVAL
無効な引数: param が NULL である、または pid が負である。
EINVAL
(sched_setparam()) 引数 param が現在のスケジューリング方針においては 無意味である。
EPERM
(sched_setparam()) 呼び出し元が適切な特権を持っていない (Linux では、 CAP_SYS_NICE ケーパビリティを持っていない)。
ESRCH
ID が pid のスレッドが見つからなかった。
 

標準規格

POSIX.1-2024.  

歴史


 POSIX.1-2001.  

関連項目


 getpriority(2), gettid(2), nice(2), sched_get_priority_max(2), sched_get_priority_min(2), sched_getaffinity(2), sched_getscheduler(2), sched_setaffinity(2), sched_setattr(2), sched_setscheduler(2), setpriority(2), capabilities(7), sched(7)


 

Index

名前
ライブラリ
書式
説明
返り値
エラー
標準規格
歴史
関連項目

This document was created by man2html, using the manual pages.