3 * nice.c - Run a program at a different niceness level.
5 * Copyright 2010 Rob Landley <rob@landley.net>
7 * See http://www.opengroup.org/onlinepubs/9699919799/utilities/nice.html
9 USE_NICE(NEWTOY(nice, "^<1n#", TOYFLAG_USR|TOYFLAG_BIN))
15 usage: nice [-n PRIORITY] command [args...]
17 Run a command line at an increased or decreased scheduling priority.
19 Higher numbers make a program yield more CPU time, from -20 (highest
20 priority) to 19 (lowest). By default processes inherit their parent's
21 niceness (usually 0). By default this command adds 10 to the parent's
22 priority. Only root can set a negative niceness level.
35 if (!toys.optflags) TT.priority = 10;
38 if (getpriority(PRIO_PROCESS, getpid()) != TT.priority)
39 perror_exit("Can't set priority");