tty_get_pgrp(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… 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:

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