SETSID(2)

✨ SETSID(2) ✨

okay bestie, gather round πŸ’– this is the System Calls Manual page for setsid β€” she's a libc girlie from the Standard C Library (libc, -lc), and honestly? she's iconic. no cap.


🌸 NAME 🌸

setsid β€” create session and set process group ID πŸŽ€


πŸ¦‹ LIBRARY πŸ¦‹

Standard C Library (libc, -lc)


✨ SYNOPSIS ✨

#include <unistd.h>

pid_t
setsid(void);

πŸ’… DESCRIPTION πŸ’…

So. The setsid() system call creates a new session. That's the whole vibe. πŸ’–

The calling process is the session leader of the new session, is the process group leader of a new process group, and has no controlling terminal. Literally no terminal. Not a single one. She's untethered. πŸ¦‹

And the calling process is the only process in either the session or the process group. main character energy, fr fr β€” nobody else is in the group chat. πŸ‘‘


🫢 RETURN VALUES 🫢

Upon successful completion, the setsid() system call returns the value of the process group ID of the new process group, which is the same as the process ID of the calling process. slay. ✨

If an error occurs, setsid() returns -1 and the global variable errno is set to indicate the error. 😭 classic.


πŸ’€ ERRORS πŸ’€

The setsid() system call will fail if:

  • [EPERM] β€” The calling process is already a process group leader, or the process group ID of a process other than the calling process matches the process ID of the calling process.
bestie. if you're already a group leader, you cannot simply become a new group leader. it's giving "you can't sit with us, you're already sitting." πŸ™ˆ

🌈 SEE ALSO 🌈

iykyk πŸ’œ


⭐ STANDARDS ⭐

The setsid() system call is expected to be compliant with the ISO/IEC 9945-1:1990 (β€œPOSIX.1”) specification. periodt. πŸ’…


mwah πŸ’‹ this page came from Debian, dated June 4, 1993 β€” yes she's an elder but she's still serving, and that's the whole point. stan a legacy syscall. πŸŽ€βœ¨

πŸ“¦ where this page comes from