public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: "Lavrentiev, Anton (NIH/NLM/NCBI) [C] via cygwin" <cygwin@cygwin.com>
To: "'cygwin@cygwin.com'" <cygwin@cygwin.com>
Subject: Re: getpriority() and top display for priority inconsistent
Date: Wed, 14 Aug 2019 20:01:00 -0000	[thread overview]
Message-ID: <BN6PR09MB1409FFA3C34F0EF48915C4E1A5AD0@BN6PR09MB1409.namprd09.prod.outlook.com> (raw)

> Feel free to provide a patch, just, please, create a valid git commit message

"getpriority() consistent with process priority https://cygwin.com/ml/cygwin/2019-08/msg00122.html"

The changeset is really trivial:

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)

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

             reply	other threads:[~2019-08-14 20:01 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-14 20:01 Lavrentiev, Anton (NIH/NLM/NCBI) [C] via cygwin [this message]
2019-08-15  7:29 ` Corinna Vinschen
2019-08-15  9:41   ` Lavrentiev, Anton (NIH/NLM/NCBI) [C] via cygwin
2019-08-15 10:20     ` Corinna Vinschen
2019-08-15 10:23       ` Corinna Vinschen
2019-08-15 11:04       ` Houder
2019-08-15 11:13         ` john doe
2019-08-15 10:54     ` john doe
  -- strict thread matches above, loose matches on Subject: below --
2019-08-08 13:46 Lavrentiev, Anton (NIH/NLM/NCBI) [C] via cygwin
2019-08-08 15:40 ` Corinna Vinschen

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=BN6PR09MB1409FFA3C34F0EF48915C4E1A5AD0@BN6PR09MB1409.namprd09.prod.outlook.com \
    --to=cygwin@cygwin.com \
    --cc=lavr@ncbi.nlm.nih.gov \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).