proctracker

package
v2.14.0 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2026 License: GPL-3.0 Imports: 9 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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