From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/14022 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Jonathan Rajotte-Julien Newsgroups: gmane.linux.lib.musl.general Subject: Re: sysconf(_SC_NPROCESSORS_CONF) returns the wrong value Date: Tue, 26 Mar 2019 12:23:34 -0400 Message-ID: <20190326162334.GF17481@joraj-alpa> References: <20190315210202.GD6994@joraj-alpa> <20190316022534.GN26605@port70.net> Reply-To: musl@lists.openwall.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="199872"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Mutt/1.9.5 (2018-04-13) To: musl@lists.openwall.com, Michael Jeanson , Richard Purdie , Mathieu Desnoyers Original-X-From: musl-return-14038-gllmg-musl=m.gmane.org@lists.openwall.com Tue Mar 26 17:23:51 2019 Return-path: Envelope-to: gllmg-musl@m.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by blaine.gmane.org with smtp (Exim 4.89) (envelope-from ) id 1h8ore-000ps2-Vn for gllmg-musl@m.gmane.org; Tue, 26 Mar 2019 17:23:51 +0100 Original-Received: (qmail 24498 invoked by uid 550); 26 Mar 2019 16:23:48 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Original-Received: (qmail 24473 invoked from network); 26 Mar 2019 16:23:47 -0000 DKIM-Filter: OpenDKIM Filter v2.10.3 mail.efficios.com 2657A1CDA4A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=efficios.com; s=default; t=1553617415; bh=/825ZEvcop6oIrd1/NMMrieacrmk2qY/OgbJQVIYu60=; h=Date:From:To:Message-ID:MIME-Version; b=LaC6+xE+AvwjhUxhaAXo9KXf1VYqlqaesl8pW16n9Mpsfv/CGOiwtu0slpE3MzGia +zYul/eSeJ/HCyJMfVRfhsM5Eerty8K/Fh5ThhAAsLeFz7S6S7M4JElfSandr7bm0K J1RBalc/uC/7SQ7QGZaziyhemtzJ6yvJTN+QsZZDGuuFxvZJz7KGVD3OLGiG4JYG1w 9ZSgjbzqLdabHhIjyJAe8z2vbnraT8ekzVU0P37l6qm0QAmiOQa88xq4n2EbTjcU9R Uic3TwAeunmXK5Z91dn/+0BgoKDHb8rxhWpF701KRYky6kS0WMDfNt5uqH2X5hGSQJ doap3EP1A/4Kw== X-Virus-Scanned: amavisd-new at efficios.com Content-Disposition: inline In-Reply-To: <20190316022534.GN26605@port70.net> Xref: news.gmane.org gmane.linux.lib.musl.general:14022 Archived-At: Hi Szabolcs, > i think we need to know why does a process care if musl returns > the wrong number? or what are the valid uses of such a number? > (there are heterogeous systems like arm big-little, numa systems > with many sockets, containers, virtualization,.. how deep may a > user process need to go down in this rabbit hole?) Does the answers from Mathieu Desnoyers [1] and Florian Weimer [2] fit the bill? [1] https://www.openwall.com/lists/musl/2019/03/16/3 [2] https://www.openwall.com/lists/musl/2019/03/19/1 > > note that most of /sys/devices/system/cpu/* is documented under > Documentation/ABI/testing in linux, not in Documentation/ABI/stable > and the format is not detailed, and some apis (e.g. /proc/cpuinfo) > are known to be different on android (and grsec?) kernels it may > be unmounted during early boot or in chroots, so sysfs parsing is > only done when really necessary. For what it's worth, uclibc and uclibc-ng seem to iterate over /sys/devices/system/cpu/* and fallback on online calculation if necessary. https://cgit.uclibc-ng.org/cgi/cgit/uclibc-ng.git/tree/libc/unistd/sysconf.c#n102 In the mean time, we implemented a fallback similar to this when we do not "know" the libc used (since musl does not come with __musl__, I read the reasons why, no need to discuss this). Not sure of the direction musl should take but I strongly believe that the behaviour regarding _SC_NPROCESSORS_CONF is not the appropriate one. Cheers -- Jonathan Rajotte-Julien EfficiOS