Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/compat/netbsd32 When converting siginfo, examine si_code...



details:   https://anonhg.NetBSD.org/src/rev/0705738cdfec
branches:  trunk
changeset: 461186:0705738cdfec
user:      rin <rin%NetBSD.org@localhost>
date:      Mon Nov 18 10:25:48 2019 +0000

description:
When converting siginfo, examine si_code at the beginning,
as explained in siginfo(2).

- If it is SI_NOINFO, there's no additional information.
- If it is non-positive, i.e., codes described in siginfo(2),
  we need to fill in _rt.

XXX
Description for SA_ASYNCIO in siginfo(2) seems outdated;
neither si_fd nor si_band are filled in with that code.

XXX
pullup to netbsd-9

diffstat:

 sys/compat/netbsd32/netbsd32_signal.c |  16 ++++++++++++++--
 1 files changed, 14 insertions(+), 2 deletions(-)

diffs (58 lines):

diff -r d073212dd050 -r 0705738cdfec sys/compat/netbsd32/netbsd32_signal.c
--- a/sys/compat/netbsd32/netbsd32_signal.c     Mon Nov 18 10:14:52 2019 +0000
+++ b/sys/compat/netbsd32/netbsd32_signal.c     Mon Nov 18 10:25:48 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: netbsd32_signal.c,v 1.48 2019/11/18 10:14:52 rin Exp $ */
+/*     $NetBSD: netbsd32_signal.c,v 1.49 2019/11/18 10:25:48 rin Exp $ */
 
 /*
  * Copyright (c) 1998, 2001 Matthew R. Green
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_signal.c,v 1.48 2019/11/18 10:14:52 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_signal.c,v 1.49 2019/11/18 10:25:48 rin Exp $");
 
 #if defined(_KERNEL_OPT) 
 #include "opt_ktrace.h"
@@ -195,6 +195,11 @@
        si->_code = si32->_code;
        si->_errno = si32->_errno;
 
+       if (si32->_code == SI_NOINFO)
+               return;
+       else if (si32->_code <= 0)      /* codes described in siginfo(2) */
+               goto fill_rt;
+
        switch (si32->_signo) {
        case SIGILL:
        case SIGFPE:
@@ -240,6 +245,7 @@
        case SIGVTALRM:
        case SIGPROF:
        default:        /* see sigqueue() and kill1() */
+fill_rt:
                si->_reason._rt._pid = si32->_reason._rt._pid;
                si->_reason._rt._uid = si32->_reason._rt._uid;
                si->_reason._rt._value.sival_int =
@@ -278,6 +284,11 @@
        si32->_code = si->_code;
        si32->_errno = si->_errno;
 
+       if (si->_code == SI_NOINFO)
+               return;
+       else if (si->_code <= 0)        /* codes described in siginfo(2) */
+               goto fill_rt;
+
        switch (si->_signo) {
        case SIGILL:
        case SIGFPE:
@@ -323,6 +334,7 @@
        case SIGVTALRM:
        case SIGPROF:
        default:        /* see sigqueue() and kill1() */
+fill_rt:
                si32->_reason._rt._pid = si->_reason._rt._pid;
                si32->_reason._rt._uid = si->_reason._rt._uid;
                si32->_reason._rt._value.sival_int =



Home | Main Index | Thread Index | Old Index