9.75 getprio/setprio

#define PRIO_PROCESS 1
#define PRIO_PGRP 2
#define PRIO_USER 3
#define PRIO_THREAD 4

#define PRIO_MIN (-20)
#define PRIO_MAX 20

int getprio(int which, int who);
int setprio(int which, int who, int prio);

These syscalls get and set niceness values, which says which entity to set the niceness to, while who the pid or id of the entity, 0 for the current caller.

who can be one of:

PRIO_PROCESS

Get or set the default niceness of a process. When set, this will make new threads created by a process be created with this niceness value, and make all exiting threads have that niceness, along with making child processes inherit the passed niceness.

PRIO_PGRP / PRIO_USER

Unimplemented, for future features.

PRIO_THREAD

Get or set the niceness of the passed thread. Setting this value does not affect the process niceness, or what will be reported when getting it, it will just be an outliar until niceness is set again, either thread-wide or process-wide.

getprio returns the niceness and -1 on failure, while setprio returns 0 on success and -1 on failure. Both in failure feature the following errno:

EINVAL

A value is not valid.