sys_getpid(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸŽ€ NAME πŸŽ€

okay bestie, welcome to sys_getpid(9) β€” the Kernel API Manual page that's literally about the current process. This one is sys_getpid β€” it returns the thread group id of the current process. πŸ’–

✨ SYNOPSIS ✨

Like, the whole signature is this and only this:

long sys_getpid (void );

πŸ¦‹ ARGUMENTS πŸ¦‹

  • void β€” no arguments. Not a single one. The vibe is empty in the best way. 🫢

πŸ’… DESCRIPTION πŸ’…

Okay so note: despite the name, sys_getpid returns the tgid, not the pid. The tgid and the pid are identical unless CLONE_THREAD was specified on clone, in which case the tgid is the same in all threads of the same group. Periodt. πŸŽ€

This is SMP safe because current->tgid does not change. No cap, it's stable like that. ✨

🌈 SEE ALSO 🌈

go peek at these too, bestie:


okay bestie, that's the page πŸ’œ β€” source/version is ./kernel, dated October 2026, and yes, it's still sys_getpid(9) in the Kernel API Manual. slay βœ¨πŸ’…πŸŽ€

πŸ“¦ where this page comes from