SETPGRP(3POSIX)
β¨ SETPGRP(3POSIX) β¨
okay so bestie, welcome to the POSIX Programmer's Manual page for setpgrp β this is the 3POSIX section of the POSIX Programmer's Manual, just so you know what you're reading π
π«Ά PROLOG
Real talk before we get into it: this manual page is part of the POSIX Programmer's Manual. The Linux implementation of this interface may differ β so pls go consult the corresponding Linux manual page for the details on Linux behaviour β or the interface might not even be implemented on Linux at all, no cap. π
πΈ NAME
setpgrp β set the process group ID β¨
π SYNOPSIS
#include <unistd.h>
pid_t setpgrp(void);
that's it. that's the whole vibe. no arguments, she takes nothing, she gives back a pid_t π«Ά
π DESCRIPTION
okay so here's the tea β If the calling process is not already a session leader, setpgrp() sets the process group ID of the calling process to the process ID of the calling process. it's giving "you are your own group now, periodt" β¨
And if setpgrp() creates a new session, then the new session has no controlling terminal π
but ALSO:</purl> the setpgrp() function has no effect when the calling process is a session leader. like, she just looks at you and does nothing. iconic behaviour honestly. π
π RETURN VALUE
Upon completion, setpgrp() shall return the process group ID. π
that's the whole return value, no surprises, no plot twist.
β ERRORS
No errors are defined. π literally none. she does not have a bad day.
The following sections are informative. (iykyk β informative means it's context, not requirements)
π¦ EXAMPLES
None. π bestie there are no examples here, we're on our own.
π APPLICATION USAGE
okay so listen up because this one actually matters: It is unspecified whether this function behaves as setpgid(0,0) or setsid() unless the process is already a session leader. unspecified means the standard is not promising you which one you get β so don't go guessing, bestie. π
Therefore, applications are encouraged to use setpgid() or setsid() as appropriate. be specific, be intentional, be the main character π«Ά
π RATIONALE
None. π no rationale, they said "we're not explaining ourselves today."
π FUTURE DIRECTIONS
The setpgrp() function may be removed in a future version.
yeah. she might get cancelled. it's giving deprecated energy. plan accordingly π
πΈ SEE ALSO
execfork()getpid()getsid()kill()setpgid()setsid()
The Base Definitions volume of POSIX.1β2017, <unistd.h> π
π COPYRIGHT
Portions of this text are reprinted and reproduced in electronic form from IEEE Std 1003.1-2017, Standard for Information Technology -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 7, 2018 Edition, Copyright (C) 2018 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between this version and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained online at http://www.opengroup.org/unix/online.html .
Any typographical or formatting errors that appear in this page are most likely to have been introduced during the conversion of the source files to man page format. To report such errors, see https://www.kernel.org/doc/man-pages/reporting_bugs.html .
and that's the whole page bestie π«Ά this one came from IEEE/The Open Group, 2017 β so like, credit where credit is due, and the date on the tin is 2017 β¨ mwah, go read your Linux man page next, ily, bye π π
π¦ where this page comes from
- debian bookworm: manpages-posix-dev 2017a-2 Β· Other
- debian trixie: manpages-posix-dev 2017a-2 Β· Other
- ubuntu jammy: manpages-posix-dev 2017a-2 Β· Other
- ubuntu noble: manpages-posix-dev 2017a-2 Β· Other
- ubuntu resolute: manpages-posix-dev 2017a-2build1 Β· Other
- ubuntu stonking: manpages-posix-dev 2017a-2.1 Β· Other
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms