SELKIELogger  1.0.0
LoggerSignals.h File Reference
#include <signal.h>
#include <stdatomic.h>
#include <stdbool.h>
Include dependency graph for LoggerSignals.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void signalShutdown (int signnum)
 Set safe shutdown flag. More...
 
void signalRotate (int signnum)
 Set log rotate flag. More...
 
void signalPause (int signnum)
 Set logger pause flag. More...
 
void signalUnpause (int signnum)
 Clear logger pause flag. More...
 
void signalHandlersInstall (void)
 Install signal handlers. More...
 
sigset_t * signalHandlerMask (void)
 Return a signal mask with suitable defaults. More...
 
void signalHandlersBlock (void)
 Block signals that we have handlers for.
 
void signalHandlersUnblock (void)
 Unblock signals that we have handlers for.
 

Variables

atomic_bool shutdownFlag
 Trigger clean software shutdown. More...
 
atomic_bool rotateNow
 Trigger immediate log rotation. More...
 
atomic_bool pauseLog
 Pause logging. More...
 

Function Documentation

◆ signalHandlerMask()

sigset_t* signalHandlerMask ( void  )

Return a signal mask with suitable defaults.

Allocates and returns as signal mask that blocks all of the signals that we have explicit handlers for.

This can then be used to ensure that source handling threads do not respond to signals, and that the main logging thread doesn't respond to any of these signals until it's ready to do so.

The signal set returned by this function must be freed by the caller.

Returns
Pointer to sigset_t

If any new signal handlers are added, they also need to be added to this list

Definition at line 164 of file LoggerSignals.c.

◆ signalHandlersInstall()

void signalHandlersInstall ( void  )

Install signal handlers.

Called from main logging thread to establish the signal handlers.

Definition at line 107 of file LoggerSignals.c.