previous: >>108744281
#define __NR_sched_setaffinity 203
#define __NR_sched_getaffinity 204
https://man7.org/linux/man-pages/man2/sched_setaffinity.2.html
tl;dr:
manage your thread's allowed CPU(s)
pretty neat, and not overly complicated. see also https://man7.org/linux/man-pages/man7/cpuset.7.html
another API which is pretty annoying where you have to allocate, query, reallocate, etc. until you don't get EINVAL. take special care to ensure you don't overflow when they round up!
it's got a nice example program. i always really appreciate manpages that do that
anyway, yeah. good syscall. actually has quite a lot of real world uses, and though the API is kind of gross, it could certainly be worse. overall, i'm quite happy with it i'd say
relevant resources:
man man
man syscalls
https://man7.org/linux/man-pages/
https://linux.die.net/man/
https://elixir.bootlin.com/linux/
https://elixir.bootlin.com/musl/
https://elixir.bootlin.com/glibc/