mirror of
https://git.FreeBSD.org/src.git
synced 2025-01-19 15:33:56 +00:00
Make the logging of abnormally exiting processes optional by a sysctl.
PR: kern/1711 Submitted by: Nick Sayer <nsayer@kfu.com>
This commit is contained in:
parent
79dea028fd
commit
57308494ec
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=37931
@ -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 */
|
||||
|
@ -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 }, \
|
||||
}
|
||||
|
||||
/*
|
||||
|
Loading…
Reference in New Issue
Block a user