Add include files to get prototype declarations, and fix bugs found.
[unix-history] / usr / src / lib / libc / gen / nice.c
CommitLineData
bb0cfa24 1/*
bfd3a734
KB
2 * Copyright (c) 1983 The Regents of the University of California.
3 * All rights reserved.
4 *
269a7923 5 * %sccs.include.redist.c%
bb0cfa24
DF
6 */
7
2ce81398 8#if defined(LIBC_SCCS) && !defined(lint)
c5980113 9static char sccsid[] = "@(#)nice.c 5.5 (Berkeley) %G%";
bfd3a734 10#endif /* LIBC_SCCS and not lint */
39ddd9b2
SL
11
12#include <sys/time.h>
13#include <sys/resource.h>
c5980113 14#include <unistd.h>
39ddd9b2
SL
15
16/*
17 * Backwards compatible nice.
18 */
c5980113 19int
39ddd9b2
SL
20nice(incr)
21 int incr;
22{
23 int prio;
24 extern int errno;
25
26 errno = 0;
27 prio = getpriority(PRIO_PROCESS, 0);
28 if (prio == -1 && errno)
29 return (-1);
30 return (setpriority(PRIO_PROCESS, 0, prio + incr));
31}