aboutsummaryrefslogtreecommitdiff
path: root/lib/xwrap.c
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2015-10-27 05:58:19 -0500
committerRob Landley <rob@landley.net>2015-10-27 05:58:19 -0500
commitd4c17cdaf1f72a872dcbe12952412f02810c29b5 (patch)
tree6e2be67906961503052e2c1d7483b95209b6f571 /lib/xwrap.c
parenteb1bbc245dd6554a8fbe879a4efb903f6e7788cb (diff)
downloadtoybox-d4c17cdaf1f72a872dcbe12952412f02810c29b5.tar.gz
Replace xcount_cpus() with a call to sysconf(_SC_NPROCESSORS_CONF)
Diffstat (limited to 'lib/xwrap.c')
-rw-r--r--lib/xwrap.c18
1 files changed, 0 insertions, 18 deletions
diff --git a/lib/xwrap.c b/lib/xwrap.c
index 69f891b9..4880bbe0 100644
--- a/lib/xwrap.c
+++ b/lib/xwrap.c
@@ -723,21 +723,3 @@ void xsignal(int signal, void *handler)
if (sigaction(signal, sa, 0)) perror_exit("xsignal %d", signal);
}
-
-unsigned xcount_cpus(void)
-{
- int len = 0, i, fd = xopen("/proc/stat", O_RDONLY);
- unsigned cpus = 0;
-
- for (;;) {
- if (1>(i = xread(fd, libbuf, sizeof(libbuf)-len))) break;
- len += i;
- // Each cpu# line has data after it, so last 5 bytes of file can't match
- for (i = 0; i<len-5; i++)
- if (!strncmp(libbuf+i, "\ncpu", 4) && isdigit(libbuf[i+4])) cpus++;
- memmove(libbuf, libbuf+i, 5);
- }
- close(fd);
-
- return cpus;
-}