X-Recipient: archive-cygwin AT delorie DOT 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=JYfNJalQOcLZUH/KbAkO5zCXTEztsmBPu1jgI5V8aCtsdYi5ZpEEW H4wLr1e8spjglfBB0B0n1aKTL2OORY/K2IS4zx4ZkkGGQHd6NGYj1Jycvqj2LO+a Ke/BWQxORYkqKKvrUuXQZH4J1XGLlIxKY/+0TZjdMQHKIKAiJ+eqiI= 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=utqn2ZQY4WTcbJyMr0mJ0RqLv24=; b=MFOlSpYENsUhVILFgSX6NqUjOzGY Afz8MdmNMsZNHIMfALhOYynxKkUMyZkzRVkarqiAtqxvwttZyTra64+HsdaTlyFh o9nQaov2YHl0NiwMPMJ32WAVoMz+pQRoi8ppoehOAItJ3rRNlckIZjgZviGOwFoN 7p0zh7hyr+LFAuw= Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-4.6 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_2,SPF_PASS autolearn=ham version=3.3.1 spammy=U*cygwin-patches, cygwin-patches AT cygwin DOT com, cygwinpatchescygwincom, Hx-ms-oob-tlc-oobclassifiers:1728 X-HELO: nihcesxway3.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=1565138726; x=1596674726; h=from:to:subject:date:message-id: content-transfer-encoding:mime-version; bh=wHPaKb2JtufRRHM5jr47L4yA4YwBLRZ8wCz8VEDJ6zs=; b=n3tjzzxApxKHAOR+cvaAPc6f6VEtSYxxEAUwI3VpPf0caJkfC3P8jlsb utS3FHp2K++Qyuo1tqUzuZbhulxPBBMubnoBE0Ws3IiwZ9Tq+wNYlNtg3 CqFLo98oUA+d+U9OcOs9YFEneC4ez8tATmGF9pUvUOiKQWLd8LbS6GQpR OgA1NHHI7Po2Gk/KpQfGVqCSAUQ3LL46SI0WD5lLwgAVMJSEcSdM85VGu FzLzrLQfAtPSYdLvF/TPZMgzf95E0ElpVbIBoOLhP9u5oX0MEz/E+y9Kx nZlCDIGeI4fNZmt5ZPrXyMmHRulsS/V/0xnQwPTShBjDf1jq2emRo+goJ A==; IronPort-SDR: WYTd340FfrzKtZ19/T2rkufmVNKxs/a+W4kVHpnAeugIF3bemJQSZWl5CL2W+Doz/OVVTsK1k8 rYpke3lixAlA== ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SYr8pF/uRtPNOQqgL+UPDMS1YNakluAdIDu1d4jg2zICF2gqP0W+mXLL40YEMIUJ++PaF2ul83VY4rvKIvHNUGIzYoEjFCIoYYLOdj384IKUPVSwaEEHfuSs14DJ8+Jr2Qrxy/aj5me0lmmLys+HaSS5k+A0ixI7AK/VgcxVh0QOqNeoQrhCsVD4Q6ESWo6CPJde1W+C5M+7nKxsiHjhQsqSSrOglSmxjtGqbgiW0TgvezR8HzCmMpbayrMbMphfIUbalMNabhDAnkzW1TqnsQyOlP6VOB6nY4MnSkXK1X96VCkH7vb0Sfo07VTrz09z8mrkTQsJTKFAmQyGHvjwzw== 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=wHPaKb2JtufRRHM5jr47L4yA4YwBLRZ8wCz8VEDJ6zs=; b=ZT8RdAOJN2mLe0Lpb4CHWg8XHT2KH1F2UzoU+0xjJK31xukAwhb34iCWAvfsg0oL/lWiBaJRv7LMVGSSaLXhIKKfSa581dgkPoLWVehf+dpouFupsuzU1W/kkMPoPPNp2uWo5KSoizqhNa+fcWRua5fiVxjwcrGNbBZ8l8dSyCtmuHZebi4h8tWcmf9UOiMW+pgsrP9yVXZxeoJvDpzm3TbzvVnnSPnyf8JH24rV8T27ZFBxMxEDAfB4HuwjSax5tYRqF4yN/8FTZjVRojUpotxaMxytmu4FyT0KJUzwK7na4DzUcbuAiSrLuXtQoZ55vEyf/+vaHPbSHwnoNhLdEg== 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=wHPaKb2JtufRRHM5jr47L4yA4YwBLRZ8wCz8VEDJ6zs=; b=Zo2JKMB8o3boG9QYXHGXXYFNZYD4gzybfFrQYBq4whfMYvyKBWb/74thZnsrd68omNBN86Y0DJQIqRcDmfuzqgA0k9JFFtvA6f2jJ6qRVI+hQvNT/STmrxojGRgMmnhsGRmNTmMTRkyloOE6a4WmGTU3S6eUPbks8EqEvLqjqPQ= From: "Lavrentiev, Anton (NIH/NLM/NCBI) [C] via cygwin" Reply-To: "Lavrentiev, Anton (NIH/NLM/NCBI) [C]" To: "'cygwin AT cygwin DOT com'" Subject: Re: getpriority() and top display for priority is inconsistent Date: Wed, 7 Aug 2019 00:45:20 +0000 Message-ID: authentication-results: spf=none (sender IP is ) smtp.mailfrom=lavr AT ncbi DOT nlm DOT nih DOT gov; x-ms-oob-tlc-oobclassifiers: OLM:1728; x-ms-exchange-senderadcheck: 1 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: BhB63S4UXnlQh5HdUY8vPqNo1aq3S2rWNK0G5Z+ZWMhDgqp6cVVsIVknqdNTVVtx Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id x770kZEo032194 > You seem to have worked it out already so please send a patch in > git format-patch foramt to the cygwin-patches mailing list. I tried :-/ : Sorry, only subscribers may post. (#5.7.2) I do not use git to pull Cygwin sources. The last snapshot (that corresponds to the last-known-stable release I'm allowed to use) is a little old, but here goes the diff patch: $ diff -p cygwin-snapshot-20181226-{0,1}/winsup/cygwin/fhandler_process.cc *** cygwin-snapshot-20181226-0/winsup/cygwin/fhandler_process.cc 2018-08-17 14:41:04.000000000 -0400 --- cygwin-snapshot-20181226-1/winsup/cygwin/fhandler_process.cc 2019-08-06 17:05:35.421073900 -0400 *************** format_process_stat (void *data, char *& *** 1066,1072 **** unsigned long fault_count = 0UL, vmsize = 0UL, vmrss = 0UL, vmmaxrss = 0UL; uint64_t utime = 0ULL, stime = 0ULL, start_time = 0ULL; ! int priority = 0; if (p->process_state & PID_EXITED) strcpy (cmd, ""); else --- 1066,1072 ---- unsigned long fault_count = 0UL, vmsize = 0UL, vmrss = 0UL, vmmaxrss = 0UL; uint64_t utime = 0ULL, stime = 0ULL, start_time = 0ULL; ! if (p->process_state & PID_EXITED) strcpy (cmd, ""); else *************** format_process_stat (void *data, char *& *** 1095,1101 **** HANDLE hProcess; VM_COUNTERS vmc; KERNEL_USER_TIMES put; - PROCESS_BASIC_INFORMATION pbi; QUOTA_LIMITS ql; SYSTEM_TIMEOFDAY_INFORMATION stodi; SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION spt; --- 1095,1100 ---- *************** format_process_stat (void *data, char *& *** 1115,1123 **** status = NtQueryInformationProcess (hProcess, ProcessTimes, (PVOID) &put, sizeof put, NULL); if (NT_SUCCESS (status)) - status = NtQueryInformationProcess (hProcess, ProcessBasicInformation, - (PVOID) &pbi, sizeof pbi, NULL); - if (NT_SUCCESS (status)) status = NtQueryInformationProcess (hProcess, ProcessQuotaLimits, (PVOID) &ql, sizeof ql, NULL); CloseHandle (hProcess); --- 1114,1119 ---- *************** format_process_stat (void *data, char *& *** 1138,1154 **** stime = put.KernelTime.QuadPart * CLOCKS_PER_SEC / NS100PERSEC; start_time = (put.CreateTime.QuadPart - stodi.BootTime.QuadPart) * CLOCKS_PER_SEC / NS100PERSEC; - /* 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; unsigned page_size = wincap.page_size (); vmsize = vmc.PagefileUsage; vmrss = vmc.WorkingSetSize / page_size; vmmaxrss = ql.MaximumWorkingSetSize / page_size; destbuf = (char *) crealloc_abort (destbuf, strlen (cmd) + 320); return __small_sprintf (destbuf, "%d (%s) %c " --- 1134,1144 ---- stime = put.KernelTime.QuadPart * CLOCKS_PER_SEC / NS100PERSEC; start_time = (put.CreateTime.QuadPart - stodi.BootTime.QuadPart) * CLOCKS_PER_SEC / NS100PERSEC; unsigned page_size = wincap.page_size (); vmsize = vmc.PagefileUsage; vmrss = vmc.WorkingSetSize / page_size; vmmaxrss = ql.MaximumWorkingSetSize / page_size; + int nice = winprio_to_nice(GetPriorityClass(hProcess)); destbuf = (char *) crealloc_abort (destbuf, strlen (cmd) + 320); return __small_sprintf (destbuf, "%d (%s) %c " *************** format_process_stat (void *data, char *& *** 1160,1166 **** p->pid, cmd, state, p->ppid, p->pgid, p->sid, p->ctty, -1, 0, fault_count, fault_count, 0, 0, utime, stime, ! utime, stime, priority, 0, 0, 0, start_time, vmsize, vmrss, vmmaxrss ); --- 1150,1156 ---- p->pid, cmd, state, p->ppid, p->pgid, p->sid, p->ctty, -1, 0, fault_count, fault_count, 0, 0, utime, stime, ! utime, stime, NZERO + nice, nice, 0, 0, start_time, vmsize, vmrss, vmmaxrss ); -- 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