proctracker

package
v2.8.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 1, 2026 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Overview

Package proctracker provides process exit tracking using pidfd_open on Linux 5.3+. Falls back to polling when pidfd is unavailable.

Index

Constants

View Source
const PollInterval = 2 * time.Second

PollInterval is the default interval for fallback polling.

Variables

View Source
var ErrProcessNotFound = errors.New("process not found")

ErrProcessNotFound is returned when a process doesn't exist.

Functions

This section is empty.

Types

type ExitCallback

type ExitCallback func(pid int)

ExitCallback is called when a tracked process exits.

type Tracker

type Tracker struct {
	// contains filtered or unexported fields
}

Tracker monitors processes and calls callbacks when they exit.

func New

func New() *Tracker

New creates a new process tracker. It automatically detects whether pidfd_open is available.

func (*Tracker) Stop

func (t *Tracker) Stop()

Stop stops all tracking and waits for goroutines to finish.

func (*Tracker) Track

func (t *Tracker) Track(pid int, callback ExitCallback) error

Track starts monitoring a process and calls the callback when it exits. Returns ErrProcessNotFound if the process doesn't exist.

func (*Tracker) Untrack

func (t *Tracker) Untrack(pid int)

Untrack stops monitoring a process.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL