From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 60196 invoked by alias); 13 Mar 2019 10:28:55 -0000 Mailing-List: contact cygwin-apps-help@cygwin.com; run by ezmlm Precedence: bulk Sender: cygwin-apps-owner@cygwin.com List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Mail-Followup-To: cygwin-apps@cygwin.com Received: (qmail 60186 invoked by uid 89); 13 Mar 2019 10:28:55 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-104.9 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_2,GOOD_FROM_CORINNA_CYGWIN,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 spammy=device, half, H*F:D*cygwin.com X-HELO: mout.kundenserver.de Received: from mout.kundenserver.de (HELO mout.kundenserver.de) (212.227.17.13) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 13 Mar 2019 10:28:54 +0000 Received: from calimero.vinschen.de ([24.134.7.25]) by mrelayeu.kundenserver.de (mreue106 [212.227.15.183]) with ESMTPSA (Nemesis) id 1N5W0q-1gxlgA3sTq-016ysT; Wed, 13 Mar 2019 11:28:48 +0100 Received: by calimero.vinschen.de (Postfix, from userid 500) id EE70BA80741; Wed, 13 Mar 2019 11:28:46 +0100 (CET) Date: Wed, 13 Mar 2019 10:28:00 -0000 From: Corinna Vinschen To: Brian Inglis Cc: cygwin-apps@cygwin.com, Wayne Porter Subject: Re: bug in procps-ng Message-ID: <20190313102846.GW3785@calimero.vinschen.de> Reply-To: cygwin-apps@cygwin.com Mail-Followup-To: Brian Inglis , cygwin-apps@cygwin.com, Wayne Porter References: <20190312170311.GL3785@calimero.vinschen.de> <565e4e13-2bea-09a8-6edc-de2f8342a5a0@SystematicSw.ab.ca> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="719vRtZnJj4YbTia" Content-Disposition: inline In-Reply-To: <565e4e13-2bea-09a8-6edc-de2f8342a5a0@SystematicSw.ab.ca> User-Agent: Mutt/1.11.3 (2019-02-01) X-SW-Source: 2019-03/txt/msg00009.txt.bz2 --719vRtZnJj4YbTia Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-length: 3447 On Mar 12 22:55, Brian Inglis wrote: > 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//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? >=20 > Are /dev/con?? and /dev/pty? visible only in those processes? /dev/consX, yes. the ptys are always visible. > 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? >=20 > $ 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 Try the same from within a console: $ ls -l /dev/ | egrep con\|pty crw-rw-rw- 4 corinna vinschen 3, 0 Mar 13 10:37 conin crw-rw-rw- 4 corinna vinschen 3, 0 Mar 13 10:37 conout crw-rw-rw- 4 corinna vinschen 3, 0 Mar 13 10:37 cons0 crw-rw-rw- 4 corinna vinschen 3, 0 Mar 13 10:37 console crw--w---- 1 corinna vinschen 136, 0 Mar 13 10:37 pty0 [~](64)$ ls -l /dev/{con,pty}* crw-rw-rw- 4 corinna vinschen 3, 0 Mar 13 10:37 /dev/conin crw-rw-rw- 4 corinna vinschen 3, 0 Mar 13 10:37 /dev/conout crw-rw-rw- 4 corinna vinschen 3, 0 Mar 13 10:37 /dev/cons0 crw-rw-rw- 4 corinna vinschen 3, 0 Mar 13 10:37 /dev/console crw--w---- 1 corinna vinschen 136, 0 Mar 13 10:37 /dev/pty0 The device numbers for conin/out/sole are different from a pty because the 5,X device numbers are the offical device numbers of these devices. But these files have no further meaning from inside a pty. As soon as you are inside a console, the conin/out/sole devices are redirected to your actual consX, which has a device number 3,X and all of them are connected now to a real device. > [...] > Cygwin /proc/PID/stat[$7] appears to have major in upper half, minor in l= ower > 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.) Thanks. I changed the output of /proc//stat accordingly, but now `procps' always shows a question mark rather than a pty number, so that's not the problem: https://paste.fedoraproject.org/paste/BqENX~bhFzNkYQpa-lwWMw/raw Corinna --=20 Corinna Vinschen Cygwin Maintainer --719vRtZnJj4YbTia Content-Type: application/pgp-signature; name="signature.asc" Content-length: 833 -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEoVYPmneWZnwT6kwF9TYGna5ET6AFAlyI214ACgkQ9TYGna5E T6Ao4A/9GskYVVz0e+iKTRuzW5lUpzMr7NPQ0J/tFOtJyFLdEtYdPptL/PXY3jjr cfXad5INjCBTLMvSQFs01K21OKM4rlw0Dmclid1gldHhg/sRiAfzGo7egjICdIma VrjG83ydv3zkNQyNNYjVNYslhhoOpKwfstikwjW3vDpln/BpOZqCBoS/80q2SKDX tsWsSv+pN8KjkazM2/Ej/g6aOBi6pjAkLbX6kyKd76hVYttSOm8g0LlInRt5Xbbl yF+lY3NfiPeRFywu614DbhtOIoVNPoVHj3sbZt89oVIQLej736rldLh7QaeSIRgk NoOURVsRDSs6wFlOWvIgHMwHT+cAcIubHW2gpYAW+mCcN5OKU5jMzBKzeu57Y9jR iFuJT0pi2Qb22iY3g9ilpH9GvyqmcewRixvmHb0pGSNxDwPlyejzFuooT+vu5HFs VL4qjlucm0iRNFpHRBIM2eC88Y0L3tVoFq7vnhiyZRsltxr0gUhBAmM/SYt3+Jjw xmMvqmGhiCbYpZrv593LtOrXm3/RSWcPxmuiRgLuC+MiE0kVWxHzxKndBin0d8P/ l6EyrYnt1KwiN+2MxKWuIYuTmB6//e69LVTfs2ZyvDRRDgjRCQXEthsJsYMUtsrX FnPldTeLngZdIY8QymbDftVNzfk4+d7BMd0qm8ayR5giv+ujwHo= =11Ir -----END PGP SIGNATURE----- --719vRtZnJj4YbTia--