Uni/Signal#
Interface for Unix signal handling.
Info
To use declarations from this page, include the <essence/uni/signal.hpp> header.
-
enum class signals : i32#
-
enumerator hangup = SIGHUP#
Hangup.
-
enumerator interrupt = SIGINT#
Terminal interrupt signal.
-
enumerator quit = SIGQUIT#
Terminal quit signal.
-
enumerator illegal = SIGILL#
Illegal instruction encountered.
-
enumerator trap = SIGTRAP#
Trace/breakpoint trap.
-
enumerator abrt = SIGABRT#
Abort the process.
-
enumerator bus = SIGBUS#
Access to an undefined portion of a memory object.
-
enumerator fpe = SIGFPE#
Erroneous arithmetic operation.
-
enumerator kill = SIGKILL#
Kill, cannot be caught or ignored.
-
enumerator usr_one = SIGUSR1#
User-defined signal 1.
-
enumerator segv = SIGSEGV#
Invalid memory reference.
-
enumerator usr_two = SIGUSR2#
User-defined signal 2.
-
enumerator pipe = SIGPIPE#
Write on a pipe with no one to read it.
-
enumerator alrm = SIGALRM#
Alarm clock.
-
enumerator term = SIGTERM#
Termination signal.
-
enumerator chld = SIGCHLD#
Child process terminated.
-
enumerator cont = SIGCONT#
Continue executing if stopped.
-
enumerator stop = SIGSTOP#
Stop executing, cannot be caught or ignored.
-
enumerator tstp = SIGTSTP#
Terminal stop signal.
-
enumerator ttin = SIGTTIN#
Background process attempting read.
-
enumerator ttou = SIGTTOU#
Background process attempting write.
-
enumerator urg = SIGURG#
High bandwidth data is available at a socket.
-
enumerator xcpu = SIGXCPU#
CPU time limit exceeded.
-
enumerator xfsz = SIGXFSZ#
File size limit exceeded.
-
enumerator vtalrm = SIGVTALRM#
Virtual timer expired.
-
enumerator winch = SIGWINCH#
Terminal window size changed.
-
enumerator sys = SIGSYS#
Bad system call.
-
enumerator unknown = 65535#
Invalid/unknown signal.
-
enumerator hangup = SIGHUP#
-
std::string_view uni::signal_str(enum uni::signals s)#
Get a string representation of signal
s.Parameter
smay also be an i32.
-
class signal#
A wrapper for a signal handler.
-
signal::signal(enum signals s, handler fn)#
Main constructor accepting a signals member and handler function.
-
const struct sigaction &sa() const#
Getter for the internal
sigactionstruct.
Example
auto handle_sig = [] (i32 sig) -> void { io::printn("Hello, I'm catching signal {}", uni::signal_str(sig)); }; uni::signal sigint(uni::signals::interrupt, handle_sig); sigint.setup();
-
signal::signal(enum signals s, handler fn)#