sys_setpriority  [kernel/sys.c]


Sets the priorities of all of the specified processes to the specified value.

Arguments

eax 97
ebx It may be one of the following values:
PRIO_PROCESS - process identifier
PRIO_PGRP    - process group identifier
PRIO_USER    - user identifier
ecx This argument is interpreted relative to ebx:
For PRIO_PROCESS it should be a process identifier.
For PRIO_PGRP it should be a process group identifier.
For PRIO_USER it should be a user ID.
A zero value for ecx denotes (respectively) the calling process, the process group of the calling process, or the real user ID of the calling process.
edx A value in the range -20 to 19. The default priority is 0; lower priorities cause more favorable scheduling.

Return values

If the system call succeeds the return value is 0.
If the system call fails the return value is one of the following errno values:

-EINVAL ebx was not one of PRIO_PROCESS, PRIO_PGRP, or PRIO_USER.
-ESRCH No process was located using the ebx and ecx values specified.
-EPERM A process was located, but its effective user ID did not match either the effective or the real user ID of the caller, and was not privileged (did not have the CAP_SYS_NICE capability).

The details on the condition for EPERM depend on the system. Linux kernels before 2.6.12 required the real or effective user ID of the caller to match the real user of the process ecx (instead of its effective user ID). Linux 2.6.12 and later require the effective user ID of the caller to match the real or effective user ID of the process ecx.
-EACCES The caller attempted to lower a process priority, but did not have the required privilege (did not have the CAP_SYS_NICE capability). Since Linux 2.6.12, this error only occurs if the caller attempts to set a process priority outside the range of the RLIMIT_NICE soft resource limit of the target process; see sys_getrlimit for details.

Remarks

A child created by sys_fork inherits its parent's nice value. The nice value is preserved across sys_execve.

Compatibility

n/a