From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 116509 invoked by alias); 13 Mar 2019 18:14:12 -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 116500 invoked by uid 89); 13 Mar 2019 18:14:11 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-2.4 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.1 spammy=UD:gitlab.com, gitlab.com, gitlabcom, device X-HELO: vsmx011.vodafonemail.xion.oxcs.net Received: from vsmx011.vodafonemail.xion.oxcs.net (HELO vsmx011.vodafonemail.xion.oxcs.net) (153.92.174.89) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 13 Mar 2019 18:14:09 +0000 Received: from vsmx003.vodafonemail.xion.oxcs.net (unknown [192.168.75.197]) by mta-5-out.mta.xion.oxcs.net (Postfix) with ESMTP id 5857B3E03DE for ; Wed, 13 Mar 2019 18:14:07 +0000 (UTC) Received: from Gertrud (unknown [87.185.218.207]) by mta-7-out.mta.xion.oxcs.net (Postfix) with ESMTPA id 295913000C6 for ; Wed, 13 Mar 2019 18:14:05 +0000 (UTC) From: Achim Gratz To: cygwin-apps@cygwin.com Subject: Re: bug in procps-ng References: <20190312170311.GL3785@calimero.vinschen.de> <565e4e13-2bea-09a8-6edc-de2f8342a5a0@SystematicSw.ab.ca> <20190313102846.GW3785@calimero.vinschen.de> Date: Wed, 13 Mar 2019 18:14:00 -0000 In-Reply-To: <20190313102846.GW3785@calimero.vinschen.de> (Corinna Vinschen's message of "Wed, 13 Mar 2019 11:28:46 +0100") Message-ID: <87pnquk5g7.fsf@Rainer.invalid> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-SW-Source: 2019-03/txt/msg00010.txt.bz2 Corinna Vinschen writes: >> [...] >> 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.) > > 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 That was an exercise in futility. Procps uses system macros to dissemble the major/minor devices, so of course it's doing the right thing on Cygwin while using Cygwin macros (I think these are actually inline functions now). But your assertion that it should use stat for finding the tty is probably wrong, there's Cygwin specific code that looks at /dev/ctty: https://gitlab.com/procps-ng/procps/blob/master/proc/devname.c#L303 That's used in addition to code that would correctly determine the devices fromt the stat info, so at the moment I have no idea where the wheels fall off that wagon. Regards, Achim. -- +<[Q+ Matrix-12 WAVE#46+305 Neuron microQkb Andromeda XTk Blofeld]>+ Factory and User Sound Singles for Waldorf rackAttack: http://Synth.Stromeko.net/Downloads.html#WaldorfSounds