From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=MAILING_LIST_MULTI, RCVD_IN_MSPIKE_H2 autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 8573 invoked from network); 27 Jul 2022 17:59:15 -0000 Received: from second.openwall.net (193.110.157.125) by inbox.vuxu.org with ESMTPUTF8; 27 Jul 2022 17:59:15 -0000 Received: (qmail 7652 invoked by uid 550); 27 Jul 2022 17:59:12 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Reply-To: musl@lists.openwall.com Received: (qmail 7593 invoked from network); 27 Jul 2022 17:59:11 -0000 Date: Wed, 27 Jul 2022 19:58:59 +0200 From: Szabolcs Nagy To: Rob Landley Cc: musl@lists.openwall.com Message-ID: <20220727175859.GC1320090@port70.net> Mail-Followup-To: Rob Landley , musl@lists.openwall.com References: <43e9ad2b-d53c-5fd5-0211-766f946c90f9@landley.net> <48546934-5ccd-0b1e-bf2b-306133101c6b@landley.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <48546934-5ccd-0b1e-bf2b-306133101c6b@landley.net> Subject: Re: [musl] Re: sysconf(_SC_NPROCESSORS_CONF) broken. * Rob Landley [2022-07-27 01:34:41 -0500]: > On 7/27/22 01:28, Rob Landley wrote: > > NPROCESSORS_CONF is supposed to show total processors, NPROCESSORS_ONLN shows > > available processors using the tasket mask sched_getaffinity()). > > > > Musl is (uniquely) using the getaffinity() version for both. Neither glibc nor > > bionic have that bug. > > > > Test: my laptop has 4 processors: > > > > $ taskset 7 nproc > > 3 > > $ taskset 7 nproc --all > > 4 > > > > With musl, both show 3. > > P.S. According to strace, devuan's nprocs --all is reading sysfs: > > openat(AT_FDCWD, "/sys/devices/system/cpu", > O_RDONLY|O_NONBLOCK|O_CLOEXEC|O_DIRECTORY) = 3 > fstat(3, {st_mode=S_IFDIR|0755, st_size=0, ...}) = 0 > getdents64(3, /* 22 entries */, 32768) = 656 > getdents64(3, /* 0 entries */, 32768) = 0 > > At a guess, counting the cpu[0-9]* entries? I looked at bionic's source and it > had a comment that x86 can use /proc/cpuinfo but arm only shows "available" > processors there, not total processors... i think the most recent thread on the topic: https://www.openwall.com/lists/musl/2021/07/06/2 an older discussion is at https://www.openwall.com/lists/musl/2019/03/15/5