Back to index

glibc  2.9
tst-cpucount.c
Go to the documentation of this file.
00001 #include <sched.h>
00002 #include <stdio.h>
00003 
00004 static int
00005 do_test (void)
00006 {
00007   cpu_set_t c;
00008 
00009   CPU_ZERO (&c);
00010 
00011   for (int cnt = 0; cnt < 130; ++cnt)
00012     {
00013       int n = CPU_COUNT (&c);
00014       if (n != cnt)
00015        {
00016          printf ("expected %d, not %d\n", cnt, n);
00017          return 1;
00018        }
00019 
00020       CPU_SET (cnt, &c);
00021     }
00022 
00023   return 0;
00024 }
00025 
00026 #define TEST_FUNCTION do_test ()
00027 #include "../test-skeleton.c"