cfengine  3.15.4
About: CFEngine is a configuration management system for configuring and maintaining Unix-like computers (using an own high level policy language). Community version.
  Fossies Dox: cfengine-3.15.4.tar.gz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

signals.c File Reference
#include <signals.h>
#include <cleanup.h>
#include <known_dirs.h>
#include <file_lib.h>
Include dependency graph for signals.c:

Go to the source code of this file.

Macros

#define CNTLNAME   "fcntl"
 

Functions

bool IsPendingTermination (void)
 
bool ReloadConfigRequested (void)
 
void ClearRequestReloadConfig ()
 
static void CloseSignalPipe (void)
 
void MakeSignalPipe (void)
 
int GetSignalPipe (void)
 
static void SignalNotify (int signum)
 
void HandleSignalsForAgent (int signum)
 
void HandleSignalsForDaemon (int signum)
 

Variables

static bool PENDING_TERMINATION = false
 
static bool RELOAD_CONFIG = false
 
static int SIGNAL_PIPE [2] = { -1, -1 }
 

Macro Definition Documentation

◆ CNTLNAME

#define CNTLNAME   "fcntl"

Function Documentation

◆ ClearRequestReloadConfig()

void ClearRequestReloadConfig ( )

Definition at line 45 of file signals.c.

References RELOAD_CONFIG.

Referenced by CheckFileChanges(), and CheckNewPromises().

◆ CloseSignalPipe()

static void CloseSignalPipe ( void  )
static

Definition at line 54 of file signals.c.

References SIGNAL_PIPE.

Referenced by MakeSignalPipe().

◆ GetSignalPipe()

int GetSignalPipe ( void  )

Gets the signal pipe, which is non-blocking. Each byte read corresponds to one arrived signal. Note: Use recv() to read from the pipe, not read().

Definition at line 115 of file signals.c.

References SIGNAL_PIPE.

Referenced by StartServer(), and WaitForIncoming().

◆ HandleSignalsForAgent()

◆ HandleSignalsForDaemon()

◆ IsPendingTermination()

bool IsPendingTermination ( void  )

◆ MakeSignalPipe()

void MakeSignalPipe ( void  )

Make a pipe that can be used to flag that a signal has arrived. Using a pipe avoids race conditions, since it saves its values until emptied. Use GetSignalPipe() to get the pipe. Note that we use a real socket as the pipe, because Windows only supports using select() with real sockets. This means also using send() and recv() instead of write() and read().

Definition at line 76 of file signals.c.

References CloseSignalPipe(), CNTLNAME, DoCleanupAndExit(), GetErrorStr(), Log(), LOG_LEVEL_CRIT, RegisterCleanupFunction(), SIGNAL_PIPE, and socketpair().

Referenced by InitSignals().

◆ ReloadConfigRequested()

bool ReloadConfigRequested ( void  )

Definition at line 40 of file signals.c.

References RELOAD_CONFIG.

Referenced by CheckFileChanges(), and CheckNewPromises().

◆ SignalNotify()

static void SignalNotify ( int  signum)
static

Definition at line 120 of file signals.c.

References errno, GetErrorStr(), Log(), LOG_LEVEL_CRIT, and SIGNAL_PIPE.

Referenced by HandleSignalsForAgent(), and HandleSignalsForDaemon().

Variable Documentation

◆ PENDING_TERMINATION

bool PENDING_TERMINATION = false
static

Definition at line 30 of file signals.c.

Referenced by HandleSignalsForDaemon(), and IsPendingTermination().

◆ RELOAD_CONFIG

bool RELOAD_CONFIG = false
static

◆ SIGNAL_PIPE

int SIGNAL_PIPE[2] = { -1, -1 }
static

Definition at line 52 of file signals.c.

Referenced by CloseSignalPipe(), GetSignalPipe(), MakeSignalPipe(), and SignalNotify().