public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* Re: getpriority() and top display for priority inconsistent
@ 2019-08-08 13:46 Lavrentiev, Anton (NIH/NLM/NCBI) [C] via cygwin
  2019-08-08 15:40 ` Corinna Vinschen
  0 siblings, 1 reply; 10+ messages in thread
From: Lavrentiev, Anton (NIH/NLM/NCBI) [C] via cygwin @ 2019-08-08 13:46 UTC (permalink / raw)
  To: 'cygwin@cygwin.com'

> I pushed your patch with a short commit message.

Thanks!  Thinking about that a little more, getpriority(PRIO_PROCESS) returns the cached version of priority (since the last
setpriority()) but should return "live" version by re-getting and re-caching the actual thing from the system:
1. The priority could have been changed from the outside (it is a windows process, after all, and anybody can use Task Manager, for example);
2. When pulling group or user priorities from getpriority(), those things get returned from fresh "winpids", which gets constructed
   on-the-fly and so "nice" gets populated from the system; so the results can be, again, inconsistent (e.g. if compared to getpriority() for
   the process alone, since it is a cached one);
3. "/proc/PID/stat" always shows the live results (even before my change, although it was showing the "wrong" value).

Thoughts?

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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: getpriority() and top display for priority inconsistent
  2019-08-08 13:46 getpriority() and top display for priority inconsistent Lavrentiev, Anton (NIH/NLM/NCBI) [C] via cygwin
@ 2019-08-08 15:40 ` Corinna Vinschen
  0 siblings, 0 replies; 10+ messages in thread
From: Corinna Vinschen @ 2019-08-08 15:40 UTC (permalink / raw)
  To: cygwin

