copy_from_read_buf(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… 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_lock sem πŸ”
  • n_tty_read/consumer path: the caller holds a non-exclusive termios_rwsem; read_tail published πŸ“Œ
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:


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