## interprocess-signals.api
#
#
# The ancestral design of this package is discussed in:
#
# Asynchronous Signals in Standard ML
# John H Reppy 1990 19p
# http://mythryl.org/pub/pml/asynchronous-signals-in-standard-ml-reppy-1990-19p.ps
# Compiled by:
#
src/lib/std/src/standard-core.sublib### "When in doubt, use brute force.
###
### -- Ken Thompson
### "Many that live deserve death.
### And some that die deserve life.
###
### Can you give it to them?
###
### Then do not be too eager to
### deal out death in judgement.
###
### For even the very wise cannot
### see all ends."
###
### -- Gandalf
###
### [J.R.R. Tolkein, "Lord of the Rings"]
# This API is implemented in:
#
#
src/lib/std/src/nj/interprocess-signals.pkg#
# it is also 'include'-d in the anonymous api in
#
#
src/lib/std/src/nj/interprocess-signals-guts.pkgapi Interprocess_Signals {
#
Signal = SIGHUP # POSIX # 1 Hangup.
| SIGINT
# ANSI # 2 Interrupt.
| SIGQUIT
# POSIX # 3 Quit.
| SIGILL
# ANSI # 4 Illegal instruction
| SIGTRAP
# POSIX # 5 Trace trap
| SIGABRT
# ANSI # 6 Abort. On Linux == BSD4.2 SIGIOT.
| SIGBUS
# BSD 4.2 # 7 BUS error.
| SIGFPE
# ANSI # 8 Floating-point exception.
| SIGKILL
# POSIX # 9 Kill, unblockable.
| SIGUSR1
# POSIX # 10 User-defined signal 1.
| SIGSEGV
# ANSI # 11 Segmentation violation. (Typically due to use of an invalid C pointer.)
| SIGUSR2
# POSIX # 12 User-defined signal 2.
| SIGPIPE
# POSIX # 13 Broken pipe.
| SIGALRM
# POSIX # 14 Alarm. See also SIGVTALRM.
| SIGTERM
# POSIX # 15 Polite (catchable) request to terminate. http://en.wikipedia.org/wiki/SIGTERM
| SIGSTKFLT
# Linux # 16 Stack fault.
| SIGCHLD
# POSIX # 17 Child status has changed.
| SIGCONT
# POSIX # 18 Continue.
| SIGSTOP
# POSIX # 19 Stop, unblockable.
| SIGTSTP
# POSIX # 20 Keyboard stop.
| SIGTTIN
# POSIX # 21 Background read from TTY.
| SIGTTOU
# POSIX # 22 Backround write to TTY.
| SIGURG
# BSD 4.2 # 23 Urgent condition on socket.
| SIGXCPU
# BSD 4.2 # 24 CPU limit exceeded.
| SIGXFSZ
# BSD 4.2 # 25 File size limit exceeded.
| SIGVTALRM
# BSD 4.2 # 26 Alarm. See also SIGALRM.
| SIGPROF
# BSD 4.2 # 27 Profiling alarm clock.
| SIGWINCH
# BSD 4.3 # 28 Window size change.
| SIGIO
# BSD4.2 # 29 I/O now possible.
| SIGPWR
# SYS V # 30 Power failure restart.
| SIGSYS
# Linux # 31 Bad system call.
;
all_signals: List( Signal );
signal_to_int: Signal -> Int;
signal_to_string: Signal -> String;
int_to_signal: Int -> Signal;
Signal_Action
= IGNORE
| DEFAULT
| HANDLER (Signal, Int, fate::Fate(Void)) -> fate::Fate( Void )
# 'Int' is count of time signal has happened since our last call.
;
set_signal_handler: (Signal, Signal_Action) -> Signal_Action;
#
# Set the handler for a signal, returning the previous action.
override_signal_handler: (Signal, Signal_Action) -> Signal_Action;
#
# If a signal is not being ignored, then set the handler.
#
# Returns the previous handler: If IGNORE, then
# the current handler is still IGNORE.
get_signal_handler # Get the current action for the given signal
:
Signal -> Signal_Action;
Signal_Mask
= MASK_ALL
| MASK List(Signal)
;
mask_signals: Signal_Mask -> Void;
#
# Mask the specified set of signals.
#
# Signals that are not IGNORED
# will be delivered when unmasked.
#
# Calls to mask_signals nest on a
# per-signal basis.
unmask_signals: Signal_Mask -> Void;
#
# Unmask the specified signals. The unmasking of a signal that is
# not masked has no effect.
masked_signals: Void -> Signal_Mask;
#
# Return the set of masked signals.
# The value MASK[] means that no
# signals are masked.
pause: Void -> Void;
#
# sleep until the next signal; if called when signals are masked,
# then signals will still be masked when pause returns.
signal_is_supported_by_host_os: Signal -> Bool;
# These two are really only intended for use in
src/lib/std/src/nj/interprocess-signals-unit-test.pkg #
ascii_signal_name_to_portable_signal_id: String -> Int;
maximum_valid_portable_signal_id: Void -> Int;
set_log_if_on: Bool -> Void;
#
# Mythryl-level control of the C-level log_if_on var in src/c/main/error-reporting.c
}; # api Signals
## COPYRIGHT (c) 1995 AT&T Bell Laboratories.
## Subsequent changes by Jeff Prothero Copyright (c) 2010-2015,
## released per terms of SMLNJ-COPYRIGHT.