From: Corinna Vinschen <corinna-cygwin@cygwin.com>
To: cygwin-patches@cygwin.com
Subject: Re: [PATCH] Cygwin: Correct /proc/*/stat for processes without ctty
Date: Thu, 10 Nov 2022 10:10:06 +0100 [thread overview]
Message-ID: <Y2y/7kG3wQ19/VoU@calimero.vinschen.de> (raw)
In-Reply-To: <CAHWeT-a3FhOO2Fc6bEm6ZuW4qcHkY2wz47OMuXKzfSgROzUOMg@mail.gmail.com>
On Nov 9 21:36, Andy Koppe wrote:
> Hi,
>
> I had noticed that selecting or excluding processes without a
> controlling terminal doesn't work in procps on Cygwin.
>
> For example, the mintty process shouldn't appear in the following, as
> the 'f' (for forest) argument triggers procps's "BSD personality",
> where processes without a controlling terminal are supposed to be
> excluded by default:
>
> $ procps f
> PID TTY STAT STIME COMMAND
> 1809 ? Ss 19:49 /usr/bin/mintty -
> 1810 pty0 Ss 19:49 \_ -zsh
> 2075 pty0 R 21:14 \_ procps f
>
> Similarly, this should list the processes without a terminal, but
> comes up empty:
>
> $ procps -t -
>
> I tracked this down to a difference in the tty field of /proc/*/stat
> (which is the 7th field). On Linux, processes without a terminal have
> value 0 there, and that's what procps expects.
>
> Cygwin 3.3 has -1 instead, whereas on master the bits of the tty field
> were rearranged in commit 437d0a8f88, which turns the -1 into
> 268435455 (i.e. 0xFFFFFFF). Either way, procps treats such processes
> as having terminals. (The ? in the TTY column output is generated by a
> different code path in procps that uses /proc/*/ctty on Cygwin.)
>
> Patches for the 3.3 branch and master attached.
Pushed in master. We won't do another 3.3, so I skipped it.
Thanks,
Corinna
prev parent reply other threads:[~2022-11-10 9:10 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-09 21:36 Andy Koppe
2022-11-10 9:10 ` Corinna Vinschen [this message]
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=Y2y/7kG3wQ19/VoU@calimero.vinschen.de \
--to=corinna-cygwin@cygwin.com \
--cc=cygwin-patches@cygwin.com \
/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).