This is the mail archive of the
cygwin
mailing list for the Cygwin project.
Re: getpriority() and top display for priority inconsistent
- From: "Lavrentiev, Anton (NIH/NLM/NCBI) [C] via cygwin" <cygwin at cygwin dot com>
- To: "'cygwin at cygwin dot com'" <cygwin at cygwin dot com>
- Date: Wed, 14 Aug 2019 20:01:25 +0000
- Subject: Re: getpriority() and top display for priority inconsistent
- Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=ncbi.nlm.nih.gov; dmarc=pass action=none header.from=ncbi.nlm.nih.gov; dkim=pass header.d=ncbi.nlm.nih.gov; arc=none
- Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ufsg/OQokG2FBMNWNkrdcf/5ao2uNfMrtTVMsoi5fzU=; b=f5Pzx9PeiOC/MiXDfJoslq3rTZgZ+XeE4Tl+vCPlqyAbYQdHdRWWwKmDMlB+ASV03HOWvfHIgOeQCWSxm+mO9rDiP5NIF8lMyMUwGeP8xV+sCLy5TDYVzwZ8m4BKLFm7KZ0kRi/HOlPYU3OyfO9L6tJD9rMEUUFKkTDTBU/dnTdtDZgc75gGPjF7UaD2fUq3BWyYBdPG2eajlGLaMlq64ocr67bjk7ko3sIOngjH6sdvU8kPgxslatUmGfvK+V6/lDXPXitMdbgf3eruOZbOFxH8l7J4jeWI37V+a9uWf9d2B4+zEEO+Dv5IO4/gE0KLgXlmWUwr4FojJDUMPCTOzQ==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CC/A/679avwXVG/VVgyC/dNZ//4eatE3AQLGUj5l0mj05wQbSP6EF2+G5SGr9DHYfUMR8xugngYA5LjJQmooaDqgxe26qyk15e753b8ET/ZOCx0sbF4I/khx0yozdScRBzcGXK1g+6uKNEN+R3Rkb9pBb2XlPMoXotnfOIHWYsgVOyehU6cSTYNwRpfox6MEbA9gTbyR4dcWZt0sGB6AOFUw+IablIZopvhSfk4EF57Jbpf3MVbh9JOo147CIJze8ig61GMQsv7QjJDfqfrbOVKh8VvfAdu6GnJ7IE428BPiRTNDKig1Rkr12P8Itfst62PhjYS2cVrf1c/W96rwaw==
- Ironport-sdr: pWKCciPGoLpyMynVX6O+1QLdYS/cBolGu9Y5ViL2WVxBheh3F9zfMng6e7G56wJwaBE6H6gEzS LV54xfL0zvPQ==
- Reply-to: "Lavrentiev, Anton (NIH/NLM/NCBI) [C]" <lavr at ncbi dot nlm dot nih dot gov>
> 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