xref: /csrg-svn/lib/libc/gen/nice.c (revision 46597)
121329Sdist /*
238472Sbostic  * Copyright (c) 1983 The Regents of the University of California.
338472Sbostic  * All rights reserved.
438472Sbostic  *
542625Sbostic  * %sccs.include.redist.c%
621329Sdist  */
712842Ssam 
826518Sdonn #if defined(LIBC_SCCS) && !defined(lint)
9*46597Sdonn static char sccsid[] = "@(#)nice.c	5.5 (Berkeley) 02/23/91";
1038472Sbostic #endif /* LIBC_SCCS and not lint */
1121329Sdist 
1212842Ssam #include <sys/time.h>
1312842Ssam #include <sys/resource.h>
14*46597Sdonn #include <unistd.h>
1512842Ssam 
1612842Ssam /*
1712842Ssam  * Backwards compatible nice.
1812842Ssam  */
19*46597Sdonn int
2012842Ssam nice(incr)
2112842Ssam 	int incr;
2212842Ssam {
2312842Ssam 	int prio;
2412842Ssam 	extern int errno;
2512842Ssam 
2612842Ssam 	errno = 0;
2712842Ssam 	prio = getpriority(PRIO_PROCESS, 0);
2812842Ssam 	if (prio == -1 && errno)
2912842Ssam 		return (-1);
3012842Ssam 	return (setpriority(PRIO_PROCESS, 0, prio + incr));
3112842Ssam }
32