Index: nice.c =================================================================== RCS file: /home/ncvs/src/usr.bin/nice/nice.c,v retrieving revision 1.11 diff -u -r1.11 nice.c --- nice.c 4 Sep 2002 23:29:05 -0000 1.11 +++ nice.c 22 Jul 2005 16:56:55 -0000 @@ -68,6 +68,7 @@ { long niceness = DEFNICE; int ch; + int what = PRIO_PROCESS; char *ep; /* Obsolescent syntax: -number, --number */ @@ -76,8 +77,11 @@ 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 */ + break; case 'n': errno = 0; niceness = strtol(optarg, &ep, 10); @@ -96,10 +100,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);