get_subdir(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

🌸 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 of name, 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 from dir to the returned subdir. Error = error code comes back and the reference on dir is just dropped. Periodt. πŸ’…

πŸ”₯ SEE ALSO πŸ”₯

Kernel file ./fs/proc/proc_sysctl.c β€” go peek at these too, iykyk:


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