Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 18 Mar 1997 10:30:02 -0800 (PST)
From:      nsayer@quack.kfu.com
To:        freebsd-bugs
Subject:   Re: kern/1711: kernel logging of signaled processes should be optional
Message-ID:  <199703181830.KAA16249@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help
The following reply was made to PR kern/1711; it has been noted by GNATS.

From: nsayer@quack.kfu.com
To: freebsd-gnats-submit@freebsd.org
Cc:  Subject: Re: kern/1711: kernel logging of signaled processes should be optional
Date: Tue, 18 Mar 1997 10:20:52 -0800 (PST)

 Ok, then here is the sysctl version of the same fix. It is not yet
 present in 2.2-RELEASE, and this patch does require some
 fuzz to apply, but it does apply and work:
 
 *** kern/kern_sig.c.orig	Tue Jul  9 11:12:37 1996
 --- kern/kern_sig.c	Thu Oct  3 16:40:32 1996
 ***************
 *** 61,66 ****
 --- 61,67 ----
   #include <sys/syslog.h>
   #include <sys/stat.h>
   #include <sys/sysent.h>
 + #include <sys/sysctl.h>
   
   #include <machine/cpu.h>
   
 ***************
 *** 1188,1193 ****
 --- 1189,1196 ----
    * If dumping core, save the signal number for the debugger.  Calls exit and
    * does not return.
    */
 + int kern_logsigexit=1;
 + 
   void
   sigexit(p, signum)
   	register struct proc *p;
 ***************
 *** 1205,1219 ****
   		 */
   		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)" : "");
   	}
   	exit1(p, W_EXITCODE(0, signum));
   	/* NOTREACHED */
   }
   
   /*
    * Dump core, into a file named "progname.core", unless the process was
 --- 1208,1225 ----
   		 */
   		if (coredump(p) == 0)
   			signum |= WCOREFLAG;
 ! 		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 */
   }
 +  
 + SYSCTL_INT(_kern, KERN_LOGSIGEXIT, logsigexit, CTLFLAG_RW, &kern_logsigexit, 0, "");
   
   /*
    * Dump core, into a file named "progname.core", unless the process was
 *** sys/sysctl.h.orig	Thu Jul 25 11:02:14 1996
 --- sys/sysctl.h	Thu Oct  3 16:20:40 1996
 ***************
 *** 223,229 ****
   #define	KERN_MAXSOCKBUF		31	/* int: max size of a socket buffer */
   #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 CTL_KERN_NAMES { \
   	{ 0, 0 }, \
 --- 223,230 ----
   #define	KERN_MAXSOCKBUF		31	/* int: max size of a socket buffer */
   #define	KERN_PS_STRINGS		32	/* int: address of PS_STRINGS */
   #define	KERN_USRSTACK		33	/* int: address of USRSTACK */
 ! #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 }, \
 ***************
 *** 260,265 ****
 --- 261,267 ----
   	{ "maxsockbuf", CTLTYPE_INT }, \
   	{ "ps_strings", CTLTYPE_INT }, \
   	{ "usrstack", CTLTYPE_INT }, \
 + 	{ "logsigexit", CTLTYPE_INT }, \
   }
   
   /*



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199703181830.KAA16249>