MCPcopy Create free account
hub / github.com/F-Stack/f-stack / donice

Function donice

freebsd/kern/kern_resource.c:267–283  ·  view source on GitHub ↗

* Set "nice" for a (whole) process. */

Source from the content-addressed store, hash-verified

265 * Set "nice" for a (whole) process.
266 */
267static int
268donice(struct thread *td, struct proc *p, int n)
269{
270 int error;
271
272 PROC_LOCK_ASSERT(p, MA_OWNED);
273 if ((error = p_cansched(td, p)))
274 return (error);
275 if (n > PRIO_MAX)
276 n = PRIO_MAX;
277 if (n < PRIO_MIN)
278 n = PRIO_MIN;
279 if (n < p->p_nice && priv_check(td, PRIV_SCHED_SETPRIORITY) != 0)
280 return (EACCES);
281 sched_nice(p, n);
282 return (0);
283}
284
285static int unprivileged_idprio;
286SYSCTL_INT(_security_bsd, OID_AUTO, unprivileged_idprio, CTLFLAG_RW,

Callers 1

kern_setpriorityFunction · 0.85

Calls 3

p_canschedFunction · 0.85
priv_checkFunction · 0.70
sched_niceFunction · 0.70

Tested by

no test coverage detected