History log of /freebsd-10.0-release/sbin/savecore/
Revision Date Author Comments
(<<< Hide modified files)
(Show modified files >>>)
259065 07-Dec-2013 gjb

- Copy stable/10 (r259064) to releng/10.0 as part of the
10.0-RELEASE cycle.
- Update __FreeBSD_version [1]
- Set branch name to -RC1

[1] 10.0-CURRENT __FreeBSD_version value ended at '55', so
start releng/10.0 at '100' so the branch is started with
a value ending in zero.

Approved by: re (implicit)
Sponsored by: The FreeBSD Foundation

256281 10-Oct-2013 gjb

Copy head (r256279) to stable/10 as part of the 10.0-RELEASE cycle.

Approved by: re (implicit)
Sponsored by: The FreeBSD Foundation


244321 16-Dec-2012 pjd

With rotating kernel dumps the higest dump number is not necessarily the
last one. To make it easier to find the last one create symlinks with 'last'
suffix that will point to the files of the last coredump, eg.:

info.last -> info.5
textdump.tar.last.gz -> textdump.tar.5.gz

Reviewed by: avg
Obtained from: WHEEL Systems


244320 16-Dec-2012 pjd

Implement -m option to savecore(8) that allows to limit number of kernel
dumps stored. Once the limit is reached it restarts from 0.

Reviewed by: avg
Obtained from: WHEEL Systems


244319 16-Dec-2012 pjd

Make use of the fact that we changed working directory to the dump directory
earlier.

Obtained from: WHEEL Systems


244317 16-Dec-2012 pjd

Sort flags properly.

Obtained from: WHEEL Systems


244316 16-Dec-2012 pjd

Prefer snprintf() over sprintf().

Obtained from: WHEEL Systems


244218 14-Dec-2012 pjd

- When checking if a dump exists on the given device there is no need to
provide dump directory. Eliminate this redundant argument. This changes
the usage, but the only risk here is that a warning will be printed
about directory given as device.

- Update usage of -C option.

- When clearing dump header from the given device there is also no need to
provide dump directory, although additional arguments for -c were not
documented.

- Document that -v can be used with -c and that list of devices can be given.

Obtained from: WHEEL Systems


244217 14-Dec-2012 pjd

The clear option (-c) is not compatible with keep (-k) and compress (-z)
options.

Obtained from: WHEEL Systems


244216 14-Dec-2012 pjd

If we are not going to clear the dump (we are either just checking if the dump
exists or we want to keep it), open device read-only.

Obtained from: WHEEL Systems


244215 14-Dec-2012 pjd

Whitespace cleanups.


234069 09-Apr-2012 rmh

Include <signal.h> (for SIGINFO).


223494 24-Jun-2011 kevlo

Remove duplicated header files


216399 12-Dec-2010 joel

Remove the advertising clause from UCB copyrighted files in sbin. This
is in accordance with the information at
ftp://ftp.cs.berkeley.edu/pub/4bsd/README.Impt.License.Change


198236 19-Oct-2009 ru

Switch the default WARNS level for sbin/ to 6.

Submitted by: Ulrich Spörlein


197299 17-Sep-2009 ru

Fixed markup.


196528 25-Aug-2009 lulf

- Add a SIGINFO handler for savecore.


191414 23-Apr-2009 brueffer

Correct the information about when the respective functionality first
appeared in FreeBSD.

PR: 133785
Submitted by: Ulrich Spoerlein <uqs@spoerlein.net>
MFC after: 3 days


186478 24-Dec-2008 trhodes

Apply various fixes:

Silence mdoc(7) warnings;
Xref correct manual pages;
Point user to the ddb.8 manual page.

PR: 129398
Submitted by: gavin


174944 27-Dec-2007 rwatson

Compare kernel dump header magic with textdump magic using strncmp()
rather than the memcmp() which is used for regular dumps: the
textdump string is one character shorter, so we need to stop
comparing at the end of the string.

Use independent version checking logic for architecture-specific
version number vs. textdump version number, as the version sequences
may (someday) differ.

Run into by: rrs


174923 26-Dec-2007 rwatson

Teach savecore(8) how to extract textdump(4) dumps.

Update savecore(8) man page to reflect textdump additions.

MFC after: 3 months


170054 28-May-2007 kevlo

Check fdopen return value.

Reviewed by: phk


150818 02-Oct-2005 maxim

