[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
more "nice" fixes in the area of terminology
From: |
Paul Eggert |
Subject: |
more "nice" fixes in the area of terminology |
Date: |
Fri, 09 Sep 2005 13:54:23 -0700 |
User-agent: |
Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux) |
I see that I didn't fix all the misuses of the term "nice value"
so I installed this further patch. I added a NEWS item.
2005-09-09 Paul Eggert <address@hidden>
* NEWS: Document "niceness" vs "nice value".
* configure.ac (utils_cv_func_setpriority): Simplify the tests.
Define HAVE_NICE rather than NICE_PRIORITY (since a niceness is
not a priority); all uses changed.
* src/nice.c (main): Hoist errno=0 outside the ifdef.
* doc/coreutils.texi (nice invocation): Document "niceness" versus
"nice value" versus "scheduling priority".
--- NEWS 29 Aug 2005 21:14:06 -0000 1.305
+++ NEWS 9 Sep 2005 19:57:59 -0000
@@ -103,6 +103,11 @@ GNU coreutils NEWS
--indicator-style=slash. Use --file-type or
--indicator-style=file-type to get -p's old behavior.
+ nice changes:
+
+ Documentation and diagnostics now refer to "nicenesses" (commonly
+ in the range -20...19 rather than "nice values" (commonly 0...39).
+
nohup changes:
nohup now ignores the umask when creating nohup.out.
@@ -270,15 +275,15 @@ GNU coreutils NEWS
Fixes for "nice":
- If it fails to lower the nice value due to lack of permissions,
+ If it fails to lower the niceness due to lack of permissions,
it goes ahead and runs the command anyway, as POSIX requires.
- It no longer incorrectly reports an error if the current nice
- value happens to be -1.
+ It no longer incorrectly reports an error if the current niceness
+ happens to be -1.
- It no longer assumes that nice values range from -20 through 19.
+ It no longer assumes that nicenesses range from -20 through 19.
- It now consistently adjusts out-of-range nice values to the
+ It now consistently adjusts out-of-range nicenesses to the
closest values in range; formerly it sometimes reported an error.
pathchk no longer accepts trailing options, e.g., "pathchk -p foo -b"
--- configure.ac 23 Aug 2005 16:38:45 -0000 1.61
+++ configure.ac 9 Sep 2005 19:57:59 -0000
@@ -114,29 +114,24 @@ if test $ac_cv_func_syslog = no; then
done
fi
-AC_MSG_CHECKING(for 3-argument setpriority function)
-AC_CACHE_VAL(utils_cv_func_setpriority,
-[AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/time.h>
- #include <sys/resource.h>]], [[setpriority(0, 0, 0);]])],
- [utils_cv_func_setpriority=yes],
- [utils_cv_func_setpriority=no])])
-AC_MSG_RESULT($utils_cv_func_setpriority)
-if test $utils_cv_func_setpriority = yes; then
- OPTIONAL_BIN_PROGS="$OPTIONAL_BIN_PROGS nice\$(EXEEXT)"
- MAN="$MAN nice.1"
-else
- AC_MSG_CHECKING(for nice function)
- AC_CACHE_VAL(utils_cv_func_nice,
- [AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[nice();]])],
- [utils_cv_func_nice=yes],
- [utils_cv_func_nice=no])])
- AC_MSG_RESULT($utils_cv_func_nice)
- if test $utils_cv_func_nice = yes; then
- AC_DEFINE(NICE_PRIORITY, 1, [FIXME])
- OPTIONAL_BIN_PROGS="$OPTIONAL_BIN_PROGS nice\$(EXEEXT)"
- MAN="$MAN nice.1"
- fi
+AC_CACHE_CHECK([for 3-argument setpriority function],
+ [utils_cv_func_setpriority],
+ [AC_LINK_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[#include <sys/time.h>
+ #include <sys/resource.h>
+ ]],
+ [[setpriority (0, 0, 0);]])],
+ [utils_cv_func_setpriority=yes],
+ [utils_cv_func_setpriority=no])])
+if test $utils_cv_func_setpriority = no; then
+ AC_CHECK_FUNCS([nice])
fi
+case $utils_cv_func_setpriority,$ac_cv_func_nice in
+*yes*)
+ OPTIONAL_BIN_PROGS="$OPTIONAL_BIN_PROGS nice\$(EXEEXT)"
+ MAN="$MAN nice.1";;
+esac
AC_DEFUN([coreutils_DUMMY_1],
[
--- doc/coreutils.texi.~1.277.~ 2005-09-07 22:34:10.000000000 -0700
+++ doc/coreutils.texi 2005-09-09 13:49:19.000000000 -0700
@@ -12517,6 +12517,16 @@ enforce more restrictive limits. An att
outside the supported range is treated as an attempt to use the
minimum or maximum supported value.
+A niceness should not be confused with a scheduling priority, which
+lets applications determine the order in which threads are scheduled
+to run. Unlike a priority, a niceness is merely advice to the
+scheduler, which the scheduler is free to ignore. Also, as a point of
+terminology, @acronym{POSIX} defines the behavior of @command{nice} in
+terms of a @dfn{nice value}, which is the nonnegative difference
+between a niceness and the minimum niceness. Though @command{nice}
+conforms to @command{POSIX}, its documentation and diagnostics use the
+term ``niceness'' for compatibility with historical practice.
+
@var{command} must not be a special built-in utility (@pxref{Special
built-in utilities}).
--- src/nice.c 8 Sep 2005 06:52:09 -0000 1.84
+++ src/nice.c 9 Sep 2005 19:58:04 -0000
@@ -1,4 +1,4 @@
-/* nice -- run a program with modified nice value
+/* nice -- run a program with modified niceness
Copyright (C) 1990-2005 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
@@ -27,7 +27,7 @@
#include "system.h"
-#ifndef NICE_PRIORITY
+#if ! HAVE_NICE
/* Include this after "system.h" so we're sure to have definitions
(from time.h or sys/time.h) required for e.g. the ru_utime member. */
# include <sys/resource.h>
@@ -43,7 +43,7 @@
#define AUTHORS "David MacKenzie"
-#ifdef NICE_PRIORITY
+#if HAVE_NICE
# define GET_NICENESS() nice (0)
#else
# define GET_NICENESS() getpriority (PRIO_PROCESS, 0)
@@ -167,7 +167,7 @@ main (int argc, char **argv)
error (0, 0, _("a command must be given with an adjustment"));
usage (EXIT_FAIL);
}
- /* No command given; print the nice value. */
+ /* No command given; print the niceness. */
errno = 0;
current_niceness = GET_NICENESS ();
if (current_niceness == -1 && errno != 0)
@@ -176,15 +176,14 @@ main (int argc, char **argv)
exit (EXIT_SUCCESS);
}
-#ifndef NICE_PRIORITY
errno = 0;
+#if HAVE_NICE
+ ok = (nice (adjustment) != -1 || errno == 0);
+#else
current_niceness = GET_NICENESS ();
if (current_niceness == -1 && errno != 0)
error (EXIT_FAIL, errno, _("cannot get niceness"));
ok = (setpriority (PRIO_PROCESS, 0, current_niceness + adjustment) == 0);
-#else
- errno = 0;
- ok = (nice (adjustment) != -1 || errno == 0);
#endif
if (!ok)
error (errno == EPERM ? 0 : EXIT_FAIL, errno, _("cannot set niceness"));
- more "nice" fixes in the area of terminology,
Paul Eggert <=