[git commit nptl] handle _SC_NPROCESSORS_CONF and _SC_NPROCESSORS_ONLN
Bernhard Reutner-Fischer
rep.dot.nop at gmail.com
Wed Aug 19 11:29:41 UTC 2009
commit: http://git.uclibc.org/uClibc/commit/?id=127f4f9c90a7ce86a1c442d90c85141e98c3ec36
branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/nptl
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop at gmail.com>
Signed-off-by: Austin Foxley <austinf at cetoncorp.com>
---
libc/sysdeps/linux/common/bits/kernel-features.h | 5 ++++
libc/unistd/sysconf.c | 24 +++++++++++-----------
2 files changed, 17 insertions(+), 12 deletions(-)
diff --git a/libc/sysdeps/linux/common/bits/kernel-features.h b/libc/sysdeps/linux/common/bits/kernel-features.h
index d95ff74..1f6ca09 100644
--- a/libc/sysdeps/linux/common/bits/kernel-features.h
+++ b/libc/sysdeps/linux/common/bits/kernel-features.h
@@ -435,3 +435,8 @@
#if __LINUX_KERNEL_VERSION >= 0x020609 && defined __alpha__
#define __ASSUME_IEEE_RAISE_EXCEPTION 1
#endif
+
+/* This header was added somewhere around 2.6.13 */
+#if __LINUX_KERNEL_VERSION >= 132621
+# define HAVE_LINUX_CPUMASK_H 1
+#endif
diff --git a/libc/unistd/sysconf.c b/libc/unistd/sysconf.c
index 3d30cce..99d2f84 100644
--- a/libc/unistd/sysconf.c
+++ b/libc/unistd/sysconf.c
@@ -37,6 +37,16 @@
#include <sysdep.h>
#endif
+#ifdef HAVE_LINUX_CPUMASK_H
+# include <linux/cpumask.h>
+#endif
+#ifndef num_present_cpus
+# define num_present_cpus() (1)
+#endif
+#ifndef num_online_cpus
+# define num_online_cpus() (1)
+#endif
+
/* libc_hidden_proto(sysconf) */
/* libc_hidden_proto(getpagesize) */
@@ -661,20 +671,10 @@ long int sysconf(int name)
#endif
case _SC_NPROCESSORS_CONF:
-#if 0
- RETURN_FUNCTION(get_nprocs_conf());
-#else
- /* this is a hack. for now always claim we have exactly one cpu */
- return 1;
-#endif
+ RETURN_FUNCTION(num_present_cpus());
case _SC_NPROCESSORS_ONLN:
-#if 0
- RETURN_FUNCTION(get_nprocs());
-#else
- /* this is a hack. for now always claim we have exactly one cpu */
- return 1;
-#endif
+ RETURN_FUNCTION(num_online_cpus());
case _SC_PHYS_PAGES:
#if 0
--
1.6.3.3
More information about the uClibc-cvs
mailing list