o Restore kerneldumpheader.architectureversion bytes swopping
mangled in rev. 1.72.

PR: bin/86805
Submitted by: Gavin Atkinson
MFC after: 3 days


150105 13-Sep-2005 rwatson

Don't consider being unable to open the bounds file worthy of printing
at LOG_WARNING by default; instead, consider it something to be printed
to the tty when 'verbose' mode is set. This avoids printing out extra
lines at every boot on a system with crash dumps enabled, but that has
not yet had to generate a crashdump.

MFC after: 1 week


147506 20-Jun-2005 dwhite

Don't bump bounds every time savecore(8) is run.

Submitted by: Ed Maste <emaste@sandvine.com>
Approved by: re


147369 14-Jun-2005 ru

Markup fixes.

Approved by: re (blanket)


147048 06-Jun-2005 philip

Fix a silly little typo I just spotted.


146763 29-May-2005 delphij

Constify savedir pointer, and remove an accompaning strdup() call.


142533 26-Feb-2005 obrien

style(9).


142359 24-Feb-2005 obrien

Allow a forced dump even if the dump header information is inconsistent.
Output more verbosity with additional -v's.

Submitted by: seanc


141611 10-Feb-2005 ru

Sync program's usage() with manpage's SYNOPSIS.


140415 18-Jan-2005 ru

Sort sections.


139975 10-Jan-2005 delphij

Initialize "he" in DoFile, so savecore(8) is WARNS=6 clean.
Bump WARNS accordingly.


133814 16-Aug-2004 ru

Use a local "compress" symbol corresponding to a variable in BSS,
rather than the one from libz, corresponding to a function, when
linking statically.

PR: bin/70392


128073 09-Apr-2004 markm

Remove advertising clause from University of California Regent's license,
per letter dated July 22, 1999.

Approved by: core, imp


126347 28-Feb-2004 maxim

o Remove obsoleted '-N' and '-d' flags.


126346 28-Feb-2004 maxim

o Sync usage() with reality: add 'z' flag.

MFC after: 1 week


126178 23-Feb-2004 johan

style.Makefile(5):
Use WARNS?= instead of WARNS=.


126042 20-Feb-2004 tjr

Merge from RELENG_4 1.28.2.13: Fix saving system crash dumps larger than
2 GB by using fseeko() instead of fseek().


120907 08-Oct-2003 marcel

Revision 1.61 changed the allocation of buffer 'buf' in DoFile() from
the stack to the heap to work around a problem on ia64. Now, roughly
16 months and two compiler updates later, it isn't an issue anymore
in the sense that putting a 1M buffer on the stack just works and we
don't actually need to work around anything anymore.
However, since there's no advantage or need to put the buffer on the
stack (again), this change merely removes the XXX comment describing
that there's an explicit reason for the heap allocation. Hence, this
change is a functional no-op.

PR: ia64/38677


119734 04-Sep-2003 dougb

Add a flag that reports the existence of a dump, and does nothing else.

The immediate purpose for this option is to use it in rc.d so that we
can make savecore behavior conditional.

Tremendous assistance with ideas and sanity checking provided by tjr
and b@etek.chalmers.se.


108533 01-Jan-2003 schweikh

Correct typos, mostly s/ a / an / where appropriate. Some whitespace cleanup,
especially in troff files.


102231 21-Aug-2002 trhodes

s/filesystem/file system/g as discussed on -developers


99503 06-Jul-2002 charnier

The .Nm utility.


97746 02-Jun-2002 marcel

Fix breakage caused by allocating the I/O buffer. There was a
sizeof(buf) lurking around that I missed.

PR: 38811
Submitted by: Adrian Colley <aecolley@spamcop.net>


97477 29-May-2002 ru

mdoc(7) police: nits.


97340 27-May-2002 marcel

Work around a memory fault on ia64 caused by having the 1MB buffer on
the stack in DoFile(). This needs some investigation. In the mean time
we do a one time malloc() for the buffer to have it on the heap instead.


96519 13-May-2002 ru

Style.


96103 06-May-2002 marcel

Make argument to printf match format.


96049 05-May-2002 fenner

- revert back to vmcore.#
- reimplement -z
- use syslog()
- improve consistancy of messages
- allow -f to recover cleared dumps
- return bufsize to 1024 * 1024
- return the ability to write sparse files
- update man page
- fix minfree to require 2k for info file instead of the kernel size
- include Berkeley copyright too due to amount of old code copied

