http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58642

--- Comment #7 from vincenzo Innocente <vincenzo.innocente at cern dot ch> ---
getconf -a | grep _NPROCESSORS
_NPROCESSORS_CONF                  32
_NPROCESSORS_ONLN                  32


ls -l /sys/devices/system/cpu/
total 0
drwxr-xr-x 8 root root    0 Sep  2 17:44 cpu0
drwxr-xr-x 8 root root    0 Sep  2 17:44 cpu1
drwxr-xr-x 8 root root    0 Sep  2 17:44 cpu10
drwxr-xr-x 8 root root    0 Sep  2 17:44 cpu11
drwxr-xr-x 8 root root    0 Sep  2 17:44 cpu12
drwxr-xr-x 8 root root    0 Sep  2 17:44 cpu13
drwxr-xr-x 8 root root    0 Sep  2 17:44 cpu14
drwxr-xr-x 8 root root    0 Sep  2 17:44 cpu15
drwxr-xr-x 8 root root    0 Sep  2 17:44 cpu16
drwxr-xr-x 8 root root    0 Sep  2 17:44 cpu17
drwxr-xr-x 8 root root    0 Sep  2 17:44 cpu18
drwxr-xr-x 8 root root    0 Sep  2 17:44 cpu19
drwxr-xr-x 8 root root    0 Sep  2 17:44 cpu2
drwxr-xr-x 8 root root    0 Sep  2 17:44 cpu20
drwxr-xr-x 8 root root    0 Sep  2 17:44 cpu21
drwxr-xr-x 8 root root    0 Sep  2 17:44 cpu22
drwxr-xr-x 8 root root    0 Sep  2 17:44 cpu23
drwxr-xr-x 8 root root    0 Sep  2 17:44 cpu24
drwxr-xr-x 8 root root    0 Sep  2 17:44 cpu25
drwxr-xr-x 8 root root    0 Sep  2 17:44 cpu26
drwxr-xr-x 8 root root    0 Sep  2 17:44 cpu27
drwxr-xr-x 8 root root    0 Sep  2 17:44 cpu28
drwxr-xr-x 8 root root    0 Sep  2 17:44 cpu29
drwxr-xr-x 8 root root    0 Sep  2 17:44 cpu3
drwxr-xr-x 8 root root    0 Sep  2 17:44 cpu30
drwxr-xr-x 8 root root    0 Sep  2 17:44 cpu31
drwxr-xr-x 8 root root    0 Sep  2 17:44 cpu4
drwxr-xr-x 8 root root    0 Sep  2 17:44 cpu5
drwxr-xr-x 8 root root    0 Sep  2 17:44 cpu6
drwxr-xr-x 8 root root    0 Sep  2 17:44 cpu7
drwxr-xr-x 8 root root    0 Sep  2 17:44 cpu8
drwxr-xr-x 8 root root    0 Sep  2 17:44 cpu9
drwxr-xr-x 2 root root    0 Sep  2 17:45 cpufreq
drwxr-xr-x 2 root root    0 Sep  2 17:45 cpuidle
drwxr-xr-x 2 root root    0 Oct  7 08:43 intel_pstate
-r--r--r-- 1 root root 4096 Oct  7 08:43 kernel_max
-r--r--r-- 1 root root 4096 Oct  7 08:43 modalias
-r--r--r-- 1 root root 4096 Oct  7 08:43 offline
-r--r--r-- 1 root root 4096 Sep  2 18:06 online
-r--r--r-- 1 root root 4096 Oct  7 08:43 possible
drwxr-xr-x 2 root root    0 Oct  7 08:43 power
-r--r--r-- 1 root root 4096 Oct  7 08:43 present
--w------- 1 root root 4096 Oct  7 08:43 probe
--w------- 1 root root 4096 Oct  7 08:43 release
-rw-r--r-- 1 root root 4096 Oct  7 08:43 uevent

dmesg | grep 'Allowing.*CPUs'
smpboot: Allowing 128 CPUs, 96 hotplug CPUs

#include <sched.h>
#include <stdio.h>
#include <errno.h>

          int main(void)
          {
               cpu_set_t  k[32];
               sched_getaffinity(0, 8, k); 
               sched_getaffinity(0, 10, k);
               sched_getaffinity(0, 12, k);
               sched_getaffinity(0, 16, k);


strace ./a.out |& grep affin
sched_getaffinity(0, 8, 0x7fffbcf19420) = -1 EINVAL (Invalid argument)
sched_getaffinity(0, 10, 0x7fffbcf19420) = -1 EINVAL (Invalid argument)
sched_getaffinity(0, 12, 0x7fffbcf19420) = -1 EINVAL (Invalid argument)
sched_getaffinity(0, 16,  { ffffffff, 0 }) = 16

Reply via email to