From owner-freebsd-hackers@FreeBSD.ORG Thu Sep 18 16:52:26 2003 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id C28E216A4B3 for ; Thu, 18 Sep 2003 16:52:26 -0700 (PDT) Received: from webmail.tiscali.de (relay1.tiscali.de [62.26.116.129]) by mx1.FreeBSD.org (Postfix) with ESMTP id 6136143FB1 for ; Thu, 18 Sep 2003 16:52:25 -0700 (PDT) (envelope-from walter@pelissero.de) Received: from daemon.home.loc (62.246.27.227) by webmail.tiscali.de (6.7.019) id 3F59F638004CD156 for hackers@freebsd.org; Fri, 19 Sep 2003 01:52:24 +0200 Received: from hyde.home.loc (hyde.home.loc [10.0.0.2]) by daemon.home.loc (8.12.9/8.12.8) with ESMTP id h8INpXH3000753 for ; Fri, 19 Sep 2003 01:51:33 +0200 (CEST) (envelope-from wcp@hyde.home.loc) Received: from hyde.home.loc (localhost [127.0.0.1]) by hyde.home.loc (8.12.9/8.12.8) with ESMTP id h8INpVFt005283 for ; Fri, 19 Sep 2003 01:51:32 +0200 (CEST) (envelope-from wcp@hyde.home.loc) Received: (from wcp@localhost) by hyde.home.loc (8.12.9/8.12.6/Submit) id h8INpTwT005280; Fri, 19 Sep 2003 01:51:30 +0200 (CEST) (envelope-from wcp) From: "Walter C. Pelissero" MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <16234.17662.6641.911050@hyde.home.loc> Date: Fri, 19 Sep 2003 01:51:25 +0200 To: hackers@freebsd.org X-Mailer: VM 7.16 under Emacs 21.3.50.2 X-Attribution: WP Subject: don't dump core dumps X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: walter@pelissero.de List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Sep 2003 23:52:26 -0000 I don't know if this a widespread opinion, but I believe that saving core files in backup tapes is a waste of time and space, often a big waste. Consider that Emacs itself can fill hundred of megs of disk space with just one core dump, that if you don't bother to debug, it will likely sit there for months before getting noticed and deleted straight away. Forbidding the creation of core files by means such as "sysctl kern.coredump=0" or "limits -c 0 big-fat-program", is not an option, because most of the times I do like to have a peek in those core files. My idea was to create core files with a NODUMP flag. A patch like the following would do the trick: diff -c /.amd_mnt/daemon/host/usr/warehouse/src/sys/kern/kern_sig.c /usr/home/wcp/tmp/buffer-content-51635BT *** /.amd_mnt/daemon/host/usr/warehouse/src/sys/kern/kern_sig.c Mon May 19 16:41:42 2003 --- /usr/home/wcp/tmp/buffer-content-51635BT Fri Sep 19 01:20:20 2003 *************** *** 119,124 **** --- 119,128 ---- SYSCTL_INT(_kern, OID_AUTO, coredump, CTLFLAG_RW, &do_coredump, 0, "Enable/Disable coredumps"); + static int set_coredump_nodump_flag = 1; + SYSCTL_INT(_kern, OID_AUTO, coredump, CTLFLAG_RW, + &set_coredump_nodump_flag, 0, "Enable/Disable setting of NODUMP flag on coredump files"); + /* * Signal properties and actions. * The array below categorizes the signals and their default actions *************** *** 1655,1660 **** --- 1659,1666 ---- VATTR_NULL(&vattr); vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, p); vattr.va_size = 0; + if (set_coredump_nodump_flag) + vattr.va_flags |= UF_NODUMP; VOP_LEASE(vp, p, cred, LEASE_WRITE); VOP_SETATTR(vp, &vattr, cred, p); p->p_acflag |= ACORE; Before someone comes up with this: no, excluding files ending in .core from backups is not an option either. Dump(8) doesn't have this option and not all files ending in .core are core dumps (see the CMUCL image). Cheers, -- walter pelissero http://www.pelissero.de