Submitted by: Chad David <davidc@acns.ab.ca>


96025 04-May-2002 mux

Restore the minfree functionality into savecore. This patch
restores the check_space() function with small modifications
to make it work with the current code. The patch was slightly
modified by Bill Fenner to handle error messages better.

Reviewed by: fenner


95183 21-Apr-2002 charnier

Add FBSDID. Start errx(3) messages with lowercase. Remove a ')' with no '('.
In usage(), use fprintf(3) instead of errx(3), to make the printed string really
start with `usage: ...'.
Reviewed by: marcel


95039 19-Apr-2002 phk

Push the .info file contents out when we're done so people can
read the description while the megs shift from one place to another.


94580 13-Apr-2002 marcel

High-level changes (user visible):
o Implement -c (clear) to clear previously kept headers (note that
dumps not cleared will remain until -c is used),
o Implement -f (force) to allow re-saving a previously saved dump,
o Implement -k (keep) and make clearing the dump header the default,
o Implement -v (verbose) and make most output conditional upon it,
o Emit minimal output for the non-verbose case with the assumption
that savecore is run mostly from within /etc/rc,
o Update usage message to reflect what is and what's not,
o mark -d as obsolete.

Low-level changes:
o Rename devname to device, for devname mirrors a global declaration
and GCC 3.x warns about it,
o Open the dump device R/W for clear and !keep to work,
o Reorder the locals of DoFile according to style(9),
o Remove newlines from strings passed to warn* and err*,
o Use stat(2) to check if a dump has been saved before,
o Truncate existing core and info files to support force,
o First check for the magic and the version before we complain about
parity errors. This prevents emitting parity error messages when
there's no dump,
o Keep track of the number of headers found and the number of headers
saved to support the minimal output,
o Close files we opened in DoFile. Not critical, but cleaner.


94182 08-Apr-2002 phk

Move generic disk ioctls from <sys/disklabel.h> to <sys/disk.h>.

Sponsored by: DARPA & NAI Labs


93717 03-Apr-2002 marcel

Make the kernel dump header endianness invariant by always dumping
in dump byte order (=network byte order). Swap blocksize and dumptime
to avoid extraneous padding on 64-bit architectures. Use CTASSERT
instead of runtime checks to make sure the header is 512 bytes large.
Various style(9) fixes.

Reviewed by: phk, bde, mike


93562 01-Apr-2002 jhb

Add long long casts so that this compiles on archs with 64-bit longs.

Pointy-hat to: phk


93515 01-Apr-2002 phk

Duh, savecore is called savecore.


93492 31-Mar-2002 phk

Savecore:

Commandline compatible with the previous savecore unless you specify
any options, none of them are implemented (yet).

Scans all devices marked "dump" or "swap" for dump header signatures
and saves dumps off under a name which is a MD5 hash of the header
information. This should give unique filenames. A *.info file contains
ascii version of the header information.


92883 21-Mar-2002 imp

o remove __P
o remove main prototype


92806 20-Mar-2002 obrien

Remove 'register' keyword.
It does not help modern compilers, and some may take some hit from it.
(I also found several functions that listed *every* of its 10 local vars with
"register" -- just how many free registers do people think machines have?)


92086 11-Mar-2002 des

Sparc64 support.


87325 04-Dec-2001 obrien

Default to WARNS=2.
Binary builds that cannot handle this must explicitly set WARNS=0.

Reviewed by: mike


85629 28-Oct-2001 n_hibma

Add a Xref to dumpon.


84509 05-Oct-2001 peter

Remove some bogus "(off_t)(dumplo + value)" and "(off_t)dumplo" casts,
since dumplo is now an off_t. Scratch a couple of other itches as well.
s/L_SET/SEEK_SET/


84508 05-Oct-2001 peter

Argh. Fix another >2GB savecore problem.

Reported by: mki@mozone.net


83415 13-Sep-2001 gallatin

fix savecore so that it works on the alpha after the size change
of dumpmag from an int to a u_long in rev 1.41 -- without this
change, savecore will always fail like this:

#savecore -v /var/crash
dumplo = 874356736 (1707728 * 512)
savecore: magic number mismatch (8fca0101 != 8fca0101)
savecore: no core dump


83332 11-Sep-2001 ru

mdoc(7) police: restore the correct sorting of SEE ALSO.


83140 06-Sep-2001 kris

* Switch from doing compress(1)ed crashdumps with the -z flag to using
gzip(1). gdb doesn't understand these, but then again it didn't
understand compressed crashdumps either.
* Change a stray lseek() into a Lseek()
* Remove the extraneous prototype for log() which has apparently never
existed in FreeBSD's sources

Obtained from: NetBSD (partially)
MFC after: 2 weeks


82265 24-Aug-2001 peter

Banish hard-coded KERNBASE references from savecore. Dynamically
adjust to whatever kernbase is in the kernel that we are dumping.


81911 19-Aug-2001 kris

Silence non-constant format string warnings by marking functions
as __printflike()/__printf0like(), adding const, or adding missing "%s"
format strings, as appropriate.

MFC after: 2 weeks


79530 10-Jul-2001 ru

mdoc(7) police: removed HISTORY info from the .Os call.


77927 09-Jun-2001 peter

dumpmag is 'u_long dumpmag' in the kernel, not 'int'. If this worked on
the Alpha, it was because of luck that it was little endian.

Tidy up the dumpsize/dumppages confusion and the out of date comments.


77892 08-Jun-2001 peter

'int dumpsize; /* memory size in bytes */' is not good for machines
with 2GB or more of ram.


74815 26-Mar-2001 ru

- Backout botched attempt to introduce MANSECT feature.
- MAN[1-9] -> MAN.


74531 20-Mar-2001 ru

Set the default manual section for sbin/ to 8.


73828 06-Mar-2001 des

Restore the -c option, which was accidentally removed from the getopt
string two revisions ago.


72542 16-Feb-2001 des

Document the new -k option in usage message and man page.


72541 16-Feb-2001 des

Add a -k option that prevents clearing the dump after saving it.

Use sysctlbyname() instead of sysctl().

Clear up and simplify the version extraction code.

Attempt to detect stretches of zeroes in the dump and avoid writing
them to disk to save space and time.


71099 16-Jan-2001 ru

Prepare for mdoc(7)NG.


68960 20-Nov-2000 ru

mdoc(7) police: use the new features of the Nm macro.


67264 17-Oct-2000 des

Work much harder at obtaining a correct device node. If what devname(3)
returns doesn't exist, or doesn't match the desired device, fall back to
scanning /dev for a matching node, and as a last resort, if that fails,
try to create the node ourselves as /dev/dump.

Add comments to several variables and functions.

Clean up syslog(3) usage; use %m instead of strerror(3).

Other minor cleanup.


66429 28-Sep-2000 des

Remove superfluous code:

1) use devname() instead of searching /dev for the dump device

2) use fopen() instead of open() so we don't need to differentiate
between compressing and not compressing when writing the core
file or the kernel (zopen() returns a FILE *, so we just use
fwrite() in both cases)

There should be no functional changes.


65396 03-Sep-2000 peter

I'm not sure what changed to cause this, but using 'dirname' as a variable
was colliding with dirname() in libc.a and causing a Sig 10/bus error.
Just change dirname to savedir and be done with it.


60293 09-May-2000 ps

Tidy up the offset calculations.

Submitted by: bde


60219 09-May-2000 ps

Read the correct size into kdumplo.

Botched/Noticed by: peter


60213 08-May-2000 ps

Allow savecore to work on > 2GB partitions.

Submitted by: peter


58403 20-Mar-2000 bde

Fixed style bugs in rev.1.28. Rev.1.28 was not submitted by bde.


58324 20-Mar-2000 ps

Only character devices exsist these days. Make savecore understand
this.


54933 21-Dec-1999 obrien

Fix bogus initialization of using a sledge hammer to quite -Wall, bad
indention, and size issue between 32 and 64bit machines.

Submitted by: bde


54283 08-Dec-1999 obrien

When erroring out that there is not enough space to write the corefile,
tell the user how much space is avaible for writing the corefile, and how
much space we wanted.


53919 30-Nov-1999 ache

Allow character devices too


50711 31-Aug-1999 phk

Fix savecore so that it operates correctly on character devices with
sectorsizes up to 8k.

Pointed out by: sos


50476 28-Aug-1999 peter

$Id$ -> $FreeBSD$


47095 13-May-1999 luoqi

Read dumpdev using sysctl(3) interface. Now savecore should work again
after the dev_t changes.


44688 12-Mar-1999 gallatin

Fix savecore so that it works on alphas
Reviewed by: Doug Rabson <dfr@nlsystems.com>


37909 28-Jul-1998 charnier

Correct use of .Nm, add rcsid, remove unused #include.


37241 28-Jun-1998 bde

Fixed printf format errors.


34963 30-Mar-1998 phk

Pickup _time_second instead of _time


24359 29-Mar-1997 imp

compare return value from getopt against -1 rather than EOF, per the final
posix standard on the topic.


22990 22-Feb-1997 peter

Revert $FreeBSD$ to $Id$


21673 14-Jan-1997 jkh

Make the long-awaited change from $Id$ to $FreeBSD$

This will make a number of things easier in the future, as well as (finally!)
avoiding the Id-smashing problem which has plagued developers for so long.

Boy, I'm glad we're not using sup anymore. This update would have been
insane otherwise.


18934 14-Oct-1996 joerg

Fix my yesterday's brain-o: don't account for the kilobytes twice.


18916 13-Oct-1996 joerg

Yikes! Originally, i intended to apply the patch from PR # 1322,
but Bill has beaten me on this. ;-)

However, he missed the part to compute the kernelsize in kilobytes,
so the minfree consideration was now overcautious. (I've also
changed the return type of dump_size() to void since int was useless.)

Being here, the fact that `vmcore' was written world-readable was just
a plain security hole: everybody who was able to crash a kernel could
later read any confidential information out of it at his will. Create
it with umask 077 instead.


