tty_write(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– tty_write(9) πŸ’–

ok so this is a page from the Kernel API Manual (yes, the (9) means it's a kernel-internals thing, iykyk) and we're talking about tty_write, bestie. buckle up πŸŽ€


✨ NAME ✨

tty_write β€” the write method for a tty device file. like, the actual thing that happens when somebody writes to your terminal node. main character energy fr πŸ’…


πŸ¦‹ SYNOPSIS πŸ¦‹

ssize_t tty_write (struct kiocb *iocb , struct iov_iter *from );

literally copy that exactly, do not touch the spacing, the kernel devs wrote it like that and we respect it 🫢


🌸 ARGUMENTS 🌸

  • iocb β€” the kernel I/O control block. it's giving "paperwork for your write" ✨
  • from β€” an iov_iter holding the data you wanna write. this is the actual payload, the good stuff πŸ“

πŸ‘‘ DESCRIPTION πŸ‘‘

so basically: write data to a tty device via the line discipline. that's the whole vibe. you hand it bytes, the line discipline does its thing, the tty driver gets the data. slay.

Locking: (ok pay attention, this part is important πŸ’€) it locks the line discipline as required. writes to the tty driver are serialized by the atomic_write_lock, and then they get processed in chunks to the device. and here's the key bit β€” the line discipline write method will not be invoked in parallel for each device. so no two-writes-at-once chaos. it's one at a time, orderly, iconic. periodt. πŸ™ˆ

ngl, the serialization detail matters β€” if you were hoping for parallel line discipline writes per device, that's a no. the atomic_write_lock says absolutely not, bestie. πŸ’€

🌈 SEE ALSO 🌈

Kernel file ./drivers/tty/tty_io.c β€” and wow okay, this list is a whole friend group, get comfy:

free_tty_struct(9), tty_free_file(9), tty_name(9), get_tty_driver(9), tty_dev_name_to_number(9), tty_find_polling_driver(9), tty_wakeup(9), tty_release_redirect(9), __tty_hangup(9), tty_hangup(9), tty_vhangup(9), tty_vhangup_self(9), tty_vhangup_session(9), tty_hung_up_p(9), stop_tty(9), start_tty(9), tty_read(9), tty_send_xchar(9), pty_line_name(9), tty_line_name(9), tty_driver_lookup_tty(9), tty_init_termios(9), tty_standard_install(9), tty_driver_install_tty(9), tty_driver_remove_tty(9), tty_reopen(9), tty_init_dev(9), tty_save_termios(9), tty_flush_works(9), release_one_tty(9), tty_kref_put(9), release_tty(9), tty_release_checks(9), tty_kclose(9), tty_release_struct(9), tty_release(9), tty_open_current_tty(9), tty_lookup_driver(9), tty_kopen_exclusive(9), tty_kopen_shared(9), tty_open_by_driver(9), tty_open(9), tty_poll(9), tiocsti(9), tiocgwinsz(9), tty_do_resize(9), tiocswinsz(9), tioccons(9), tiocsetd(9), tiocgetd(9), send_break(9), tty_get_tiocm(9), tty_tiocmget(9), tty_tiocmset(9), tty_get_icount(9), alloc_tty_struct(9), tty_put_char(9), tty_register_device(9), tty_register_device_attr(9), tty_unregister_device(9), __tty_alloc_driver(9), tty_driver_kref_put(9), tty_register_driver(9), tty_unregister_driver(9)

like I said. huge friend group. every single one of them ate πŸ’–βœ¨


and that's the page! 🫢 sign-off time: this one lives in ./drivers/tty, and the version date stamp says October 2026 β€” so yes, it's futuristic and we're obsessed. see you in the next man page, bestie πŸ’œπŸ¦‹

πŸ“¦ where this page comes from