Source-Changes-HG archive

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

[src/trunk]: src/tests/lib/libc/sys If we have SYSVMSG in kernel (test finds ...



details:   https://anonhg.NetBSD.org/src/rev/7be8cd67263f
branches:  trunk
changeset: 826956:7be8cd67263f
user:      kre <kre%NetBSD.org@localhost>
date:      Sat Oct 07 17:15:44 2017 +0000

description:
If we have SYSVMSG in kernel (test finds it) restore the signal handler
to its previous state, so any signals that occur during the rest of the
test gat handled just as they would (core dump) as if the handler was never
executed.   No need to bother if the SYSVMSG test fails, as in that case,
nothing else will be done anyway.

diffstat:

 tests/lib/libc/sys/t_msgctl.c |  8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diffs (36 lines):

diff -r 498fc261e112 -r 7be8cd67263f tests/lib/libc/sys/t_msgctl.c
--- a/tests/lib/libc/sys/t_msgctl.c     Sat Oct 07 17:03:49 2017 +0000
+++ b/tests/lib/libc/sys/t_msgctl.c     Sat Oct 07 17:15:44 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: t_msgctl.c,v 1.6 2017/10/06 17:00:28 kre Exp $ */
+/* $NetBSD: t_msgctl.c,v 1.7 2017/10/07 17:15:44 kre Exp $ */
 
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: t_msgctl.c,v 1.6 2017/10/06 17:00:28 kre Exp $");
+__RCSID("$NetBSD: t_msgctl.c,v 1.7 2017/10/07 17:15:44 kre Exp $");
 
 #include <sys/msg.h>
 #include <sys/stat.h>
@@ -360,14 +360,16 @@
 no_kernel_sysvmsg(void)
 {
        int id;
+       void (*osig)(int);
 
        sig_caught = 0;
-       (void) signal(SIGSYS, sigsys_handler);
+       osig = signal(SIGSYS, sigsys_handler);
        id = msgget(MSG_KEY, IPC_CREAT | 0600);
        if (sig_caught || id == -1)
                return 1;
 
        (void)msgctl(id, IPC_RMID, 0);
+       (void)signal(SIGSYS, osig);
 
        return 0;
 }



Home | Main Index | Thread Index | Old Index