]> git.saurik.com Git - apple/libc.git/blob - gen/FreeBSD/signal.c.patch
9064ec852d3b022bc905d650339060463e706425
[apple/libc.git] / gen / FreeBSD / signal.c.patch
1 --- signal.c.orig 2009-11-07 14:51:38.000000000 -0800
2 +++ signal.c 2009-11-07 14:51:40.000000000 -0800
3 @@ -43,10 +43,13 @@ __FBSDID("$FreeBSD: src/lib/libc/gen/sig
4
5 sigset_t _sigintr; /* shared with siginterrupt */
6
7 -sig_t
8 -signal(s, a)
9 +extern int _sigaction_nobind (int sig, const struct sigaction *nsv, struct sigaction *osv);
10 +
11 +static sig_t
12 +signal__(s, a, bind)
13 int s;
14 sig_t a;
15 + int bind;
16 {
17 struct sigaction sa, osa;
18
19 @@ -55,7 +58,34 @@ signal(s, a)
20 sa.sa_flags = 0;
21 if (!sigismember(&_sigintr, s))
22 sa.sa_flags |= SA_RESTART;
23 +#if defined(__DYNAMIC__)
24 + if (bind) {
25 +#endif /* __DYNAMIC__ */
26 if (_sigaction(s, &sa, &osa) < 0)
27 return (SIG_ERR);
28 +#if defined(__DYNAMIC__)
29 + } else {
30 + if (_sigaction_nobind(s, &sa, &osa) < 0)
31 + return (SIG_ERR);
32 + }
33 +#endif /* __DYNAMIC__ */
34 return (osa.sa_handler);
35 }
36 +
37 +sig_t
38 +signal(s, a)
39 + int s;
40 + sig_t a;
41 +{
42 + return signal__(s, a, 1);
43 +}
44 +
45 +#if defined(__DYNAMIC__)
46 +sig_t
47 +_signal_nobind(s, a)
48 + int s;
49 + sig_t a;
50 +{
51 + return signal__(s, a, 0);
52 +}
53 +#endif /* __DYNAMIC__ */