Signal handling. More...
Typedefs | |
typedef void(* | vtm_signal_fn )(int psig) |
Enumerations | |
enum | vtm_signal_type { VTM_SIG_HUP, VTM_SIG_INT, VTM_SIG_TERM, VTM_SIG_SEGV, VTM_SIG_PIPE, VTM_SIG_USR1, VTM_SIG_USR2 } |
Functions | |
VTM_API int | vtm_signal_set_handler (enum vtm_signal_type sig, vtm_signal_fn func) |
VTM_API int | vtm_signal_block (enum vtm_signal_type sig) |
VTM_API int | vtm_signal_default (enum vtm_signal_type sig) |
VTM_API int | vtm_signal_convert_from_os (int psig, enum vtm_signal_type *out) |
VTM_API int | vtm_signal_convert_to_os (enum vtm_signal_type sig, int *out) |
VTM_API void | vtm_signal_safe_puts (const char *str) |
VTM_API int vtm_signal_set_handler | ( | enum vtm_signal_type | sig, |
vtm_signal_fn | func | ||
) |
Installs a signal handler for given signal.
sig | signal for which the handler function should be set |
func | the function that should be called when the signal occurs |
VTM_API int vtm_signal_block | ( | enum vtm_signal_type | sig | ) |
Blocks the given signal.
sig | the signal which should be blocked |
VTM_API int vtm_signal_default | ( | enum vtm_signal_type | sig | ) |
Restores default handler for the given signal.
sig | the signal for which the default handler should be restored |
VTM_API int vtm_signal_convert_from_os | ( | int | psig, |
enum vtm_signal_type * | out | ||
) |
Converts platform specific signal number to enum.
psig | the signal number | |
[out] | out | the converted signal enum value |
VTM_API int vtm_signal_convert_to_os | ( | enum vtm_signal_type | sig, |
int * | out | ||
) |
Converts enum to platform specific signal number.
sig | the signal that should be converted | |
[out] | out | the converted signal number |
VTM_API void vtm_signal_safe_puts | ( | const char * | str | ) |
Safe way to print to stdout from signal handler.
str | the string to print |