Deleted Added
full compact
svr4_signal.c (141815) svr4_signal.c (142500)
1/*-
2 * Copyright (c) 1998 Mark Newton
3 * Copyright (c) 1994 Christos Zoulas
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:

--- 13 unchanged lines hidden (view full) ---

22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */
28
29#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 1998 Mark Newton
3 * Copyright (c) 1994 Christos Zoulas
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:

--- 13 unchanged lines hidden (view full) ---

22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */
28
29#include <sys/cdefs.h>
30__FBSDID("$FreeBSD: head/sys/compat/svr4/svr4_signal.c 141815 2005-02-13 17:37:20Z sobomax $");
30__FBSDID("$FreeBSD: head/sys/compat/svr4/svr4_signal.c 142500 2005-02-25 19:34:10Z sam $");
31
32#include <sys/param.h>
33#include <sys/systm.h>
34#include <sys/filedesc.h>
35#include <sys/lock.h>
36#include <sys/mutex.h>
37#include <sys/proc.h>
38#include <sys/signal.h>

--- 15 unchanged lines hidden (view full) ---

54#define svr4_sigemptyset(s) memset((s), 0, sizeof(*(s)))
55#define svr4_sigismember(s, n) ((s)->bits[svr4_sigword(n)] & svr4_sigmask(n))
56#define svr4_sigaddset(s, n) ((s)->bits[svr4_sigword(n)] |= svr4_sigmask(n))
57
58void svr4_to_bsd_sigaction(const struct svr4_sigaction *, struct sigaction *);
59void bsd_to_svr4_sigaction(const struct sigaction *, struct svr4_sigaction *);
60void svr4_sigfillset(svr4_sigset_t *);
61
31
32#include <sys/param.h>
33#include <sys/systm.h>
34#include <sys/filedesc.h>
35#include <sys/lock.h>
36#include <sys/mutex.h>
37#include <sys/proc.h>
38#include <sys/signal.h>

--- 15 unchanged lines hidden (view full) ---

54#define svr4_sigemptyset(s) memset((s), 0, sizeof(*(s)))
55#define svr4_sigismember(s, n) ((s)->bits[svr4_sigword(n)] & svr4_sigmask(n))
56#define svr4_sigaddset(s, n) ((s)->bits[svr4_sigword(n)] |= svr4_sigmask(n))
57
58void svr4_to_bsd_sigaction(const struct svr4_sigaction *, struct sigaction *);
59void bsd_to_svr4_sigaction(const struct sigaction *, struct svr4_sigaction *);
60void svr4_sigfillset(svr4_sigset_t *);
61
62int bsd_to_svr4_sig[SVR4_SIGTBLSZ] = {
62int bsd_to_svr4_sig[SVR4_NSIG] = {
63 0,
63 SVR4_SIGHUP,
64 SVR4_SIGINT,
65 SVR4_SIGQUIT,
66 SVR4_SIGILL,
67 SVR4_SIGTRAP,
68 SVR4_SIGABRT,
69 SVR4_SIGEMT,
70 SVR4_SIGFPE,

--- 17 unchanged lines hidden (view full) ---

88 SVR4_SIGVTALRM,
89 SVR4_SIGPROF,
90 SVR4_SIGWINCH,
91 0, /* SIGINFO */
92 SVR4_SIGUSR1,
93 SVR4_SIGUSR2,
94};
95
64 SVR4_SIGHUP,
65 SVR4_SIGINT,
66 SVR4_SIGQUIT,
67 SVR4_SIGILL,
68 SVR4_SIGTRAP,
69 SVR4_SIGABRT,
70 SVR4_SIGEMT,
71 SVR4_SIGFPE,

--- 17 unchanged lines hidden (view full) ---

89 SVR4_SIGVTALRM,
90 SVR4_SIGPROF,
91 SVR4_SIGWINCH,
92 0, /* SIGINFO */
93 SVR4_SIGUSR1,
94 SVR4_SIGUSR2,
95};
96
96int svr4_to_bsd_sig[SVR4_SIGTBLSZ] = {
97int svr4_to_bsd_sig[SVR4_NSIG] = {
98 0,
97 SIGHUP,
98 SIGINT,
99 SIGQUIT,
100 SIGILL,
101 SIGTRAP,
102 SIGABRT,
103 SIGEMT,
104 SIGFPE,

--- 24 unchanged lines hidden (view full) ---

129
130void
131svr4_sigfillset(s)
132 svr4_sigset_t *s;
133{
134 int i;
135
136 svr4_sigemptyset(s);
99 SIGHUP,
100 SIGINT,
101 SIGQUIT,
102 SIGILL,
103 SIGTRAP,
104 SIGABRT,
105 SIGEMT,
106 SIGFPE,

--- 24 unchanged lines hidden (view full) ---

131
132void
133svr4_sigfillset(s)
134 svr4_sigset_t *s;
135{
136 int i;
137
138 svr4_sigemptyset(s);
137 for (i = 0; i < SVR4_NSIG; i++)
139 for (i = 1; i < SVR4_NSIG; i++)
138 if (svr4_to_bsd_sig[i] != 0)
139 svr4_sigaddset(s, i);
140}
141
142void
143svr4_to_bsd_sigset(sss, bss)
144 const svr4_sigset_t *sss;
145 sigset_t *bss;
146{
147 int i, newsig;
148
149 SIGEMPTYSET(*bss);
140 if (svr4_to_bsd_sig[i] != 0)
141 svr4_sigaddset(s, i);
142}
143
144void
145svr4_to_bsd_sigset(sss, bss)
146 const svr4_sigset_t *sss;
147 sigset_t *bss;
148{
149 int i, newsig;
150
151 SIGEMPTYSET(*bss);
150 for (i = 0; i < SVR4_NSIG; i++)
151 if (svr4_sigismember(sss, i + 1)) {
152 for (i = 1; i < SVR4_NSIG; i++)
153 if (svr4_sigismember(sss, i)) {
152 newsig = svr4_to_bsd_sig[i];
153 if (newsig)
154 SIGADDSET(*bss, newsig);
155 }
156}
157
158void
159bsd_to_svr4_sigset(bss, sss)
160 const sigset_t *bss;
161 svr4_sigset_t *sss;
162{
163 int i, newsig;
164
165 svr4_sigemptyset(sss);
154 newsig = svr4_to_bsd_sig[i];
155 if (newsig)
156 SIGADDSET(*bss, newsig);
157 }
158}
159
160void
161bsd_to_svr4_sigset(bss, sss)
162 const sigset_t *bss;
163 svr4_sigset_t *sss;
164{
165 int i, newsig;
166
167 svr4_sigemptyset(sss);
166 sss->bits[0] = bss->__bits[0] & ~((1U << SVR4_SIGTBLSZ) - 1);
167 sss->bits[1] = bss->__bits[1];
168 sss->bits[2] = bss->__bits[2];
169 sss->bits[3] = bss->__bits[3];
170 for (i = 1; i <= SVR4_SIGTBLSZ; i++) {
168 for (i = 1; i < SVR4_NSIG; i++) {
171 if (SIGISMEMBER(*bss, i)) {
169 if (SIGISMEMBER(*bss, i)) {
172 newsig = bsd_to_svr4_sig[_SIG_IDX(i)];
170 newsig = bsd_to_svr4_sig[i];
173 if (newsig)
174 svr4_sigaddset(sss, newsig);
175 }
176 }
177}
178
179/*
180 * XXX: Only a subset of the flags is currently implemented.

--- 399 unchanged lines hidden ---
171 if (newsig)
172 svr4_sigaddset(sss, newsig);
173 }
174 }
175}
176
177/*
178 * XXX: Only a subset of the flags is currently implemented.

--- 399 unchanged lines hidden ---