1 /* 2 * Copyright (c) 1983, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * %sccs.include.redist.c% 6 */ 7 8 #if defined(LIBC_SCCS) && !defined(lint) 9 static char sccsid[] = "@(#)nice.c 8.1 (Berkeley) 06/04/93"; 10 #endif /* LIBC_SCCS and not lint */ 11 12 #include <sys/types.h> 13 #include <sys/time.h> 14 #include <sys/resource.h> 15 #include <unistd.h> 16 17 /* 18 * Backwards compatible nice. 19 */ 20 int 21 nice(incr) 22 int incr; 23 { 24 int prio; 25 extern int errno; 26 27 errno = 0; 28 prio = getpriority(PRIO_PROCESS, 0); 29 if (prio == -1 && errno) 30 return (-1); 31 return (setpriority(PRIO_PROCESS, 0, prio + incr)); 32 } 33