xref: /original-bsd/lib/libc/gen/nice.c (revision 7a8f01dc)
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.4 (Berkeley) 06/01/90";
10 #endif /* LIBC_SCCS and not lint */
11 
12 #include <sys/time.h>
13 #include <sys/resource.h>
14 
15 /*
16  * Backwards compatible nice.
17  */
18 nice(incr)
19 	int incr;
20 {
21 	int prio;
22 	extern int errno;
23 
24 	errno = 0;
25 	prio = getpriority(PRIO_PROCESS, 0);
26 	if (prio == -1 && errno)
27 		return (-1);
28 	return (setpriority(PRIO_PROCESS, 0, prio + incr));
29 }
30