int hwloc_set_cpubind(hwloc_topology_t topology, hwloc_const_bitmap_t set, int flags) { set = hwloc_fix_cpubind(topology, set); if (!set) return -1; if (flags & HWLOC_CPUBIND_PROCESS) { if (topology->binding_hooks.set_thisproc_cpubind) return topology->binding_hooks.set_thisproc_cpubind(topology, set, flags); } else if (flags & HWLOC_CPUBIND_THREAD) { if (topology->binding_hooks.set_thisthread_cpubind) return topology->binding_hooks.set_thisthread_cpubind(topology, set, flags); } else { if (topology->binding_hooks.set_thisproc_cpubind) { int err = topology->binding_hooks.set_thisproc_cpubind(topology, set, flags); if (err >= 0 || errno != ENOSYS) return err; /* ENOSYS, fallback */ } if (topology->binding_hooks.set_thisthread_cpubind) return topology->binding_hooks.set_thisthread_cpubind(topology, set, flags); } errno = ENOSYS; return -1; }
int hwloc_set_thread_cpubind(hwloc_topology_t topology, hwloc_thread_t tid, hwloc_const_bitmap_t set, int flags) { set = hwloc_fix_cpubind(topology, set); if (!set) return -1; if (topology->binding_hooks.set_thread_cpubind) return topology->binding_hooks.set_thread_cpubind(topology, tid, set, flags); errno = ENOSYS; return -1; }
int hwloc_set_proc_cpubind(hwloc_topology_t topology, hwloc_pid_t pid, hwloc_const_bitmap_t set, int flags) { set = hwloc_fix_cpubind(topology, set); if (!set) return -1; if (topology->set_proc_cpubind) return topology->set_proc_cpubind(topology, pid, set, flags); errno = ENOSYS; return -1; }
int hwloc_set_cpubind(hwloc_topology_t topology, hwloc_const_bitmap_t set, int flags) { set = hwloc_fix_cpubind(topology, set); if (!set) return -1; if (flags & HWLOC_CPUBIND_PROCESS) { if (topology->set_thisproc_cpubind) return topology->set_thisproc_cpubind(topology, set, flags); } else if (flags & HWLOC_CPUBIND_THREAD) { if (topology->set_thisthread_cpubind) return topology->set_thisthread_cpubind(topology, set, flags); } else { if (topology->set_thisproc_cpubind) return topology->set_thisproc_cpubind(topology, set, flags); else if (topology->set_thisthread_cpubind) return topology->set_thisthread_cpubind(topology, set, flags); } errno = ENOSYS; return -1; }