Return to BSD News archive
Newsgroups: comp.os.386bsd.misc Path: sserve!newshost.anu.edu.au!munnari.oz.au!spool.mu.edu!howland.reston.ans.net!xlink.net!smurf.sub.org!flatlin!pilhuhn!hwr From: hwr@pilhuhn.sub.org (Heiko W.Rupp) Subject: [386bsd] Patch to have cores dumped in /cores Date: Thu, 1 Jul 1993 08:08:50 GMT Organization: The home of the Pilhuhn Message-ID: <C9H7yq.AIG@pilhuhn.sub.org> Lines: 58 This is a little patch to have core dumps be dumped in /cores instead of the current working directory. The advantage of this over leaving core dumps in the cwd is that they are easy to find an remove. If /cores does not exist, no core dumps are made. It works for me on 386bsd with the very first pathckit, but should equally work with 386bsd0.2.4 and NetBSD. kern_sig.c can be found under kern/ in the kernel-sources. *** kern_sig.c.orig Thu Jun 11 22:37:29 1992 --- kern_sig.c Wed Jun 30 16:25:03 1993 *************** *** 1004,1011 **** /* * Create a core dump. ! * The file name is "core.progname". * Core dumps are not created if the process is setuid. */ coredump(p) register struct proc *p; --- 1004,1012 ---- /* * Create a core dump. ! * The file name is "core.pid". * Core dumps are not created if the process is setuid. + * or if /cores does not exist. */ coredump(p) register struct proc *p; *************** *** 1025,1031 **** if (ctob(UPAGES + vm->vm_dsize + vm->vm_ssize) >= p->p_rlimit[RLIMIT_CORE].rlim_cur) return (EFAULT); ! sprintf(name, "core.%s", p->p_comm); nd.ni_dirp = name; nd.ni_segflg = UIO_SYSSPACE; if (error = vn_open(&nd, p, O_CREAT|FWRITE, 0644)) --- 1026,1034 ---- if (ctob(UPAGES + vm->vm_dsize + vm->vm_ssize) >= p->p_rlimit[RLIMIT_CORE].rlim_cur) return (EFAULT); ! /* save coredumps in /cores */ ! /* format is core.pid -hwr */ ! sprintf(name, "/cores/core.%u", p->p_pid); nd.ni_dirp = name; nd.ni_segflg = UIO_SYSSPACE; if (error = vn_open(&nd, p, O_CREAT|FWRITE, 0644)) -- Heiko W.Rupp Gerwigstr.5 D-76131 Karlsruhe +49 721 693642 "*However*, one thing on the Net is certain: there is someone willing to argue about any point." -- I don't know but I'll dispute any attribution