diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Makemodule.am | 1 | ||||
-rw-r--r-- | lib/include/util.h | 26 |
2 files changed, 27 insertions, 0 deletions
diff --git a/lib/Makemodule.am b/lib/Makemodule.am index fa8789b..836bd4d 100644 --- a/lib/Makemodule.am +++ b/lib/Makemodule.am @@ -1,6 +1,7 @@ libinit_a_SOURCES = lib/init/delsvc.c lib/init/svcmap.c lib/init/rdsvc.c libinit_a_SOURCES += lib/init/svcscan.c lib/init/del_svc_list.c libinit_a_SOURCES += lib/init/svc_tsort.c lib/include/service.h +libinit_a_SOURCES += lib/include/util.h libinit_a_CPPFLAGS = $(AM_CPPFLAGS) libinit_a_CFLAGS = $(AM_CFLAGS) diff --git a/lib/include/util.h b/lib/include/util.h new file mode 100644 index 0000000..884eeab --- /dev/null +++ b/lib/include/util.h @@ -0,0 +1,26 @@ +#ifndef UTIL_H +#define UTIL_H + +#include <signal.h> + +static inline void cli(sigset_t *old_mask) +{ + sigset_t mask; + + sigfillset(&mask); + sigprocmask(SIG_SETMASK, &mask, old_mask); +} + +static inline void sti(const sigset_t *old_mask) +{ + sigset_t mask; + + if (old_mask == NULL) { + sigemptyset(&mask); + sigprocmask(SIG_SETMASK, &mask, NULL); + } else { + sigprocmask(SIG_SETMASK, old_mask, NULL); + } +} + +#endif /* UTIL_H */ |