__dev_get_by_name(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… __dev_get_by_name(9) β€” like, the kernel API manual bestie ✨

okay so this is a page from the Kernel API Manual (yes, the (9) one, we're in kernel-land now 🧚) and it's about finding a network device by its name. short page, but honestly iconic of it.


✨ NAME ✨

__dev_get_by_name β€” find a device by its name πŸŽ€


🌸 SYNOPSIS 🌸

struct net_device * __dev_get_by_name (struct net *net , const char *name );

that's the whole thing. no extra params, no surprises, we love a clean signature 🫢


πŸ¦‹ ARGUMENTS πŸ¦‹

  • net β€” the applicable net namespace πŸ’œ like, which namespace are we searching in, bestie
  • name β€” name to find πŸ” the actual string you're hunting for

⭐ DESCRIPTION ⭐

so the vibe here is: find an interface by name. simple. iconic. main character energy.

Must be called under RTNL semaphore. 🚨 no cap, that part is not optional β€” this function expects you to hold it already.

if the name is found, you get a pointer to the device back πŸ’– if the name is not found, you get NULL back, which is the kernel's polite way of saying "nope, didn't find it" πŸ’€

and here's the part that matters, bestie: the reference counters are not incremented β€” not even a little β€” so the caller must be careful with locks πŸ”’ like, this function does not take a ref for you, you have to handle that yourself. it's giving "look, don't touch" energy πŸ™ˆ


🌈 SEE ALSO 🌈

all of these are in the kernel file ./net/core/dev.c β€” go off πŸ‘‘

like, that's a whole list. she knows everyone at the function party πŸŽ‰


mwah πŸ’‹ that's the page. brought to you by ./net/core, dated October 2026, and still serving kernel API realness. go hold that RTNL semaphore and slay πŸ”₯πŸ‘‘

πŸ“¦ where this page comes from