Commit Graph

77 Commits

Author SHA1 Message Date
Maxim Konovalov
125450bbb7 o Restore kerneldumpheader.architectureversion bytes swopping
mangled in rev. 1.72.

PR:		bin/86805
Submitted by:	Gavin Atkinson
MFC after:	3 days
2005-10-02 11:31:45 +00:00
Robert Watson
d32e7ba722 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
2005-09-13 19:15:28 +00:00
Doug White
9520784e29 Don't bump bounds every time savecore(8) is run.
Submitted by:	Ed Maste <emaste@sandvine.com>
Approved by:	re
2005-06-20 20:01:29 +00:00
Xin LI
466e103c7d Constify savedir pointer, and remove an accompaning strdup() call. 2005-05-29 16:28:07 +00:00
David E. O'Brien
ecb90dcc75 style(9). 2005-02-26 01:19:21 +00:00
David E. O'Brien
5fb7027c82 Allow a forced dump even if the dump header information is inconsistent.
Output more verbosity with additional -v's.

Submitted by:	seanc
2005-02-24 02:45:10 +00:00
Ruslan Ermilov
8d646af581 Sync program's usage() with manpage's SYNOPSIS. 2005-02-10 09:19:34 +00:00
Xin LI
e80cfa4631 Initialize "he" in DoFile, so savecore(8) is WARNS=6 clean.
Bump WARNS accordingly.
2005-01-10 10:44:56 +00:00
Ruslan Ermilov
9f676d2ed6 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
2004-08-16 07:02:14 +00:00
Maxim Konovalov
34ee70a6a0 o Remove obsoleted '-N' and '-d' flags. 2004-02-28 10:42:27 +00:00
Maxim Konovalov
1e581b9759 o Sync usage() with reality: add 'z' flag.
MFC after:	1 week
2004-02-28 10:22:17 +00:00
Tim J. Robbins
65922d0bb2 Merge from RELENG_4 1.28.2.13: Fix saving system crash dumps larger than
2 GB by using fseeko() instead of fseek().
2004-02-20 12:22:52 +00:00
Marcel Moolenaar
4b290df1dd 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
2003-10-08 07:37:11 +00:00
Doug Barton
628d16a388 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.
2003-09-04 10:07:01 +00:00
Jens Schweikhardt
9d5abbddbf Correct typos, mostly s/ a / an / where appropriate. Some whitespace cleanup,
especially in troff files.
2003-01-01 18:49:04 +00:00
Marcel Moolenaar
acc6623066 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>
2002-06-02 19:20:37 +00:00
Marcel Moolenaar
6db5f8a79e 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.
2002-05-27 07:54:43 +00:00
Marcel Moolenaar
fac09f6b79 Make argument to printf match format. 2002-05-06 08:27:21 +00:00
Bill Fenner
edc4f96e24 - 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>
2002-05-05 01:04:00 +00:00
Maxime Henrion
3203428dc5 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
2002-05-04 10:36:35 +00:00
Philippe Charnier
4b8b67343c 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
2002-04-21 07:18:16 +00:00
Poul-Henning Kamp
dce9aaab45 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.
2002-04-19 09:38:45 +00:00
Marcel Moolenaar
5da217f64c 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.
2002-04-13 08:20:15 +00:00
Poul-Henning Kamp
2dd527b3ac Move generic disk ioctls from <sys/disklabel.h> to <sys/disk.h>.
Sponsored by:	DARPA & NAI Labs
2002-04-08 09:20:07 +00:00
Marcel Moolenaar
5cb87b0c59 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
2002-04-03 07:24:12 +00:00
John Baldwin
3837db64a7 Add long long casts so that this compiles on archs with 64-bit longs.
Pointy-hat to:	phk
2002-04-01 18:23:58 +00:00
Poul-Henning Kamp
d503fad022 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.
2002-03-31 22:26:56 +00:00
Warner Losh
d476a036e2 o remove __P
o remove main prototype
2002-03-21 13:20:49 +00:00
David E. O'Brien
3d438ad61f 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?)
2002-03-20 17:55:10 +00:00
Dag-Erling Smørgrav
66a79b3d49 Sparc64 support. 2002-03-11 11:23:48 +00:00
Peter Wemm
9ee1532786 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/
2001-10-05 03:13:13 +00:00
Peter Wemm
1ade1386ba Argh. Fix another >2GB savecore problem.
Reported by:   mki@mozone.net
2001-10-05 03:06:35 +00:00
Andrew Gallatin
c97e08fb94 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
2001-09-13 21:19:13 +00:00
Kris Kennaway
dff462c363 * 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
2001-09-06 09:30:09 +00:00
Peter Wemm
241ca2287a Banish hard-coded KERNBASE references from savecore. Dynamically
adjust to whatever kernbase is in the kernel that we are dumping.
2001-08-24 09:26:17 +00:00
Kris Kennaway
5979df34a6 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
2001-08-19 08:19:37 +00:00
Peter Wemm
9b0a8ba37a 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.
2001-06-09 01:41:03 +00:00
Peter Wemm
1c08773e6e 'int dumpsize; /* memory size in bytes */' is not good for machines
with 2GB or more of ram.
2001-06-08 03:06:24 +00:00
Dag-Erling Smørgrav
867dd03869 Restore the -c option, which was accidentally removed from the getopt
string two revisions ago.
2001-03-06 01:58:30 +00:00
Dag-Erling Smørgrav
4c98f36d94 Document the new -k option in usage message and man page. 2001-02-16 16:28:36 +00:00
Dag-Erling Smørgrav
532c19016b 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.
2001-02-16 16:27:32 +00:00
Dag-Erling Smørgrav
c74e16f917 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.
2000-10-17 22:43:41 +00:00
Dag-Erling Smørgrav
c548151f51 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.
2000-09-28 20:09:36 +00:00
Peter Wemm
7365d61d00 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.
2000-09-03 07:02:00 +00:00
Paul Saab
e0ab5cb523 Tidy up the offset calculations.
Submitted by:	bde
2000-05-09 22:20:14 +00:00
Paul Saab
8df53a80dc Read the correct size into kdumplo.
Botched/Noticed by:	peter
2000-05-09 01:08:00 +00:00
Paul Saab
332dbf570d Allow savecore to work on > 2GB partitions.
Submitted by:	peter
2000-05-08 22:57:35 +00:00
Bruce Evans
e9ae1d4b2d Fixed style bugs in rev.1.28. Rev.1.28 was not submitted by bde. 2000-03-20 20:07:28 +00:00
Paul Saab
2837fe5558 Only character devices exsist these days. Make savecore understand
this.
2000-03-20 06:54:06 +00:00
David E. O'Brien
7c815b0db8 Fix bogus initialization of using a sledge hammer to quite -Wall, bad
indention, and size issue between 32 and 64bit machines.

Submitted by:	bde
1999-12-21 07:41:07 +00:00