1994-05-26 06:35:07 +00:00
|
|
|
/*-
|
|
|
|
* Copyright (c) 1986, 1992, 1993
|
|
|
|
* The Regents of the University of California. All rights reserved.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
|
|
|
* 3. All advertising materials mentioning features or use of this software
|
|
|
|
* must display the following acknowledgement:
|
|
|
|
* This product includes software developed by the University of
|
|
|
|
* California, Berkeley and its contributors.
|
|
|
|
* 4. Neither the name of the University nor the names of its contributors
|
|
|
|
* may be used to endorse or promote products derived from this software
|
|
|
|
* without specific prior written permission.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
|
|
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
|
|
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
|
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
|
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
|
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
|
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
|
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
|
|
* SUCH DAMAGE.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef lint
|
1998-07-28 06:38:57 +00:00
|
|
|
static const char copyright[] =
|
1994-05-26 06:35:07 +00:00
|
|
|
"@(#) Copyright (c) 1986, 1992, 1993\n\
|
|
|
|
The Regents of the University of California. All rights reserved.\n";
|
|
|
|
#endif /* not lint */
|
|
|
|
|
|
|
|
#ifndef lint
|
1998-07-28 06:38:57 +00:00
|
|
|
#if 0
|
1994-05-26 06:35:07 +00:00
|
|
|
static char sccsid[] = "@(#)savecore.c 8.3 (Berkeley) 1/2/94";
|
1998-07-28 06:38:57 +00:00
|
|
|
#endif
|
|
|
|
static const char rcsid[] =
|
1999-08-28 00:22:10 +00:00
|
|
|
"$FreeBSD$";
|
1994-05-26 06:35:07 +00:00
|
|
|
#endif /* not lint */
|
|
|
|
|
|
|
|
#include <sys/param.h>
|
|
|
|
#include <sys/stat.h>
|
|
|
|
#include <sys/mount.h>
|
|
|
|
#include <sys/syslog.h>
|
1999-05-13 04:29:09 +00:00
|
|
|
#include <sys/sysctl.h>
|
1994-05-26 06:35:07 +00:00
|
|
|
|
1994-05-28 04:15:16 +00:00
|
|
|
#include <vm/vm.h>
|
1994-05-28 16:21:59 +00:00
|
|
|
#include <vm/vm_param.h>
|
1995-12-13 11:36:20 +00:00
|
|
|
#include <vm/pmap.h>
|
1994-05-28 04:15:16 +00:00
|
|
|
|
2000-10-17 22:43:41 +00:00
|
|
|
#include <dirent.h>
|
1994-05-26 06:35:07 +00:00
|
|
|
#include <fcntl.h>
|
|
|
|
#include <nlist.h>
|
|
|
|
#include <paths.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <unistd.h>
|
2001-09-06 09:30:09 +00:00
|
|
|
|
|
|
|
extern FILE *zopen(const char *fname, const char *mode);
|
1994-05-26 06:35:07 +00:00
|
|
|
|
1999-03-12 14:46:00 +00:00
|
|
|
#ifdef __alpha__
|
|
|
|
#define ok(number) ALPHA_K0SEG_TO_PHYS(number)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef __i386__
|
2001-08-24 09:26:17 +00:00
|
|
|
#define ok(number) ((number) - kernbase)
|
1999-03-12 14:46:00 +00:00
|
|
|
#endif
|
1994-05-26 06:35:07 +00:00
|
|
|
|
|
|
|
struct nlist current_nl[] = { /* Namelist for currently running system. */
|
1999-05-13 04:29:09 +00:00
|
|
|
#define X_DUMPLO 0
|
1994-05-26 06:35:07 +00:00
|
|
|
{ "_dumplo" },
|
1999-05-13 04:29:09 +00:00
|
|
|
#define X_TIME 1
|
1998-03-30 10:10:29 +00:00
|
|
|
{ "_time_second" },
|
1999-05-13 04:29:09 +00:00
|
|
|
#define X_DUMPSIZE 2
|
1994-05-26 06:35:07 +00:00
|
|
|
{ "_dumpsize" },
|
1999-05-13 04:29:09 +00:00
|
|
|
#define X_VERSION 3
|
1994-05-26 06:35:07 +00:00
|
|
|
{ "_version" },
|
1999-05-13 04:29:09 +00:00
|
|
|
#define X_PANICSTR 4
|
1994-05-26 06:35:07 +00:00
|
|
|
{ "_panicstr" },
|
1999-05-13 04:29:09 +00:00
|
|
|
#define X_DUMPMAG 5
|
1994-05-26 06:35:07 +00:00
|
|
|
{ "_dumpmag" },
|
2001-08-24 09:26:17 +00:00
|
|
|
#define X_KERNBASE 6
|
|
|
|
{ "_kernbase" },
|
1994-05-26 06:35:07 +00:00
|
|
|
{ "" },
|
|
|
|
};
|
1999-05-13 04:29:09 +00:00
|
|
|
int cursyms[] = { X_DUMPLO, X_VERSION, X_DUMPMAG, -1 };
|
1994-05-26 06:35:07 +00:00
|
|
|
int dumpsyms[] = { X_TIME, X_DUMPSIZE, X_VERSION, X_PANICSTR, X_DUMPMAG, -1 };
|
|
|
|
|
|
|
|
struct nlist dump_nl[] = { /* Name list for dumped system. */
|
1999-05-13 04:29:09 +00:00
|
|
|
{ "_dumplo" }, /* Entries MUST be the same as */
|
|
|
|
{ "_time_second" }, /* those in current_nl[]. */
|
1994-05-26 06:35:07 +00:00
|
|
|
{ "_dumpsize" },
|
|
|
|
{ "_version" },
|
|
|
|
{ "_panicstr" },
|
|
|
|
{ "_dumpmag" },
|
2001-08-24 09:26:17 +00:00
|
|
|
{ "_kernbase" },
|
1994-05-26 06:35:07 +00:00
|
|
|
{ "" },
|
|
|
|
};
|
|
|
|
|
|
|
|
/* Types match kernel declarations. */
|
2001-06-09 01:41:03 +00:00
|
|
|
u_long dumpmag; /* magic number in dump */
|
|
|
|
|
|
|
|
/* Based on kernel variables, but with more convenient types. */
|
2000-05-08 22:57:35 +00:00
|
|
|
off_t dumplo; /* where dump starts on dumpdev */
|
2001-06-08 03:06:24 +00:00
|
|
|
off_t dumpsize; /* amount of memory dumped */
|
1994-05-26 06:35:07 +00:00
|
|
|
|
2000-10-17 22:43:41 +00:00
|
|
|
char *kernel; /* user-specified kernel */
|
2000-09-03 07:02:00 +00:00
|
|
|
char *savedir; /* directory to save dumps in */
|
2000-10-17 22:43:41 +00:00
|
|
|
char ddname[MAXPATHLEN]; /* name of dump device */
|
1994-05-26 06:35:07 +00:00
|
|
|
dev_t dumpdev; /* dump device */
|
2000-03-20 06:54:06 +00:00
|
|
|
int dumpfd; /* read/write descriptor on char dev */
|
1994-05-26 06:35:07 +00:00
|
|
|
time_t now; /* current date */
|
2000-10-17 22:43:41 +00:00
|
|
|
char panic_mesg[1024]; /* panic message */
|
|
|
|
int panicstr; /* flag: dump was caused by panic */
|
|
|
|
char vers[1024]; /* version of kernel that crashed */
|
1994-05-26 06:35:07 +00:00
|
|
|
|
2001-08-24 09:26:17 +00:00
|
|
|
#ifdef __i386__
|
|
|
|
u_long kernbase; /* offset of kvm to core file */
|
|
|
|
#endif
|
|
|
|
|
1994-05-26 06:35:07 +00:00
|
|
|
int clear, compress, force, verbose; /* flags */
|
2001-02-16 16:27:32 +00:00
|
|
|
int keep; /* keep dump on device */
|
1994-05-26 06:35:07 +00:00
|
|
|
|
|
|
|
void check_kmem __P((void));
|
|
|
|
int check_space __P((void));
|
|
|
|
void clear_dump __P((void));
|
1999-08-31 18:12:44 +00:00
|
|
|
void DumpRead __P((int fd, void *bp, int size, off_t off, int flag));
|
|
|
|
void DumpWrite __P((int fd, void *bp, int size, off_t off, int flag));
|
1994-05-26 06:35:07 +00:00
|
|
|
int dump_exists __P((void));
|
2000-10-17 22:43:41 +00:00
|
|
|
void find_dev __P((dev_t));
|
1994-05-26 06:35:07 +00:00
|
|
|
int get_crashtime __P((void));
|
1996-10-13 20:55:45 +00:00
|
|
|
void get_dumpsize __P((void));
|
1994-05-26 06:35:07 +00:00
|
|
|
void kmem_setup __P((void));
|
|
|
|
void Lseek __P((int, off_t, int));
|
1994-09-24 00:08:43 +00:00
|
|
|
int Open __P((const char *, int rw));
|
1994-05-26 06:35:07 +00:00
|
|
|
int Read __P((int, void *, int));
|
|
|
|
void save_core __P((void));
|
|
|
|
void usage __P((void));
|
|
|
|
void Write __P((int, void *, int));
|
|
|
|
|
|
|
|
int
|
|
|
|
main(argc, argv)
|
|
|
|
int argc;
|
|
|
|
char *argv[];
|
|
|
|
{
|
|
|
|
int ch;
|
|
|
|
|
|
|
|
openlog("savecore", LOG_PERROR, LOG_DAEMON);
|
|
|
|
|
2001-03-06 01:58:30 +00:00
|
|
|
while ((ch = getopt(argc, argv, "cdfkN:vz")) != -1)
|
1994-05-26 06:35:07 +00:00
|
|
|
switch(ch) {
|
|
|
|
case 'c':
|
|
|
|
clear = 1;
|
|
|
|
break;
|
|
|
|
case 'd': /* Not documented. */
|
|
|
|
case 'v':
|
|
|
|
verbose = 1;
|
|
|
|
break;
|
|
|
|
case 'f':
|
|
|
|
force = 1;
|
|
|
|
break;
|
2001-02-16 16:27:32 +00:00
|
|
|
case 'k':
|
|
|
|
keep = 1;
|
|
|
|
break;
|
1994-05-26 06:35:07 +00:00
|
|
|
case 'N':
|
1994-08-05 09:14:37 +00:00
|
|
|
kernel = optarg;
|
1994-05-26 06:35:07 +00:00
|
|
|
break;
|
|
|
|
case 'z':
|
|
|
|
compress = 1;
|
|
|
|
break;
|
|
|
|
case '?':
|
|
|
|
default:
|
|
|
|
usage();
|
|
|
|
}
|
|
|
|
argc -= optind;
|
|
|
|
argv += optind;
|
|
|
|
|
|
|
|
if (!clear) {
|
|
|
|
if (argc != 1 && argc != 2)
|
|
|
|
usage();
|
2000-09-03 07:02:00 +00:00
|
|
|
savedir = argv[0];
|
1994-05-26 06:35:07 +00:00
|
|
|
}
|
|
|
|
if (argc == 2)
|
1994-08-05 09:14:37 +00:00
|
|
|
kernel = argv[1];
|
1994-05-26 06:35:07 +00:00
|
|
|
|
|
|
|
(void)time(&now);
|
|
|
|
kmem_setup();
|
|
|
|
|
|
|
|
if (clear) {
|
|
|
|
clear_dump();
|
|
|
|
exit(0);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!dump_exists() && !force)
|
|
|
|
exit(1);
|
|
|
|
|
|
|
|
check_kmem();
|
|
|
|
|
|
|
|
if (panicstr)
|
|
|
|
syslog(LOG_ALERT, "reboot after panic: %s", panic_mesg);
|
|
|
|
else
|
|
|
|
syslog(LOG_ALERT, "reboot");
|
|
|
|
|
1996-10-13 18:12:20 +00:00
|
|
|
get_dumpsize();
|
|
|
|
|
1994-05-26 06:35:07 +00:00
|
|
|
if ((!get_crashtime() || !check_space()) && !force)
|
|
|
|
exit(1);
|
|
|
|
|
|
|
|
save_core();
|
|
|
|
|
2001-02-16 16:27:32 +00:00
|
|
|
if (!keep)
|
|
|
|
clear_dump();
|
|
|
|
|
1994-05-26 06:35:07 +00:00
|
|
|
exit(0);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
kmem_setup()
|
|
|
|
{
|
|
|
|
int kmem, i;
|
1994-09-24 00:08:43 +00:00
|
|
|
const char *dump_sys;
|
1999-05-13 04:29:09 +00:00
|
|
|
size_t len;
|
2000-05-09 22:20:14 +00:00
|
|
|
long kdumplo; /* block number where dump starts on dumpdev */
|
2001-02-16 16:27:32 +00:00
|
|
|
char *p;
|
1995-05-30 06:12:45 +00:00
|
|
|
|
1994-05-26 06:35:07 +00:00
|
|
|
/*
|
|
|
|
* Some names we need for the currently running system, others for
|
|
|
|
* the system that was running when the dump was made. The values
|
|
|
|
* obtained from the current system are used to look for things in
|
|
|
|
* /dev/kmem that cannot be found in the dump_sys namelist, but are
|
|
|
|
* presumed to be the same (since the disk partitions are probably
|
|
|
|
* the same!)
|
|
|
|
*/
|
1994-09-24 00:08:43 +00:00
|
|
|
if ((nlist(getbootfile(), current_nl)) == -1)
|
2000-10-17 22:43:41 +00:00
|
|
|
syslog(LOG_ERR, "%s: nlist: %m", getbootfile());
|
1994-05-26 06:35:07 +00:00
|
|
|
for (i = 0; cursyms[i] != -1; i++)
|
|
|
|
if (current_nl[cursyms[i]].n_value == 0) {
|
|
|
|
syslog(LOG_ERR, "%s: %s not in namelist",
|
1994-09-24 00:08:43 +00:00
|
|
|
getbootfile(), current_nl[cursyms[i]].n_name);
|
1994-05-26 06:35:07 +00:00
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
|
1994-09-24 00:08:43 +00:00
|
|
|
dump_sys = kernel ? kernel : getbootfile();
|
1994-05-26 06:35:07 +00:00
|
|
|
if ((nlist(dump_sys, dump_nl)) == -1)
|
2000-10-17 22:43:41 +00:00
|
|
|
syslog(LOG_ERR, "%s: nlist: %m", dump_sys);
|
1994-05-26 06:35:07 +00:00
|
|
|
for (i = 0; dumpsyms[i] != -1; i++)
|
|
|
|
if (dump_nl[dumpsyms[i]].n_value == 0) {
|
|
|
|
syslog(LOG_ERR, "%s: %s not in namelist",
|
|
|
|
dump_sys, dump_nl[dumpsyms[i]].n_name);
|
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
|
2001-08-24 09:26:17 +00:00
|
|
|
#ifdef __i386__
|
|
|
|
if (dump_nl[X_KERNBASE].n_value != 0)
|
|
|
|
kernbase = dump_nl[X_KERNBASE].n_value;
|
|
|
|
else
|
|
|
|
kernbase = KERNBASE;
|
|
|
|
#endif
|
|
|
|
|
1999-05-13 04:29:09 +00:00
|
|
|
len = sizeof dumpdev;
|
2001-02-16 16:27:32 +00:00
|
|
|
if (sysctlbyname("kern.dumpdev", &dumpdev, &len, NULL, 0) == -1) {
|
1999-05-13 04:29:09 +00:00
|
|
|
syslog(LOG_ERR, "sysctl: kern.dumpdev: %m");
|
|
|
|
exit(1);
|
|
|
|
}
|
1994-05-26 06:35:07 +00:00
|
|
|
if (dumpdev == NODEV) {
|
|
|
|
syslog(LOG_WARNING, "no core dump (no dumpdev)");
|
|
|
|
exit(1);
|
|
|
|
}
|
1999-05-13 04:29:09 +00:00
|
|
|
|
|
|
|
kmem = Open(_PATH_KMEM, O_RDONLY);
|
1994-05-26 06:35:07 +00:00
|
|
|
Lseek(kmem, (off_t)current_nl[X_DUMPLO].n_value, L_SET);
|
2000-05-09 01:08:00 +00:00
|
|
|
(void)Read(kmem, &kdumplo, sizeof(kdumplo));
|
2000-05-09 22:20:14 +00:00
|
|
|
dumplo = (off_t)kdumplo * DEV_BSIZE;
|
1994-05-26 06:35:07 +00:00
|
|
|
if (verbose)
|
2000-05-09 22:20:14 +00:00
|
|
|
(void)printf("dumplo = %lld (%ld * %d)\n",
|
|
|
|
(long long)dumplo, kdumplo, DEV_BSIZE);
|
1994-05-26 06:35:07 +00:00
|
|
|
Lseek(kmem, (off_t)current_nl[X_DUMPMAG].n_value, L_SET);
|
|
|
|
(void)Read(kmem, &dumpmag, sizeof(dumpmag));
|
2000-10-17 22:43:41 +00:00
|
|
|
find_dev(dumpdev);
|
1994-05-26 06:35:07 +00:00
|
|
|
dumpfd = Open(ddname, O_RDWR);
|
1994-08-05 09:14:37 +00:00
|
|
|
if (kernel)
|
1994-05-26 06:35:07 +00:00
|
|
|
return;
|
|
|
|
|
2001-09-06 09:30:09 +00:00
|
|
|
Lseek(kmem, (off_t)current_nl[X_VERSION].n_value, SEEK_SET);
|
2001-02-16 16:27:32 +00:00
|
|
|
Read(kmem, vers, sizeof(vers));
|
|
|
|
vers[sizeof(vers) - 1] = '\0';
|
|
|
|
p = strchr(vers, '\n');
|
|
|
|
if (p)
|
|
|
|
p[1] = '\0';
|
|
|
|
|
|
|
|
/* Don't fclose(fp), we use kmem later. */
|
1994-05-26 06:35:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
check_kmem()
|
|
|
|
{
|
1999-08-31 18:12:44 +00:00
|
|
|
char core_vers[1024], *p;
|
|
|
|
|
|
|
|
DumpRead(dumpfd, core_vers, sizeof(core_vers),
|
|
|
|
(off_t)(dumplo + ok(dump_nl[X_VERSION].n_value)), L_SET);
|
|
|
|
core_vers[sizeof(core_vers) - 1] = '\0';
|
|
|
|
p = strchr(core_vers, '\n');
|
|
|
|
if (p)
|
|
|
|
p[1] = '\0';
|
1994-08-05 09:14:37 +00:00
|
|
|
if (strcmp(vers, core_vers) && kernel == 0)
|
1994-05-26 06:35:07 +00:00
|
|
|
syslog(LOG_WARNING,
|
1999-08-31 18:12:44 +00:00
|
|
|
"warning: %s version mismatch:\n\t\"%s\"\nand\t\"%s\"\n",
|
1994-09-24 00:08:43 +00:00
|
|
|
getbootfile(), vers, core_vers);
|
1999-08-31 18:12:44 +00:00
|
|
|
DumpRead(dumpfd, &panicstr, sizeof(panicstr),
|
1994-05-26 06:35:07 +00:00
|
|
|
(off_t)(dumplo + ok(dump_nl[X_PANICSTR].n_value)), L_SET);
|
|
|
|
if (panicstr) {
|
1999-08-31 18:12:44 +00:00
|
|
|
DumpRead(dumpfd, panic_mesg, sizeof(panic_mesg),
|
|
|
|
(off_t)(dumplo + ok(panicstr)), L_SET);
|
1994-05-26 06:35:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2000-10-17 22:43:41 +00:00
|
|
|
/*
|
|
|
|
* Clear the magic number in the dump header.
|
|
|
|
*/
|
1994-05-26 06:35:07 +00:00
|
|
|
void
|
|
|
|
clear_dump()
|
|
|
|
{
|
2000-10-17 22:43:41 +00:00
|
|
|
int newdumpmag;
|
1994-05-26 06:35:07 +00:00
|
|
|
|
2000-10-17 22:43:41 +00:00
|
|
|
newdumpmag = 0;
|
|
|
|
DumpWrite(dumpfd, &newdumpmag, sizeof(newdumpmag),
|
1999-08-31 18:12:44 +00:00
|
|
|
(off_t)(dumplo + ok(dump_nl[X_DUMPMAG].n_value)), L_SET);
|
2000-03-20 06:54:06 +00:00
|
|
|
close(dumpfd);
|
1994-05-26 06:35:07 +00:00
|
|
|
}
|
|
|
|
|
2000-10-17 22:43:41 +00:00
|
|
|
/*
|
|
|
|
* Check if a dump exists by looking for a magic number in the dump
|
|
|
|
* header.
|
|
|
|
*/
|
1994-05-26 06:35:07 +00:00
|
|
|
int
|
|
|
|
dump_exists()
|
|
|
|
{
|
|
|
|
int newdumpmag;
|
|
|
|
|
1999-08-31 18:12:44 +00:00
|
|
|
DumpRead(dumpfd, &newdumpmag, sizeof(newdumpmag),
|
|
|
|
(off_t)(dumplo + ok(dump_nl[X_DUMPMAG].n_value)), L_SET);
|
1994-05-26 06:35:07 +00:00
|
|
|
if (newdumpmag != dumpmag) {
|
|
|
|
if (verbose)
|
|
|
|
syslog(LOG_WARNING, "magic number mismatch (%x != %x)",
|
|
|
|
newdumpmag, dumpmag);
|
|
|
|
syslog(LOG_WARNING, "no core dump");
|
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
return (1);
|
|
|
|
}
|
|
|
|
|
|
|
|
char buf[1024 * 1024];
|
2001-02-16 16:27:32 +00:00
|
|
|
#define BLOCKSIZE (1<<12)
|
|
|
|
#define BLOCKMASK (~(BLOCKSIZE-1))
|
1994-05-26 06:35:07 +00:00
|
|
|
|
2000-10-17 22:43:41 +00:00
|
|
|
/*
|
|
|
|
* Save the core dump.
|
|
|
|
*/
|
1994-05-26 06:35:07 +00:00
|
|
|
void
|
|
|
|
save_core()
|
|
|
|
{
|
|
|
|
register FILE *fp;
|
2000-09-28 20:09:36 +00:00
|
|
|
register int bounds, ifd, nr, nw;
|
2001-02-16 16:27:32 +00:00
|
|
|
int hs, he; /* start and end of hole */
|
2000-03-20 06:54:06 +00:00
|
|
|
char path[MAXPATHLEN];
|
1996-10-13 20:55:45 +00:00
|
|
|
mode_t oumask;
|
1994-05-26 06:35:07 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Get the current number and update the bounds file. Do the update
|
|
|
|
* now, because may fail later and don't want to overwrite anything.
|
|
|
|
*/
|
2000-09-03 07:02:00 +00:00
|
|
|
(void)snprintf(path, sizeof(path), "%s/bounds", savedir);
|
1994-05-26 06:35:07 +00:00
|
|
|
if ((fp = fopen(path, "r")) == NULL)
|
|
|
|
goto err1;
|
|
|
|
if (fgets(buf, sizeof(buf), fp) == NULL) {
|
|
|
|
if (ferror(fp))
|
2000-10-17 22:43:41 +00:00
|
|
|
err1: syslog(LOG_WARNING, "%s: %m", path);
|
1994-05-26 06:35:07 +00:00
|
|
|
bounds = 0;
|
|
|
|
} else
|
|
|
|
bounds = atoi(buf);
|
|
|
|
if (fp != NULL)
|
|
|
|
(void)fclose(fp);
|
|
|
|
if ((fp = fopen(path, "w")) == NULL)
|
|
|
|
syslog(LOG_ERR, "%s: %m", path);
|
|
|
|
else {
|
|
|
|
(void)fprintf(fp, "%d\n", bounds + 1);
|
|
|
|
(void)fclose(fp);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Create the core file. */
|
1996-10-13 20:55:45 +00:00
|
|
|
oumask = umask(S_IRWXG|S_IRWXO); /* Restrict access to the core file.*/
|
1994-05-26 06:35:07 +00:00
|
|
|
(void)snprintf(path, sizeof(path), "%s/vmcore.%d%s",
|
2001-09-06 09:30:09 +00:00
|
|
|
savedir, bounds, compress ? ".gz" : "");
|
2000-09-28 20:09:36 +00:00
|
|
|
if (compress)
|
2001-09-06 09:30:09 +00:00
|
|
|
fp = zopen(path, "w");
|
2000-09-28 20:09:36 +00:00
|
|
|
else
|
|
|
|
fp = fopen(path, "w");
|
|
|
|
if (fp == NULL) {
|
2000-10-17 22:43:41 +00:00
|
|
|
syslog(LOG_ERR, "%s: %m", path);
|
2000-09-28 20:09:36 +00:00
|
|
|
exit(1);
|
|
|
|
}
|
1996-10-13 20:55:45 +00:00
|
|
|
(void)umask(oumask);
|
1994-05-26 06:35:07 +00:00
|
|
|
|
|
|
|
/* Seek to the start of the core. */
|
2000-03-20 06:54:06 +00:00
|
|
|
Lseek(dumpfd, (off_t)dumplo, L_SET);
|
1994-05-26 06:35:07 +00:00
|
|
|
|
|
|
|
/* Copy the core file. */
|
|
|
|
syslog(LOG_NOTICE, "writing %score to %s",
|
|
|
|
compress ? "compressed " : "", path);
|
|
|
|
for (; dumpsize > 0; dumpsize -= nr) {
|
|
|
|
(void)printf("%6dK\r", dumpsize / 1024);
|
|
|
|
(void)fflush(stdout);
|
2000-03-20 06:54:06 +00:00
|
|
|
nr = read(dumpfd, buf, MIN(dumpsize, sizeof(buf)));
|
1994-05-26 06:35:07 +00:00
|
|
|
if (nr <= 0) {
|
|
|
|
if (nr == 0)
|
|
|
|
syslog(LOG_WARNING,
|
|
|
|
"WARNING: EOF on dump device");
|
|
|
|
else
|
2000-03-20 06:54:06 +00:00
|
|
|
syslog(LOG_ERR, "%s: %m", ddname);
|
1994-05-26 06:35:07 +00:00
|
|
|
goto err2;
|
|
|
|
}
|
2001-02-16 16:27:32 +00:00
|
|
|
|
2001-09-06 09:30:09 +00:00
|
|
|
if (compress) {
|
|
|
|
nw = fwrite(buf, 1, nr, fp);
|
|
|
|
} else {
|
|
|
|
for (nw = 0; nw < nr; nw = he) {
|
|
|
|
/* find a contiguous block of zeroes */
|
|
|
|
for (hs = nw; hs < nr; hs += BLOCKSIZE) {
|
|
|
|
for (he = hs; he < nr && buf[he] == 0; ++he)
|
|
|
|
/* nothing */ ;
|
2001-02-16 16:27:32 +00:00
|
|
|
/* is the hole long enough to matter? */
|
|
|
|
if (he >= hs + BLOCKSIZE)
|
2001-09-06 09:30:09 +00:00
|
|
|
break;
|
|
|
|
}
|
2001-02-16 16:27:32 +00:00
|
|
|
|
2001-09-06 09:30:09 +00:00
|
|
|
/* back down to a block boundary */
|
|
|
|
he &= BLOCKMASK;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* 1) Don't go beyond the end of the buffer.
|
|
|
|
* 2) If the end of the buffer is less than
|
|
|
|
* BLOCKSIZE bytes away, we're at the end
|
|
|
|
* of the file, so just grab what's left.
|
|
|
|
*/
|
|
|
|
if (hs + BLOCKSIZE > nr)
|
2001-02-16 16:27:32 +00:00
|
|
|
hs = he = nr;
|
|
|
|
|
2001-09-06 09:30:09 +00:00
|
|
|
/*
|
|
|
|
* At this point, we have a partial ordering:
|
|
|
|
* nw <= hs <= he <= nr
|
|
|
|
* If hs > nw, buf[nw..hs] contains non-zero data.
|
|
|
|
* If he > hs, buf[hs..he] is all zeroes.
|
|
|
|
*/
|
|
|
|
if (hs > nw)
|
2001-02-16 16:27:32 +00:00
|
|
|
if (fwrite(buf + nw, hs - nw, 1, fp) != 1)
|
2001-09-06 09:30:09 +00:00
|
|
|
break;
|
|
|
|
if (he > hs)
|
2001-02-16 16:27:32 +00:00
|
|
|
if (fseek(fp, he - hs, SEEK_CUR) == -1)
|
2001-09-06 09:30:09 +00:00
|
|
|
break;
|
|
|
|
}
|
2001-02-16 16:27:32 +00:00
|
|
|
}
|
1994-05-26 06:35:07 +00:00
|
|
|
if (nw != nr) {
|
2000-10-17 22:43:41 +00:00
|
|
|
syslog(LOG_ERR, "%s: %m", path);
|
1994-05-26 06:35:07 +00:00
|
|
|
err2: syslog(LOG_WARNING,
|
|
|
|
"WARNING: vmcore may be incomplete");
|
|
|
|
(void)printf("\n");
|
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
}
|
2000-03-20 06:54:06 +00:00
|
|
|
|
2000-09-28 20:09:36 +00:00
|
|
|
(void)fclose(fp);
|
1994-05-26 06:35:07 +00:00
|
|
|
|
|
|
|
/* Copy the kernel. */
|
1994-09-24 00:08:43 +00:00
|
|
|
ifd = Open(kernel ? kernel : getbootfile(), O_RDONLY);
|
1994-08-05 09:14:37 +00:00
|
|
|
(void)snprintf(path, sizeof(path), "%s/kernel.%d%s",
|
2001-09-06 09:30:09 +00:00
|
|
|
savedir, bounds, compress ? ".gz" : "");
|
2000-09-28 20:09:36 +00:00
|
|
|
if (compress)
|
2001-09-06 09:30:09 +00:00
|
|
|
fp = zopen(path, "w");
|
2000-09-28 20:09:36 +00:00
|
|
|
else
|
|
|
|
fp = fopen(path, "w");
|
|
|
|
if (fp == NULL) {
|
2000-10-17 22:43:41 +00:00
|
|
|
syslog(LOG_ERR, "%s: %m", path);
|
2000-09-28 20:09:36 +00:00
|
|
|
exit(1);
|
|
|
|
}
|
1994-05-26 06:35:07 +00:00
|
|
|
syslog(LOG_NOTICE, "writing %skernel to %s",
|
|
|
|
compress ? "compressed " : "", path);
|
|
|
|
while ((nr = read(ifd, buf, sizeof(buf))) > 0) {
|
2000-09-28 20:09:36 +00:00
|
|
|
nw = fwrite(buf, 1, nr, fp);
|
1994-05-26 06:35:07 +00:00
|
|
|
if (nw != nr) {
|
2000-10-17 22:43:41 +00:00
|
|
|
syslog(LOG_ERR, "%s: %m", path);
|
1994-05-26 06:35:07 +00:00
|
|
|
syslog(LOG_WARNING,
|
1994-08-05 09:14:37 +00:00
|
|
|
"WARNING: kernel may be incomplete");
|
1994-05-26 06:35:07 +00:00
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (nr < 0) {
|
2000-10-17 22:43:41 +00:00
|
|
|
syslog(LOG_ERR, "%s: %m", kernel ? kernel : getbootfile());
|
1994-05-26 06:35:07 +00:00
|
|
|
syslog(LOG_WARNING,
|
1994-08-05 09:14:37 +00:00
|
|
|
"WARNING: kernel may be incomplete");
|
1994-05-26 06:35:07 +00:00
|
|
|
exit(1);
|
|
|
|
}
|
2000-09-28 20:09:36 +00:00
|
|
|
(void)fclose(fp);
|
2000-03-20 06:54:06 +00:00
|
|
|
close(ifd);
|
1994-05-26 06:35:07 +00:00
|
|
|
}
|
|
|
|
|
2000-10-17 22:43:41 +00:00
|
|
|
/*
|
|
|
|
* Verify that the specified device node exists and matches the
|
|
|
|
* specified device.
|
|
|
|
*/
|
|
|
|
int
|
|
|
|
verify_dev(name, dev)
|
|
|
|
char *name;
|
|
|
|
register dev_t dev;
|
|
|
|
{
|
|
|
|
struct stat sb;
|
|
|
|
|
|
|
|
if (lstat(name, &sb) == -1)
|
|
|
|
return (-1);
|
|
|
|
if (!S_ISCHR(sb.st_mode) || sb.st_rdev != dev)
|
|
|
|
return (-1);
|
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Find the dump device.
|
|
|
|
*
|
|
|
|
* 1) try devname(3); see if it returns something sensible
|
|
|
|
* 2) scan /dev for the desired node
|
|
|
|
* 3) as a last resort, try to create the node we need
|
|
|
|
*/
|
|
|
|
void
|
1999-11-30 03:48:04 +00:00
|
|
|
find_dev(dev)
|
1994-05-26 06:35:07 +00:00
|
|
|
register dev_t dev;
|
|
|
|
{
|
2000-10-17 22:43:41 +00:00
|
|
|
struct dirent *ent;
|
|
|
|
char *dn, *dnp;
|
|
|
|
DIR *d;
|
2000-09-28 20:09:36 +00:00
|
|
|
|
2000-10-17 22:43:41 +00:00
|
|
|
strcpy(ddname, _PATH_DEV);
|
|
|
|
dnp = ddname + sizeof _PATH_DEV - 1;
|
2000-09-28 20:09:36 +00:00
|
|
|
if ((dn = devname(dev, S_IFCHR)) != NULL) {
|
2000-10-17 22:43:41 +00:00
|
|
|
strcpy(dnp, dn);
|
|
|
|
if (verify_dev(ddname, dev) == 0)
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if ((d = opendir(_PATH_DEV)) != NULL) {
|
|
|
|
while ((ent = readdir(d))) {
|
|
|
|
strcpy(dnp, ent->d_name);
|
|
|
|
if (verify_dev(ddname, dev) == 0) {
|
|
|
|
closedir(d);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
closedir(d);
|
1994-05-26 06:35:07 +00:00
|
|
|
}
|
2000-10-17 22:43:41 +00:00
|
|
|
strcpy(dnp, "dump");
|
|
|
|
if (mknod(ddname, S_IFCHR|S_IRUSR|S_IWUSR, dev) == 0)
|
|
|
|
return;
|
|
|
|
syslog(LOG_ERR, "can't find device %d/%#x", major(dev), minor(dev));
|
1994-05-26 06:35:07 +00:00
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
|
2000-10-17 22:43:41 +00:00
|
|
|
/*
|
|
|
|
* Extract the date and time of the crash from the dump header, and
|
|
|
|
* make sure it looks sane (within one week of current date and time).
|
|
|
|
*/
|
1994-05-26 06:35:07 +00:00
|
|
|
int
|
|
|
|
get_crashtime()
|
|
|
|
{
|
|
|
|
time_t dumptime; /* Time the dump was taken. */
|
|
|
|
|
1999-08-31 18:12:44 +00:00
|
|
|
DumpRead(dumpfd, &dumptime, sizeof(dumptime),
|
|
|
|
(off_t)(dumplo + ok(dump_nl[X_TIME].n_value)), L_SET);
|
1994-05-26 06:35:07 +00:00
|
|
|
if (dumptime == 0) {
|
|
|
|
if (verbose)
|
|
|
|
syslog(LOG_ERR, "dump time is zero");
|
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
(void)printf("savecore: system went down at %s", ctime(&dumptime));
|
1995-08-07 19:17:46 +00:00
|
|
|
#define LEEWAY (7 * 86400)
|
1994-05-26 06:35:07 +00:00
|
|
|
if (dumptime < now - LEEWAY || dumptime > now + LEEWAY) {
|
|
|
|
(void)printf("dump time is unreasonable\n");
|
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
return (1);
|
|
|
|
}
|
|
|
|
|
2000-10-17 22:43:41 +00:00
|
|
|
/*
|
|
|
|
* Extract the size of the dump from the dump header.
|
|
|
|
*/
|
1996-10-13 20:55:45 +00:00
|
|
|
void
|
1996-10-13 18:12:20 +00:00
|
|
|
get_dumpsize()
|
|
|
|
{
|
2001-06-09 01:41:03 +00:00
|
|
|
int kdumpsize;
|
2001-06-08 03:06:24 +00:00
|
|
|
|
1996-10-13 18:12:20 +00:00
|
|
|
/* Read the dump size. */
|
2001-06-09 01:41:03 +00:00
|
|
|
DumpRead(dumpfd, &kdumpsize, sizeof(kdumpsize),
|
1999-08-31 18:12:44 +00:00
|
|
|
(off_t)(dumplo + ok(dump_nl[X_DUMPSIZE].n_value)), L_SET);
|
2001-06-09 01:41:03 +00:00
|
|
|
dumpsize = kdumpsize * getpagesize();
|
1996-10-13 18:12:20 +00:00
|
|
|
}
|
|
|
|
|
2000-10-17 22:43:41 +00:00
|
|
|
/*
|
|
|
|
* Check that sufficient space is available on the disk that holds the
|
|
|
|
* save directory.
|
|
|
|
*/
|
1994-05-26 06:35:07 +00:00
|
|
|
int
|
|
|
|
check_space()
|
|
|
|
{
|
|
|
|
register FILE *fp;
|
1994-09-24 00:08:43 +00:00
|
|
|
const char *tkernel;
|
1996-10-13 18:12:20 +00:00
|
|
|
off_t minfree, spacefree, totfree, kernelsize, needed;
|
1994-05-26 06:35:07 +00:00
|
|
|
struct stat st;
|
|
|
|
struct statfs fsbuf;
|
|
|
|
char buf[100], path[MAXPATHLEN];
|
|
|
|
|
1994-09-24 00:08:43 +00:00
|
|
|
tkernel = kernel ? kernel : getbootfile();
|
1994-08-05 09:14:37 +00:00
|
|
|
if (stat(tkernel, &st) < 0) {
|
|
|
|
syslog(LOG_ERR, "%s: %m", tkernel);
|
1994-05-26 06:35:07 +00:00
|
|
|
exit(1);
|
|
|
|
}
|
1996-10-14 22:56:01 +00:00
|
|
|
kernelsize = st.st_blocks * S_BLKSIZE;
|
1996-10-13 18:12:20 +00:00
|
|
|
|
2000-09-03 07:02:00 +00:00
|
|
|
if (statfs(savedir, &fsbuf) < 0) {
|
|
|
|
syslog(LOG_ERR, "%s: %m", savedir);
|
1994-05-26 06:35:07 +00:00
|
|
|
exit(1);
|
|
|
|
}
|
1996-09-05 08:08:41 +00:00
|
|
|
spacefree = ((off_t) fsbuf.f_bavail * fsbuf.f_bsize) / 1024;
|
1996-10-13 18:12:20 +00:00
|
|
|
totfree = ((off_t) fsbuf.f_bfree * fsbuf.f_bsize) / 1024;
|
1994-05-26 06:35:07 +00:00
|
|
|
|
2000-09-03 07:02:00 +00:00
|
|
|
(void)snprintf(path, sizeof(path), "%s/minfree", savedir);
|
1994-05-26 06:35:07 +00:00
|
|
|
if ((fp = fopen(path, "r")) == NULL)
|
|
|
|
minfree = 0;
|
|
|
|
else {
|
|
|
|
if (fgets(buf, sizeof(buf), fp) == NULL)
|
|
|
|
minfree = 0;
|
|
|
|
else
|
|
|
|
minfree = atoi(buf);
|
|
|
|
(void)fclose(fp);
|
|
|
|
}
|
|
|
|
|
1994-08-05 09:14:37 +00:00
|
|
|
needed = (dumpsize + kernelsize) / 1024;
|
1996-10-13 18:12:20 +00:00
|
|
|
if (((minfree > 0) ? spacefree : totfree) - needed < minfree) {
|
1994-05-26 06:35:07 +00:00
|
|
|
syslog(LOG_WARNING,
|
2000-03-20 20:07:28 +00:00
|
|
|
"no dump, not enough free space on device (%lld available, need %lld)",
|
|
|
|
(long long)(minfree > 0 ? spacefree : totfree),
|
|
|
|
(long long)needed);
|
1994-05-26 06:35:07 +00:00
|
|
|
return (0);
|
|
|
|
}
|
1996-10-13 18:12:20 +00:00
|
|
|
if (spacefree - needed < 0)
|
1994-05-26 06:35:07 +00:00
|
|
|
syslog(LOG_WARNING,
|
|
|
|
"dump performed, but free space threshold crossed");
|
|
|
|
return (1);
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
Open(name, rw)
|
1994-09-24 00:08:43 +00:00
|
|
|
const char *name;
|
1994-05-26 06:35:07 +00:00
|
|
|
int rw;
|
|
|
|
{
|
|
|
|
int fd;
|
|
|
|
|
|
|
|
if ((fd = open(name, rw, 0)) < 0) {
|
|
|
|
syslog(LOG_ERR, "%s: %m", name);
|
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
return (fd);
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
Read(fd, bp, size)
|
|
|
|
int fd, size;
|
|
|
|
void *bp;
|
|
|
|
{
|
|
|
|
int nr;
|
|
|
|
|
|
|
|
nr = read(fd, bp, size);
|
|
|
|
if (nr != size) {
|
|
|
|
syslog(LOG_ERR, "read: %m");
|
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
return (nr);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
Lseek(fd, off, flag)
|
|
|
|
int fd, flag;
|
|
|
|
off_t off;
|
|
|
|
{
|
|
|
|
off_t ret;
|
|
|
|
|
|
|
|
ret = lseek(fd, off, flag);
|
|
|
|
if (ret == -1) {
|
|
|
|
syslog(LOG_ERR, "lseek: %m");
|
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
1999-08-31 18:12:44 +00:00
|
|
|
/*
|
|
|
|
* DumpWrite and DumpRead block io requests to the * dump device.
|
|
|
|
*/
|
|
|
|
#define DUMPBUFSIZE 8192
|
|
|
|
void
|
|
|
|
DumpWrite(fd, bp, size, off, flag)
|
|
|
|
int fd, size, flag;
|
|
|
|
void *bp;
|
|
|
|
off_t off;
|
|
|
|
{
|
|
|
|
unsigned char buf[DUMPBUFSIZE], *p, *q;
|
|
|
|
off_t pos;
|
|
|
|
int i, j;
|
|
|
|
|
|
|
|
if (flag != L_SET) {
|
|
|
|
syslog(LOG_ERR, "lseek: not LSET");
|
|
|
|
exit(2);
|
|
|
|
}
|
|
|
|
q = bp;
|
|
|
|
while (size) {
|
|
|
|
pos = off & ~(DUMPBUFSIZE - 1);
|
|
|
|
Lseek(fd, pos, flag);
|
|
|
|
(void)Read(fd, buf, sizeof(buf));
|
|
|
|
j = off & (DUMPBUFSIZE - 1);
|
|
|
|
p = buf + j;
|
|
|
|
i = size;
|
|
|
|
if (i > DUMPBUFSIZE - j)
|
|
|
|
i = DUMPBUFSIZE - j;
|
|
|
|
memcpy(p, q, i);
|
|
|
|
Lseek(fd, pos, flag);
|
|
|
|
(void)Write(fd, buf, sizeof(buf));
|
|
|
|
size -= i;
|
|
|
|
q += i;
|
|
|
|
off += i;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
DumpRead(fd, bp, size, off, flag)
|
|
|
|
int fd, size, flag;
|
|
|
|
void *bp;
|
|
|
|
off_t off;
|
|
|
|
{
|
|
|
|
unsigned char buf[DUMPBUFSIZE], *p, *q;
|
|
|
|
off_t pos;
|
|
|
|
int i, j;
|
|
|
|
|
|
|
|
if (flag != L_SET) {
|
|
|
|
syslog(LOG_ERR, "lseek: not LSET");
|
|
|
|
exit(2);
|
|
|
|
}
|
|
|
|
q = bp;
|
|
|
|
while (size) {
|
|
|
|
pos = off & ~(DUMPBUFSIZE - 1);
|
|
|
|
Lseek(fd, pos, flag);
|
|
|
|
(void)Read(fd, buf, sizeof(buf));
|
|
|
|
j = off & (DUMPBUFSIZE - 1);
|
|
|
|
p = buf + j;
|
|
|
|
i = size;
|
|
|
|
if (i > DUMPBUFSIZE - j)
|
|
|
|
i = DUMPBUFSIZE - j;
|
|
|
|
memcpy(q, p, i);
|
|
|
|
size -= i;
|
|
|
|
q += i;
|
|
|
|
off += i;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
1994-05-26 06:35:07 +00:00
|
|
|
void
|
|
|
|
Write(fd, bp, size)
|
|
|
|
int fd, size;
|
|
|
|
void *bp;
|
|
|
|
{
|
|
|
|
int n;
|
|
|
|
|
|
|
|
if ((n = write(fd, bp, size)) < size) {
|
2000-10-17 22:43:41 +00:00
|
|
|
syslog(LOG_ERR, "write: %m");
|
1994-05-26 06:35:07 +00:00
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
usage()
|
|
|
|
{
|
2001-02-16 16:28:36 +00:00
|
|
|
(void)syslog(LOG_ERR, "usage: savecore [-cfkvz] [-N system] directory");
|
1994-05-26 06:35:07 +00:00
|
|
|
exit(1);
|
|
|
|
}
|