tty_lookup_driver(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– NAME πŸ’–

okay so this is the tty_lookup_driver(9) page from the Kernel API Manual, and it's literally about one thing: lookup a tty driver for a given device file. that's the whole vibe bestie πŸ’…

✨ SYNOPSIS ✨

struct tty_driver * tty_lookup_driver (dev_t device , struct file *filp
       , int *index );

πŸŽ€ ARGUMENTS πŸŽ€

  • device β€” device number. yes, that's the device number right there 🫢
  • filp β€” file pointer to tty. the file pointer for the tty, no cap.
  • index β€” index for the device in the return driver. it tells you the device's index in the returned driver ✨

🌸 DESCRIPTION 🌸

If returned value is not erroneous, the caller is responsible to decrement the refcount by tty_driver_kref_put. so if the return value isn't an error, bestie, you gotta handle that refcount cleanup yourself β€” don't leave it hanging 😭

Locking: tty_mutex protects get_tty_driver. that's the lock tea, fr fr πŸ”’

πŸ¦‹ RETURN πŸ¦‹

driver for this inode (with increased refcount). yep, it gives you the driver for this inode, and the refcount is increased β€” so handle it with care πŸ‘‘

πŸ‘‘ SEE ALSO πŸ‘‘

Kernel file ./drivers/tty/tty_io.c is in the mix too, and here's the whole SEE ALSO squad β€” every single one, because we do not skip the crew 🫢


cute little sign-off: source/version corner is ./drivers/tty, the date is October 2026, and this page is tty_lookup_driver(9). bye bestie, mwah πŸ’‹πŸ«Ά

πŸ“¦ where this page comes from