hwlocality
hwlocality copied to clipboard
Expose Linux libc interop
Expose libc::sched_(get|set)affinity interoperability behind suitable cfg flags with associated doc(cfg)/cfg(doc): https://hwloc.readthedocs.io/en/v2.9/group__hwlocality__glibc__sched.html
That actually looks quite Linux specific. Also, at the time of writing, there is no safe way to create a libc::cpu_set_t, which means that interfacing hwloc_cpuset_to_glibc_sched_affinity() would require some use of MaybeUninit.
Ah, well, I see, the issue is that the cpu_set_t of one libc may theoretically not match that of another libc. Then indeed, we need cfg(all(target_os = "linux", target_env = "gnu"))
Unfortunately, with the libc crate in its current state, it is not possible to implement this, because the hwloc functions are static functions (so we need to rewrite them in the rust bindings), and the libc crate 1/does not seem to allow safely creating a cpu_set_t and 2/expects &mut cpu_set_t in all functions that manipulate cpusets.