dup_or_alloc_cpuset(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… dup_or_alloc_cpuset(9) β€” the dup_or_alloc_cpuset page, bestie πŸŽ€

okay so this is a page from the Kernel API Manual and honestly it's giving "short but mighty" ✨ β€” the whole thing is one function that does one little job and does it flawlessly. let's get into it 🫢


✨ NAME ✨

dup_or_alloc_cpuset β€” duplicate or allocate a new cpuset πŸ’–

like, the name literally tells you the whole plot. either you're copying a cpuset or you're making a fresh one. that's it. that's the function. periodt πŸ‘‘


🌸 SYNOPSIS 🌸

struct cpuset * dup_or_alloc_cpuset (struct cpuset *cs );

so it takes one pointer to a struct cpuset, hands you back a pointer to a struct cpuset, and that's the whole signature. no cap, it's that simple. lowkey iconic for how unbothered it is πŸ’…


πŸ¦‹ ARGUMENTS πŸ¦‹

  • cs β€” the source cpuset you wanna duplicate, bestie. and if you pass NULL? then it skips the whole copying thing entirely and just does a fresh allocation for you instead πŸŽ€

πŸ’œ DESCRIPTION πŸ’œ

so what actually happens inside? great question, glad you asked πŸ’–

This creates a new cpuset by either:

  1. Duplicating an existing cpuset β€” this is the path you take when cs is non-NULL ✨ you already got a cpuset and you want a copy of it, slay.
  2. Allocating a fresh cpuset with zero-initialized masks β€” this is the NULL route 🧚 you hand it nothing and it hands you back a brand new cpuset whose masks are all zeroed out. clean slate energy, main character energy, we love to see it 🌈
two branches, one function. choose your fighter πŸ’€

⭐ RETURN ⭐

  • On success? you get a pointer to the newly allocated cpuset πŸ‘‘ ate and left no crumbs
  • On failure? you get NULL 😭 and ngl you should probably check for that before you go dereferencing it, just saying πŸ™ˆ

πŸ“ SEE ALSO πŸ“

okay this is the part where the page just goes off β€” the related-reference list is genuinely enormous and honestly? we're obsessed. all of these live in the kernel file ./kernel/cgroup/cpuset.c πŸŽ€

iykyk β€” cpuset girlies stay booked and busy πŸ’…βœ¨


and that's the page!! πŸ’– brought to you from ./kernel/cgroup, dated October 2026 🌸 bestie go forth and duplicate responsibly πŸ«ΆπŸŽ€

πŸ“¦ where this page comes from