File:  [DVB] / dietlibc / lib / nice.c
Revision 1.3: download - view: text, annotated - select for diffs
Fri Oct 10 18:23:27 2014 UTC (9 years, 7 months ago) by leitner
Branches: MAIN
CVS tags: HEAD
  add getcontext, setcontext, makecontext, swapcontext (i386 and x86_64 only for now)

#ifndef _REENTRANT
#define _REENTRANT
#endif
#include <errno.h>
#include <unistd.h>
#include <sys/resource.h>

int nice(int incr) {
  int prio;
  int res;
  errno=0;
  prio = getpriority(PRIO_PROCESS,0) + incr;
  if (prio < PRIO_MIN) prio=PRIO_MIN;
  if (prio >= PRIO_MAX) prio=PRIO_MAX-1;
  if (setpriority (PRIO_PROCESS, 0, prio)==-1) {
    if (errno==EACCES) errno=EPERM;
    return -1;
  } else
    return getpriority(PRIO_PROCESS, 0);
}

LinuxTV legacy CVS <linuxtv.org/cvs>