| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: svr4_32_signal.c,v 1.26.40.1 2017/08/19 03:40:50 snj Exp $ */ | | 1 | /* $NetBSD: svr4_32_signal.c,v 1.26.40.2 2017/08/19 04:02:49 snj Exp $ */ |
2 | | | 2 | |
3 | /*- | | 3 | /*- |
4 | * Copyright (c) 1994, 1998 The NetBSD Foundation, Inc. | | 4 | * Copyright (c) 1994, 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 Christos Zoulas and by Charles M. Hannum. | | 8 | * by Christos Zoulas and by Charles M. Hannum. |
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: svr4_32_signal.c,v 1.26.40.1 2017/08/19 03:40:50 snj Exp $"); | | 33 | __KERNEL_RCSID(0, "$NetBSD: svr4_32_signal.c,v 1.26.40.2 2017/08/19 04:02:49 snj Exp $"); |
34 | | | 34 | |
35 | #if defined(_KERNEL_OPT) | | 35 | #if defined(_KERNEL_OPT) |
36 | #include "opt_compat_svr4.h" | | 36 | #include "opt_compat_svr4.h" |
37 | #endif | | 37 | #endif |
38 | | | 38 | |
39 | #include <sys/param.h> | | 39 | #include <sys/param.h> |
40 | #include <sys/systm.h> | | 40 | #include <sys/systm.h> |
41 | #include <sys/namei.h> | | 41 | #include <sys/namei.h> |
42 | #include <sys/proc.h> | | 42 | #include <sys/proc.h> |
43 | #include <sys/filedesc.h> | | 43 | #include <sys/filedesc.h> |
44 | #include <sys/ioctl.h> | | 44 | #include <sys/ioctl.h> |
45 | #include <sys/mount.h> | | 45 | #include <sys/mount.h> |
46 | #include <sys/kernel.h> | | 46 | #include <sys/kernel.h> |
| @@ -387,64 +387,64 @@ svr4_32_sys_signal(struct lwp *l, const | | | @@ -387,64 +387,64 @@ svr4_32_sys_signal(struct lwp *l, const |
387 | if (error) | | 387 | if (error) |
388 | return error; | | 388 | return error; |
389 | | | 389 | |
390 | switch (sigcall) { | | 390 | switch (sigcall) { |
391 | case SVR4_SIGDEFER_MASK: | | 391 | case SVR4_SIGDEFER_MASK: |
392 | if (SCARG(uap, handler) == SVR4_SIG_HOLD) | | 392 | if (SCARG(uap, handler) == SVR4_SIG_HOLD) |
393 | goto sighold; | | 393 | goto sighold; |
394 | /* FALLTHROUGH */ | | 394 | /* FALLTHROUGH */ |
395 | | | 395 | |
396 | case SVR4_SIGNAL_MASK: | | 396 | case SVR4_SIGNAL_MASK: |
397 | nbsa.sa_handler = (sig_t)SCARG(uap, handler); | | 397 | nbsa.sa_handler = (sig_t)SCARG(uap, handler); |
398 | sigemptyset(&nbsa.sa_mask); | | 398 | sigemptyset(&nbsa.sa_mask); |
399 | nbsa.sa_flags = 0; | | 399 | nbsa.sa_flags = 0; |
400 | error = sigaction1(l, signum, &nbsa, &obsa, NULL, 0); | | 400 | error = sigaction1(l, native_signo, &nbsa, &obsa, NULL, 0); |
401 | if (error) | | 401 | if (error) |
402 | return (error); | | 402 | return error; |
403 | *retval = (u_int)(u_long)obsa.sa_handler; | | 403 | *retval = (u_int)(u_long)obsa.sa_handler; |
404 | return (0); | | 404 | return 0; |
405 | | | 405 | |
406 | case SVR4_SIGHOLD_MASK: | | 406 | case SVR4_SIGHOLD_MASK: |
407 | sighold: | | 407 | sighold: |
408 | sigemptyset(&ss); | | 408 | sigemptyset(&ss); |
409 | sigaddset(&ss, signum); | | 409 | sigaddset(&ss, native_signo); |
410 | mutex_enter(p->p_lock); | | 410 | mutex_enter(p->p_lock); |
411 | error = sigprocmask1(l, SIG_BLOCK, &ss, 0); | | 411 | error = sigprocmask1(l, SIG_BLOCK, &ss, 0); |
412 | mutex_exit(p->p_lock); | | 412 | mutex_exit(p->p_lock); |
413 | return error; | | 413 | return error; |
414 | | | 414 | |
415 | case SVR4_SIGRELSE_MASK: | | 415 | case SVR4_SIGRELSE_MASK: |
416 | sigemptyset(&ss); | | 416 | sigemptyset(&ss); |
417 | sigaddset(&ss, signum); | | 417 | sigaddset(&ss, native_signo); |
418 | mutex_enter(p->p_lock); | | 418 | mutex_enter(p->p_lock); |
419 | error = sigprocmask1(l, SIG_UNBLOCK, &ss, 0); | | 419 | error = sigprocmask1(l, SIG_UNBLOCK, &ss, 0); |
420 | mutex_exit(p->p_lock); | | 420 | mutex_exit(p->p_lock); |
421 | return error; | | 421 | return error; |
422 | | | 422 | |
423 | case SVR4_SIGIGNORE_MASK: | | 423 | case SVR4_SIGIGNORE_MASK: |
424 | nbsa.sa_handler = SIG_IGN; | | 424 | nbsa.sa_handler = SIG_IGN; |
425 | sigemptyset(&nbsa.sa_mask); | | 425 | sigemptyset(&nbsa.sa_mask); |
426 | nbsa.sa_flags = 0; | | 426 | nbsa.sa_flags = 0; |
427 | return (sigaction1(l, signum, &nbsa, 0, NULL, 0)); | | 427 | return sigaction1(l, native_signo, &nbsa, 0, NULL, 0); |
428 | | | 428 | |
429 | case SVR4_SIGPAUSE_MASK: | | 429 | case SVR4_SIGPAUSE_MASK: |
430 | mutex_enter(p->p_lock); | | 430 | mutex_enter(p->p_lock); |
431 | ss = l->l_sigmask; | | 431 | ss = l->l_sigmask; |
432 | mutex_exit(p->p_lock); | | 432 | mutex_exit(p->p_lock); |
433 | sigdelset(&ss, signum); | | 433 | sigdelset(&ss, native_signo); |
434 | return (sigsuspend1(l, &ss)); | | 434 | return sigsuspend1(l, &ss); |
435 | | | 435 | |
436 | default: | | 436 | default: |
437 | return (ENOSYS); | | 437 | return ENOSYS; |
438 | } | | 438 | } |
439 | } | | 439 | } |
440 | | | 440 | |
441 | int | | 441 | int |
442 | svr4_32_sys_sigprocmask(struct lwp *l, const struct svr4_32_sys_sigprocmask_args *uap, register_t *retval) | | 442 | svr4_32_sys_sigprocmask(struct lwp *l, const struct svr4_32_sys_sigprocmask_args *uap, register_t *retval) |
443 | { | | 443 | { |
444 | /* { | | 444 | /* { |
445 | syscallarg(int) how; | | 445 | syscallarg(int) how; |
446 | syscallarg(const svr4_32_sigset_t *) set; | | 446 | syscallarg(const svr4_32_sigset_t *) set; |
447 | syscallarg(svr4_32_sigset_t *) oset; | | 447 | syscallarg(svr4_32_sigset_t *) oset; |
448 | } */ | | 448 | } */ |
449 | struct proc *p = l->l_proc; | | 449 | struct proc *p = l->l_proc; |
450 | svr4_32_sigset_t nsss, osss; | | 450 | svr4_32_sigset_t nsss, osss; |