set_cpus_allowed_ptr(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… set_cpus_allowed_ptr β€” kernel API manual, but make it cute

okay so bestie, we're in the Kernel API Manual today and the star of the show is set_cpus_allowed_ptr ✨ literally the function that sets the CPU affinity mask of a task. that's it, that's the vibe. icl it's giving "i decide which CPUs you get to hang out with" πŸ‘‘


πŸŽ€ NAME πŸŽ€

set_cpus_allowed_ptr β€” set CPU affinity mask of a task 🧚

like, it picks which CPU(s) a task is allowed to run on. main character energy for the task, honestly.


✨ SYNOPSIS ✨

int set_cpus_allowed_ptr (struct task_struct *p , const struct cpumask
*new_mask );

no cap, that's the whole signature β€” copy it exactly, don't come for me πŸ™ˆ


πŸ¦‹ ARGUMENTS πŸ¦‹

  • p β€” the task πŸ’– like, the actual task you're doing this to
  • new_mask β€” CPU affinity mask 🌸 the shiny new set of CPUs you're handing over

🌈 RETURN 🌈

returns zero if it all went slay βœ… or a negative error code if it did not 😭 (iykyk, negative error codes are never the vibe)


πŸ’œ SEE ALSO πŸ’œ

go read those too fr fr, they're all in the group chat πŸ“šπŸ«Ά


ok tiny reminder bestie: zero means success, negative means error β€” don't flip it, that's not the assignment πŸ’€

and that's the whole page, periodt πŸ’… this one lives in ./include/linux (source ./include/linux) and it's dated October 2026 β€” so yes she's from the future, and she ate πŸŒŸπŸŽ€ bye bestie, mwah πŸ«ΆπŸ’–

πŸ“¦ where this page comes from