xref: /csrg-svn/lib/libc/gen/nice.c (revision 61111)
121329Sdist /*
2*61111Sbostic  * Copyright (c) 1983, 1993
3*61111Sbostic  *	The Regents of the University of California.  All rights reserved.
438472Sbostic  *
542625Sbostic  * %sccs.include.redist.c%
621329Sdist  */
712842Ssam 
826518Sdonn #if defined(LIBC_SCCS) && !defined(lint)
9*61111Sbostic static char sccsid[] = "@(#)nice.c	8.1 (Berkeley) 06/04/93";
1038472Sbostic #endif /* LIBC_SCCS and not lint */
1121329Sdist 
1253712Smckusick #include <sys/types.h>
1312842Ssam #include <sys/time.h>
1412842Ssam #include <sys/resource.h>
1546597Sdonn #include <unistd.h>
1612842Ssam 
1712842Ssam /*
1812842Ssam  * Backwards compatible nice.
1912842Ssam  */
2046597Sdonn int
nice(incr)2112842Ssam nice(incr)
2212842Ssam 	int incr;
2312842Ssam {
2412842Ssam 	int prio;
2512842Ssam 	extern int errno;
2612842Ssam 
2712842Ssam 	errno = 0;
2812842Ssam 	prio = getpriority(PRIO_PROCESS, 0);
2912842Ssam 	if (prio == -1 && errno)
3012842Ssam 		return (-1);
3112842Ssam 	return (setpriority(PRIO_PROCESS, 0, prio + incr));
3212842Ssam }
33