Data Structures | Macros | Functions | Variables
sig.c File Reference
#include "syshead.h"
#include "buffer.h"
#include "error.h"
#include "win32.h"
#include "init.h"
#include "status.h"
#include "sig.h"
#include "occ.h"
#include "manage.h"
#include "openvpn.h"
#include "memdbg.h"
Include dependency graph for sig.c:

Go to the source code of this file.

Data Structures

struct  signame


#define SM_UNDEF   0
#define SM_PRE_INIT   1
#define SM_POST_INIT   2


int parse_signal (const char *signame)
const char * signal_name (const int sig, const bool upper)
const char * signal_description (const int signum, const char *sigtext)
void throw_signal (const int signum)
void throw_signal_soft (const int signum, const char *signal_text)
static void signal_reset (struct signal_info *si)
void print_signal (const struct signal_info *si, const char *title, int msglevel)
void signal_restart_status (const struct signal_info *si)
static void signal_handler (const int signum)
void pre_init_signal_catch (void)
void post_init_signal_catch (void)
void restore_signal_state (void)
void print_status (const struct context *c, struct status_output *so)
static void process_explicit_exit_notification_init (struct context *c)
void process_explicit_exit_notification_timer_wakeup (struct context *c)
void remap_signal (struct context *c)
static void process_sigusr2 (const struct context *c)
static bool process_sigterm (struct context *c)
static bool ignore_restart_signals (struct context *c)
 If a restart signal is received during exit-notification, reset the signal and return true. More...
bool process_signal (struct context *c)
void register_signal (struct context *c, int sig, const char *text)


struct signal_info siginfo_static
static const struct signame signames []
static int signal_mode

Macro Definition Documentation


#define SM_POST_INIT   2

Definition at line 231 of file sig.c.

Referenced by post_init_signal_catch(), and restore_signal_state().


#define SM_PRE_INIT   1

Definition at line 230 of file sig.c.

Referenced by pre_init_signal_catch(), and restore_signal_state().


#define SM_UNDEF   0

Definition at line 229 of file sig.c.

Function Documentation

◆ ignore_restart_signals()

static bool ignore_restart_signals ( struct context c)

If a restart signal is received during exit-notification, reset the signal and return true.

If its a soft restart signal from the event loop which implies the loop cannot continue, remap to SIGTERM to exit promptly.

Definition at line 401 of file sig.c.

References context::c2, event_timeout_defined(), context_2::explicit_exit_notification_interval, M_INFO, msg, register_signal(), context::sig, SIG_SOURCE_HARD, SIGHUP, signal_name(), signal_info::signal_received, signal_reset(), SIGTERM, SIGUSR1, and signal_info::source.

Referenced by process_signal().

◆ parse_signal()

int parse_signal ( const char *  signame)

Definition at line 63 of file sig.c.

References SIZE, signame::upper, and signame::value.

Referenced by man_signal().

◆ post_init_signal_catch()

void post_init_signal_catch ( void  )

◆ pre_init_signal_catch()

void pre_init_signal_catch ( void  )

◆ print_signal()

void print_signal ( const struct signal_info si,
const char *  title,
int  msglevel 

◆ print_status()

void print_status ( const struct context c,
struct status_output so 

◆ process_explicit_exit_notification_init()

static void process_explicit_exit_notification_init ( struct context c)

◆ process_explicit_exit_notification_timer_wakeup()

void process_explicit_exit_notification_timer_wakeup ( struct context c)

◆ process_signal()

bool process_signal ( struct context c)

◆ process_sigterm()

static bool process_sigterm ( struct context c)

◆ process_sigusr2()

static void process_sigusr2 ( const struct context c)

Definition at line 374 of file sig.c.

References M_INFO, print_status(), context::sig, signal_reset(), status_close(), and status_open().

Referenced by process_signal().

◆ register_signal()

void register_signal ( struct context c,
int  sig,
const char *  text 

◆ remap_signal()

void remap_signal ( struct context c)

◆ restore_signal_state()

void restore_signal_state ( void  )

◆ signal_description()

const char* signal_description ( const int  signum,
const char *  sigtext 

Definition at line 91 of file sig.c.

References signal_name().

Referenced by do_close_tun().

◆ signal_handler()

static void signal_handler ( const int  signum)

Definition at line 220 of file sig.c.

References throw_signal().

Referenced by post_init_signal_catch(), and pre_init_signal_catch().

◆ signal_name()

const char* signal_name ( const int  sig,
const bool  upper 

◆ signal_reset()

static void signal_reset ( struct signal_info si)

◆ signal_restart_status()

void signal_restart_status ( const struct signal_info si)

◆ throw_signal()

void throw_signal ( const int  signum)

◆ throw_signal_soft()

void throw_signal_soft ( const int  signum,
const char *  signal_text 

Variable Documentation

◆ siginfo_static

struct signal_info siginfo_static

◆ signal_mode

int signal_mode

Definition at line 232 of file sig.c.

Referenced by post_init_signal_catch(), pre_init_signal_catch(), and restore_signal_state().

◆ signames

const struct signame signames[]
Initial value:
= {
{ SIGINT, "SIGINT", "sigint"},
{ SIGTERM, "SIGTERM", "sigterm" },
{ SIGHUP, "SIGHUP", "sighup" },
{ SIGUSR1, "SIGUSR1", "sigusr1" },
{ SIGUSR2, "SIGUSR2", "sigusr2" }
#define SIGUSR1
Definition: config-msvc.h:115
#define SIGTERM
Definition: config-msvc.h:117
#define SIGHUP
Definition: config-msvc.h:113
#define SIGINT
Definition: config-msvc.h:114
#define SIGUSR2
Definition: config-msvc.h:116

Definition at line 54 of file sig.c.