50 lines
1.5 KiB
C
50 lines
1.5 KiB
C
/*
|
|
* <signal.h> overlay for the MontaukOS git port.
|
|
*
|
|
* The libc supplies signal()/raise()/kill() and the signal numbers; this adds
|
|
* the sigaction() family that git uses in a handful of places (fast-import's
|
|
* SIGUSR1 checkpoint handler, sigchain's SIGPIPE and SIGINT handling).
|
|
*
|
|
* MontaukOS delivers only SIGINT, and has no signal masks: a handler is
|
|
* either installed or it is not. sigaction() below is therefore a wrapper
|
|
* around signal() that honours sa_handler and ignores sa_mask and sa_flags,
|
|
* and the sigset_t operations manipulate a plain bitmask that nothing
|
|
* consults. See montauk-compat.c.
|
|
*/
|
|
#ifndef _MONTAUK_GIT_SIGNAL_H_
|
|
#define _MONTAUK_GIT_SIGNAL_H_
|
|
|
|
#include_next <signal.h>
|
|
|
|
/* One past the highest signal number the libc names (SIGSTOP, 19). */
|
|
#define NSIG 32
|
|
|
|
typedef unsigned long sigset_t;
|
|
|
|
struct sigaction {
|
|
sighandler_t sa_handler;
|
|
sigset_t sa_mask;
|
|
int sa_flags;
|
|
void (*sa_restorer)(void);
|
|
};
|
|
|
|
#define SA_RESTART 0x10000000
|
|
#define SA_NOCLDSTOP 0x00000001
|
|
#define SA_SIGINFO 0x00000004
|
|
#define SA_NODEFER 0x40000000
|
|
#define SA_RESETHAND 0x80000000
|
|
|
|
#define SIG_BLOCK 0
|
|
#define SIG_UNBLOCK 1
|
|
#define SIG_SETMASK 2
|
|
|
|
int sigemptyset(sigset_t *set);
|
|
int sigfillset(sigset_t *set);
|
|
int sigaddset(sigset_t *set, int signum);
|
|
int sigdelset(sigset_t *set, int signum);
|
|
int sigismember(const sigset_t *set, int signum);
|
|
int sigaction(int signum, const struct sigaction *act, struct sigaction *old);
|
|
int sigprocmask(int how, const sigset_t *set, sigset_t *old);
|
|
|
|
#endif /* _MONTAUK_GIT_SIGNAL_H_ */
|