pub struct Signal(/* private fields */);
Expand description
A Unix-like signal.
Represents a signal that can be sent to or received by processes on Unix-like systems.
Implementations§
Source§impl Signal
impl Signal
Sourcepub const NULL: Self
pub const NULL: Self
Null signal.
Corresponds to signal number 0
.
Can be used to check if a process exists without sending an actual signal.
Sourcepub const HANGUP: Self
pub const HANGUP: Self
Hangup (SIGHUP
).
Corresponds to signal number 1
.
Sent to a process when its controlling terminal is closed or when a parent process exits, often used by daemons to re-read configuration files.
Sourcepub const INTERRUPT: Self
pub const INTERRUPT: Self
Interrupt (SIGINT
).
Corresponds to signal number 2
.
Sent by the terminal to the foreground process group to request its termination,
often initiated by the user pressing Ctrl+C
.
Sourcepub const QUIT: Self
pub const QUIT: Self
Quit (SIGQUIT
).
Corresponds to signal number 3
.
Sent by the terminal to the foreground process group (often by pressing Ctrl+\
).
Typically causes a core dump and process termination.
Sourcepub const ILLEGAL_INSTRUCTION: Self
pub const ILLEGAL_INSTRUCTION: Self
Illegal instruction (SIGILL
).
Corresponds to signal number 4
.
Indicates an attempt to execute an invalid or malformed instruction.
Sourcepub const TRAP: Self
pub const TRAP: Self
Trace trap (SIGTRAP
).
Corresponds to signal number 5
.
Used by debuggers to implement breakpoints.
Sourcepub const ABORT: Self
pub const ABORT: Self
Abort (SIGABRT
).
Corresponds to signal number 6
.
Sent by the abort()
function (or _exit()
in some cases) to indicate an abnormal
termination, typically due to a detected internal inconsistency. Often causes a core dump.
Sourcepub const BUS_ERROR: Self
pub const BUS_ERROR: Self
Bus error (SIGBUS
).
Corresponds to signal number 7
.
Indicates a memory access error, often due to misaligned access or non-existent physical address.
Sourcepub const FLOATING_POINT_EXCEPTION: Self
pub const FLOATING_POINT_EXCEPTION: Self
Floating-point exception (SIGFPE
).
Corresponds to signal number 8
.
Indicates an erroneous arithmetic operation (e.g., division by zero, overflow).
Sourcepub const KILL: Self
pub const KILL: Self
Kill (SIGKILL
).
Corresponds to signal number 9
.
Unconditionally terminates a process. This signal cannot be caught, blocked, or ignored, making it the most forceful way to kill a process.
Sourcepub const USER1: Self
pub const USER1: Self
User-defined signal 1 (SIGUSR1
).
Corresponds to signal number 10
(often).
A custom signal for application-specific use. Its exact number can vary by system.
Sourcepub const SEGMENTATION_VIOLATION: Self
pub const SEGMENTATION_VIOLATION: Self
Segmentation violation (SIGSEGV
).
Corresponds to signal number 11
.
Indicates an invalid memory access (e.g., trying to write to read-only memory, or access outside allocated bounds). Typically causes a core dump.
Sourcepub const USER2: Self
pub const USER2: Self
User-defined signal 2 (SIGUSR2
).
Corresponds to signal number 12
(often).
Another custom signal for application-specific use. Its exact number can vary by system.
Sourcepub const BROKEN_PIPE: Self
pub const BROKEN_PIPE: Self
Broken pipe (SIGPIPE
).
Corresponds to signal number 13
.
Sent when a process attempts to write to a pipe, socket, or FIFO whose reading end has been closed.
Sourcepub const ALARM: Self
pub const ALARM: Self
Alarm clock (SIGALRM
).
Corresponds to signal number 14
.
Generated by the alarm()
system call for timer expiration.
Sourcepub const TERMINATION: Self
pub const TERMINATION: Self
Termination (SIGTERM
).
Corresponds to signal number 15
.
A generic request to terminate a process. Unlike SIGKILL
, this signal can be caught and
handled by the process to perform cleanup before exiting gracefully.
Sourcepub const STACK_FAULT: Self
pub const STACK_FAULT: Self
Stack fault (SIGSTKFLT
).
Corresponds to signal number 16
.
(Linux specific) Indicates a stack fault on a coprocessor. Less common.
Sourcepub const CHILD: Self
pub const CHILD: Self
Child stopped or terminated (SIGCHLD
).
Corresponds to signal number 17
.
Sent to a parent process when one of its child processes stops or terminates.
Sourcepub const CONTINUE: Self
pub const CONTINUE: Self
Continue (SIGCONT
).
Corresponds to signal number 18
.
If the process is stopped, it is resumed. If it is already running, it continues.
Sourcepub const STOP: Self
pub const STOP: Self
Stop (SIGSTOP
).
Corresponds to signal number 19
.
Stops a process. Unlike SIGTSTP
, this signal cannot be caught, blocked, or ignored, making
it a forceful way to pause execution.
Sourcepub const TTY_STOP: Self
pub const TTY_STOP: Self
Tty stop (SIGTSTP
).
Corresponds to signal number 20
.
Sent by the terminal to the foreground process group when the user presses Ctrl+Z
.
Can be caught and handled to allow the process to clean up or save state before stopping.
Sourcepub const TTY_IN: Self
pub const TTY_IN: Self
Background read from tty (SIGTTIN
).
Corresponds to signal number 21
.
Sent to a process in the background when it attempts to read from its controlling terminal.
Sourcepub const TTY_OUT: Self
pub const TTY_OUT: Self
Background write to tty (SIGTTOU
).
Corresponds to signal number 22
.
Sent to a process in the background when it attempts to write to its controlling terminal.
Sourcepub const URGENT_IO: Self
pub const URGENT_IO: Self
Urgent condition on socket (SIGURG
).
Corresponds to signal number 23
.
Indicates urgent data is available on a socket.
Sourcepub const CPU_LIMIT: Self
pub const CPU_LIMIT: Self
CPU time limit exceeded (SIGXCPU
).
Corresponds to signal number 24
.
Sent when a process exceeds its CPU time limit.
Sourcepub const FILE_SIZE_LIMIT: Self
pub const FILE_SIZE_LIMIT: Self
File size limit exceeded (SIGXFSZ
).
Corresponds to signal number 25
.
Sent when a process attempts to create a file larger than its imposed limit.
Sourcepub const VIRTUAL_ALARM: Self
pub const VIRTUAL_ALARM: Self
Virtual alarm clock (SIGVTALRM
).
Corresponds to signal number 26
.
Generated by a virtual alarm clock, often used for profiling.
Sourcepub const PROFILING_TIMER: Self
pub const PROFILING_TIMER: Self
Profiling timer expired (SIGPROF
).
Corresponds to signal number 27
.
Generated by a profiling timer, typically used for profiling applications.
Sourcepub const WINDOW_CHANGED: Self
pub const WINDOW_CHANGED: Self
Window changed (SIGWINCH
).
Corresponds to signal number 28
.
Sent to the foreground process group when the terminal window size has changed.
Sourcepub const IO_POSSIBLE: Self
pub const IO_POSSIBLE: Self
I/O is possible (SIGIO
).
Corresponds to signal number 29
.
Indicates that asynchronous I/O is possible on a file descriptor.
Sourcepub const POWER_FAILURE: Self
pub const POWER_FAILURE: Self
Power failure restart (SIGPWR
).
Corresponds to signal number 30
.
(Linux specific) Indicates a power failure.
Sourcepub const BAD_SYSTEM_CALL: Self
pub const BAD_SYSTEM_CALL: Self
Bad system call (SIGSYS
).
Corresponds to signal number 31
.
Indicates an invalid system call.