Blame SOURCES/time-1.9-Use-kibibytes-instead-of-kilobytes-in-a-documentatio.patch

27f975
From 9fd52d5705fad70c0cb4ad8d508596a488262acf Mon Sep 17 00:00:00 2001
27f975
From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@redhat.com>
27f975
Date: Mon, 13 Jul 2020 09:24:35 +0200
27f975
Subject: [PATCH] Use kibibytes instead of kilobytes in a documentation
27f975
MIME-Version: 1.0
27f975
Content-Type: text/plain; charset=UTF-8
27f975
Content-Transfer-Encoding: 8bit
27f975
27f975
This patch does not changes any output of the time program. It only
27f975
clarifies a manual and the comments.
27f975
27f975
<https://lists.gnu.org/archive/html/bug-time/2020-07/msg00000.html>
27f975
27f975
Signed-off-by: Petr Písař <ppisar@redhat.com>
27f975
---
27f975
 configure.ac          |  6 +++---
27f975
 doc/time.texi         | 12 ++++++------
27f975
 src/rusage-kb.c       |  4 ++--
27f975
 src/rusage-kb.h       | 10 +++++-----
27f975
 src/time.c            |  6 +++---
27f975
 tests/time-max-rss.sh |  4 ++--
27f975
 6 files changed, 21 insertions(+), 21 deletions(-)
27f975
27f975
diff --git a/configure.ac b/configure.ac
27f975
index d2950bd..67738b5 100644
27f975
--- a/configure.ac
27f975
+++ b/configure.ac
27f975
@@ -90,7 +90,7 @@ if test -z "$time_getrusage_mem_units" ; then
27f975
 
27f975
     solaris*)        time_getrusage_mem_units=pages ;;
27f975
 
27f975
-    # As a fallback, assume KB (the most common value).
27f975
+    # As a fallback, assume KiB (the most common value).
27f975
     # Set the 'warn' variable to warn the user at the end
27f975
     # of ./configure
27f975
     *) time_getrusage_mem_units=kb
27f975
@@ -104,7 +104,7 @@ case $time_getrusage_mem_units in
27f975
   kb)
27f975
      AC_DEFINE([GETRUSAGE_RETURNS_KB],[1],
27f975
                 [Define to 1 if getrusage(2) on this systems returns
27f975
-                 ru_maxrss in kilobytes])
27f975
+                 ru_maxrss in kibibytes])
27f975
      ;;
27f975
 
27f975
   bytes)
27f975
@@ -140,7 +140,7 @@ AC_OUTPUT
27f975
 # Warn the user if getrusage(2) behaviour on this OS is unknown
27f975
 if test "$warn_getrusage_mem_units" ; then
27f975
   AC_MSG_WARN([unknown getrusage behavior on operating system '$host_os'.
27f975
-               Assuming Kilobytes.
27f975
+               Assuming kibibytes.
27f975
                please report this with the output of 'uname -a' to
27f975
                bug-time@gnu.org])
27f975
 fi
27f975
diff --git a/doc/time.texi b/doc/time.texi
27f975
index dac65b4..3a05ed9 100644
27f975
--- a/doc/time.texi
27f975
+++ b/doc/time.texi
27f975
@@ -241,22 +241,22 @@ times divied by the total running time.
27f975
 @table @code
27f975
 @item M
27f975
 Maximum resident set size of the process during its lifetime, in
27f975
-Kilobytes.
27f975
+kibibytes.
27f975
 
27f975
 @item t
27f975
-Average resident set size of the process, in Kilobytes.
27f975
+Average resident set size of the process, in kibibytes.
27f975
 
27f975
 @item K
27f975
-Average total (data+stack+text) memory use of the process, in Kilobytes.
27f975
+Average total (data+stack+text) memory use of the process, in kibibytes.
27f975
 
27f975
 @item D
27f975
-Average size of the process's unshared data area, in Kilobytes.
27f975
+Average size of the process's unshared data area, in kibibytes.
27f975
 
27f975
 @item p
27f975
-Average size of the process's unshared stack, in Kilobytes.
27f975
+Average size of the process's unshared stack, in kibibytes.
27f975
 
27f975
 @item X
27f975
-Average size of the process's shared text, in Kilobytes.
27f975
+Average size of the process's shared text, in kibibytes.
27f975
 
27f975
 @item Z
27f975
 System's page size, in bytes.  This is a per-system constant, but
27f975
diff --git a/src/rusage-kb.c b/src/rusage-kb.c
27f975
index aad06b8..04352cd 100644
27f975
--- a/src/rusage-kb.c
27f975
+++ b/src/rusage-kb.c
27f975
@@ -25,8 +25,8 @@
27f975
 #include <limits.h>
27f975
 #include <unistd.h>
27f975
 
