Skip to content



setsid - create a new session and set the process group ID.


The setsid() system call is instrumental in creating a new session.

A session is a collection of process groups, typically used in terminal job control. When a process calls setsid(), it becomes the leader of a new session, the leader of a new process group, and detaches from its controlling terminal.

This mechanism is foundational for daemon processes in Unix-like systems, allowing them to dissociate from their parent shell and run in the background, independent of the user's session.


This system call doesn't take any arguments.

Available Tags

  • K - Originated from kernel-space.
  • U - Originated from user space.
  • TOCTOU - Vulnerable to TOCTOU (time of check, time of use).
  • OPT - Optional argument - might not always be available (passed with null value).




Tracepoint (through sys_enter).


To observe and trace when the setsid() system call is invoked, marking the creation of a new session and process group.

Example Use Case

Monitoring the creation of new sessions is vital in scenarios where tracking background processes, daemonizing processes, or job control is essential, such as in system initialization or process supervision.


Misusing setsid() can cause processes to become orphaned unintentionally or detached from their expected sessions, leading to potential mismanagement of resources or processes running without supervision.

  • setpgid() - Set the process group ID for a process.
  • getpgid() - Retrieve the process group ID of a process.
  • getpgrp() - Get the process group ID of the calling process.

This document was automatically generated by OpenAI and reviewed by a Human.