From owner-svn-src-all@freebsd.org Wed Jul 27 03:21:03 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C8F5BBA64C3; Wed, 27 Jul 2016 03:21:03 +0000 (UTC) (envelope-from stevek@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8A7521871; Wed, 27 Jul 2016 03:21:03 +0000 (UTC) (envelope-from stevek@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6R3L2j2001225; Wed, 27 Jul 2016 03:21:02 GMT (envelope-from stevek@FreeBSD.org) Received: (from stevek@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6R3L2AE001222; Wed, 27 Jul 2016 03:21:02 GMT (envelope-from stevek@FreeBSD.org) Message-Id: <201607270321.u6R3L2AE001222@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: stevek set sender to stevek@FreeBSD.org using -f From: "Stephen J. Kiernan" Date: Wed, 27 Jul 2016 03:21:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303355 - in head/sys: conf kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 Jul 2016 03:21:03 -0000 Author: stevek Date: Wed Jul 27 03:21:02 2016 New Revision: 303355 URL: https://svnweb.freebsd.org/changeset/base/303355 Log: Add the NUM_CORE_FILES kernel config option which specifies the limit for the number of core files allowed by a particular process when using the %I core file name pattern. Sanity check at compile time to ensure the value is within the valid range of 0-10. Reviewed by: jtl, sjg Approved by: sjg (mentor) Sponsored by: Juniper Networks, Inc. Differential Revision: https://reviews.freebsd.org/D6812 Modified: head/sys/conf/NOTES head/sys/conf/options head/sys/kern/kern_sig.c Modified: head/sys/conf/NOTES ============================================================================== --- head/sys/conf/NOTES Wed Jul 27 00:46:48 2016 (r303354) +++ head/sys/conf/NOTES Wed Jul 27 03:21:02 2016 (r303355) @@ -578,6 +578,17 @@ options COMPILING_LINT # options STACK +# +# The NUM_CORE_FILES option specifies the limit for the number of core +# files generated by a particular process, when the core file format +# specifier includes the %I pattern. Since we only have 1 character for +# the core count in the format string, meaning the range will be 0-9, the +# maximum value allowed for this option is 10. +# This core file limit can be adjusted at runtime via the debug.ncores +# sysctl. +# +options NUM_CORE_FILES=5 + ##################################################################### # PERFORMANCE MONITORING OPTIONS Modified: head/sys/conf/options ============================================================================== --- head/sys/conf/options Wed Jul 27 00:46:48 2016 (r303354) +++ head/sys/conf/options Wed Jul 27 03:21:02 2016 (r303355) @@ -65,6 +65,7 @@ SYSCTL_DEBUG opt_sysctl.h EARLY_PRINTF opt_global.h TEXTDUMP_PREFERRED opt_ddb.h TEXTDUMP_VERBOSE opt_ddb.h +NUM_CORE_FILES opt_global.h # Miscellaneous options. ADAPTIVE_LOCKMGRS Modified: head/sys/kern/kern_sig.c ============================================================================== --- head/sys/kern/kern_sig.c Wed Jul 27 00:46:48 2016 (r303354) +++ head/sys/kern/kern_sig.c Wed Jul 27 03:21:02 2016 (r303355) @@ -3142,8 +3142,12 @@ childproc_exited(struct proc *p) * We only have 1 character for the core count in the format * string, so the range will be 0-9 */ -#define MAX_NUM_CORES 10 -static int num_cores = 5; +#define MAX_NUM_CORE_FILES 10 +#ifndef NUM_CORE_FILES +#define NUM_CORE_FILES 5 +#endif +CTASSERT(NUM_CORE_FILES >= 0 && NUM_CORE_FILES <= MAX_NUM_CORE_FILES); +static int num_cores = NUM_CORE_FILES; static int sysctl_debug_num_cores_check (SYSCTL_HANDLER_ARGS) @@ -3155,8 +3159,8 @@ sysctl_debug_num_cores_check (SYSCTL_HAN error = sysctl_handle_int(oidp, &new_val, 0, req); if (error != 0 || req->newptr == NULL) return (error); - if (new_val > MAX_NUM_CORES) - new_val = MAX_NUM_CORES; + if (new_val > MAX_NUM_CORE_FILES) + new_val = MAX_NUM_CORE_FILES; if (new_val < 0) new_val = 0; num_cores = new_val;