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

  • exec
  • fork()
  • getpid()
  • getsid()
  • kill()
  • setpgid()
  • setsid()

The Base Definitions volume of POSIX.1‐2017, <unistd.h> πŸŽ€


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