Expand description
Signal Handling Catalog
Provides signal definitions, behaviors, and platform support information from the Crucible SSOT catalog.
§Overview
This module exposes the Foundry-layer signal catalog data. It does NOT provide handler registration or runtime signal handling - those are Module-layer concerns for future implementation.
§Example
use rsfulmen::foundry::signals::{
lookup_signal, get_signal_number, resolve_signal,
list_signal_names, match_signal_names, SIGTERM, EXIT_SIGTERM
};
// Look up signal by name (strict)
let term = lookup_signal("SIGTERM").unwrap();
assert_eq!(term.unix_number, 15);
assert_eq!(term.exit_code, 143);
// Resolve signal from common variants (ergonomic)
assert_eq!(resolve_signal("TERM").unwrap().name, "SIGTERM");
assert_eq!(resolve_signal("term").unwrap().name, "SIGTERM");
assert_eq!(resolve_signal("15").unwrap().name, "SIGTERM");
// Get all signal names for CLI completion
let names = list_signal_names();
assert!(names.contains(&"SIGTERM"));
// Match signal names with glob patterns
let usr_signals = match_signal_names("*USR*");
assert!(usr_signals.contains(&"SIGUSR1"));
// Get platform-specific signal number
let num = get_signal_number("SIGTERM").unwrap();
assert_eq!(num, 15);
// Use constants
assert_eq!(SIGTERM, 15);
assert_eq!(EXIT_SIGTERM, 143);§Platform Support
Signal numbers vary by platform:
- SIGUSR1: 10 (Linux), 30 (macOS/FreeBSD)
- SIGUSR2: 12 (Linux), 31 (macOS/FreeBSD)
Use get_signal_number for correct platform-specific values.
Structs§
- 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)
- 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
- SIGUSR1 signal number (10 on Linux, 30 on macOS/FreeBSD)
- SIGUSR2
- SIGUSR2 signal number (12 on Linux, 31 on macOS/FreeBSD)
Functions§
- 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.
- 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 matching a simple glob pattern.
- resolve_
signal - Resolve a signal from common name variants.
- signal_
count - Get the number of signals in the catalog.
- signal_
from_ exit_ code - Find a signal from its exit code (using catalog values).