10 #define SA_NOCLDWAIT 2
12 #define SA_ONSTACK 0x08000000
13 #define SA_RESTART 0x10000000
14 #define SA_NODEFER 0x40000000
15 #define SA_RESETHAND 0x80000000
16 #define SA_RESTORER 0x04000000
19 unsigned long __bits
[128 / sizeof(long)];
21 typedef struct sigset_t sigset_t
;
24 void (*sa_handler
)(int);
27 void (*sa_restorer
)(void);
30 int sigreturn(unsigned long n
);
35 int (*restorer
)(unsigned long n
);
39 int __sigaction(int sig
, const struct sigaction
*sa
, struct sigaction
*old
)
43 ksa
.handler
= sa
->sa_handler
;
44 ksa
.flags
= sa
->sa_flags
| SA_RESTORER
;
45 ksa
.restorer
= sigreturn
;
46 ksa
.mask
= sa
->sa_mask
;
48 if (sigaction(sig
, sa
? (long) &ksa
: 0, old
? (long) &_ksa
: 0, 8))
51 old
->sa_handler
= _ksa
.handler
;
52 old
->sa_flags
= _ksa
.flags
;
53 old
->sa_mask
= _ksa
.mask
;
58 int sigaction(int sig
, struct sigaction
*sa
, struct sigaction
*old_sa
);
60 sighandler_t
signal(int sig
, sighandler_t func
)
62 struct sigaction sa
= {.sa_handler
= func
, .sa_flags
= SA_RESTART
};
63 if (__sigaction(sig
, &sa
, &sa
) < 0)