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