tty_dev_name_to_number(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… tty_dev_name_to_number(9) β€” a Kernel API Manual moment πŸŽ€

okay so bestie, welcome to tty_dev_name_to_number(9), straight out of the Kernel API Manual, and it's giving "tiny function, big responsibilities" energy. let's get into it ✨


🌸 NAME 🌸

tty_dev_name_to_number β€” return dev_t for device name

like, that's literally the whole vibe. you hand it a name, it hands you back a dev_t. iconic behavior fr fr 🫢


✨ SYNOPSIS ✨

int tty_dev_name_to_number (const char *name , dev_t *number );

no cap, that's the whole signature. look at her go πŸ‘‘


πŸŽ€ ARGUMENTS πŸŽ€

  • name β€” the user space name of the device under /dev. you know, the little guy you actually type, not the numbers πŸ¦‹
  • number β€” pointer to the dev_t that this function will populate. she fills it in for you, cute right? πŸ’–

πŸ¦‹ DESCRIPTION πŸ¦‹

okay so here's the tea: this function converts device names like ttyS0 or ttyUSB1 into dev_t like (4, 64) or (188, 1). literally a glow-up from name to numbers πŸ’…βœ¨

and if no corresponding driver is registered? bestie, it's not happening β€” the function returns -ENODEV. sad but honest 😭

Locking: this acquires tty_mutex to protect the tty_drivers list from being modified while we are traversing it, and makes sure to release it before exiting. she locks, she unlocks, she never leaves you hanging. that's main character energy πŸ”₯πŸ”


🌈 SEE ALSO 🌈

the whole friend group lives in the kernel file ./drivers/tty/tty_io.c β€” and honestly, this list ate:

iykyk πŸ§šπŸ’œ


quick vibe check: that source line says ./drivers/tty, and you'll catch her in October 2026 β€” so basically bookmark it. mwah πŸ’‹

okay bestie that's the whole page, go forth and convert those names to numbers, periodt πŸ’…β­πŸ“πŸŒΈπŸ‘‘

πŸ“¦ where this page comes from