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