sys_sched_getaffinity(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… sys_sched_getaffinity(9)

okay so bestie, welcome to the Kernel API Manual ✨ β€” this one's sys_sched_getaffinity, and it's literally the syscall that tells you which CPUs a process is allowed to run on. like, which ones it's vibing with. πŸ¦‹


✨ NAME ✨

sys_sched_getaffinity β€” get the CPU affinity of a process πŸ‘‘


🌸 SYNOPSIS 🌸

long sys_sched_getaffinity (pid_t pid , unsigned int len , unsigned long
__user * user_mask_ptr );

πŸŽ€ ARGUMENTS πŸŽ€

  • pid β€” the pid of the process. like, which process are we checking on πŸ’–
  • len β€” length in bytes of the bitmask pointed to by user_mask_ptr. so, how much room you're giving it 🫢
  • user_mask_ptr β€” a user-space pointer to hold the current CPU mask. this is where the answer gets dropped off 🎁

⭐ RETURN ⭐

on success, you get back the size of the CPU mask copied to user_mask_ptr. otherwise, an error code. that's it, that's the whole vibe check πŸ’…


🌈 SEE ALSO 🌈


ngl, that's the whole page β€” no plot twists, no secret options, just a syscall doing its little mask-copy thing πŸ”₯

and that's a wrap, bestie 🫢 this little love letter came from ./kernel/sched, dated October 2026, and it answers to the name sys_sched_getaffinity(9) β€” periodt πŸ’œβœ¨

πŸ“¦ where this page comes from