public inbox for cygwin-apps@cygwin.com
 help / color / mirror / Atom feed
From: Brian Inglis <Brian.Inglis@SystematicSw.ab.ca>
To: cygwin-apps@cygwin.com
Subject: Re: bug in procps-ng
Date: Wed, 13 Mar 2019 04:55:00 -0000	[thread overview]
Message-ID: <565e4e13-2bea-09a8-6edc-de2f8342a5a0@SystematicSw.ab.ca> (raw)
In-Reply-To: <20190312170311.GL3785@calimero.vinschen.de>

On 2019-03-12 11:03, Corinna Vinschen wrote:
> I hope you're still with us.
> There appears to be a bug in procps-ng:
> $ procps -e
>   PID TTY          TIME CMD
>  1507 ?        00:00:00 tcsh
>  1529 ?        00:00:00 cygrunsrv
>  1506 ?        00:00:00 mintty
>  1531 ?        00:00:00 bash
>  1551 pty0     00:00:00 procps
>  1488 pty0     00:00:00 sh
>  1487 ?        00:00:01 mintty
>  1530 ?        00:00:00 xterm
> As you can see, the tty info seems to be broken.  In theory
> procps-ng should fetch the tty info from /proc/<PID>/stat.
> As far as I can see, the tty info in this file is correct
> for other processes.  But procps only shows info for its
> own tty for some reason.
> Any idea why?

Are /dev/con?? and /dev/pty? visible only in those processes?
Need persistent visible mappings to /dev/con?? and /dev/pty?
Inconsistencies in /dev/con?? handling: why do con* appear under major 5 with
different minors, and also as 3,0 consistent with /proc/PID/stat?

$ ls -l /dev/ | egrep con\|pty
crw-rw-rw-  1 Brian  Users    5, 255 Mar 12 22:23 conin
crw-rw-rw-  1 Brian  Users    5, 254 Mar 12 22:23 conout
crw-rw-rw-  1 Brian  Users    5,   1 Mar 12 22:23 console
crw--w----  1 Brian  Users  136,   0 Mar 12 22:23 pty0
$ ls -l /dev/{con,pty}*		# /proc/PID/stat maps to these major/minors
crw-rw-rw- 1 Brian Users   3, 0 Mar 12 22:23 /dev/conin
crw-rw-rw- 1 Brian Users   3, 0 Mar 12 22:23 /dev/conout
crw-rw-rw- 1 Brian Users   3, 0 Mar 12 22:23 /dev/console
crw--w---- 1 Brian Users 136, 0 Mar 12 22:23 /dev/pty0
$ fgrep /dev/ /proc/?????/ctty
/proc/63731/ctty:/dev/cons0
/proc/63835/ctty:/dev/cons0
/proc/63836/ctty:/dev/cons0
/proc/63865/ctty:/dev/pty0
$ ls -glo /proc/?????/fd/0	# /dev/con?? links appear stale (red on black)
lrwxrwxrwx 1 0 Mar 12 22:23 /proc/63731/fd/0 -> /dev/cons0
lrwxrwxrwx 1 0 Mar 12 22:23 /proc/63835/fd/0 -> /dev/cons0
lrwxrwxrwx 1 0 Mar 12 22:23 /proc/63836/fd/0 -> /var/log/xwin/XWin.0.log
lrwxrwxrwx 1 0 Mar 12 22:23 /proc/63839/fd/0 -> /dev/null
lrwxrwxrwx 1 0 Mar 12 22:23 /proc/63849/fd/0 -> /dev/null
lrwxrwxrwx 1 0 Mar 12 22:23 /proc/63850/fd/0 -> /dev/null
lrwxrwxrwx 1 0 Mar 12 22:23 /proc/63854/fd/0 -> /dev/null
lrwxrwxrwx 1 0 Mar 12 22:23 /proc/63862/fd/0 -> /dev/null
lrwxrwxrwx 1 0 Mar 12 22:23 /proc/63864/fd/0 -> /dev/null
lrwxrwxrwx 1 0 Mar 12 22:23 /proc/63865/fd/0 -> /dev/pty0
lrwxrwxrwx 1 0 Mar 12 22:23 /proc/63867/fd/0 -> /dev/null
lrwxrwxrwx 1 0 Mar 12 22:23 /proc/63883/fd/0 -> /dev/null

Cygwin /proc/PID/stat[$7] appears to have major in upper half, minor in lower
half e.g. 8912896 -> 00880000 -> 136,0; 196608 -> 00030000 -> 3,0.
Linux man 5 proc defines:
(7) tty_nr  %d
	The controlling terminal of the process. (The minor device number is
	contained in the combination of bits 31 to 20 and 7 to 0; the major
	device number is in bits 15 to 8.)

-- 
Take care. Thanks, Brian Inglis, Calgary, Alberta, Canada

This email may be disturbing to some readers as it contains
too much technical detail. Reader discretion is advised.

  reply	other threads:[~2019-03-13  4:55 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-12 17:03 Corinna Vinschen
2019-03-13  4:55 ` Brian Inglis [this message]
2019-03-13 10:28   ` Corinna Vinschen
2019-03-13 18:14     ` Achim Gratz
2019-03-14 20:25       ` Achim Gratz
2019-03-15 11:52         ` Corinna Vinschen
2019-03-15 16:05           ` Achim Gratz
2019-03-15 20:42             ` Corinna Vinschen

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=565e4e13-2bea-09a8-6edc-de2f8342a5a0@SystematicSw.ab.ca \
    --to=brian.inglis@systematicsw.ab.ca \
    --cc=cygwin-apps@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).