get_subdir(9)
πΈ NAME πΈ
Okay bestie, welcome to get_subdir(9) from the Kernel API Manual β the function that will find or create a subdir with the specified name. Thatβs the whole assignment, and it ate π
β¨
β¨ SYNOPSIS β¨
struct ctl_dir * get_subdir (struct ctl_dir *dir , const char *name ,
int namelen );
π ARGUMENTS π
dirβ the directory where you wanna create the subdirectory π«Άnameβ the name of the subdirectory to find or create, iconic behavior honestly πnamelenβ the length ofname, yes bestie we need the length too π
π¦ DESCRIPTION π¦
So hereβs the vibe: this function takes a directory with an elevated reference count so we know that if we drop the lock, the directory will not go away ππ
Upon success, the reference is moved from dir to the returned subdirectory. Slay. Upon error, an error code is returned and the reference on dir is simply dropped. No cap, thatβs the whole deal πβ¨
Bestie reminder: success = reference moves fromdirto the returned subdir. Error = error code comes back and the reference ondiris just dropped. Periodt. π
π₯ SEE ALSO π₯
Kernel file ./fs/proc/proc_sysctl.c β go peek at these too, iykyk:
register_sysctl_mount_point(9)__register_sysctl_table(9)register_sysctl_sz(9)__register_sysctl_init(9)unregister_sysctl_table(9)
Catch u later, bestie π«Ά this page comes from ./fs/proc, dated October 2026, and the manual tag is get_subdir(9) ππβ¨
π¦ 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