git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] getpriority: Only getpriority translation the priority values

From
ACAlejandro Colomar <alx.manpages@gmail.com>
Date
May 14, 2022, 15:00 UTC
Message-ID
<76ff060f-a3f2-2e60-5b1a-4a59cf3f3d8c@gmail.com>
In-Reply-To
<0fc70bd3-5883-47e4-1814-6ed6c756a400@gmail.com>
[CC += nick]
On 5/14/22 16:37, Alejandro Colomar wrote:
Show 13 quoted lines
> Hi Theodore,
> 
> On 5/11/22 00:08, Theodore Dubois wrote:
>> 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>
> 
> Patch applied.
> 
> BTW, I had to manually edit the patch.
> It's the second time I see this (I can't find the other one), your patch 
The other one:
<https://lore.kernel.org/linux-man/809c40c4-068b-8296-57d9-024e6623362d@gmail.com/T/#u>
nick, I finally found it again!
Show 58 quoted lines
> didn't apply for the following reason: the a/ and b/ prefixes in the 
> file paths are missing.  Did you use git-format-patch(1) to produce the 
> patch?  Can you reproduce this?
> 
> I CCd the git mailing list in case they know what's going on.
> 
> Thanks,
> 
> Alex
> 
>> ---
>>   man2/getpriority.2 | 17 ++++-------------
>>   1 file changed, 4 insertions(+), 13 deletions(-)
>>
>> diff --git man2/getpriority.2 man2/getpriority.2
> 
> Should have been:
> diff --git a/man2/getpriority.2 b/man2/getpriority.2
> 
>> index 3e1be3e6c..24c1b7f11 100644
>> --- man2/getpriority.2
>> +++ man2/getpriority.2
> 
> Should have been:
> 
> --- a/man2/getpriority.2
> +++ b/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,
> 
-- 
Alejandro Colomar
Linux man-pages comaintainer; https://www.kernel.org/doc/man-pages/
http://www.alejandro-colomar.es/
Previous: Alejandro ColomarNext: Martin Ågren
Message 2 of 6 in “Re: [PATCH] getpriority: Only getpriority translation the priority values”
  1. Alejandro ColomarMay 14, 2022
  2. Alejandro ColomarMay 14, 2022
  3. Martin ÅgrenMay 14, 2022
  4. Alejandro ColomarMay 14, 2022
  5. Theodore DuboisMay 17, 2022
  6. Perhaps we want {diff,log,format}.noprefix and friends?Junio C Hamano, May 18, 2022

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.