process

package
v1.0.57 Latest Latest
Warning

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

Go to latest
Published: Aug 6, 2026 License: Apache-2.0 Imports: 2 Imported by: 0 modules, 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 process provides cross-platform process-existence checks. Used by the bus daemon's stale-lock recovery path: bus.lock holds the daemon's PID; on startup a competing process reads that PID and calls Alive() to decide whether to abort (the holder is still running) or steal the lock (orphan).

On Unix this is the standard signal-0 trick (syscall.Kill(pid, 0)) which errors with ESRCH if the process is gone. On Windows it uses OpenProcess with PROCESS_QUERY_LIMITED_INFORMATION and GetExitCodeProcess to detect STILL_ACTIVE; this avoids the Unix-only assumption in plan §1.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Alive

func Alive(pid int) bool

Alive reports whether a process with the given PID is currently running. Returns false for non-positive PIDs without performing any syscall.

On Unix this uses signal 0 (syscall.Kill(pid, 0)), which performs the normal permission/existence check without delivering a signal:

  • nil error → process exists and we have permission
  • syscall.EPERM → process exists but owned by another user (still counts as alive for our purpose)
  • syscall.ESRCH → no such process

Any other error is treated as "alive" defensively, so we never steal a lock based on an ambiguous syscall failure.

Types

This section is empty.

Jump to

Keyboard shortcuts

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