libcortex
Event loop library following a "batteries included" approach
Loading...
Searching...
No Matches
signals.h
1#ifndef _CRTX_SIGNALS_H
2#define _CRTX_SIGNALS_H
3
4#ifdef __cplusplus
5extern "C" {
6#endif
7
8/*
9 * Mario Kicherer (dev@kicherer.org) 2016
10 *
11 */
12
13#include <signal.h>
14#include <sys/types.h>
15
16#include "core.h"
17#include "pipe.h"
18
19#define CRTX_SIGNAL_DEFAULT 0
20#define CRTX_SIGNAL_SIGACTION 1
21#define CRTX_SIGNAL_SIGNALFD 2
22#define CRTX_SIGNAL_SELFPIPE 3
23
25 int signum;
26 char *name;
27 char *etype;
28 // struct crtx_listener_base *lstnr;
29 struct crtx_dll *lstnrs;
30 struct sigaction sa;
31};
32
34 struct crtx_listener_base base;
35
36 // int *signals; // { SIGINT, ..., 0 }
37 struct crtx_signal *signals;
38 unsigned int n_signals;
39
40 char type;
41 int fd;
42
43 void (*signal_handler)(int sig_num);
44
45 struct crtx_pipe_listener pipe_lstnr;
46 struct crtx_signals_listener *sub_lstnr;
47};
48
49int crtx_signals_handle_std_signals(struct crtx_signals_listener **signal_lstnr);
50
51typedef void (*sigchld_cb)(pid_t pid, int status, void *userdata);
52void *crtx_signals_add_child_handler(sigchld_cb cb, void *userdata);
53int crtx_signals_rem_child_handler(void *sigchld_cb);
54
55struct crtx_signal *crtx_get_signal_info(int signum);
56
57struct crtx_listener_base *crtx_setup_signals_listener(void *options);
58CRTX_DECLARE_ALLOC_FUNCTION(signals)
59
60void crtx_signals_init();
61void crtx_signals_finish();
62
63#ifdef __cplusplus
64}
65#endif
66
67#endif
The core definitions of libcortex.
base structure of a listener
Definition core.h:186
Definition pipe.h:16
Definition signals.h:24
Definition signals.h:33