nice(1) takes an absolute priority argument

Geoff Collyer geoff at utcs.UUCP
Tue Dec 4 17:38:01 AEST 1984


Index:	bin/nice.c 4.2BSD

Description:
	Despite the claim in nice(1) that the number argument is the
	amount by which ``the priority is incremented'', it is actually
	presented to setpriority(2) as an *absolute* priority, not an
	increment.
Repeat-By:
	As an ordinary (non-super) user, type
		nice -2 nice -1 date
	nice will print
		setpriority: Permission denied
Fix:
	My fix was to use nice(3c) instead of the overkill of getpriority(2).
	Diffs follow:
7,9d4
< #include <sys/time.h>
< #include <sys/resource.h>
< 
24,27c20
< 	if (setpriority(PRIO_PROCESS, 0, nicarg) < 0) {
< 		perror("setpriority");
< 		exit(1);
< 	}
---
> 	nice(nicarg);



More information about the Comp.unix.wizards mailing list