qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 19/32] bsd-user: Implement getpriority(2) and setpriority(2).


From: Richard Henderson
Subject: Re: [PATCH 19/32] bsd-user: Implement getpriority(2) and setpriority(2).
Date: Tue, 29 Aug 2023 13:10:02 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0

On 8/27/23 08:57, Karim Taha wrote:
+static inline abi_long do_bsd_getpriority(abi_long which, abi_long who)
+{
+    abi_long ret;
+    /*
+     * Note that negative values are valid for getpriority, so we must
+     * differentiate based on errno settings.
+     */
+    errno = 0;
+    ret = getpriority(which, who);
+    if (ret == -1 && errno != 0) {
+        ret = -host_to_target_errno(errno);
+        return ret;
+    }
+    /* Return value is a biased priority to avoid negative numbers. */
+    ret = 20 - ret;

This appears to be a linux-ism.

There is no such bias in sys/kern/kern_resource.c, kern_getpriority(), but there is in sys/compat/linux/linux_misc.c, linux_getpriority().


r~







reply via email to

[Prev in Thread] Current Thread [Next in Thread]