copy_from_read_buf(9)
π copy_from_read_buf β NAME
okay so, copy_from_read_buf β it copies read data directly, no cap. it's a helper from the Kernel API Manual and honestly it's giving "small function, big job" energy. π
β¨ SYNOPSIS β¨
bool copy_from_read_buf (const struct tty_struct *tty , u8 **kbp ,
size_t *nr );
like, yes bestie, that's the whole signature β returns a bool, takes three things, we'll get to them π
πΈ ARGUMENTS πΈ
ttyβ the terminal device. the main character of this whole situation π«Άkbpβ data. that's it, that's the description, it's literally just "data" πnrβ size of data. how much of it there is, so we know what we're working with β
π¦ DESCRIPTION π¦
so this is a helper function whose whole purpose in life is to speed up n_tty_read. iconic behavior honestly. π₯
it is only called when ICANON is off β remember that, it's a vibe check the function does not do for you β and it copies characters straight from the tty queue. no detours, no extra steps, just straight from the queue. β¨
π Locking:
- called under the
ldata->atomic_read_locksem π n_tty_read/consumer path: the caller holds a non-exclusivetermios_rwsem;read_tailpublished π
bestie please respect the locking rules, they are not decorative π
π RETURN π
returns true if it successfully copied data β but there is still more data to be had. so like, success with a little "...and there's more" attached ππ
π SEE ALSO π
kernel file ./drivers/tty/n_tty.c, plus literally the whole 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),eraser(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)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)
okay that's the whole page bestie, go forth and read your tty queues responsibly π β¨
this little number lives in ./drivers/tty, it's part of the Kernel API Manual, dated October 2026, and if you need to look it up by name it's copy_from_read_buf(9) β mwah, bye! ππ¦π
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms