summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjoerg <joerg@FreeBSD.org>1998-07-28 22:34:12 +0000
committerjoerg <joerg@FreeBSD.org>1998-07-28 22:34:12 +0000
commitd4df58a7bc400f4d07b99cf44dd6e94c8b806de3 (patch)
tree6088ed045ba2a5c866190fb3bee8be91354e420b
parent8e80b10039c926b9b0961173cb71c0c05a8dd136 (diff)
downloadFreeBSD-src-d4df58a7bc400f4d07b99cf44dd6e94c8b806de3.zip
FreeBSD-src-d4df58a7bc400f4d07b99cf44dd6e94c8b806de3.tar.gz
Make the logging of abnormally exiting processes optional by a sysctl.
PR: kern/1711 Submitted by: Nick Sayer <nsayer@kfu.com>
-rw-r--r--sys/kern/kern_sig.c17
-rw-r--r--sys/sys/sysctl.h6
2 files changed, 15 insertions, 8 deletions
diff --git a/sys/kern/kern_sig.c b/sys/kern/kern_sig.c
index 403b45e..f3dadae 100644
--- a/sys/kern/kern_sig.c
+++ b/sys/kern/kern_sig.c
@@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)kern_sig.c 8.7 (Berkeley) 4/18/94
- * $Id: kern_sig.c,v 1.43 1998/07/08 06:38:39 sef Exp $
+ * $Id: kern_sig.c,v 1.44 1998/07/15 02:32:09 bde Exp $
*/
#include "opt_compat.h"
@@ -82,6 +82,9 @@ static void setsigvec __P((struct proc *p, int signum, struct sigaction *sa));
static void stop __P((struct proc *));
static char *expand_name __P((const char*, int, int));
+static int kern_logsigexit = 1;
+SYSCTL_INT(_kern, KERN_LOGSIGEXIT, logsigexit, CTLFLAG_RW, &kern_logsigexit, 0, "");
+
/*
* Can process p, with pcred pc, send the signal signum to process q?
*/
@@ -1238,11 +1241,13 @@ sigexit(p, signum)
*/
if (coredump(p) == 0)
signum |= WCOREFLAG;
- log(LOG_INFO, "pid %d (%s), uid %d: exited on signal %d%s\n",
- p->p_pid, p->p_comm,
- p->p_cred && p->p_ucred ? p->p_ucred->cr_uid : -1,
- signum &~ WCOREFLAG,
- signum & WCOREFLAG ? " (core dumped)" : "");
+ if (kern_logsigexit)
+ log(LOG_INFO,
+ "pid %d (%s), uid %d: exited on signal %d%s\n",
+ p->p_pid, p->p_comm,
+ p->p_cred && p->p_ucred ? p->p_ucred->cr_uid : -1,
+ signum &~ WCOREFLAG,
+ signum & WCOREFLAG ? " (core dumped)" : "");
}
exit1(p, W_EXITCODE(0, signum));
/* NOTREACHED */
diff --git a/sys/sys/sysctl.h b/sys/sys/sysctl.h
index 50cd3bd..90cb92c 100644
--- a/sys/sys/sysctl.h
+++ b/sys/sys/sysctl.h
@@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* @(#)sysctl.h 8.1 (Berkeley) 6/2/93
- * $Id: sysctl.h,v 1.59 1998/03/28 11:50:55 dufault Exp $
+ * $Id: sysctl.h,v 1.60 1998/04/24 04:15:52 dg Exp $
*/
#ifndef _SYS_SYSCTL_H_
@@ -234,7 +234,8 @@ int sysctl_handle_opaque SYSCTL_HANDLER_ARGS;
#define KERN_DUMMY 31 /* unused */
#define KERN_PS_STRINGS 32 /* int: address of PS_STRINGS */
#define KERN_USRSTACK 33 /* int: address of USRSTACK */
-#define KERN_MAXID 34 /* number of valid kern ids */
+#define KERN_LOGSIGEXIT 34 /* int: do we log sigexit procs? */
+#define KERN_MAXID 35 /* number of valid kern ids */
#define CTL_KERN_NAMES { \
{ 0, 0 }, \
@@ -271,6 +272,7 @@ int sysctl_handle_opaque SYSCTL_HANDLER_ARGS;
{ "dummy", CTLTYPE_INT }, \
{ "ps_strings", CTLTYPE_INT }, \
{ "usrstack", CTLTYPE_INT }, \
+ { "logsigexit", CTLTYPE_INT }, \
}
/*
OpenPOWER on IntegriCloud