xref: /original-bsd/lib/libc/gen/nice.c (revision e0c0d005)
1 /*
2  * Copyright (c) 1983 The Regents of the University of California.
3  * All rights reserved.
4  *
5  * %sccs.include.redist.c%
6  */
7 
8 #if defined(LIBC_SCCS) && !defined(lint)
9 static char sccsid[] = "@(#)nice.c	5.5 (Berkeley) 02/23/91";
10 #endif /* LIBC_SCCS and not lint */
11 
12 #include <sys/time.h>
13 #include <sys/resource.h>
14 #include <unistd.h>
15 
16 /*
17  * Backwards compatible nice.
18  */
19 int
20 nice(incr)
21 	int incr;
22 {
23 	int prio;
24 	extern int errno;
25 
26 	errno = 0;
27 	prio = getpriority(PRIO_PROCESS, 0);
28 	if (prio == -1 && errno)
29 		return (-1);
30 	return (setpriority(PRIO_PROCESS, 0, prio + incr));
31 }
32