Skip to main content

Module signals

Module signals 

Source
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.
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)
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).