27f975
-/* Return the number of kilobytes corresponding to a number of pages PAGES.
27f975
-   (Actually, we use it to convert pages*ticks into kilobytes*ticks.)
27f975
+/* Return the number of kibibytes corresponding to a number of pages PAGES.
27f975
+   (Actually, we use it to convert pages*ticks into kibibytes*ticks.)
27f975
 
27f975
    Try to do arithmetic so that the risk of overflow errors is minimized.
27f975
    This is funky since the pagesize could be less than 1K.
27f975
diff --git a/src/rusage-kb.h b/src/rusage-kb.h
27f975
index 4a53515..b7b1155 100644
27f975
--- a/src/rusage-kb.h
27f975
+++ b/src/rusage-kb.h
27f975
@@ -19,7 +19,7 @@
27f975
 #ifndef _RUSAGE_KB_
27f975
 #define _RUSAGE_KB_
27f975
 
27f975
-/* As of 2017, most kernels' getrusage(2) returns ru_maxrss in kilobytes:
27f975
+/* As of 2017, most kernels' getrusage(2) returns ru_maxrss in kibibytes:
27f975
       Linux, Hurd, Free/Open/Net-BSD, MINIX, AIX7
27f975
 
27f975
    OpenSolaris's getrusage(2) documents a return value in pages,
27f975
@@ -32,20 +32,20 @@
27f975
 
27f975
 #if GETRUSAGE_RETURNS_KB
27f975
 
27f975
-/* define as no-op, as RUSAGE values are already in KB */
27f975
+/* define as no-op, as RUSAGE values are already in KiB */
27f975
 #define RUSAGE_MEM_TO_KB(x) (x)
27f975
 
27f975
 #elif GETRUSAGE_RETURNS_BYTES
27f975
 
27f975
-/* Convert bytes to kilobytes */
27f975
+/* Convert bytes to kibibytes */
27f975
 #define RUSAGE_MEM_TO_KB(x) ((x)/1024)
27f975
 
27f975
 #elif GETRUSAGE_RETURNS_PAGES
27f975
 
27f975
-/* Convert bytes to kilobytes */
27f975
+/* Convert bytes to kibibytes */
27f975
 #define RUSAGE_MEM_TO_KB(x) (ptok (x))
27f975
 
27f975
-/* A function to get the system's page size and convert pages to KB */
27f975
+/* A function to get the system's page size and convert pages to KiB */
27f975
 unsigned long
27f975
 ptok (unsigned long pages);
27f975
 
27f975
diff --git a/src/time.c b/src/time.c
27f975
index 7e07995..f76265a 100644
27f975
--- a/src/time.c
27f975
+++ b/src/time.c
27f975
@@ -108,8 +108,8 @@ typedef RETSIGTYPE (*sighandler) ();
27f975
    and 100 on the sun4.
27f975
 
27f975
    Some manuals have an apparent error, claiming that units for average
27f975
-   sizes are kb*sec.  Judging by the contents of `struct rusage', it
27f975
-   looks like it should be kb*ticks, like on SunOS.  Ticks/sec seems
27f975
+   sizes are KiB*sec.  Judging by the contents of `struct rusage', it
27f975
+   looks like it should be KiB*ticks, like on SunOS.  Ticks/sec seems
27f975
    to be (empirically):
27f975
    50 Mt. Xinu
27f975
    250 Ultrix (mips)
27f975
@@ -412,7 +412,7 @@ linear_argv (argv)
27f975
    x == exit status of command
27f975
 
27f975
    Various memory usages are found by converting from page-seconds
27f975
-   to kbytes by multiplying by the page size, dividing by 1024,
27f975
+   to kibibytes by multiplying by the page size, dividing by 1024,
27f975
    and dividing by elapsed real time.
27f975
 
27f975
    FP is the stream to print to.
27f975
diff --git a/tests/time-max-rss.sh b/tests/time-max-rss.sh
27f975
index 0adda5c..5ecd3f2 100755
27f975
--- a/tests/time-max-rss.sh
27f975
+++ b/tests/time-max-rss.sh
27f975
@@ -27,7 +27,7 @@ fail=
27f975
 # The auxiliary program should be built and runnable
27f975
 time-aux || framework_failure_ "time-aux is missing/not runnable"
27f975
 
27f975
-# Get the baseline number of MAX-RSS kilobytes
27f975
+# Get the baseline number of MAX-RSS kibibytes
27f975
 # use by the program when not allocating any extra memory
27f975
 env time -o mem-baseline -f "%M" time-aux \
27f975
   || framework_failure_ "failed to run time/time-aux (baseline max-rss)"
27f975
@@ -49,7 +49,7 @@ test "$b" -eq "0" && test "$c" -eq 0 \
27f975
 # There could be alot of variation between each invocation,
27f975
 # accept a reasonable range
27f975
 if test "$d" -ge 5000 && test "$d" -le 6000 ; then
27f975
-    : # acceptable values: 5000-6000 KB
27f975
+    : # acceptable values: 5000-6000 KiB
27f975
 else
27f975
     cat<<EOF>&2
27f975
 time(1) failed to detect 5MB allcoation.
27f975
-- 
27f975
2.25.4
27f975