From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca (simark.ca [158.69.221.121]) by sourceware.org (Postfix) with ESMTPS id DDC9F385DC0C for ; Mon, 13 Apr 2020 20:43:40 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org DDC9F385DC0C Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=simark.ca Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=simark@simark.ca Received: from [10.0.0.11] (unknown [192.222.164.54]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id 78F0D1E60C; Mon, 13 Apr 2020 16:43:40 -0400 (EDT) Subject: Re: [PATCH] Implement IP_STAT on NetBSD To: Kamil Rytarowski , gdb-patches@sourceware.org References: <20200413181911.17133-1-n54@gmx.com> <64ef8889-0782-a541-6efa-3c37ed06b372@simark.ca> <4671cd7b-b081-1aad-88c3-f40aaefa38f5@gmx.com> <52edb779-5a48-ccd0-4873-67551aa89eac@simark.ca> From: Simon Marchi Message-ID: <629691cd-1d8b-53e6-46d7-514bf70fe170@simark.ca> Date: Mon, 13 Apr 2020 16:43:40 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.6.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: fr Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-11.4 required=5.0 tests=BAYES_00, KAM_DMARC_STATUS, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Apr 2020 20:43:42 -0000 On 2020-04-13 4:26 p.m., Kamil Rytarowski wrote: > On 13.04.2020 22:11, Simon Marchi wrote: >>> This compat shim is only to emulate Linux... it's possible to follow the >>> FreeBSD case and just print local kinfo_proc2 as-is (that is fully >>> OS-specific). >>> >>> What do you think? >>> >>> The same question applies to IP_STATUS. >> When you put it like this... it just seems useless to read the info from /proc. >> >> If sysctl is guaranteed to always be there and is the blessed way of getting the >> information, then let's just use that. > > As the kernel emulates Linux in /proc, the stat file is more complete in > the kernel as there are missing fields (sys/rusage.h ones, eip, esp, > stack position etc) Ok, so if you'd like to have this extra information printed, then it could make sense to try /proc first (if you think it's worth the extra complexity). >> The goal is not to emulate Linux, but to >> use each OS's interface to get the required information. > > Is it fine to print NetBSD specific internals from kinfo_proc2 in > NetBSD-specific format? Making up Linux-like output will be always > imperfect, but on the other hand end-users can be confused. You would have to give some specific examples, but in general it's fine for different OSes to print different information. If some process property only exists in NetBSD, then it should be printed here. If some process property exists in Linux but not NetBSD, then it should not be printed here. Although when we print the same things, we should strive to print them in a consistent way. Simon