Module Name:    src
Committed By:   riz
Date:           Tue Oct  9 23:06:13 UTC 2012

Modified Files:
        src/sys/arch/powerpc/powerpc [netbsd-6]: trap.c

Log Message:
sys/arch/powerpc/powerpc/trap.c                 patch

        Silence trap printfs caused by OpenSSL.
        [christos, ticket #589]


To generate a diff of this commit:
cvs rdiff -u -r1.145 -r1.145.8.1 src/sys/arch/powerpc/powerpc/trap.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/powerpc/powerpc/trap.c
diff -u src/sys/arch/powerpc/powerpc/trap.c:1.145 src/sys/arch/powerpc/powerpc/trap.c:1.145.8.1
--- src/sys/arch/powerpc/powerpc/trap.c:1.145	Tue Sep 27 01:02:36 2011
+++ src/sys/arch/powerpc/powerpc/trap.c	Tue Oct  9 23:06:13 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: trap.c,v 1.145 2011/09/27 01:02:36 jym Exp $	*/
+/*	$NetBSD: trap.c,v 1.145.8.1 2012/10/09 23:06:13 riz Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996 Wolfgang Solfrank.
@@ -32,7 +32,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.145 2011/09/27 01:02:36 jym Exp $");
+__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.145.8.1 2012/10/09 23:06:13 riz Exp $");
 
 #include "opt_altivec.h"
 #include "opt_ddb.h"
@@ -258,7 +258,9 @@ trap(struct trapframe *tf)
 			break;
 		}
 		ci->ci_ev_udsi_fatal.ev_count++;
-		if (cpu_printfataltraps) {
+		if (cpu_printfataltraps
+		    && (p->p_slflag & PSL_TRACED) == 0
+		    && !sigismember(&p->p_sigctx.ps_sigcatch, SIGSEGV)) {
 			printf("trap: pid %d.%d (%s): user %s DSI trap @ %#lx "
 			    "by %#lx (DSISR %#x, err=%d)\n",
 			    p->p_pid, l->l_lid, p->p_comm,
@@ -325,7 +327,9 @@ trap(struct trapframe *tf)
 			break;
 		}
 		ci->ci_ev_isi_fatal.ev_count++;
-		if (cpu_printfataltraps) {
+		if (cpu_printfataltraps
+		    && (p->p_slflag & PSL_TRACED) == 0
+		    && !sigismember(&p->p_sigctx.ps_sigcatch, SIGSEGV)) {
 			printf("trap: pid %d.%d (%s): user ISI trap @ %#lx "
 			    "(SRR1=%#lx)\n", p->p_pid, l->l_lid, p->p_comm,
 			    tf->tf_srr0, tf->tf_srr1);
@@ -352,7 +356,9 @@ trap(struct trapframe *tf)
 		ci->ci_ev_ali.ev_count++;
 		if (fix_unaligned(l, tf) != 0) {
 			ci->ci_ev_ali_fatal.ev_count++;
-			if (cpu_printfataltraps) {
+			if (cpu_printfataltraps
+			    && (p->p_slflag & PSL_TRACED) == 0
+			    && !sigismember(&p->p_sigctx.ps_sigcatch, SIGBUS)) {
 				printf("trap: pid %d.%d (%s): user ALI trap @ "
 				    "%#lx by %#lx (DSISR %#x)\n",
 				    p->p_pid, l->l_lid, p->p_comm,
@@ -376,7 +382,9 @@ trap(struct trapframe *tf)
 		vec_load();
 		break;
 #else
-		if (cpu_printfataltraps) {
+		if (cpu_printfataltraps
+		    && (p->p_slflag & PSL_TRACED) == 0
+		    && !sigismember(&p->p_sigctx.ps_sigcatch, SIGILL)) {
 			printf("trap: pid %d.%d (%s): user VEC trap @ %#lx "
 			    "(SRR1=%#lx)\n",
 			    p->p_pid, l->l_lid, p->p_comm,
@@ -392,7 +400,9 @@ trap(struct trapframe *tf)
 #endif
 	case EXC_MCHK|EXC_USER:
 		ci->ci_ev_umchk.ev_count++;
-		if (cpu_printfataltraps) {
+		if (cpu_printfataltraps
+		    && (p->p_slflag & PSL_TRACED) == 0
+		    && !sigismember(&p->p_sigctx.ps_sigcatch, SIGBUS)) {
 			printf("trap: pid %d (%s): user MCHK trap @ %#lx "
 			    "(SRR1=%#lx)\n",
 			    p->p_pid, p->p_comm, tf->tf_srr0, tf->tf_srr1);
@@ -436,10 +446,14 @@ trap(struct trapframe *tf)
 				ksi.ksi_code = ILL_PRVOPC;
 			} else
 				ksi.ksi_code = ILL_ILLOPC;
-			if (cpu_printfataltraps)
+			if (cpu_printfataltraps
+			    && (p->p_slflag & PSL_TRACED) == 0
+			    && !sigismember(&p->p_sigctx.ps_sigcatch,
+				    ksi.ksi_signo)) {
 				printf("trap: pid %d.%d (%s): user PGM trap @"
 				    " %#lx (SRR1=%#lx)\n", p->p_pid, l->l_lid,
 				    p->p_comm, tf->tf_srr0, tf->tf_srr1);
+			}
 			(*p->p_emul->e_trapsignal)(l, &ksi);
 		}
 		break;

Reply via email to