summaryrefslogtreecommitdiff
path: root/src/include/skalibs/sig.h
blob: 236257b85e506e8600f5491b53b0d4025da04a99 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
/* ISC license. */

#ifndef SIG_H
#define SIG_H

#include <sys/types.h>
#include <signal.h>
#include <skalibs/gccattributes.h>

typedef void skasighandler_t (int) ;
typedef skasighandler_t *skasighandler_t_ref ;

struct skasigaction
{
  skasighandler_t_ref handler ;
  unsigned int flags : 2 ;
} ;

#define SKASA_MASKALL 0x01
#define SKASA_NOCLDSTOP 0x02

extern struct skasigaction const SKASIG_DFL ;
extern struct skasigaction const SKASIG_IGN ;
extern int skasigaction (int, struct skasigaction const *, struct skasigaction *) ;

#define sig_catcha(sig, ac) skasigaction(sig, (ac), 0)
#define sig_restore(sig) skasigaction((sig), &SKASIG_DFL, 0)

extern void sig_restoreto (sigset_t const *, unsigned int) ;
extern int sig_catch (int, skasighandler_t_ref) ;
#define sig_ignore(sig) sig_catcha((sig), &SKASIG_IGN)
#define sig_uncatch(sig) sig_restore(sig)

#define SIGSTACKSIZE 16
extern int sig_pusha (int, struct skasigaction const *) ;
extern int sig_pop (int) ;
extern int sig_push (int, skasighandler_t_ref) ;

extern void sig_block (int) ;
extern void sig_blockset (sigset_t const *) ;
extern void sig_unblock (int) ;
extern void sig_blocknone (void) ;
extern void sig_pause (void) ;
extern void sig_shield (void) ;
extern void sig_unshield (void) ;

extern char const *sig_name (int) ;
extern int sig_number (char const *) ;
extern size_t sig_scan (char const *, int *) ;
extern size_t sig0_scan (char const *, int *) ;

#endif