file_ref_get(9)
π file_ref_get(9) π
okay bestie, welcome to the Kernel API Manual, where todayβs main character is file_ref_get(9). This is the little function that goes βyes, give me one reference on this fileβ β and it does it with full memory ordering. no cap, itβs giving careful refcount energy. π«Ά
β¨ NAME β¨
file_ref_get β acquire one reference on a file. π
πΈ SYNOPSIS πΈ
bool file_ref_get (file_ref_t *ref );
π ARGUMENTS π
refβ pointer to the reference count. literally the thing youβre trying to get a ref on, bestie.
π¦ DESCRIPTION π¦
okay so this is similar to atomic_inc_not_zero, but it saturates at FILE_REF_MAXREF. yes, it has a ceiling β it will not just keep climbing forever.
It provides full memory ordering. π§β¨
β RETURN β
- False β if the attempt to acquire a reference failed. This happens when the last reference has been put already. π
- True β if a reference was successfully acquired. slay. π
π SEE ALSO π
Kernel file ./include/linux/file_ref.h β plus file_ref_init(9), file_ref_inc(9), file_ref_put(9), file_ref_put_close(9), and file_ref_read(9). go read those too, iykyk ππ
okay thatβs the whole vibe: file_ref_get(9), from ./include/linux, dated October 2026 β source/version noted, date noted, and this page is officially signed off with a sparkle. ππ
π¦ 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