Skip to content
BSD syscall#96

svc · unix #96

setpriority

Sets the scheduling nice value for a process, group, or user.

Prototype

int setpriority(int which, id_t who, int prio);

Returns: int

Arguments

NameTypeDirDescription
whichint-
whoid_t-
prioint-

Version history

XNU tagmacOS#
xnu-1456.1.26macOS 10.6 Snow Leopard96
xnu-1699.24.8macOS 10.7 Lion96
xnu-2050.18.24macOS 10.8 Mountain Lion96
xnu-2422.115.4macOS 10.9 Mavericks96
xnu-1486.2.1196
xnu-1504.15.396
xnu-1504.3.1296
xnu-1504.7.496
xnu-1504.9.1796
xnu-1504.9.2696
xnu-1504.9.3796
xnu-1699.22.7396
xnu-1699.22.8196
xnu-1699.24.2396
xnu-1699.26.896
xnu-1699.32.796
xnu-2050.22.1396
xnu-2050.24.1596
xnu-2050.48.1196
xnu-2050.7.996
xnu-2050.9.296
xnu-2422.1.7296
xnu-2422.100.1396
xnu-2422.110.1796
xnu-2422.90.2096

Notes

Only root can lower the nice value (raise priority); unprivileged callers can only raise nice. On macOS, nice() and setpriority() influence the BSD scheduler's tier but not the Mach thread QoS — coexisting QoS classes can dominate scheduling regardless of nice.

Related APIs

getprioritygetrusagegetrlimitsetrlimitproc_rlimit_control