(root)/
glibc-2.38/
posix/
tst-cpucount.c
       1  #include <sched.h>
       2  #include <stdio.h>
       3  #include <sys/param.h>
       4  
       5  static int
       6  do_test (void)
       7  {
       8    cpu_set_t c;
       9  
      10    CPU_ZERO (&c);
      11  
      12    for (int cnt = 0; cnt < MIN (CPU_SETSIZE, 130); ++cnt)
      13      {
      14        int n = CPU_COUNT (&c);
      15        if (n != cnt)
      16  	{
      17  	  printf ("expected %d, not %d\n", cnt, n);
      18  	  return 1;
      19  	}
      20  
      21        CPU_SET (cnt, &c);
      22      }
      23  
      24    return 0;
      25  }
      26  
      27  #define TEST_FUNCTION do_test ()
      28  #include "../test-skeleton.c"