nice(1) takes an absolute priority argument

geoff at utcs.uucp geoff at utcs.uucp
Sat Dec 8 18:51:50 AEST 1984


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