Server Wait On Clients System - API Documentation
v1.6.4
Server Wait On Clients System.
|
Signal handling functions. More...
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <swoc/libswocclient.h>
#include <swoc/signalhandle.h>
Functions | |
void | init_sig_handle (void) |
Initialise signal handler. More... | |
void | termination_handler (int signum) |
Handler for caught signals. More... | |
Signal handling functions.
Likely terminate signals to handle.
SIGTERM
SIGINT (Ctrl-C)
SIGQUIT (Ctrl-)
SIGHUP
Might want to handle these non-terminate signals.SIGCONT
SIGTSTP (Ctrl-Z)
Released under the GPLv3 only.
SPDX-License-Identifier: GPL-3.0-only
void init_sig_handle | ( | void | ) |
Initialise signal handler.
Block all other caught signals whilst the handler processes.
void termination_handler | ( | int | signum | ) |
Handler for caught signals.
There are 2 possibilities here:-
Catch, process and terminate
or
Catch, process and continue.
Catch, process and terminate is straight forward as the easiest way to terminate is to re-raise the signal using the default hander.
Catch, process and continue has 2 forms:-
Continue via simple return
or
Continue via re-raise the signal using the default handler.
The simple return is just that.
Re-raise the signal using the default handler is required for instance with SIGTSTP (Ctrl-Z). This is because in a terminal the default handler ensures the stopped process is in the background and control is passed back to the shell, (fg can then be used to resume the process). This means that SIGTSTP is now set to use the default handler, hence this relies on SIGCONT to explicitly reset the SIGTSTP handler.
signum | The signal number. |