* cleanup for WARNS=1
* fix .Nm usage * deprecate register
This commit is contained in:
parent
571340263d
commit
beb7c8b582
|
@ -1,4 +1,4 @@
|
|||
.\" $NetBSD: savecore.8,v 1.11 1995/06/27 22:40:46 briggs Exp $
|
||||
.\" $NetBSD: savecore.8,v 1.12 1997/09/15 11:08:44 lukem Exp $
|
||||
.\"
|
||||
.\" Copyright (c) 1980, 1991, 1993
|
||||
.\" The Regents of the University of California. All rights reserved.
|
||||
|
@ -40,14 +40,14 @@
|
|||
.Nm savecore
|
||||
.Nd "save a core dump of the operating system"
|
||||
.Sh SYNOPSIS
|
||||
.Nm savecore
|
||||
.Nm
|
||||
.Fl c
|
||||
.Nm savecore
|
||||
.Op Fl fvz
|
||||
.Op Fl N Ar system
|
||||
.Ar directory
|
||||
.Sh DESCRIPTION
|
||||
.Nm Savecore
|
||||
.Nm
|
||||
copies the currently running kernel and its associated core dump into
|
||||
.Fa directory ,
|
||||
and enters a reboot message and information about the core dump into
|
||||
|
@ -57,7 +57,7 @@ The options are as follows:
|
|||
.Bl -tag -width directory
|
||||
.It Fl c
|
||||
Clears the dump, so that future invocations of
|
||||
.Nm savecore
|
||||
.Nm
|
||||
will ignore it.
|
||||
.It Fl f
|
||||
Forces a dump to be taken even if the dump doesn't appear correct or there
|
||||
|
@ -73,7 +73,7 @@ Compresses the core dump and kernel (see
|
|||
.Xr compress 1 ).
|
||||
.El
|
||||
.Pp
|
||||
.Nm Savecore
|
||||
.Nm
|
||||
checks the core dump in various ways to make sure that it is current and
|
||||
that it corresponds to the currently running system.
|
||||
If it passes these checks, it saves the core image in
|
||||
|
@ -90,10 +90,10 @@ option is used).
|
|||
The ``#'' is the number from the first line of the file
|
||||
.Ar directory Ns Pa /bounds ,
|
||||
and it is incremented and stored back into the file each time
|
||||
.Nm savecore
|
||||
.Nm
|
||||
successfully runs.
|
||||
.Pp
|
||||
.Nm Savecore
|
||||
.Nm
|
||||
also checks the available disk space before attempting to make the copies.
|
||||
If there is insufficient disk space in the filesystem containing
|
||||
.Ar directory ,
|
||||
|
@ -104,13 +104,13 @@ filesystem after the copies were made would be less than the number
|
|||
in the first line of this file, the copies are not attempted.
|
||||
.Pp
|
||||
If
|
||||
.Nm savecore
|
||||
.Nm
|
||||
successfully copies the kernel and the core dump, the core dump is cleared
|
||||
so that future invocations of
|
||||
.Nm savecore
|
||||
.Nm
|
||||
will ignore it.
|
||||
.Pp
|
||||
.Nm Savecore
|
||||
.Nm
|
||||
is meant to be called near the end of the initialization file
|
||||
.Pa /etc/rc
|
||||
(see
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: savecore.c,v 1.31 1997/08/25 19:31:53 kleink Exp $ */
|
||||
/* $NetBSD: savecore.c,v 1.32 1997/09/15 11:08:45 lukem Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1986, 1992, 1993
|
||||
|
@ -33,17 +33,17 @@
|
|||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
static char copyright[] =
|
||||
"@(#) Copyright (c) 1986, 1992, 1993\n\
|
||||
The Regents of the University of California. All rights reserved.\n";
|
||||
__COPYRIGHT("@(#) Copyright (c) 1986, 1992, 1993\n\
|
||||
The Regents of the University of California. All rights reserved.\n");
|
||||
#endif /* not lint */
|
||||
|
||||
#ifndef lint
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)savecore.c 8.3 (Berkeley) 1/2/94";
|
||||
#else
|
||||
static char rcsid[] = "$NetBSD: savecore.c,v 1.31 1997/08/25 19:31:53 kleink Exp $";
|
||||
__RCSID("$NetBSD: savecore.c,v 1.32 1997/09/15 11:08:45 lukem Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
|
@ -130,6 +130,7 @@ int get_crashtime __P((void));
|
|||
void kmem_setup __P((void));
|
||||
void log __P((int, char *, ...));
|
||||
void Lseek __P((int, off_t, int));
|
||||
int main __P((int, char *[]));
|
||||
int Open __P((char *, int rw));
|
||||
char *rawname __P((char *s));
|
||||
void save_core __P((void));
|
||||
|
@ -253,8 +254,8 @@ kmem_setup()
|
|||
}
|
||||
dumplo *= DEV_BSIZE;
|
||||
if (verbose)
|
||||
(void)printf("dumplo = %d (%d * %d)\n",
|
||||
dumplo, dumplo / DEV_BSIZE, DEV_BSIZE);
|
||||
(void)printf("dumplo = %ld (%ld * %ld)\n",
|
||||
(long)dumplo, (long)(dumplo / DEV_BSIZE), (long)DEV_BSIZE);
|
||||
if (KREAD(kd_kern, current_nl[X_DUMPMAG].n_value, &dumpmag) != 0) {
|
||||
if (verbose)
|
||||
syslog(LOG_WARNING, "kvm_read: %s", kvm_geterr(kd_kern));
|
||||
|
@ -310,8 +311,8 @@ kmem_setup()
|
|||
void
|
||||
check_kmem()
|
||||
{
|
||||
register char *cp;
|
||||
register long panicloc;
|
||||
char *cp;
|
||||
long panicloc;
|
||||
char core_vers[1024];
|
||||
|
||||
(void)kvm_read(kd_dump, dump_nl[X_VERSION].n_value, core_vers,
|
||||
|
@ -370,7 +371,8 @@ dump_exists()
|
|||
*/
|
||||
if (newdumpmag != dumpmag) {
|
||||
if (verbose)
|
||||
syslog(LOG_WARNING, "magic number mismatch (%x != %x)",
|
||||
syslog(LOG_WARNING,
|
||||
"magic number mismatch (0x%x != 0x%x)",
|
||||
newdumpmag, dumpmag);
|
||||
syslog(LOG_WARNING, "no core dump");
|
||||
return (0);
|
||||
|
@ -392,10 +394,11 @@ char buf[1024 * 1024];
|
|||
void
|
||||
save_core()
|
||||
{
|
||||
register FILE *fp;
|
||||
register int bounds, ifd, nr, nw, ofd;
|
||||
FILE *fp;
|
||||
int bounds, ifd, nr, nw, ofd;
|
||||
char *rawp, path[MAXPATHLEN];
|
||||
|
||||
ofd = -1;
|
||||
/*
|
||||
* Get the current number and update the bounds file. Do the update
|
||||
* now, because may fail later and don't want to overwrite anything.
|
||||
|
@ -432,7 +435,8 @@ err1: syslog(LOG_WARNING, "%s: %s", path, strerror(errno));
|
|||
ofd = Create(path, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
|
||||
fp = fdopen(ofd, "w");
|
||||
if (fp == NULL) {
|
||||
syslog(LOG_ERR, "%s: fdopen: %s", path);
|
||||
syslog(LOG_ERR, "%s: fdopen: %s", path,
|
||||
strerror(errno));
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
@ -522,10 +526,10 @@ err2: syslog(LOG_WARNING,
|
|||
|
||||
char *
|
||||
find_dev(dev, type)
|
||||
register dev_t dev;
|
||||
register int type;
|
||||
dev_t dev;
|
||||
int type;
|
||||
{
|
||||
register DIR *dfd;
|
||||
DIR *dfd;
|
||||
struct dirent *dir;
|
||||
struct stat sb;
|
||||
char *dp, devname[MAXPATHLEN + 1];
|
||||
|
@ -603,7 +607,7 @@ get_crashtime()
|
|||
int
|
||||
check_space()
|
||||
{
|
||||
register FILE *fp;
|
||||
FILE *fp;
|
||||
char *tkernel;
|
||||
off_t minfree, spacefree, kernelsize, needed;
|
||||
struct stat st;
|
||||
|
@ -678,7 +682,7 @@ Create(file, mode)
|
|||
char *file;
|
||||
int mode;
|
||||
{
|
||||
register int fd;
|
||||
int fd;
|
||||
|
||||
fd = open(file, O_WRONLY | O_CREAT | O_TRUNC, mode);
|
||||
if (fd < 0) {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: savecore_old.c,v 1.3 1997/08/26 07:13:18 veego Exp $ */
|
||||
/* $NetBSD: savecore_old.c,v 1.4 1997/09/15 11:08:46 lukem Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1986, 1992, 1993
|
||||
|
@ -33,17 +33,17 @@
|
|||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
static char copyright[] =
|
||||
"@(#) Copyright (c) 1986, 1992, 1993\n\
|
||||
The Regents of the University of California. All rights reserved.\n";
|
||||
__COPYRIGHT("@(#) Copyright (c) 1986, 1992, 1993\n\
|
||||
The Regents of the University of California. All rights reserved.\n");
|
||||
#endif /* not lint */
|
||||
|
||||
#ifndef lint
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)savecore.c 8.3 (Berkeley) 1/2/94";
|
||||
#else
|
||||
static char rcsid[] = "$NetBSD: savecore_old.c,v 1.3 1997/08/26 07:13:18 veego Exp $";
|
||||
__RCSID("$NetBSD: savecore_old.c,v 1.4 1997/09/15 11:08:46 lukem Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
|
@ -126,6 +126,7 @@ int get_crashtime __P((void));
|
|||
void kmem_setup __P((void));
|
||||
void log __P((int, char *, ...));
|
||||
void Lseek __P((int, off_t, int));
|
||||
int main __P((int, char *[]));
|
||||
int Open __P((char *, int rw));
|
||||
int Read __P((int, void *, int));
|
||||
char *rawname __P((char *s));
|
||||
|
@ -247,8 +248,8 @@ kmem_setup()
|
|||
(void)Read(kmem, &dumplo, sizeof(dumplo));
|
||||
dumplo *= DEV_BSIZE;
|
||||
if (verbose)
|
||||
(void)printf("dumplo = %d (%d * %d)\n",
|
||||
dumplo, dumplo / DEV_BSIZE, DEV_BSIZE);
|
||||
(void)printf("dumplo = %ld (%ld * %ld)\n",
|
||||
(long)dumplo, (long)(dumplo / DEV_BSIZE), (long)DEV_BSIZE);
|
||||
Lseek(kmem, (off_t)(current_nl[X_DUMPMAG].n_value), SEEK_SET);
|
||||
(void)Read(kmem, &dumpmag, sizeof(dumpmag));
|
||||
ddname = find_dev(dumpdev, S_IFBLK);
|
||||
|
@ -269,7 +270,7 @@ kmem_setup()
|
|||
void
|
||||
check_kmem()
|
||||
{
|
||||
register char *cp;
|
||||
char *cp;
|
||||
FILE *fp;
|
||||
char core_vers[1024];
|
||||
|
||||
|
@ -327,7 +328,8 @@ dump_exists()
|
|||
*/
|
||||
if (newdumpmag != dumpmag) {
|
||||
if (verbose)
|
||||
syslog(LOG_WARNING, "magic number mismatch (%x != %x)",
|
||||
syslog(LOG_WARNING,
|
||||
"magic number mismatch (0x%x != 0x%x)",
|
||||
newdumpmag, dumpmag);
|
||||
syslog(LOG_WARNING, "no core dump");
|
||||
return (0);
|
||||
|
@ -340,10 +342,11 @@ char buf[1024 * 1024];
|
|||
void
|
||||
save_core()
|
||||
{
|
||||
register FILE *fp;
|
||||
register int bounds, ifd, nr, nw, ofd;
|
||||
FILE *fp;
|
||||
int bounds, ifd, nr, nw, ofd;
|
||||
char *rawp, path[MAXPATHLEN];
|
||||
|
||||
ofd = -1;
|
||||
/*
|
||||
* Get the current number and update the bounds file. Do the update
|
||||
* now, because may fail later and don't want to overwrite anything.
|
||||
|
@ -463,10 +466,10 @@ err2: syslog(LOG_WARNING,
|
|||
|
||||
char *
|
||||
find_dev(dev, type)
|
||||
register dev_t dev;
|
||||
register int type;
|
||||
dev_t dev;
|
||||
int type;
|
||||
{
|
||||
register DIR *dfd;
|
||||
DIR *dfd;
|
||||
struct dirent *dir;
|
||||
struct stat sb;
|
||||
char *dp, devname[MAXPATHLEN + 1];
|
||||
|
@ -541,7 +544,7 @@ get_crashtime()
|
|||
int
|
||||
check_space()
|
||||
{
|
||||
register FILE *fp;
|
||||
FILE *fp;
|
||||
char *tkernel;
|
||||
off_t minfree, spacefree, kernelsize, needed;
|
||||
struct stat st;
|
||||
|
@ -631,7 +634,7 @@ Create(file, mode)
|
|||
char *file;
|
||||
int mode;
|
||||
{
|
||||
register int fd;
|
||||
int fd;
|
||||
|
||||
fd = open(file, O_WRONLY | O_CREAT | O_TRUNC, mode);
|
||||
if (fd < 0) {
|
||||
|
|
Loading…
Reference in New Issue