eraser(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… eraser β€” handle erase function ✨

ok so bestie, welcome to eraser(9) from the Kernel API Manual, section 9 πŸŽ€. this is the little function that handles what happens when someone actually presses the erase key, and honestly? it's doing the most for you behind the scenes. let's get into it 🫢


✨ SYNOPSIS ✨

void eraser (u8 c , const struct tty_struct *tty );

🌸 ARGUMENTS 🌸

  • c β€” the character input, aka the actual char coming at you πŸ‘€
  • tty β€” the terminal device, the whole vibe of a terminal this is happening on πŸ’»

πŸ¦‹ DESCRIPTION πŸ¦‹

okay so here's the tea: eraser performs the erase and the necessary output whenever an erase character shows up in the stream coming from the driver layer πŸ”₯. it's not just "poof, gone" β€” no ma'am, there's output involved too.

and the icon behavior? it handles the complexities of UTF-8 multibyte symbols πŸ‘‘. like, multibyte characters are genuinely messy and this function is out here dealing with all of it so you don't have to. not me being obsessed with a kernel function 😭

Locking: n_tty_receive_buf/producer path: caller holds non-exclusive termios_rwsem πŸ”’

lowkey important: that locking note is not decorative, bestie. on the n_tty_receive_buf/producer path the caller is the one holding the non-exclusive termios_rwsem. you don't grab it yourself, and you definitely don't drop it. periodt πŸ’…

πŸ’œ SEE ALSO πŸ’œ

the kernel file ./drivers/tty/n_tty.c, plus literally this entire friend group:

n_tty_kick_worker(9), n_tty_write_wakeup(9), put_tty_queue(9), reset_buffer_flags(9), n_tty_flush_buffer(9), is_utf8_continuation(9), is_continuation(9), do_output_char(9), process_output(9), process_output_block(9), __process_echoes(9), add_echo_byte(9), echo_move_back_col(9), echo_set_canon_col(9), echo_erase_tab(9), echo_char_raw(9), echo_char(9), finish_erasing(9), isig(9), n_tty_receive_break(9), n_tty_receive_overrun(9), n_tty_receive_parity_error(9), n_tty_receive_char_flow_ctrl(9), n_tty_receive_char(9), n_tty_receive_buf_common(9), n_tty_set_termios(9), n_tty_close(9), n_tty_open(9), copy_from_read_buf(9), canon_copy_from_read_buf(9), job_control(9), n_tty_read(9), n_tty_write(9), n_tty_poll(9), n_tty_inherit_ops(9) 🌈

like yeah, that's a lot of friends, but they all live in ./drivers/tty together and they're all iconic in their own way ⭐


and that's the whole page, bestie!! πŸŒΈπŸ’–βœ¨ this was eraser(9) from ./drivers/tty, dated October 2026 β€” mwah, go erase something iconic πŸ’‹πŸ‘‘

πŸ“¦ where this page comes from