tty_buffer_alloc(9)
β¨ tty_buffer_alloc(9) β¨
okay so this is a page from the Kernel API Manual, and honestly? it's a little guy with a big job. bestie, let's get into it π
πΈ NAME πΈ
tty_buffer_alloc β allocate a tty buffer
like. it does exactly what it says on the tin. no cap.
π SYNOPSIS π
struct tty_buffer * tty_buffer_alloc (struct tty_port *port , size_t size );
π¦ ARGUMENTS π¦
portβ the tty port. that's your main character here, the whole reason we're doing any of this π«Άsizeβ the desired size, measured in characters. how much room do you want, bestie? speak now.
π DESCRIPTION π
Allocate a new tty buffer to hold the desired number of characters. simple. iconic. very demure.
but here's the little detail you CANNOT skip: we round our buffers off in 256 character chunks to get better allocation behaviour. highkey obsessed with that. it's giving tidy-up energy, it's giving "we don't do awkward little buffers in this house" β¨ 256 at a time, that's the vibe check, that's the rule.
π₯ RETURN π₯
Returns NULL if out of memory β or if the allocation would exceed the per device queue. so yeah, two ways to fail, both of them NULL. do with that what you will π
ngl, check that return value. NULL is not a vibe, it's an error condition. π
β SEE ALSO β
- Kernel file
./drivers/tty/tty_buffer.c tty_buffer_lock_exclusive(9)tty_buffer_unlock_exclusive(9)tty_buffer_space_avail(9)tty_buffer_free_all(9)tty_buffer_free(9)tty_buffer_flush(9)__tty_buffer_request_room(9)tty_prepare_flip_string(9)tty_ldisc_receive_buf(9)flush_to_ldisc(9)tty_flip_buffer_push(9)tty_insert_flip_string_and_push_buffer(9)tty_buffer_init(9)tty_buffer_set_limit(9)
the whole friend group fr fr. go read them too, they're all slay π
and that's the page, babes π§ this one lives under ./drivers/tty and it's dated October 2026, so like β future girlies are gonna be reading this. bye bestie, go allocate responsibly π
π
π¦ 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