[PATCH] Cygwin: getpriority() consistent with process priority

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

[PATCH] Cygwin: getpriority() consistent with process priority

cygwin-patches mailing list
https://cygwin.com/ml/cygwin/2019-08/msg00122.html
---
 winsup/cygwin/syscalls.cc | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/winsup/cygwin/syscalls.cc b/winsup/cygwin/syscalls.cc
index a914ae8..20126ce 100644
--- a/winsup/cygwin/syscalls.cc
+++ b/winsup/cygwin/syscalls.cc
@@ -3977,7 +3977,12 @@ getpriority (int which, id_t who)
       if (!who)
  who = myself->pid;
       if ((pid_t) who == myself->pid)
- return myself->nice;
+        {
+          DWORD winprio = GetPriorityClass(GetCurrentProcess());
+          if (winprio != nice_to_winprio(myself->nice))
+            myself->nice = winprio_to_nice(winprio);
+          return myself->nice;
+        }
       break;
     case PRIO_PGRP:
       if (!who)
--
2.8.3

Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] Cygwin: getpriority() consistent with process priority

Corinna Vinschen-2
On Oct 30 11:47, Anton Lavrentiev via cygwin-patches wrote:

> https://cygwin.com/ml/cygwin/2019-08/msg00122.html
> ---
>  winsup/cygwin/syscalls.cc | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/winsup/cygwin/syscalls.cc b/winsup/cygwin/syscalls.cc
> index a914ae8..20126ce 100644
> --- a/winsup/cygwin/syscalls.cc
> +++ b/winsup/cygwin/syscalls.cc
> @@ -3977,7 +3977,12 @@ getpriority (int which, id_t who)
>        if (!who)
>   who = myself->pid;
>        if ((pid_t) who == myself->pid)
> - return myself->nice;
> +        {
> +          DWORD winprio = GetPriorityClass(GetCurrentProcess());
> +          if (winprio != nice_to_winprio(myself->nice))
> +            myself->nice = winprio_to_nice(winprio);
> +          return myself->nice;
> +        }
>        break;
>      case PRIO_PGRP:
>        if (!who)
> --
> 2.8.3
Pushed.


Thanks,
Corinna

--
Corinna Vinschen
Cygwin Maintainer

signature.asc (849 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

RE: [PATCH] Cygwin: getpriority() consistent with process priority

cygwin-patches mailing list
> Pushed.

Thank you!  It took me awhile, sorry about that -- was extremely busy with stuff and travel