LWN.net Logo

Breaking userspace

Breaking userspace

Posted Jan 29, 2013 16:20 UTC (Tue) by nix (subscriber, #2304)
In reply to: Breaking userspace by eru
Parent article: Poettering: The Biggest Myths

IIRC, that's actually never worked on all multi-CPU architectures: it just happens that x86 and x86_64 report one stanza per CPU.


(Log in to post comments)

Breaking userspace

Posted Jan 29, 2013 16:54 UTC (Tue) by cesarb (subscriber, #6266) [Link]

/sys/devices/system/cpu seems better, and looks the same at least on this desktop (x86-64) and my phone (arm).

Breaking userspace

Posted Jan 29, 2013 19:01 UTC (Tue) by nix (subscriber, #2304) [Link]

But that's /sys, which is also rather more mutable than the syscall interface.

getconf _NPROCESSORS_CONF (or _NPROCESSORS_ONLN) is the thing to use (or, from a program, sysconf(_SC_NPROCESSORS_CONF) et seq. This is in glibc, so has a stability guarantee that is worth something. Let it figure out where to go for the answer.

Breaking userspace

Posted Jan 29, 2013 20:10 UTC (Tue) by eru (subscriber, #2753) [Link]

Thanks nix, and khim, that looks like what I need.

Copyright © 2013, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds