Add native to linux siginfo si_status translation, used on i386 and amd64.diff -r1.35 -r1.36 src/sys/compat/linux/arch/amd64/linux_machdep.c
(njoly)
--- src/sys/compat/linux/arch/amd64/linux_machdep.c 2009/03/18 16:00:16 1.35
+++ src/sys/compat/linux/arch/amd64/linux_machdep.c 2009/05/29 14:19:12 1.36
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: linux_machdep.c,v 1.35 2009/03/18 16:00:16 cegger Exp $ */ | 1 | /* $NetBSD: linux_machdep.c,v 1.36 2009/05/29 14:19:12 njoly Exp $ */ | |
2 | 2 | |||
3 | /*- | 3 | /*- | |
4 | * Copyright (c) 2005 Emmanuel Dreyfus, all rights reserved. | 4 | * Copyright (c) 2005 Emmanuel Dreyfus, all rights reserved. | |
5 | * | 5 | * | |
6 | * Redistribution and use in source and binary forms, with or without | 6 | * Redistribution and use in source and binary forms, with or without | |
7 | * modification, are permitted provided that the following conditions | 7 | * modification, are permitted provided that the following conditions | |
8 | * are met: | 8 | * are met: | |
9 | * 1. Redistributions of source code must retain the above copyright | 9 | * 1. Redistributions of source code must retain the above copyright | |
10 | * notice, this list of conditions and the following disclaimer. | 10 | * notice, this list of conditions and the following disclaimer. | |
11 | * 2. Redistributions in binary form must reproduce the above copyright | 11 | * 2. Redistributions in binary form must reproduce the above copyright | |
12 | * notice, this list of conditions and the following disclaimer in the | 12 | * notice, this list of conditions and the following disclaimer in the | |
13 | * documentation and/or other materials provided with the distribution. | 13 | * documentation and/or other materials provided with the distribution. | |
14 | * 3. All advertising materials mentioning features or use of this software | 14 | * 3. All advertising materials mentioning features or use of this software | |
@@ -23,37 +23,36 @@ | @@ -23,37 +23,36 @@ | |||
23 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | 23 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | |
24 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS | 24 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS | |
25 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | 25 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | |
26 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | 26 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | |
27 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | 27 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | |
28 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | 28 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | |
29 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | 29 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | |
30 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | 30 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | |
31 | * POSSIBILITY OF SUCH DAMAGE. | 31 | * POSSIBILITY OF SUCH DAMAGE. | |
32 | */ | 32 | */ | |
33 | 33 | |||
34 | #include <sys/cdefs.h> | 34 | #include <sys/cdefs.h> | |
35 | 35 | |||
36 | __KERNEL_RCSID(0, "$NetBSD: linux_machdep.c,v 1.35 2009/03/18 16:00:16 cegger Exp $"); | 36 | __KERNEL_RCSID(0, "$NetBSD: linux_machdep.c,v 1.36 2009/05/29 14:19:12 njoly Exp $"); | |
37 | 37 | |||
38 | #include <sys/param.h> | 38 | #include <sys/param.h> | |
39 | #include <sys/types.h> | 39 | #include <sys/types.h> | |
40 | #include <sys/systm.h> | 40 | #include <sys/systm.h> | |
41 | #include <sys/signal.h> | 41 | #include <sys/signal.h> | |
42 | #include <sys/exec.h> | 42 | #include <sys/exec.h> | |
43 | #include <sys/proc.h> | 43 | #include <sys/proc.h> | |
44 | #include <sys/ptrace.h> /* for process_read_fpregs() */ | 44 | #include <sys/ptrace.h> /* for process_read_fpregs() */ | |
45 | #include <sys/user.h> | 45 | #include <sys/user.h> | |
46 | #include <sys/wait.h> | |||
47 | #include <sys/ucontext.h> | 46 | #include <sys/ucontext.h> | |
48 | #include <sys/conf.h> | 47 | #include <sys/conf.h> | |
49 | 48 | |||
50 | #include <machine/reg.h> | 49 | #include <machine/reg.h> | |
51 | #include <machine/pcb.h> | 50 | #include <machine/pcb.h> | |
52 | #include <machine/fpu.h> | 51 | #include <machine/fpu.h> | |
53 | #include <machine/mcontext.h> | 52 | #include <machine/mcontext.h> | |
54 | #include <machine/specialreg.h> | 53 | #include <machine/specialreg.h> | |
55 | #include <machine/vmparam.h> | 54 | #include <machine/vmparam.h> | |
56 | #include <machine/cpufunc.h> | 55 | #include <machine/cpufunc.h> | |
57 | 56 | |||
58 | /* | 57 | /* | |
59 | * To see whether wscons is configured (for virtual console ioctl calls). | 58 | * To see whether wscons is configured (for virtual console ioctl calls). | |
@@ -236,40 +235,28 @@ linux_sendsig(const ksiginfo_t *ksi, con | @@ -236,40 +235,28 @@ linux_sendsig(const ksiginfo_t *ksi, con | |||
236 | switch (sigframe.info.lsi_signo) { | 235 | switch (sigframe.info.lsi_signo) { | |
237 | case LINUX_SIGILL: | 236 | case LINUX_SIGILL: | |
238 | case LINUX_SIGFPE: | 237 | case LINUX_SIGFPE: | |
239 | case LINUX_SIGSEGV: | 238 | case LINUX_SIGSEGV: | |
240 | case LINUX_SIGBUS: | 239 | case LINUX_SIGBUS: | |
241 | case LINUX_SIGTRAP: | 240 | case LINUX_SIGTRAP: | |
242 | sigframe.info._sifields._sigfault._addr = ksi->ksi_addr; | 241 | sigframe.info._sifields._sigfault._addr = ksi->ksi_addr; | |
243 | break; | 242 | break; | |
244 | case LINUX_SIGCHLD: | 243 | case LINUX_SIGCHLD: | |
245 | sigframe.info._sifields._sigchld._pid = ksi->ksi_pid; | 244 | sigframe.info._sifields._sigchld._pid = ksi->ksi_pid; | |
246 | sigframe.info._sifields._sigchld._uid = ksi->ksi_uid; | 245 | sigframe.info._sifields._sigchld._uid = ksi->ksi_uid; | |
247 | sigframe.info._sifields._sigchld._utime = ksi->ksi_utime; | 246 | sigframe.info._sifields._sigchld._utime = ksi->ksi_utime; | |
248 | sigframe.info._sifields._sigchld._stime = ksi->ksi_stime; | 247 | sigframe.info._sifields._sigchld._stime = ksi->ksi_stime; | |
249 | 248 | sigframe.info._sifields._sigchld._status = | ||
250 | if (WCOREDUMP(ksi->ksi_status)) { | 249 | native_to_linux_si_status(ksi->ksi_code, ksi->ksi_status); | |
251 | sigframe.info.lsi_code = LINUX_CLD_DUMPED; | |||
252 | sigframe.info._sifields._sigchld._status = | |||
253 | _WSTATUS(ksi->ksi_status); | |||
254 | } else if (_WSTATUS(ksi->ksi_status)) { | |||
255 | sigframe.info.lsi_code = LINUX_CLD_KILLED; | |||
256 | sigframe.info._sifields._sigchld._status = | |||
257 | _WSTATUS(ksi->ksi_status); | |||
258 | } else { | |||
259 | sigframe.info.lsi_code = LINUX_CLD_EXITED; | |||
260 | sigframe.info._sifields._sigchld._status = | |||
261 | ((ksi->ksi_status & 0xff00U) >> 8); | |||
262 | } | |||
263 | break; | 250 | break; | |
264 | case LINUX_SIGIO: | 251 | case LINUX_SIGIO: | |
265 | sigframe.info._sifields._sigpoll._band = ksi->ksi_band; | 252 | sigframe.info._sifields._sigpoll._band = ksi->ksi_band; | |
266 | sigframe.info._sifields._sigpoll._fd = ksi->ksi_fd; | 253 | sigframe.info._sifields._sigpoll._fd = ksi->ksi_fd; | |
267 | break; | 254 | break; | |
268 | default: | 255 | default: | |
269 | sigframe.info._sifields._sigchld._pid = ksi->ksi_pid; | 256 | sigframe.info._sifields._sigchld._pid = ksi->ksi_pid; | |
270 | sigframe.info._sifields._sigchld._uid = ksi->ksi_uid; | 257 | sigframe.info._sifields._sigchld._uid = ksi->ksi_uid; | |
271 | if ((sigframe.info.lsi_signo == LINUX_SIGALRM) || | 258 | if ((sigframe.info.lsi_signo == LINUX_SIGALRM) || | |
272 | (sigframe.info.lsi_signo >= LINUX_SIGRTMIN)) | 259 | (sigframe.info.lsi_signo >= LINUX_SIGRTMIN)) | |
273 | sigframe.info._sifields._timer._sigval.sival_ptr = | 260 | sigframe.info._sifields._timer._sigval.sival_ptr = | |
274 | ksi->ksi_value.sival_ptr; | 261 | ksi->ksi_value.sival_ptr; | |
275 | break; | 262 | break; |
--- src/sys/compat/linux/arch/i386/linux_machdep.c 2009/04/23 17:37:51 1.144
+++ src/sys/compat/linux/arch/i386/linux_machdep.c 2009/05/29 14:19:13 1.145
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: linux_machdep.c,v 1.144 2009/04/23 17:37:51 njoly Exp $ */ | 1 | /* $NetBSD: linux_machdep.c,v 1.145 2009/05/29 14:19:13 njoly Exp $ */ | |
2 | 2 | |||
3 | /*- | 3 | /*- | |
4 | * Copyright (c) 1995, 2000, 2008, 2009 The NetBSD Foundation, Inc. | 4 | * Copyright (c) 1995, 2000, 2008, 2009 The NetBSD Foundation, Inc. | |
5 | * All rights reserved. | 5 | * All rights reserved. | |
6 | * | 6 | * | |
7 | * This code is derived from software contributed to The NetBSD Foundation | 7 | * This code is derived from software contributed to The NetBSD Foundation | |
8 | * by Frank van der Linden, and by Andrew Doran. | 8 | * by Frank van der Linden, and by Andrew Doran. | |
9 | * | 9 | * | |
10 | * Redistribution and use in source and binary forms, with or without | 10 | * Redistribution and use in source and binary forms, with or without | |
11 | * modification, are permitted provided that the following conditions | 11 | * modification, are permitted provided that the following conditions | |
12 | * are met: | 12 | * are met: | |
13 | * 1. Redistributions of source code must retain the above copyright | 13 | * 1. Redistributions of source code must retain the above copyright | |
14 | * notice, this list of conditions and the following disclaimer. | 14 | * notice, this list of conditions and the following disclaimer. | |
@@ -20,27 +20,27 @@ | @@ -20,27 +20,27 @@ | |||
20 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | 20 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | |
21 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | 21 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | |
22 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | 22 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | |
23 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | 23 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | |
24 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | 24 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | |
25 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | 25 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | |
26 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | 26 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | |
27 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | 27 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | |
28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | 28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | |
29 | * POSSIBILITY OF SUCH DAMAGE. | 29 | * POSSIBILITY OF SUCH DAMAGE. | |
30 | */ | 30 | */ | |
31 | 31 | |||
32 | #include <sys/cdefs.h> | 32 | #include <sys/cdefs.h> | |
33 | __KERNEL_RCSID(0, "$NetBSD: linux_machdep.c,v 1.144 2009/04/23 17:37:51 njoly Exp $"); | 33 | __KERNEL_RCSID(0, "$NetBSD: linux_machdep.c,v 1.145 2009/05/29 14:19:13 njoly Exp $"); | |
34 | 34 | |||
35 | #if defined(_KERNEL_OPT) | 35 | #if defined(_KERNEL_OPT) | |
36 | #include "opt_vm86.h" | 36 | #include "opt_vm86.h" | |
37 | #include "opt_user_ldt.h" | 37 | #include "opt_user_ldt.h" | |
38 | #endif | 38 | #endif | |
39 | 39 | |||
40 | #include <sys/param.h> | 40 | #include <sys/param.h> | |
41 | #include <sys/systm.h> | 41 | #include <sys/systm.h> | |
42 | #include <sys/signalvar.h> | 42 | #include <sys/signalvar.h> | |
43 | #include <sys/kernel.h> | 43 | #include <sys/kernel.h> | |
44 | #include <sys/proc.h> | 44 | #include <sys/proc.h> | |
45 | #include <sys/user.h> | 45 | #include <sys/user.h> | |
46 | #include <sys/buf.h> | 46 | #include <sys/buf.h> | |
@@ -288,28 +288,28 @@ linux_rt_sendsig(const ksiginfo_t *ksi, | @@ -288,28 +288,28 @@ linux_rt_sendsig(const ksiginfo_t *ksi, | |||
288 | switch (lsi->lsi_signo = frame.sf_sig) { | 288 | switch (lsi->lsi_signo = frame.sf_sig) { | |
289 | case LINUX_SIGILL: | 289 | case LINUX_SIGILL: | |
290 | case LINUX_SIGFPE: | 290 | case LINUX_SIGFPE: | |
291 | case LINUX_SIGSEGV: | 291 | case LINUX_SIGSEGV: | |
292 | case LINUX_SIGBUS: | 292 | case LINUX_SIGBUS: | |
293 | case LINUX_SIGTRAP: | 293 | case LINUX_SIGTRAP: | |
294 | lsi->lsi_addr = ksi->ksi_addr; | 294 | lsi->lsi_addr = ksi->ksi_addr; | |
295 | break; | 295 | break; | |
296 | case LINUX_SIGCHLD: | 296 | case LINUX_SIGCHLD: | |
297 | lsi->lsi_uid = ksi->ksi_uid; | 297 | lsi->lsi_uid = ksi->ksi_uid; | |
298 | lsi->lsi_pid = ksi->ksi_pid; | 298 | lsi->lsi_pid = ksi->ksi_pid; | |
299 | lsi->lsi_utime = ksi->ksi_utime; | 299 | lsi->lsi_utime = ksi->ksi_utime; | |
300 | lsi->lsi_stime = ksi->ksi_stime; | 300 | lsi->lsi_stime = ksi->ksi_stime; | |
301 | /* XXX is that right? */ | 301 | lsi->lsi_status = | |
302 | lsi->lsi_status = WEXITSTATUS(ksi->ksi_status); | 302 | native_to_linux_si_status(ksi->ksi_code, ksi->ksi_status); | |
303 | break; | 303 | break; | |
304 | case LINUX_SIGIO: | 304 | case LINUX_SIGIO: | |
305 | lsi->lsi_band = ksi->ksi_band; | 305 | lsi->lsi_band = ksi->ksi_band; | |
306 | lsi->lsi_fd = ksi->ksi_fd; | 306 | lsi->lsi_fd = ksi->ksi_fd; | |
307 | break; | 307 | break; | |
308 | default: | 308 | default: | |
309 | lsi->lsi_uid = ksi->ksi_uid; | 309 | lsi->lsi_uid = ksi->ksi_uid; | |
310 | lsi->lsi_pid = ksi->ksi_pid; | 310 | lsi->lsi_pid = ksi->ksi_pid; | |
311 | if (lsi->lsi_signo == LINUX_SIGALRM || | 311 | if (lsi->lsi_signo == LINUX_SIGALRM || | |
312 | lsi->lsi_signo >= LINUX_SIGRTMIN) | 312 | lsi->lsi_signo >= LINUX_SIGRTMIN) | |
313 | lsi->lsi_value.sival_ptr = ksi->ksi_value.sival_ptr; | 313 | lsi->lsi_value.sival_ptr = ksi->ksi_value.sival_ptr; | |
314 | break; | 314 | break; | |
315 | } | 315 | } |
--- src/sys/compat/linux/common/linux_signal.c 2009/02/18 14:43:22 1.67
+++ src/sys/compat/linux/common/linux_signal.c 2009/05/29 14:19:13 1.68
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: linux_signal.c,v 1.67 2009/02/18 14:43:22 njoly Exp $ */ | 1 | /* $NetBSD: linux_signal.c,v 1.68 2009/05/29 14:19:13 njoly Exp $ */ | |
2 | 2 | |||
3 | /*- | 3 | /*- | |
4 | * Copyright (c) 1995, 1998 The NetBSD Foundation, Inc. | 4 | * Copyright (c) 1995, 1998 The NetBSD Foundation, Inc. | |
5 | * All rights reserved. | 5 | * All rights reserved. | |
6 | * | 6 | * | |
7 | * This code is derived from software contributed to The NetBSD Foundation | 7 | * This code is derived from software contributed to The NetBSD Foundation | |
8 | * by Frank van der Linden and Eric Haszlakiewicz. | 8 | * by Frank van der Linden and Eric Haszlakiewicz. | |
9 | * | 9 | * | |
10 | * Redistribution and use in source and binary forms, with or without | 10 | * Redistribution and use in source and binary forms, with or without | |
11 | * modification, are permitted provided that the following conditions | 11 | * modification, are permitted provided that the following conditions | |
12 | * are met: | 12 | * are met: | |
13 | * 1. Redistributions of source code must retain the above copyright | 13 | * 1. Redistributions of source code must retain the above copyright | |
14 | * notice, this list of conditions and the following disclaimer. | 14 | * notice, this list of conditions and the following disclaimer. | |
@@ -38,41 +38,42 @@ | @@ -38,41 +38,42 @@ | |||
38 | * linux_sys_siggetmask : linux_sig_notalpha.c | 38 | * linux_sys_siggetmask : linux_sig_notalpha.c | |
39 | * linux_sys_sigsetmask : linux_sig_notalpha.c | 39 | * linux_sys_sigsetmask : linux_sig_notalpha.c | |
40 | * linux_sys_pause : linux_sig_notalpha.c | 40 | * linux_sys_pause : linux_sig_notalpha.c | |
41 | * linux_sys_sigaction : linux_sigaction.c | 41 | * linux_sys_sigaction : linux_sigaction.c | |
42 | * | 42 | * | |
43 | */ | 43 | */ | |
44 | 44 | |||
45 | /* | 45 | /* | |
46 | * Unimplemented: | 46 | * Unimplemented: | |
47 | * linux_sys_rt_sigtimedwait : sigsuspend w/timeout. | 47 | * linux_sys_rt_sigtimedwait : sigsuspend w/timeout. | |
48 | */ | 48 | */ | |
49 | 49 | |||
50 | #include <sys/cdefs.h> | 50 | #include <sys/cdefs.h> | |
51 | __KERNEL_RCSID(0, "$NetBSD: linux_signal.c,v 1.67 2009/02/18 14:43:22 njoly Exp $"); | 51 | __KERNEL_RCSID(0, "$NetBSD: linux_signal.c,v 1.68 2009/05/29 14:19:13 njoly Exp $"); | |
52 | 52 | |||
53 | #define COMPAT_LINUX 1 | 53 | #define COMPAT_LINUX 1 | |
54 | 54 | |||
55 | #include <sys/param.h> | 55 | #include <sys/param.h> | |
56 | #include <sys/systm.h> | 56 | #include <sys/systm.h> | |
57 | #include <sys/namei.h> | 57 | #include <sys/namei.h> | |
58 | #include <sys/proc.h> | 58 | #include <sys/proc.h> | |
59 | #include <sys/filedesc.h> | 59 | #include <sys/filedesc.h> | |
60 | #include <sys/ioctl.h> | 60 | #include <sys/ioctl.h> | |
61 | #include <sys/mount.h> | 61 | #include <sys/mount.h> | |
62 | #include <sys/kernel.h> | 62 | #include <sys/kernel.h> | |
63 | #include <sys/signal.h> | 63 | #include <sys/signal.h> | |
64 | #include <sys/signalvar.h> | 64 | #include <sys/signalvar.h> | |
65 | #include <sys/malloc.h> | 65 | #include <sys/malloc.h> | |
66 | #include <sys/wait.h> | |||
66 | 67 | |||
67 | #include <sys/syscallargs.h> | 68 | #include <sys/syscallargs.h> | |
68 | 69 | |||
69 | #include <compat/linux/common/linux_types.h> | 70 | #include <compat/linux/common/linux_types.h> | |
70 | #include <compat/linux/common/linux_signal.h> | 71 | #include <compat/linux/common/linux_signal.h> | |
71 | #include <compat/linux/common/linux_exec.h> /* For emul_linux */ | 72 | #include <compat/linux/common/linux_exec.h> /* For emul_linux */ | |
72 | #include <compat/linux/common/linux_machdep.h> /* For LINUX_NPTL */ | 73 | #include <compat/linux/common/linux_machdep.h> /* For LINUX_NPTL */ | |
73 | #include <compat/linux/common/linux_emuldata.h> /* for linux_emuldata */ | 74 | #include <compat/linux/common/linux_emuldata.h> /* for linux_emuldata */ | |
74 | #include <compat/linux/common/linux_siginfo.h> | 75 | #include <compat/linux/common/linux_siginfo.h> | |
75 | #include <compat/linux/common/linux_sigevent.h> | 76 | #include <compat/linux/common/linux_sigevent.h> | |
76 | #include <compat/linux/common/linux_util.h> | 77 | #include <compat/linux/common/linux_util.h> | |
77 | #include <compat/linux/common/linux_ipc.h> | 78 | #include <compat/linux/common/linux_ipc.h> | |
78 | #include <compat/linux/common/linux_sem.h> | 79 | #include <compat/linux/common/linux_sem.h> | |
@@ -676,13 +677,37 @@ linux_sys_tgkill(struct lwp *l, const st | @@ -676,13 +677,37 @@ linux_sys_tgkill(struct lwp *l, const st | |||
676 | int | 677 | int | |
677 | native_to_linux_si_code(int code) | 678 | native_to_linux_si_code(int code) | |
678 | { | 679 | { | |
679 | int si_codes[] = { | 680 | int si_codes[] = { | |
680 | LINUX_SI_USER, LINUX_SI_QUEUE, LINUX_SI_TIMER, LINUX_SI_ASYNCIO, | 681 | LINUX_SI_USER, LINUX_SI_QUEUE, LINUX_SI_TIMER, LINUX_SI_ASYNCIO, | |
681 | LINUX_SI_MESGQ, LINUX_SI_TKILL /* SI_LWP */ | 682 | LINUX_SI_MESGQ, LINUX_SI_TKILL /* SI_LWP */ | |
682 | }; | 683 | }; | |
683 | 684 | |||
684 | if (code <= 0 && -code < __arraycount(si_codes)) | 685 | if (code <= 0 && -code < __arraycount(si_codes)) | |
685 | return si_codes[-code]; | 686 | return si_codes[-code]; | |
686 | 687 | |||
687 | return code; | 688 | return code; | |
688 | } | 689 | } | |
690 | ||||
691 | int | |||
692 | native_to_linux_si_status(int code, int status) | |||
693 | { | |||
694 | int sts; | |||
695 | ||||
696 | switch (code) { | |||
697 | case CLD_CONTINUED: | |||
698 | sts = LINUX_SIGCONT; | |||
699 | break; | |||
700 | case CLD_EXITED: | |||
701 | sts = WEXITSTATUS(status); | |||
702 | break; | |||
703 | case CLD_STOPPED: | |||
704 | case CLD_TRAPPED: | |||
705 | case CLD_DUMPED: | |||
706 | case CLD_KILLED: | |||
707 | default: | |||
708 | sts = native_to_linux_signo[WTERMSIG(status)]; | |||
709 | break; | |||
710 | } | |||
711 | ||||
712 | return sts; | |||
713 | } |
--- src/sys/compat/linux/common/linux_signal.h 2008/10/19 09:44:31 1.29
+++ src/sys/compat/linux/common/linux_signal.h 2009/05/29 14:19:13 1.30
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: linux_signal.h,v 1.29 2008/10/19 09:44:31 njoly Exp $ */ | 1 | /* $NetBSD: linux_signal.h,v 1.30 2009/05/29 14:19:13 njoly Exp $ */ | |
2 | 2 | |||
3 | /*- | 3 | /*- | |
4 | * Copyright (c) 1995, 1998 The NetBSD Foundation, Inc. | 4 | * Copyright (c) 1995, 1998 The NetBSD Foundation, Inc. | |
5 | * All rights reserved. | 5 | * All rights reserved. | |
6 | * | 6 | * | |
7 | * This code is derived from software contributed to The NetBSD Foundation | 7 | * This code is derived from software contributed to The NetBSD Foundation | |
8 | * by Frank van der Linden and Eric Haszlakiewicz. | 8 | * by Frank van der Linden and Eric Haszlakiewicz. | |
9 | * | 9 | * | |
10 | * Redistribution and use in source and binary forms, with or without | 10 | * Redistribution and use in source and binary forms, with or without | |
11 | * modification, are permitted provided that the following conditions | 11 | * modification, are permitted provided that the following conditions | |
12 | * are met: | 12 | * are met: | |
13 | * 1. Redistributions of source code must retain the above copyright | 13 | * 1. Redistributions of source code must retain the above copyright | |
14 | * notice, this list of conditions and the following disclaimer. | 14 | * notice, this list of conditions and the following disclaimer. | |
@@ -83,18 +83,19 @@ void linux_old_to_native_sigaction(struc | @@ -83,18 +83,19 @@ void linux_old_to_native_sigaction(struc | |||
83 | const struct linux_old_sigaction *); | 83 | const struct linux_old_sigaction *); | |
84 | void native_to_linux_old_sigaction(struct linux_old_sigaction *, | 84 | void native_to_linux_old_sigaction(struct linux_old_sigaction *, | |
85 | const struct sigaction *); | 85 | const struct sigaction *); | |
86 | 86 | |||
87 | void linux_to_native_sigaction(struct sigaction *, | 87 | void linux_to_native_sigaction(struct sigaction *, | |
88 | const struct linux_sigaction *); | 88 | const struct linux_sigaction *); | |
89 | void native_to_linux_sigaction(struct linux_sigaction *, | 89 | void native_to_linux_sigaction(struct linux_sigaction *, | |
90 | const struct sigaction *); | 90 | const struct sigaction *); | |
91 | 91 | |||
92 | void native_to_linux_sigaltstack(struct linux_sigaltstack *, | 92 | void native_to_linux_sigaltstack(struct linux_sigaltstack *, | |
93 | const struct sigaltstack *); | 93 | const struct sigaltstack *); | |
94 | 94 | |||
95 | int native_to_linux_si_code(int); | 95 | int native_to_linux_si_code(int); | |
96 | int native_to_linux_si_status(int, int); | |||
96 | 97 | |||
97 | __END_DECLS | 98 | __END_DECLS | |
98 | #endif /* !_KERNEL */ | 99 | #endif /* !_KERNEL */ | |
99 | 100 | |||
100 | #endif /* !_LINUX_SIGNAL_H */ | 101 | #endif /* !_LINUX_SIGNAL_H */ |
--- src/sys/compat/linux32/arch/amd64/linux32_machdep.c 2009/03/15 15:56:50 1.21
+++ src/sys/compat/linux32/arch/amd64/linux32_machdep.c 2009/05/29 14:19:13 1.22
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: linux32_machdep.c,v 1.21 2009/03/15 15:56:50 cegger Exp $ */ | 1 | /* $NetBSD: linux32_machdep.c,v 1.22 2009/05/29 14:19:13 njoly Exp $ */ | |
2 | 2 | |||
3 | /*- | 3 | /*- | |
4 | * Copyright (c) 2006 Emmanuel Dreyfus, all rights reserved. | 4 | * Copyright (c) 2006 Emmanuel Dreyfus, all rights reserved. | |
5 | * | 5 | * | |
6 | * Redistribution and use in source and binary forms, with or without | 6 | * Redistribution and use in source and binary forms, with or without | |
7 | * modification, are permitted provided that the following conditions | 7 | * modification, are permitted provided that the following conditions | |
8 | * are met: | 8 | * are met: | |
9 | * 1. Redistributions of source code must retain the above copyright | 9 | * 1. Redistributions of source code must retain the above copyright | |
10 | * notice, this list of conditions and the following disclaimer. | 10 | * notice, this list of conditions and the following disclaimer. | |
11 | * 2. Redistributions in binary form must reproduce the above copyright | 11 | * 2. Redistributions in binary form must reproduce the above copyright | |
12 | * notice, this list of conditions and the following disclaimer in the | 12 | * notice, this list of conditions and the following disclaimer in the | |
13 | * documentation and/or other materials provided with the distribution. | 13 | * documentation and/or other materials provided with the distribution. | |
14 | * 3. All advertising materials mentioning features or use of this software | 14 | * 3. All advertising materials mentioning features or use of this software | |
@@ -21,52 +21,51 @@ | @@ -21,52 +21,51 @@ | |||
21 | * THIS SOFTWARE IS PROVIDED BY THE THE AUTHOR AND CONTRIBUTORS ``AS IS'' | 21 | * THIS SOFTWARE IS PROVIDED BY THE THE AUTHOR AND CONTRIBUTORS ``AS IS'' | |
22 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, | 22 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, | |
23 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | 23 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | |
24 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS | 24 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS | |
25 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | 25 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | |
26 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | 26 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | |
27 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | 27 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | |
28 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | 28 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | |
29 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | 29 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | |
30 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | 30 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | |
31 | * POSSIBILITY OF SUCH DAMAGE. | 31 | * POSSIBILITY OF SUCH DAMAGE. | |
32 | */ | 32 | */ | |
33 | #include <sys/cdefs.h> | 33 | #include <sys/cdefs.h> | |
34 | __KERNEL_RCSID(0, "$NetBSD: linux32_machdep.c,v 1.21 2009/03/15 15:56:50 cegger Exp $"); | 34 | __KERNEL_RCSID(0, "$NetBSD: linux32_machdep.c,v 1.22 2009/05/29 14:19:13 njoly Exp $"); | |
35 | 35 | |||
36 | #include <sys/param.h> | 36 | #include <sys/param.h> | |
37 | #include <sys/systm.h> | 37 | #include <sys/systm.h> | |
38 | #include <sys/signalvar.h> | 38 | #include <sys/signalvar.h> | |
39 | #include <sys/kernel.h> | 39 | #include <sys/kernel.h> | |
40 | #include <sys/proc.h> | 40 | #include <sys/proc.h> | |
41 | #include <sys/user.h> | 41 | #include <sys/user.h> | |
42 | #include <sys/buf.h> | 42 | #include <sys/buf.h> | |
43 | #include <sys/reboot.h> | 43 | #include <sys/reboot.h> | |
44 | #include <sys/conf.h> | 44 | #include <sys/conf.h> | |
45 | #include <sys/exec.h> | 45 | #include <sys/exec.h> | |
46 | #include <sys/file.h> | 46 | #include <sys/file.h> | |
47 | #include <sys/callout.h> | 47 | #include <sys/callout.h> | |
48 | #include <sys/malloc.h> | 48 | #include <sys/malloc.h> | |
49 | #include <sys/mbuf.h> | 49 | #include <sys/mbuf.h> | |
50 | #include <sys/msgbuf.h> | 50 | #include <sys/msgbuf.h> | |
51 | #include <sys/mount.h> | 51 | #include <sys/mount.h> | |
52 | #include <sys/vnode.h> | 52 | #include <sys/vnode.h> | |
53 | #include <sys/device.h> | 53 | #include <sys/device.h> | |
54 | #include <sys/syscallargs.h> | 54 | #include <sys/syscallargs.h> | |
55 | #include <sys/filedesc.h> | 55 | #include <sys/filedesc.h> | |
56 | #include <sys/exec_elf.h> | 56 | #include <sys/exec_elf.h> | |
57 | #include <sys/disklabel.h> | 57 | #include <sys/disklabel.h> | |
58 | #include <sys/ioctl.h> | 58 | #include <sys/ioctl.h> | |
59 | #include <sys/wait.h> | |||
60 | #include <miscfs/specfs/specdev.h> | 59 | #include <miscfs/specfs/specdev.h> | |
61 | 60 | |||
62 | #include <machine/netbsd32_machdep.h> | 61 | #include <machine/netbsd32_machdep.h> | |
63 | 62 | |||
64 | #include <compat/netbsd32/netbsd32.h> | 63 | #include <compat/netbsd32/netbsd32.h> | |
65 | #include <compat/netbsd32/netbsd32_syscallargs.h> | 64 | #include <compat/netbsd32/netbsd32_syscallargs.h> | |
66 | 65 | |||
67 | #include <compat/linux/common/linux_signal.h> | 66 | #include <compat/linux/common/linux_signal.h> | |
68 | #include <compat/linux/common/linux_errno.h> | 67 | #include <compat/linux/common/linux_errno.h> | |
69 | 68 | |||
70 | #include <compat/linux32/common/linux32_types.h> | 69 | #include <compat/linux32/common/linux32_types.h> | |
71 | #include <compat/linux32/common/linux32_errno.h> | 70 | #include <compat/linux32/common/linux32_errno.h> | |
72 | #include <compat/linux32/common/linux32_machdep.h> | 71 | #include <compat/linux32/common/linux32_machdep.h> | |
@@ -215,31 +214,28 @@ linux32_rt_sendsig(const ksiginfo_t *ksi | @@ -215,31 +214,28 @@ linux32_rt_sendsig(const ksiginfo_t *ksi | |||
215 | switch (lsi->lsi_signo) { | 214 | switch (lsi->lsi_signo) { | |
216 | case LINUX32_SIGILL: | 215 | case LINUX32_SIGILL: | |
217 | case LINUX32_SIGFPE: | 216 | case LINUX32_SIGFPE: | |
218 | case LINUX32_SIGSEGV: | 217 | case LINUX32_SIGSEGV: | |
219 | case LINUX32_SIGBUS: | 218 | case LINUX32_SIGBUS: | |
220 | case LINUX32_SIGTRAP: | 219 | case LINUX32_SIGTRAP: | |
221 | NETBSD32PTR32(lsi->lsi_addr, ksi->ksi_addr); | 220 | NETBSD32PTR32(lsi->lsi_addr, ksi->ksi_addr); | |
222 | break; | 221 | break; | |
223 | case LINUX32_SIGCHLD: | 222 | case LINUX32_SIGCHLD: | |
224 | lsi->lsi_uid = ksi->ksi_uid; | 223 | lsi->lsi_uid = ksi->ksi_uid; | |
225 | lsi->lsi_pid = ksi->ksi_pid; | 224 | lsi->lsi_pid = ksi->ksi_pid; | |
226 | lsi->lsi_utime = ksi->ksi_utime; | 225 | lsi->lsi_utime = ksi->ksi_utime; | |
227 | lsi->lsi_stime = ksi->ksi_stime; | 226 | lsi->lsi_stime = ksi->ksi_stime; | |
228 | 227 | lsi->lsi_status = native_to_linux_si_status(ksi->ksi_code, | ||
229 | /* We use the same codes */ | 228 | ksi->ksi_status); | |
230 | lsi->lsi_code = ksi->ksi_code; | |||
231 | /* XXX is that right? */ | |||
232 | lsi->lsi_status = WEXITSTATUS(ksi->ksi_status); | |||
233 | break; | 229 | break; | |
234 | case LINUX32_SIGIO: | 230 | case LINUX32_SIGIO: | |
235 | lsi->lsi_band = ksi->ksi_band; | 231 | lsi->lsi_band = ksi->ksi_band; | |
236 | lsi->lsi_fd = ksi->ksi_fd; | 232 | lsi->lsi_fd = ksi->ksi_fd; | |
237 | break; | 233 | break; | |
238 | default: | 234 | default: | |
239 | lsi->lsi_uid = ksi->ksi_uid; | 235 | lsi->lsi_uid = ksi->ksi_uid; | |
240 | lsi->lsi_pid = ksi->ksi_pid; | 236 | lsi->lsi_pid = ksi->ksi_pid; | |
241 | if (lsi->lsi_signo == LINUX32_SIGALRM || | 237 | if (lsi->lsi_signo == LINUX32_SIGALRM || | |
242 | lsi->lsi_signo >= LINUX32_SIGRTMIN) | 238 | lsi->lsi_signo >= LINUX32_SIGRTMIN) | |
243 | NETBSD32PTR32(lsi->lsi_value.sival_ptr, | 239 | NETBSD32PTR32(lsi->lsi_value.sival_ptr, | |
244 | ksi->ksi_value.sival_ptr); | 240 | ksi->ksi_value.sival_ptr); | |
245 | break; | 241 | break; |