refcount_dec_not_one(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ¦‹ refcount_dec_not_one(9) β€” like, the manual page πŸ’…

okay so this is a page from the Kernel API Manual, section 9 of the man pages, and it's all about refcount_dec_not_one, bestie. buckle up πŸŽ€


✨ NAME ✨

refcount_dec_not_one β€” decrement a refcount if it is not 1


🌸 SYNOPSIS 🌸

bool refcount_dec_not_one (refcount_t *r );

πŸ’œ ARGUMENTS πŸ’œ

  • r β€” the refcount. that's it, that's the whole argument. she's low maintenance πŸ’…

🧚 DESCRIPTION 🧚

so here's the vibe: there is no atomic_t counterpart for this one. none. doesn't exist. it's giving main character energy, she's one of a kind ✨

what she does is decrement the refcount unless the value is 1 β€” and in that case she just... doesn't, and returns false. like, nope, not touching that one, bye πŸ™ˆ

back in the day people used to do this same thing by hand, and it looked like this:

atomic_add_unless(var, -1, 1)

iconic behaviour, honestly. but now we have a whole function for it, slay πŸ‘‘


⭐ RETURN ⭐

  • true β€” the decrement operation was successful πŸŽ‰
  • false β€” otherwise πŸ’€

πŸ”₯ SEE ALSO πŸ”₯

like, go read those too, they're the friend group 🫢


ngl if you skimmed this: she decrements unless it's 1, returns false when it's 1, true when she actually decremented. no cap. πŸ“

and that's the whole page, bestie πŸ’– this one came out of ./lib in October 2026, so go forth and refcount responsibly πŸŒˆβ­πŸ’œ

πŸ“¦ where this page comes from