Skip to content

setpgid

Intro

setpgid - Set the process group ID of a process

Description

The setpgid() function sets the process group ID of the process specified by pid to pgid. If pid is zero, the process ID of the current process is used. If pgid is zero, the process ID of the process specified by pid is used. The setpgid() system call is allowed only for a process with a single thread.

Setpgid can be used to implement job control in a shell. In a single-threaded program, setpgid() can be used to create a new process group within the same session.

Arguments

  • pid:pid_t - The process ID of the process.
  • pgid:pid_t - The ID of the process group to which the process should be moved.

Available Tags

  • K - Originated from kernel-space.

Hooks

setpgid

Type

Kprobe

Purpose

To instrument the process control system call to detect changes in the process group ID.

Example Use Case

Monitoring changes in process group IDs, particularly when using Job Control (e.g. with a shell).

Issues

None.

  • execve() - Used to create a new process session and set the process group ID.
  • setpgrp() - Used to set the process group ID of the current process and create a new process group.

This document was automatically generated by OpenAI and needs review. It might not be accurate and might contain errors. The authors of Tracee recommend that the user reads the "events.go" source file to understand the events and their arguments better.