X-Recipient: archive-cygwin@delorie.com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
	:list-unsubscribe:list-subscribe:list-archive:list-post
	:list-help:sender:from:reply-to:to:subject:date:message-id
	:content-type:content-transfer-encoding:mime-version; q=dns; s=
	default; b=cb6wybSTYVlYcIMwEhY/j7afViN5O4njT1YwiD2ewSfrS3MLYFc8H
	PEg+HIdIdCtTAgUlZhXlcqmZUVvFiev40qUucAYvuAo0L5itRZ4NhODBj/WJskUA
	zw3XdXQaYfOJ5QFIq0XUgfY3v20xJ0c/tTR1iG5JIvVJO4DcWFF9yw=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
	:list-unsubscribe:list-subscribe:list-archive:list-post
	:list-help:sender:from:reply-to:to:subject:date:message-id
	:content-type:content-transfer-encoding:mime-version; s=default;
	 bh=9nkOr5uFs6o3kz359KdecDj6cRA=; b=Y0VDQCnSEViwaJWnhcizJP+YFEkE
	kUH7P1aUlKJYGOX3zufO+zvlWJad2wvW+LV1nm3txQ3eK+/tpz+AI1zZSGDEqYMH
	T7llNiJcaa4iwMOxw9S73rx2/SrvxvSEkMh3MYeYpKEP+nHKG541rlEJo5KXNeXO
	gsChRyzQygMuQ2g=
Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com
Authentication-Results: sourceware.org; auth=none
X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=AWL,BAYES_00,SPF_PASS autolearn=ham version=3.3.1 spammy=
X-HELO: nihcesxway.hub.nih.gov
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;  d=nih.gov; i=@nih.gov; q=dns/txt; s=NIH; t=1565117681;  x=1596653681;  h=from:to:subject:date:message-id:   content-transfer-encoding:mime-version;  bh=5gERPJpqEPGWcq/kG57GvB+OnCfQkelYeNTKrziWvm0=;  b=NZSwbC6ypca67PTiOu6c/RquZ8zfnqMHOJKAgo1Xop+fDM+2kBZSRVkw   wED6t58LYePm71H8iAkO8qX0MVi0jB3bkPW2oOdO7Vm4qa5sRncVGDmkY   l/786XLih9fjzX6iTkfZkgUAPnIfmPYWnxZ56uQxyJ3WK2la+02BgG1Y7   UdvonnBuzayFYKNA7KOWABFeCu7S+mM0bMnmqpH5FS98LaKVAboKXbQrl   GSCZ0iprtcjhdxs+aFqbP/O94yBmA6KBZBcBr71/3stYkS57o5lhy9Zcl   DA/QzcEjzt6/rvfGKxKOy+DoG2yGV3fnLZ+p0u4wHHWuTnQ9VoCM+lnsi   Q==;
IronPort-SDR: /ORKr5snuU3pzXrQpwfwzKKBT8gtS0V84zhfvZRcSc2x/EQyThy/JUs7DNtr1fDW8LoRHsI/Oq 1ju5ovXpwawmw2gqi/o7iNnW7zm8WyuUIW9ok2SeUu8otmmFhwOgbYvsqGK1YpO74WoLiYWOwX xiKnqhHg7jV2seb7AmeKGFJlseRhF7pYHAMzL1H0UK+KNpgqaTCruEowEJa5JtCfjndOIa6tai XicDk0rXUQL5ZlioJGGj+zSqor+AHr1LLn3mZGePJaR2OpKm3ptZUNM2RbK40UG6m4a25J6hQ4 Iq8=
ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hXJVAEawnv8buiYFPD9Y70H46YXoLVcLMTs7ggaFDXavj7zxaFTAZrANbHgQgnVFfSOheYKEaB/Ty/WGU9W5EueaFZ5IznMMmeoskaYaf3jdwPhtk4b1i2XSJsO8PeSNabtbinqnzOwh4fMGO8tNqjTqNX0gPbfvnlUKWwSQm8MS/fRvgoVsUb6cks383iMuF+OVDYqficxMEogFw2RgT0CAOjldWky0x4lONFbGZr46IImXen+TULMVyksPfy0oKaXKpR5GIgwJ+SFbhv9GL3MboWJLp27gPXiBQeT7BNrU/0capDT84CXjxyXsPzcEsyIfkbYv9QCA0EuGNmh6aA==
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=5gERPJpqEPGWcq/kG57GvB+OnCfQkelYeNTKrziWvm0=; b=Gxoq54GXr3Swku3kUl6A5ifNNls9Ip+KWXDzr1cxvXWEsYHyq+eUQmiE8um7k9hkKIObv98/XiLhSAO6+KOYx9/8cwI9WYVD/m4HvpjekA281mQGbDp3RAdoyefaNWSJYcVfoXZnpx0D/aL67Qq1EVSBZl3Mf3Jz6Aj/V4xgqzvXj1kttWK9X7PZjQjMRJLTVJZRuZ5oYOe908wAnQ4x7SZxq9Z5/iuGy13DXQ43DKs9iU6+OaGvxAtaaU29rOrhROaDb3I31+aUaW29NBXE+eD+nVHl1oR2sL4N2gyajvnx5JNoAMi4eKd1t35Pf7zlUgXygkqot+2lRzGnyd+ZWw==
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
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nih.onmicrosoft.com; s=selector1-nih-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=5gERPJpqEPGWcq/kG57GvB+OnCfQkelYeNTKrziWvm0=; b=lCK4KUQMH4n28uCnrfwvdCjmFv9o9snOIMwnLGanae0aVzvkaqcbQ+6/TvpBw1FmD2MtXP0aw/SS/Kxd2QP07oy2d99RYPK+oGcqKWBHL3OroQejeHwAV7zQ3FOb51aiL8z1+xHo/RSD3xqgPZl+mTGuRGHotom5Fq0xx+g9sxw=
From: "Lavrentiev, Anton (NIH/NLM/NCBI) [C] via cygwin" <cygwin@cygwin.com>
Reply-To: "Lavrentiev, Anton (NIH/NLM/NCBI) [C]" <lavr@ncbi.nlm.nih.gov>
To: "'cygwin@cygwin.com'" <cygwin@cygwin.com>
Subject: getpriority() and top display for priority is inconsistent
Date: Tue, 6 Aug 2019 18:54:08 +0000
Message-ID: <BL0PR0901MB4308798C7E132A9D569FB9AAA5D50@BL0PR0901MB4308.namprd09.prod.outlook.com>
authentication-results: spf=none (sender IP is ) smtp.mailfrom=lavr@ncbi.nlm.nih.gov;
x-ms-oob-tlc-oobclassifiers: OLM:8882;
x-ms-exchange-senderadcheck: 1
x-ms-exchange-transport-forked: True
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
X-MS-Exchange-CrossTenant-mailboxtype: HOSTED
X-MS-Exchange-CrossTenant-userprincipalname: rq9jJVx5A9UcGHNFnjFznadpmQHro+6eow90JxkR22VI1zDvhsHuCjr0IfPwX6l6
Content-Transfer-Encoding: 8bit
X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id x76ItFnt022782

I have noticed a discrepancy between the process priority shown by "top" vs. what getpriority() returns.

I'm using the procps-based "top", so it reads the priority value from /proc/PID/stat.  The value gets there via code found in "fhandler_process.cc":

  /* The BasePriority returned to a 32 bit process under WOW64 is
     apparently broken, for 32 and 64 bit target processes.  64 bit
     processes get the correct base priority, even for 32 bit processes. */
  if (wincap.is_wow64 ())
    priority = 8; /* Default value. */
  else
    priority = pbi.BasePriority;

But that's an inconsistent way of generating the value, because it is supposed to be the one that "getpriority()" returns.

Also, it looks like the higher value in "pbi.BasePriority" corresponds to a higher process priority, while Unix priority is higher when the value is less
(20 - nice, generally).

It looks like it should have been done by calling a utility function, winprio_to_nice(GetPriorityClass(CurrentProcess())), and setting up both the priority
field (as "NZERO + winprio_to_nice()") and the following "nice" field (which is currently set to permanent zero) with what winprio_to_nice() returns.


--
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


