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=-3.3 required=5.0 tests=MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 7421 invoked from network); 5 May 2021 14:05:09 -0000 Received: from mother.openwall.net (195.42.179.200) by inbox.vuxu.org with ESMTPUTF8; 5 May 2021 14:05:09 -0000 Received: (qmail 30168 invoked by uid 550); 5 May 2021 14:05:07 -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 30150 invoked from network); 5 May 2021 14:05:06 -0000 Date: Wed, 5 May 2021 17:04:53 +0300 (MSK) From: Alexander Monakov To: musl@lists.openwall.com cc: Vincent Donnefort In-Reply-To: <20210505130615.6222-1-vincent.donnefort@arm.com> Message-ID: References: <20210505130615.6222-1-vincent.donnefort@arm.com> User-Agent: Alpine 2.20.13 (LNX 116 2015-12-14) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Subject: Re: [musl] [PATCH] sysconf: add _SC_NPROCESSORS_CONF support On Wed, 5 May 2021, Vincent Donnefort wrote: > Currently, _SC_NPROCESSORS_CONF is always equal to _SC_NPROCESSORS_ONLN. > However, it is expected from the first one to give the total number of CPUs > in the system, while the later must return only the number of CPUs which > are currently online. This distinction is important for a software such as > trace-cmd. Trace-cmd is a front-end for the kernel tracing tool ftrace. > When recording traces, trace-cmd needs to get the total number of CPUs > available in the system (_SC_NPROCESSORS_CONF) and not only the online ones > otherwise if a CPU goes offline some data might be missing. > > Hence, add a specific method to get _SC_NPROCESSORS_CONF, based on the > sysfs CPU entries /sys/devices/system/cpu/cpu[0-9] Why do the opendir instead of reading from /sys/devices/system/cpu/possible? The online/offline/possible CPU masks are documented in linux/Documentation/ABI/testing/sysfs-devices-system-cpu and linux/Documentation/cputopology.txt Alexander