libamxp  1.4.0
Patterns C Implementation
amxp_syssig.c File Reference
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <amxc/amxc_macros.h>
#include <amxc/amxc.h>
#include <amxp/amxp.h>

Go to the source code of this file.

Macros

#define _GNU_SOURCE
 

Functions

int amxp_syssig_enable (const int sigid, const bool enable)
 Enables or disables monitoring of a system signal. More...
 
bool amxp_syssig_is_enabled (const int sigid)
 Checks if a system signal is being monitored. More...
 
int amxp_syssig_get_fd (void)
 Returns a file descriptor that can be used in an eventloop. More...
 
int amxp_syssig_read (void)
 Reads from the file descriptor. More...
 
 CONSTRUCTOR_LVL (200)
 
 DESTRUCTOR_LVL (200)
 

Variables

static int sig_fd = -1
 
static sigset_t mask
 

Macro Definition Documentation

◆ _GNU_SOURCE

#define _GNU_SOURCE

Definition at line 56 of file amxp_syssig.c.

Function Documentation

◆ CONSTRUCTOR_LVL()

CONSTRUCTOR_LVL ( 200  )

Definition at line 140 of file amxp_syssig.c.

140  {
141  sigemptyset(&mask);
142  sig_fd = signalfd(sig_fd, &mask, SFD_NONBLOCK | SFD_CLOEXEC);
143 }
static int sig_fd
Definition: amxp_syssig.c:67
static sigset_t mask
Definition: amxp_syssig.c:68

◆ DESTRUCTOR_LVL()

DESTRUCTOR_LVL ( 200  )

Definition at line 145 of file amxp_syssig.c.

145  {
146  close(sig_fd);
147  sigemptyset(&mask);
148 }

Variable Documentation

◆ mask

sigset_t mask
static

Definition at line 68 of file amxp_syssig.c.

◆ sig_fd

int sig_fd = -1
static

Definition at line 67 of file amxp_syssig.c.