public inbox for linux-man@vger.kernel.org
 help / color / mirror / Atom feed
From: Theodore Dubois <tbodt@google.com>
To: linux-man@vger.kernel.org, mtk.manpages@gmail.com,
	alx.manpages@gmail.com
Cc: Theodore Dubois <tbodt@google.com>
Subject: [PATCH] getpriority: Only getpriority translation the priority values
Date: Tue, 10 May 2022 15:08:21 -0700	[thread overview]
Message-ID: <20220510220821.1481801-1-tbodt@google.com> (raw)

The translation is needed to avoid returning a negative number from a
successful syscall, and this requirement doesn't apply to setpriority.
See the implementation of getpriority in kernel/sys.c.

Signed-off-by: Theodore Dubois <tbodt@google.com>
---
 man2/getpriority.2 | 17 ++++-------------
 1 file changed, 4 insertions(+), 13 deletions(-)

diff --git man2/getpriority.2 man2/getpriority.2
index 3e1be3e6c..24c1b7f11 100644
--- man2/getpriority.2
+++ man2/getpriority.2
@@ -206,20 +206,11 @@ All BSD-like systems (SunOS 4.1.3, Ultrix 4.2,
 manner as Linux 2.6.12 and later.
 .\"
 .SS C library/kernel differences
-Within the kernel, nice values are actually represented
-using the range 40..1
-(since negative numbers are error codes) and these are the values
-employed by the
-.BR setpriority ()
-and
-.BR getpriority ()
-system calls.
-The glibc wrapper functions for these system calls handle the
-translations between the user-land and kernel representations
-of the nice value according to the formula
+The getpriority system call returns nice values translated to the range 40..1,
+since a negative return value would be interpreted as an error.
+The glibc wrapper function for getpriority translates the value back according to the formula
 .IR "unice\ =\ 20\ \-\ knice" .
-(Thus, the kernel's 40..1 range corresponds to the
-range \-20..19 as seen by user space.)
+(Thus, the 40..1 range returned by the kernel corresponds to the range \-20..19 as seen by user space.)
 .SH BUGS
 According to POSIX, the nice value is a per-process setting.
 However, under the current Linux/NPTL implementation of POSIX threads,
-- 
2.36.0.512.ge40c2bad7a-goog


             reply	other threads:[~2022-05-10 22:08 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-10 22:08 Theodore Dubois [this message]
2022-05-14 14:20 ` [PATCH] getpriority: Only getpriority translation the priority values Alejandro Colomar
2022-05-14 14:37 ` Alejandro Colomar
2022-05-14 15:00   ` Alejandro Colomar
2022-05-14 18:43   ` Martin Ågren
2022-05-14 21:18     ` Alejandro Colomar
2022-05-17 17:02     ` Theodore Dubois

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220510220821.1481801-1-tbodt@google.com \
    --to=tbodt@google.com \
    --cc=alx.manpages@gmail.com \
    --cc=linux-man@vger.kernel.org \
    --cc=mtk.manpages@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox