Index: nice.c =================================================================== RCS file: /home/ncvs/src/usr.bin/nice/nice.c,v retrieving revision 1.4.2.1 diff -u -r1.4.2.1 nice.c --- nice.c 18 Jun 2002 08:40:28 -0000 1.4.2.1 +++ nice.c 21 Jul 2005 13:19:31 -0000 @@ -70,6 +70,7 @@ { long niceness = DEFNICE; int ch; + int what = PRIO_PROCESS; char *ep; /* Obsolescent syntax: -number, --number */ @@ -78,8 +79,10 @@ if (asprintf(&argv[1], "-n%s", argv[1] + 1) < 0) err(1, "asprintf"); - while ((ch = getopt(argc, argv, "n:")) != -1) { + while ((ch = getopt(argc, argv, "d:n:")) != -1) { switch (ch) { + case 'd': /* disk I/O priority */ + what = 4; /* PRIO_DISK */ case 'n': errno = 0; niceness = strtol(optarg, &ep, 10); @@ -98,10 +101,11 @@ usage(); errno = 0; + if (what == PRIO_PROCESS) niceness += getpriority(PRIO_PROCESS, 0); if (errno) warn("getpriority"); - else if (setpriority(PRIO_PROCESS, 0, (int)niceness)) + else if (setpriority(what, 0, (int)niceness)) warn("setpriority"); execvp(*argv, argv); err(errno == ENOENT ? 127 : 126, "%s", *argv);