Skip to main content

Crate sysprims_signal

Crate sysprims_signal 

Source
Expand description

sysprims-signal: Cross-platform signal dispatch.

This crate provides:

  • Process signal dispatch by PID (kill)
  • Process group signal dispatch by PGID (killpg, Unix-only)
  • Convenience wrappers (terminate, force_kill, etc.)

Errors use the canonical sysprims_core::SysprimsError type.

§Safety

This crate validates PIDs to prevent dangerous POSIX signal semantics:

  • PID 0 rejected: kill(0, sig) would signal the caller’s process group
  • PID > i32::MAX rejected: Large u32 values wrap to negative i32, and kill(-1, sig) signals ALL processes the caller can reach

See docs/safety/signal-dispatch.md for full details on POSIX signal semantics and why these restrictions exist.

Re-exports§

pub use handle::open_process_handle;
pub use handle::open_process_handle_verified;
pub use handle::ProcessHandle;
pub use handle::SignalBinding;

Modules§

handle
Process-bound signal and exit-watch handle (ProcessHandle).

Structs§

BatchKillFailure
BatchKillResult
Behavior
Behavior definition with phases.
BehaviorPhase
A phase within a behavior definition.
PlatformOverrides
Platform-specific signal number overrides.
PlatformSupport
Platform support entry from the support matrix.
Signal
Signal definition from the Crucible catalog.
WindowsFallback
Windows fallback configuration for unsupported signals.

Enums§

FallbackBehavior
Windows fallback behavior type.
SignalBehavior
Signal behavior type.
SupportLevel
Platform support level for Unix-like systems.
WindowsSupportLevel
Platform support level for Windows.

Constants§

EXIT_SIGALRM
Exit code for SIGALRM (142 = 128 + 14)
EXIT_SIGHUP
Exit code for SIGHUP (129 = 128 + 1)
EXIT_SIGINT
Exit code for SIGINT (130 = 128 + 2)
EXIT_SIGKILL
Exit code for SIGKILL (137 = 128 + 9)
EXIT_SIGPIPE
Exit code for SIGPIPE (141 = 128 + 13)
EXIT_SIGQUIT
Exit code for SIGQUIT (131 = 128 + 3)
EXIT_SIGTERM
Exit code for SIGTERM (143 = 128 + 15)
EXIT_SIGUSR1
Exit code for SIGUSR1 (138 = 128 + 10 on Linux; 158 = 128 + 30 on macOS/FreeBSD)
EXIT_SIGUSR2
Exit code for SIGUSR2 (140 = 128 + 12 on Linux; 159 = 128 + 31 on macOS/FreeBSD)
MAX_SAFE_PID
Maximum valid PID value.
SIGALRM
SIGALRM signal number (14)
SIGHUP
SIGHUP signal number (1)
SIGINT
SIGINT signal number (2)
SIGKILL
SIGKILL signal number (9)
SIGPIPE
SIGPIPE signal number (13)
SIGQUIT
SIGQUIT signal number (3)
SIGTERM
SIGTERM signal number (15)
SIGUSR1
User-defined signal 1 (30 on macOS, 10 on Linux and other platforms).
SIGUSR2
User-defined signal 2 (31 on macOS, 12 on Linux and other platforms).

Functions§

force_kill
Convenience wrapper: send SIGKILL (or Windows terminate).
force_kill_group
Convenience wrapper: send SIGKILL to a process group.
force_kill_many
Convenience wrapper: send SIGKILL to multiple processes.
get_exit_code
Get the exit code for a signal on the current platform.
get_exit_code_for_platform
Get the exit code for a signal on a specific platform.
get_platform_support
Get platform support information for a signal.
get_signal_number
Get the signal number for the current platform.
get_signal_number_for_platform
Get the signal number for a specific platform.
is_signal_supported
Check if a signal is supported on the current platform.
kill
Send a signal to a process.
kill_by_name
Send a signal to a process, resolving the signal number by name.
kill_group_by_name
Send a signal to a process group, resolving the signal number by name.
kill_many
Send a signal to multiple processes.
killpg
Send a signal to a process group.
list_behaviors
List all behavior definitions.
list_platform_support
List all platform support entries.
list_signal_names
Return all signal names from the catalog.
list_signals
List all signals in the catalog.
lookup_behavior
Look up a behavior definition by ID.
lookup_signal
Look up a signal by name (e.g., “SIGTERM”).
lookup_signal_by_id
Look up a signal by its short ID (e.g., “term”, “int”).
lookup_signal_by_number
Look up a signal by Unix signal number.
match_signal_names
Return signal names that match a simple glob pattern.
resolve_signal
Resolve a signal from common name variants.
resolve_signal_name
Resolve a signal number by name (SIGTERM, TERM, sigterm, or short ID term).
signal_count
Get the number of signals in the catalog.
signal_from_exit_code
Find a signal from its exit code (using catalog values).
terminate
Convenience wrapper: send SIGTERM (or Windows terminate).
terminate_group
Convenience wrapper: send SIGTERM to a process group.
terminate_many
Convenience wrapper: send SIGTERM to multiple processes.
validate_pgid
Validate that a PGID is safe (1..=MAX_SAFE_PID) per ADR-0011.
validate_pid
Validate that a PID is safe (1..=MAX_SAFE_PID) per ADR-0011.