KILLPG(2)
π KILLPG(2) π
ok so bestie, welcome to the System Calls Manual β¨ we're talking about killpg today and honestly? it's giving group-chat energy but for processes. no cap.
πΈ NAME πΈ
killpg β send signal to a process group π
π LIBRARY π
Standard C Library (libc, -lc) π«Ά
β¨ SYNOPSIS β¨
#include <sys/types.h>
#include <signal.h>
int
killpg(pid_t pgrp, int sig);
π¦ DESCRIPTION π¦
okay so the killpg() function sends the signal sig to the process group pgrp. that's it, that's the whole vibe. it's the "hey everyone in this group, listen up" of system calls π₯
if you wanna know what signals even are, go peek at sigaction(2) for the full list β it's a whole menu, pick your fighter.
and here's the cute part: if pgrp is 0, then killpg() sends the signal to the sending process's own process group. it's like texting your own group chat. main character behavior tbh π
β οΈ bestie, listen: the sending process must be able to kill() at least one process in the receiving process group. you can't just barge in. the rules are the rules, periodt.
π RETURN VALUES π
killpg() returns the value 0 if successful π slay. otherwise, the value -1 is returned and the global variable errno is set to indicate the error π (yes we're checking errno, always check errno).
π ERRORS π
the killpg() function will fail and no signal will be sent if any of these happen:
[EINVAL]β thesigargument is not a valid signal number π like girl what number is that[ESRCH]β no process can be found in the process group specified bypgrpπ» it's empty in there, nobody home[EPERM]βkill()returnsEPERMfor all processes in the process group π« you don't have the permissions, respectfully denied
π SEE ALSO π
iykyk, go read those next π§
β HISTORY β
the killpg() function appeared in 4.0BSD. old money, iconic, legendary behavior π
and that's the whole page, bestie π this one's from the Debian fam, dated March 15, 2012, and it lives in KILLPG(2). go forth and signal your process groups responsibly π«ΆπΈβ¨
π¦ where this page comes from
- debian bookworm: freebsd-manpages 12.2-1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- debian trixie: freebsd-manpages 12.2-2 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu jammy: freebsd-manpages 12.2-1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu noble: freebsd-manpages 12.2-1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu questing: freebsd-manpages 12.2-2
- ubuntu resolute: freebsd-manpages 12.2-2build1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu stonking: freebsd-manpages 12.2-2build1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- Copyright (c) 1980, 1991, 1993 The Regents of the University of California. All rights reserved
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms