From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 106642 invoked by alias); 13 Mar 2019 04:55:30 -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 106072 invoked by uid 89); 13 Mar 2019 04:55:29 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-5.0 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_2,RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.1 spammy=HX-Languages-Length:2915, H*R:D*ca, device, half X-HELO: smtp-out-so.shaw.ca Received: from smtp-out-so.shaw.ca (HELO smtp-out-so.shaw.ca) (64.59.136.137) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 13 Mar 2019 04:55:27 +0000 Received: from [192.168.1.114] ([24.64.172.44]) by shaw.ca with ESMTP id 3vvIhXd2NvQPf3vvJhOfVf; Tue, 12 Mar 2019 22:55:25 -0600 Reply-To: Brian.Inglis@SystematicSw.ab.ca Subject: Re: bug in procps-ng To: cygwin-apps@cygwin.com References: <20190312170311.GL3785@calimero.vinschen.de> From: Brian Inglis Openpgp: preference=signencrypt Message-ID: <565e4e13-2bea-09a8-6edc-de2f8342a5a0@SystematicSw.ab.ca> Date: Wed, 13 Mar 2019 04:55:00 -0000 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.5.3 MIME-Version: 1.0 In-Reply-To: <20190312170311.GL3785@calimero.vinschen.de> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2019-03/txt/msg00008.txt.bz2 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? 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.