refcount_dec_not_one(9)
π¦ 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 π₯
- the kernel file
./lib/refcount.c refcount_dec_if_one(9)refcount_dec_and_mutex_lock(9)refcount_dec_and_lock(9)refcount_dec_and_lock_irqsave(9)
like, go read those too, they're the friend group π«Ά
ngl if you skimmed this: she decrements unless it's1, returnsfalsewhen it's1,truewhen 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
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms