tty_get_pgrp(9)
π tty_get_pgrp β bestie, it's a Kernel API Manual moment β¨
okay so real talk, this one is a tiny little function from the <pink>Kernel API Manual</pink> and it's lowkey iconic for how much it does in so few words. let's get into it π
β¨ NAME β¨
tty_get_pgrp β returns a <hotpink>ref counted</hotpink> pgrp pid, no cap π«Ά
πΈ SYNOPSIS πΈ
struct pid * tty_get_pgrp (struct tty_struct *tty );
like yes, that's the whole vibe. one function, one arg, one return type. main character energy fr fr π
π¦ ARGUMENTS π¦
ttyβ the tty to read π that's it, that's the whole arg, she's simple and she knows it
β DESCRIPTION β
so what does she actually do? she returns a <purple>refcounted instance</purple> of the pid struct for the <mint>process group controlling the tty</mint> π
that's the entire lore. you hand her a tty, she hands you back a refcounted pid struct for whichever process group is running the show on that tty. <yellow>refcounted</yellow> is the key word here btw β she's not just giving you a raw pointer and wishing you luck, she's doing the bookkeeping so your reference is properly counted π§
bestie pls remember: refcounted means you are now on the hook for the reference. don't just vibe and forget about it π«Ά
π₯ SEE ALSO π₯
all the siblings and cousins live in the kernel file ./drivers/tty/tty_jobctrl.c and honestly they're all worth a read:
__tty_check_change(9)__proc_set_tty(9)tty_signal_session_leader(9)disassociate_ctty(9)tiocsctty(9)tiocgpgrp(9)tiocspgrp(9)tiocgsid(9)
go read them. i'll wait. π
and that's the page!! π sending you off from ./drivers/tty with a big <rainbow>October 2026</rainbow> energy and the very same tty_get_pgrp(9) we started with β slay, go forth, and manage your refcounts 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