xref: /csrg-svn/lib/libc/gen/nice.c (revision 26518)
121329Sdist /*
221329Sdist  * Copyright (c) 1980 Regents of the University of California.
321329Sdist  * All rights reserved.  The Berkeley software License Agreement
421329Sdist  * specifies the terms and conditions for redistribution.
521329Sdist  */
612842Ssam 
7*26518Sdonn #if defined(LIBC_SCCS) && !defined(lint)
8*26518Sdonn static char sccsid[] = "@(#)nice.c	5.2 (Berkeley) 03/09/86";
9*26518Sdonn #endif LIBC_SCCS and not lint
1021329Sdist 
1112842Ssam #include <sys/time.h>
1212842Ssam #include <sys/resource.h>
1312842Ssam 
1412842Ssam /*
1512842Ssam  * Backwards compatible nice.
1612842Ssam  */
1712842Ssam nice(incr)
1812842Ssam 	int incr;
1912842Ssam {
2012842Ssam 	int prio;
2112842Ssam 	extern int errno;
2212842Ssam 
2312842Ssam 	errno = 0;
2412842Ssam 	prio = getpriority(PRIO_PROCESS, 0);
2512842Ssam 	if (prio == -1 && errno)
2612842Ssam 		return (-1);
2712842Ssam 	return (setpriority(PRIO_PROCESS, 0, prio + incr));
2812842Ssam }
29