1.\" Copyright (c) 1980, 1991 The Regents of the University of California. 2.\" All rights reserved. 3.\" 4.\" Redistribution and use in source and binary forms, with or without 5.\" modification, are permitted provided that the following conditions 6.\" are met: 7.\" 1. Redistributions of source code must retain the above copyright 8.\" notice, this list of conditions and the following disclaimer. 9.\" 2. Redistributions in binary form must reproduce the above copyright 10.\" notice, this list of conditions and the following disclaimer in the 11.\" documentation and/or other materials provided with the distribution. 12.\" 3. All advertising materials mentioning features or use of this software 13.\" must display the following acknowledgement: 14.\" This product includes software developed by the University of 15.\" California, Berkeley and its contributors. 16.\" 4. Neither the name of the University nor the names of its contributors 17.\" may be used to endorse or promote products derived from this software 18.\" without specific prior written permission. 19.\" 20.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 21.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 22.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 23.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 24.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 25.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 26.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 27.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 28.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 29.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 30.\" SUCH DAMAGE. 31.\" 32.\" @(#)savecore.8 6.6 (Berkeley) 3/16/91 33.\" 34.\" $Header: /cvsroot/src/sbin/savecore/savecore.8,v 1.5 1993/04/28 06:40:21 cgd Exp $ 35.\" 36.Dd March 16, 1991 37.Dt SAVECORE 8 38.Os BSD 4 39.Sh NAME 40.Nm savecore 41.Nd "save the details of a crash of the operating system" 42.Sh SYNOPSIS 43.Nm savecore 44.Ar dirname 45.Op Ar system 46.Sh DESCRIPTION 47.Nm Savecore 48is meant to be called near the end of the initialization file 49.Pa /etc/rc 50(see 51.Xr rc 8 ) . 52Its function 53is to detect the presence and save the state of the operating 54system's previous abnormal termination, assuming the state was recorded 55for this purpose. If this state information is found, 56.Nm savecore 57will also write a reboot message in the shutdown log. 58The state information is a snapshot of all RAM memory at the time 59of abnormal termination, untranslated by the processor's memory management 60unit, in physical rather than virtual order (like the memory device, see 61.Xr mem 4 ). 62.Pp 63Operands supported by 64.Nm savecore : 65.Bl -tag -width Ar 66.It Ar dirname 67The directory name where the core dump will be written. 68.It Ar system 69If the core dump was from a system other than 70.Pa /netbsd , 71the name 72of that system must be supplied as 73.Ar system . 74.El 75.Pp 76.Nm Savecore 77looks for a physical RAM memory image of the current system 78(currently recorded during system crashes in the 79system's swap space) and it checks the image for veracity. 80If the saved memory image is valid, it saves this in 81.Ar dirname Ns Pa /ram.n 82and the current version of the operating system's executable file 83in 84.Ar dirname Ns Pa /system.n 85Sequence numbers are incremented and appended to the end of the pathnames 86each time 87.Nm savecore 88is run in the directory. 89.Pp 90Before savecore writes out a memory image, it reads a number from the file 91.Ar dirname Ns Pa /minfree . 92If the number of free kilobytes on the filesystem which contains 93.Ar dirname 94is less than the number obtained from the minfree file, 95the core dump is not saved. 96If the minfree file does not exist, savecore always writes out the core 97file (assuming that a core dump was taken). 98.Pp 99.Nm Savecore 100also logs a reboot message using facility 101.Dv LOG_AUTH 102(see 103.Xr syslog 3 ) 104If the system crashed as a result of a panic, 105.Nm savecore 106logs the panic string too. 107.Sh FILES 108.Bl -tag -width /netbsd -compact 109.It Pa /netbsd 110current 111.Tn system executable file 112.El 113.Sh BUGS 114Can be fooled into thinking a core dump is the wrong size. 115.Sh HISTORY 116The 117.Nm 118command appeared in 119.Bx 4.1 . 120