OpenVPN
Data Structures | 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
 

Functions

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)
 
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)
 

Variables

struct signal_info siginfo_static
 
static const struct signame signames []
 

Function Documentation

◆ ignore_restart_signals()

static bool ignore_restart_signals ( struct context c)
static

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 412 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  )

Definition at line 255 of file sig.c.

References SIGHUP, SIGINT, SIGTERM, SIGUSR1, and SIGUSR2.

Referenced by init_instance_handle_signals(), and restore_signal_state().

◆ pre_init_signal_catch()

void pre_init_signal_catch ( void  )

Definition at line 239 of file sig.c.

References SIGHUP, SIGINT, SIGTERM, SIGUSR1, and SIGUSR2.

Referenced by init_instance_handle_signals(), openvpn_main(), and restore_signal_state().

◆ 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)
static

◆ 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)
static

◆ process_sigusr2()

static void process_sigusr2 ( const struct context c)
static

Definition at line 383 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  )

Definition at line 272 of file sig.c.

References post_init_signal_catch(), and pre_init_signal_catch().

Referenced by possibly_become_daemon().

◆ 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_name()

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

◆ signal_reset()

static void signal_reset ( struct signal_info si)
static

◆ 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

◆ signames

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

Definition at line 54 of file sig.c.