summaryrefslogtreecommitdiff
path: root/posix/tst-cpucount.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2007-04-03 23:29:18 +0000
committerUlrich Drepper <drepper@redhat.com>2007-04-03 23:29:18 +0000
commiteab1bdfb8ef2902e7b68352d6ce1b5d603597e36 (patch)
tree00ac9dba5b0687fd0bb056bed3d75e812a2c6a79 /posix/tst-cpucount.c
parent9700b0390e40c7ffaed2a74ae3285edfe6080bd3 (diff)
downloadglibc-eab1bdfb8ef2902e7b68352d6ce1b5d603597e36.tar.gz
* posix/Makefile (routines): Add sched_cpucount.
(tests): Add tst-cpucount. * posix/sched_cpucount.c: New file. * posix/tst-cpucount.c: New file. * posix/Versions: Export __sched_cpucount with version GLIBC_2.6.
Diffstat (limited to 'posix/tst-cpucount.c')
-rw-r--r--posix/tst-cpucount.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/posix/tst-cpucount.c b/posix/tst-cpucount.c
new file mode 100644
index 0000000000..fe3cded732
--- /dev/null
+++ b/posix/tst-cpucount.c
@@ -0,0 +1,27 @@
+#include <sched.h>
+#include <stdio.h>
+
+static int
+do_test (void)
+{
+ cpu_set_t c;
+
+ CPU_ZERO (&c);
+
+ for (int cnt = 0; cnt < 130; ++cnt)
+ {
+ int n = CPU_COUNT (&c);
+ if (n != cnt)
+ {
+ printf ("expected %d, not %d\n", cnt, n);
+ return 1;
+ }
+
+ CPU_SET (cnt, &c);
+ }
+
+ return 0;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"