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.11—96
xnu-1504.15.3—96
xnu-1504.3.12—96
xnu-1504.7.4—96
xnu-1504.9.17—96
xnu-1504.9.26—96
xnu-1504.9.37—96
xnu-1699.22.73—96
xnu-1699.22.81—96
xnu-1699.24.23—96
xnu-1699.26.8—96
xnu-1699.32.7—96
xnu-2050.22.13—96
xnu-2050.24.15—96
xnu-2050.48.11—96
xnu-2050.7.9—96
xnu-2050.9.2—96
xnu-2422.1.72—96
xnu-2422.100.13—96
xnu-2422.110.17—96
xnu-2422.90.20—96

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