file_ref_put(9)
π
file_ref_put β like, the Kernel API Manual page, but make it make sense
okay so bestie, we're in the file_ref_put(9) section of the Kernel API Manual and honestly this one is a little baddie. let's get into it β¨
π NAME
file_ref_put β release a file reference π«Ά
β¨ SYNOPSIS
bool file_ref_put (file_ref_t *ref );
π§ ARGUMENTS
refβ pointer to the reference count. that's it, that's the whole vibe π
π₯ DESCRIPTION
okay so here's the tea β: this one gives you release memory ordering, meaning all those prior loads and stores are done before β like, they showed up, they did their thing, they're not coming back. and on success it gives you acquire ordering, such that free has to come after. no cutting the line, no cap. π¦
π RETURN
- True β if this was the last reference and no future references are possible. that's the signal, bestie! it tells the caller "you're so valid, you can safely release the object protected by the reference counter" π
- False β if there are still active references, or if the put raced with a concurrent get/put pair. in that case the caller is not allowed to release the protected object. π like, hands off, respectfully.
fr fr do not release the object on a False. the race case is a whole thing. π
π SEE ALSO
kernel file ./include/linux/file_ref.h β plus the whole friend group: file_ref_init(9), file_ref_get(9), file_ref_inc(9), file_ref_put_close(9), file_ref_read(9) π«Άβ¨
and that's the page, periodt π
this little icon came out of ./include/linux and it's dated October 2026 β see you in the future, bestie π¦β
π¦ 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