[-- Attachment #1: Type: text/plain, Size: 1221 bytes --]

On Aug  8 13:45, Lavrentiev, Anton (NIH/NLM/NCBI) [C] via cygwin wrote:
> > I pushed your patch with a short commit message.
> 
> Thanks!  Thinking about that a little more, getpriority(PRIO_PROCESS)
> returns the cached version of priority (since the last setpriority())
> but should return "live" version by re-getting and re-caching the
> actual thing from the system: 1. The priority could have been changed
> from the outside (it is a windows process, after all, and anybody can
> use Task Manager, for example); 2. When pulling group or user
> priorities from getpriority(), those things get returned from fresh
> "winpids", which gets constructed on-the-fly and so "nice" gets
> populated from the system; so the results can be, again, inconsistent
> (e.g. if compared to getpriority() for the process alone, since it is
> a cached one); 3. "/proc/PID/stat" always shows the live results (even
> before my change, although it was showing the "wrong" value).
> 
> Thoughts?

Feel free to provide a patch, just, please, create a valid git commit
message and send the stuff to cygwin-patches (unless the patch is
really trivial).


Thanks,
Corinna

-- 
Corinna Vinschen
Cygwin Maintainer

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: getpriority() and top display for priority inconsistent
  2019-08-15 11:04       ` Houder
@ 2019-08-15 11:13         ` john doe
  0 siblings, 0 replies; 10+ messages in thread
From: john doe @ 2019-08-15 11:13 UTC (permalink / raw)
  To: cygwin

On 8/15/2019 1:04 PM, Houder wrote:
> On Thu, 15 Aug 2019 12:20:38, Corinna Vinschen  wrote:
>>
>> On Aug 15 09:41, Lavrentiev, Anton (NIH/NLM/NCBI) [C] via cygwin wrote:
>>>> git format-patch output with commit message, please?
>>> =20
>>> Please educate me how to do that;  I am just using "git diff --no-color".
>>
>> $ git add <files with changes you want to commit>
>> $ git commit
>>
>>   - opens editor to create a commit message.  first line is summary,
>>     second line stays empty, descriptive text follows in line 3+.
>>

So, your commit message should have the form of:
"Subject line

Commit message"

A subject line is maximum 50 character long
A subject line starts in the imperative mode and does not end with any
punctuation marks.

The commit message is 72 character long.

--
John Doe

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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: getpriority() and top display for priority inconsistent
  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
  1 sibling, 1 reply; 10+ messages in thread
From: Houder @ 2019-08-15 11:04 UTC (permalink / raw)
  To: cygwin

On Thu, 15 Aug 2019 12:20:38, Corinna Vinschen  wrote:
> 
> On Aug 15 09:41, Lavrentiev, Anton (NIH/NLM/NCBI) [C] via cygwin wrote:
> > > git format-patch output with commit message, please?
> >=20
> > Please educate me how to do that;  I am just using "git diff --no-color".
> 
> $ git add <files with changes you want to commit>
> $ git commit
> 
>   - opens editor to create a commit message.  first line is summary,
>     second line stays empty, descriptive text follows in line 3+.
> 
> $ git format-patch -1
> 
>   - creates a git patch file which can be attached to your email or
>     just send *as* email with `git send-email --to=3D<addr> <filename>
> 
> Starting with git has a bit steep learning curve, but it's totally
> worth it.  There's a great free online book available:

Steep learning curve is right (but you already got that, is it not,
Anton?

> 
>   https://git-scm.com/book/
> 

Look at ch5 (distributed git), then .2 (contributing to a project),
then 'Public Project over Email'.

Also consult (using your Linux-box?)

 - man git-format-patch
 - man git-send-email

On Cygwin you have to install both git and git-email ... the latter
in case you want to use git send-email ...

Also, you will have to extend ~/.gitconfig in case you want to use
git send-email w/

[sendemail]
	smtpserver = smtp....
	smtpencryption = ...
	smtpserverport = ...
	smtpuser = ...

You were leaving town soon, were you not?

Good luck!
Henri


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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: getpriority() and top display for priority inconsistent
  2019-08-15  9:41   ` Lavrentiev, Anton (NIH/NLM/NCBI) [C] via cygwin
  2019-08-15 10:20     ` Corinna Vinschen
@ 2019-08-15 10:54     ` john doe
  1 sibling, 0 replies; 10+ messages in thread
From: john doe @ 2019-08-15 10:54 UTC (permalink / raw)
  To: cygwin

On 8/15/2019 11:41 AM, Lavrentiev, Anton (NIH/NLM/NCBI) [C] via cygwin
wrote:
>> git format-patch output with commit message, please?
>
> Please educate me how to do that;  I am just using "git diff --no-color".
>

$ git format-patch --stdout <commit-message>

If you want to request for comment you could use 'git send-email' on
your own patch.

Basically, you need to familiorize yourself with 'git format-patch' and
'git send-email'.

--
John Doe

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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: getpriority() and top display for priority inconsistent
  2019-08-15 10:20     ` Corinna Vinschen
@ 2019-08-15 10:23       ` Corinna Vinschen
  2019-08-15 11:04       ` Houder
  1 sibling, 0 replies; 10+ messages in thread
From: Corinna Vinschen @ 2019-08-15 10:23 UTC (permalink / raw)
  To: Lavrentiev, Anton (NIH/NLM/NCBI) [C]; +Cc: cygwin

[-- Attachment #1: Type: text/plain, Size: 519 bytes --]

On Aug 15 12:20, Corinna Vinschen wrote:
> On Aug 15 09:41, Lavrentiev, Anton (NIH/NLM/NCBI) [C] via cygwin wrote:
> > > git format-patch output with commit message, please?
> > 
> > Please educate me how to do that;  I am just using "git diff --no-color".
> 
> $ git add <files with changes you want to commit>
> $ git commit -a

Scratch the -a.  This means `coommit all changes' and lazily replaces
the `git add' command.  I screwed up here, sorry.


Corinna

-- 
Corinna Vinschen
Cygwin Maintainer

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: getpriority() and top display for priority inconsistent
  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 10:54     ` john doe
  1 sibling, 2 replies; 10+ messages in thread
From: Corinna Vinschen @ 2019-08-15 10:20 UTC (permalink / raw)
  To: Lavrentiev, Anton (NIH/NLM/NCBI) [C]; +Cc: cygwin

[-- Attachment #1: Type: text/plain, Size: 1693 bytes --]

On Aug 15 09:41, Lavrentiev, Anton (NIH/NLM/NCBI) [C] via cygwin wrote:
> > git format-patch output with commit message, please?
> 
> Please educate me how to do that;  I am just using "git diff --no-color".

$ git add <files with changes you want to commit>
$ git commit -a

  - opens editor to create a commit message.  first line is summary,
    second line stays empty, descriptive text follows in line 3+.

$ git format-patch -1

  - creates a git patch file which can be attached to your email or
    just send *as* email with `git send-email --to=<addr> <filename>

Starting with git has a bit steep learning curve, but it's totally
worth it.  There's a great free online book available:

  https://git-scm.com/book/

> > The commit message should describe what the problem is and how the patch fixes it.  One or
> > two sentences are enough.
> 
> The commit message is there:
> 
> > > "getpriority() consistent with process priority
> > https://cygwin.com/ml/cygwin/2019-08/msg00122.html"

Well, that's just a quote from a former email.  I would never have
recognized it as a commit message.  A commit message should consist
of the one-line summary (in our case starting with the text "Cygwin: "
to distinguish the change from generic newlib changes), followed
by an empty line, followed by a descriptive text, what problem this
patch fixes and how.

Don't get me wrong, I'm glad you send patches, but it's tricky to create
a meaningful commit message if you're not the author of a patch.  It's
also pretty time-consuming since you have to care for correct authorship
and stuff.


Thanks,
Corinna

-- 
Corinna Vinschen
Cygwin Maintainer

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* RE: getpriority() and top display for priority inconsistent
  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:54     ` john doe
  0 siblings, 2 replies; 10+ messages in thread
From: Lavrentiev, Anton (NIH/NLM/NCBI) [C] via cygwin @ 2019-08-15  9:41 UTC (permalink / raw)
  To: cygwin

> git format-patch output with commit message, please?

Please educate me how to do that;  I am just using "git diff --no-color".

> The commit message should describe what the problem is and how the patch fixes it.  One or
> two sentences are enough.

The commit message is there:

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


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


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: getpriority() and top display for priority inconsistent
  2019-08-14 20:01 Lavrentiev, Anton (NIH/NLM/NCBI) [C] via cygwin
@ 2019-08-15  7:29 ` Corinna Vinschen
  2019-08-15  9:41   ` Lavrentiev, Anton (NIH/NLM/NCBI) [C] via cygwin
  0 siblings, 1 reply; 10+ messages in thread
From: Corinna Vinschen @ 2019-08-15  7:29 UTC (permalink / raw)
  To: Lavrentiev, Anton (NIH/NLM/NCBI) [C]; +Cc: 'cygwin@cygwin.com'

[-- Attachment #1: Type: text/plain, Size: 1219 bytes --]

On Aug 14 20:01, Lavrentiev, Anton (NIH/NLM/NCBI) [C] via cygwin wrote:
> > 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)
> 

git format-patch output with commit message, please?  The commit message
should describe what the problem is and how the patch fixes it.  One or
two sentences are enogh.


Thanks,
Corinna

-- 
Corinna Vinschen
Cygwin Maintainer

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: getpriority() and top display for priority inconsistent
@ 2019-08-14 20:01 Lavrentiev, Anton (NIH/NLM/NCBI) [C] via cygwin
  2019-08-15  7:29 ` Corinna Vinschen
  0 siblings, 1 reply; 10+ messages in thread
From: Lavrentiev, Anton (NIH/NLM/NCBI) [C] via cygwin @ 2019-08-14 20:01 UTC (permalink / raw)
  To: 'cygwin@cygwin.com'

> 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

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2019-08-15 11:13 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-08 13:46 getpriority() and top display for priority inconsistent Lavrentiev, Anton (NIH/NLM/NCBI) [C] via cygwin
2019-08-08 15:40 ` Corinna Vinschen
2019-08-14 20:01 Lavrentiev, Anton (NIH/NLM/NCBI) [C] via cygwin
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

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