18914 13-Oct-1996 fenner

Make the savecore command work like the man page says:
- make minfree work by getting the dump size before checking to see
if the dump will fit on the filesystem
- also fail to dump if no minfree is specified but there are not enough
free blocks.

Fix a typo in the man page.

Fixes PR bin/1322

Submitted by: "Philippe C." <charnier@lirmm.fr>


18042 05-Sep-1996 dg

Cast the partial result of an expression to an off_t to fix an overflow
in the calculation of free disk space. Fixes PR#1569.

Submitted by: Tor Egge <Tor.Egge@idt.ntnu.no>


17717 20-Aug-1996 wosch

a header file for zopen.3

Pointed out by: Philippe Charnier <charnier@lirmm.fr>


15530 02-May-1996 phk

NBPG -> getpagesize()


12806 13-Dec-1995 peter

Add #include <vm/pmap.h> in order to make savecore compile again after the
last round of <vm/*.h> include file changes.


9987 07-Aug-1995 wollman

Delete bogus referneces to timezone code internal header file `tzfile.h',
which is no longer bogusly installed in /usr/include.


9795 30-Jul-1995 joerg

Remove a newline from the output of savecore(8), so the bogus number
1024 that used to remain on a line of its own after savecore completed
its job will be overwritten later in the /etc/rc process.

Reviewed by:
Submitted by: graichen@sirius.physik.fu-berlin.de (Thomas Graichen)
Obtained from:


9481 11-Jul-1995 bde

Remove a bogus fclose. Normally the "w" stream for /var/crash/bounds was
fclosed twice and this didn't seem to cause any problems, but when
/var/crash was on an an unwritable nfs-mounted partition, fclose(NULL)
caused a core dump.


8871 30-May-1995 rgrimes

Remove trailing whitespace.


5344 02-Jan-1995 joerg

The -N option takes one argument, hence the getopt control string
needs to have a colon for it. Looks like nobody has tested this
so far.


3041 24-Sep-1994 wollman

Get rid of _PATH_UNIX completely; use getbootfile(3) instead.

DANGER WILL ROBINSON!
_PATH_UNIX is currently defined as the literal string "don't use this".
I am of two minds about this myself, but wanted to get something into the
tree as quickly as possible.


1856 05-Aug-1994 dg

Converted 'vmunix' to 'kernel'.


1855 05-Aug-1994 wollman

Convert to our man installation style. Also fixed long-standing bug
in `fastboot'/`fasthalt' in which the interpreter would hang around
after `reboot' or `halt' is run, causing an irritating ``Killed'' message.


1618 28-May-1994 rgrimes

I know better than to edit files on freefall, next time take a patch file.
Change vm_paramh. to vm_param.h


1599 28-May-1994 rgrimes

Must now include vm/vm.h and vm/vm_param.h due to the way we define KERNBASE.
Reviewed by: David Greenman


1559 26-May-1994 rgrimes

This commit was generated by cvs2svn to compensate for changes in r1558,
which included commits to RCS files with non-trunk default branches.