Back to index

glibc  2.9
Functions
nice.c File Reference
#include <errno.h>
#include <unistd.h>
#include <sys/resource.h>
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

int nice (int incr)

Function Documentation

int nice ( int  incr)

Definition at line 27 of file nice.c.

{
  int save;
  int prio;
  int result;

  /* -1 is a valid priority, so we use errno to check for an error.  */
  save = errno;
  __set_errno (0);
  prio = getpriority (PRIO_PROCESS, 0);
  if (prio == -1)
    {
      if (errno != 0)
       return -1;
      else
       __set_errno (save);
    }

  result = setpriority (PRIO_PROCESS, 0, prio + incr);
  if (result == -1)
    {
      if (errno == EACCES)
       errno = EPERM;
      return -1;
    }
  return getpriority (PRIO_PROCESS, 0);
}

Here is the call graph for this function: