Commit Graph

54 Commits

Author SHA1 Message Date
gallatin
c146c39169 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
ru
aea682b496 mdoc(7) police: restore the correct sorting of SEE ALSO. 2001-09-11 09:58:34 +00:00
kris
fc676747dd * 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
e2a4bdbcb1 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
549ffd12d2 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
ru
cb3283b5da mdoc(7) police: removed HISTORY info from the .Os call. 2001-07-10 11:04:34 +00:00
peter
7b55d3bd4e 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
e9b0b951fb '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
ru
e7c03cd6b0 - Backout botched attempt to introduce MANSECT feature.
- MAN[1-9] -> MAN.
2001-03-26 14:33:27 +00:00
ru
e2a472a47a Set the default manual section for sbin/ to 8. 2001-03-20 18:13:31 +00:00
des
8726e6b921 Restore the -c option, which was accidentally removed from the getopt
string two revisions ago.
2001-03-06 01:58:30 +00:00
des
cce215b1dc Document the new -k option in usage message and man page. 2001-02-16 16:28:36 +00:00
des
891a9e94d2 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
ru
2ca7f0f2db Prepare for mdoc(7)NG. 2001-01-16 09:15:57 +00:00
ru
d16dd614f6 mdoc(7) police: use the new features of the Nm macro. 2000-11-20 16:52:27 +00:00
des
06aa71d007 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
des
667f9d47ad 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
a67cdf8827 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
ps
b87a84748a Tidy up the offset calculations.
Submitted by:	bde
2000-05-09 22:20:14 +00:00
ps
084aa5ef3d Read the correct size into kdumplo.
Botched/Noticed by:	peter
2000-05-09 01:08:00 +00:00
ps
52765a72c3 Allow savecore to work on > 2GB partitions.
Submitted by:	peter
2000-05-08 22:57:35 +00:00
bde
86272c8586 Fixed style bugs in rev.1.28. Rev.1.28 was not submitted by bde. 2000-03-20 20:07:28 +00:00
ps
67c7537e26 Only character devices exsist these days. Make savecore understand
this.
2000-03-20 06:54:06 +00:00
obrien
9df4535698 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
obrien
4e717e558d 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.
1999-12-08 06:22:58 +00:00
ache
9682d6c800 Allow character devices too 1999-11-30 03:48:04 +00:00
phk
3a88c4f9cb Fix savecore so that it operates correctly on character devices with
sectorsizes up to 8k.

Pointed out by: sos
1999-08-31 18:12:44 +00:00
peter
e226894fa0 $Id$ -> $FreeBSD$ 1999-08-28 00:22:10 +00:00
luoqi
db13884070 Read dumpdev using sysctl(3) interface. Now savecore should work again
after the dev_t changes.
1999-05-13 04:29:09 +00:00
gallatin
2016ec11b4 Fix savecore so that it works on alphas
Reviewed by: Doug Rabson <dfr@nlsystems.com>
1999-03-12 14:46:00 +00:00
charnier
f12208ec5e Correct use of .Nm, add rcsid, remove unused #include. 1998-07-28 06:38:57 +00:00
bde
9438bb416e Fixed printf format errors. 1998-06-28 20:33:36 +00:00
phk
e53834328b Pickup _time_second instead of _time 1998-03-30 10:10:29 +00:00
imp
88b6081b7e compare return value from getopt against -1 rather than EOF, per the final
posix standard on the topic.
1997-03-29 03:33:12 +00:00
peter
4997d39dce Revert $FreeBSD$ to $Id$ 1997-02-22 14:40:44 +00:00
jkh
9c0cd3f9df 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.
1997-01-14 07:20:47 +00:00
joerg
63a681b585 Fix my yesterday's brain-o: don't account for the kilobytes twice. 1996-10-14 22:56:01 +00:00
joerg
80c1600329 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.
1996-10-13 20:55:45 +00:00
fenner
94bba4e2c7 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>
1996-10-13 18:12:20 +00:00
dg
aa96ace92a 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>
1996-09-05 08:08:41 +00:00
wosch
5b1f465721 a header file for zopen.3
Pointed out by: Philippe Charnier <charnier@lirmm.fr>
1996-08-20 20:49:39 +00:00
phk
59a63fa06a NBPG -> getpagesize() 1996-05-02 09:09:04 +00:00
peter
87ebc1900e Add #include <vm/pmap.h> in order to make savecore compile again after the
last round of <vm/*.h> include file changes.
1995-12-13 11:36:20 +00:00
wollman
01cdce9796 Delete bogus referneces to timezone code internal header file `tzfile.h',
which is no longer bogusly installed in /usr/include.
1995-08-07 19:17:46 +00:00
joerg
5c4ac4b21d 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:
1995-07-30 13:10:56 +00:00
bde
92cdf9db9a 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.
1995-07-11 17:03:44 +00:00
rgrimes
0d84aee7e3 Remove trailing whitespace. 1995-05-30 06:12:45 +00:00
joerg
94aaebe4cf 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.
1995-01-02 12:08:06 +00:00
wollman
0df0b6cca0 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.
1994-09-24 00:08:43 +00:00
dg
17e7606224 Converted 'vmunix' to 'kernel'. 1994-08-05 09:14:37 +00:00