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§
- Batch
Kill Failure - Batch
Kill Result - Behavior
- Behavior definition with phases.
- Behavior
Phase - A phase within a behavior definition.
- Platform
Overrides - Platform-specific signal number overrides.
- Platform
Support - Platform support entry from the support matrix.
- Signal
- Signal definition from the Crucible catalog.
- Windows
Fallback - Windows fallback configuration for unsupported signals.
Enums§
- Fallback
Behavior - Windows fallback behavior type.
- Signal
Behavior - Signal behavior type.
- Support
Level - Platform support level for Unix-like systems.
- Windows
Support Level - 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_
SIGUS R1 - Exit code for SIGUSR1 (138 = 128 + 10 on Linux; 158 = 128 + 30 on macOS/FreeBSD)
- EXIT_
SIGUS R2 - 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 (
30on macOS,10on Linux and other platforms). - SIGUSR2
- User-defined signal 2 (
31on macOS,12on Linux and other platforms).
Functions§
- force_
kill - Convenience wrapper: send
SIGKILL(or Windows terminate). - force_
kill_ group - Convenience wrapper: send
SIGKILLto a process group. - force_
kill_ many - Convenience wrapper: send
SIGKILLto 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 IDterm). - 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
SIGTERMto a process group. - terminate_
many - Convenience wrapper: send
SIGTERMto 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.