2 * SPDX-License-Identifier: BSD-3-Clause
4 * Copyright (c) 2002 Poul-Henning Kamp
5 * Copyright (c) 2002 Networks Associates Technology, Inc.
8 * This software was developed for the FreeBSD Project by Poul-Henning Kamp
9 * and NAI Labs, the Security Research Division of Network Associates, Inc.
10 * under DARPA/SPAWAR contract N66001-01-C-8035 ("CBOSS"), as part of the
11 * DARPA CHATS research program.
13 * Redistribution and use in source and binary forms, with or without
14 * modification, are permitted provided that the following conditions
16 * 1. Redistributions of source code must retain the above copyright
17 * notice, this list of conditions and the following disclaimer.
18 * 2. Redistributions in binary form must reproduce the above copyright
19 * notice, this list of conditions and the following disclaimer in the
20 * documentation and/or other materials provided with the distribution.
21 * 3. The names of the authors may not be used to endorse or promote
22 * products derived from this software without specific prior written
25 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
26 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
28 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
29 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
30 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
31 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
32 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
33 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
34 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
37 * Copyright (c) 1986, 1992, 1993
38 * The Regents of the University of California. All rights reserved.
40 * Redistribution and use in source and binary forms, with or without
41 * modification, are permitted provided that the following conditions
43 * 1. Redistributions of source code must retain the above copyright
44 * notice, this list of conditions and the following disclaimer.
45 * 2. Redistributions in binary form must reproduce the above copyright
46 * notice, this list of conditions and the following disclaimer in the
47 * documentation and/or other materials provided with the distribution.
48 * 3. Neither the name of the University nor the names of its contributors
49 * may be used to endorse or promote products derived from this software
50 * without specific prior written permission.
52 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
53 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
54 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
55 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
56 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
57 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
58 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
59 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
60 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
61 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
65 #include <sys/cdefs.h>
66 __FBSDID("$FreeBSD$");
68 #include <sys/param.h>
70 #include <sys/kerneldump.h>
71 #include <sys/mount.h>
89 /* The size of the buffer used for I/O. */
90 #define BUFFERSIZE (1024*1024)
94 #define STATUS_UNKNOWN 2
96 static int checkfor, compress, clear, force, keep, verbose; /* flags */
97 static int nfound, nsaved, nerr; /* statistics */
100 extern FILE *zopen(const char *, const char *);
102 static sig_atomic_t got_siginfo;
103 static void infohandler(int);
106 printheader(xo_handle_t *xo, const struct kerneldumpheader *h,
107 const char *device, int bounds, const int status)
111 const char *stat_str;
114 xo_emit_h(xo, "{Lwc:Dump header from device}{:dump_device/%s}\n",
116 xo_emit_h(xo, "{P: }{Lwc:Architecture}{:architecture/%s}\n",
119 "{P: }{Lwc:Architecture Version}{:architecture_version/%u}\n",
120 dtoh32(h->architectureversion));
121 dumplen = dtoh64(h->dumplength);
122 xo_emit_h(xo, "{P: }{Lwc:Dump Length}{:dump_length_bytes/%lld}\n",
124 xo_emit_h(xo, "{P: }{Lwc:Blocksize}{:blocksize/%d}\n",
125 dtoh32(h->blocksize));
126 xo_emit_h(xo, "{P: }{Lwc:Compression}{:compression/%s}\n",
127 h->compression == KERNELDUMP_COMP_GZIP ?
130 t = dtoh64(h->dumptime);
131 xo_emit_h(xo, "{P: }{Lwc:Dumptime}{:dumptime/%s}", ctime(&t));
132 xo_emit_h(xo, "{P: }{Lwc:Hostname}{:hostname/%s}\n", h->hostname);
133 xo_emit_h(xo, "{P: }{Lwc:Magic}{:magic/%s}\n", h->magic);
134 xo_emit_h(xo, "{P: }{Lwc:Version String}{:version_string/%s}",
136 xo_emit_h(xo, "{P: }{Lwc:Panic String}{:panic_string/%s}\n",
138 xo_emit_h(xo, "{P: }{Lwc:Dump Parity}{:dump_parity/%u}\n", h->parity);
139 xo_emit_h(xo, "{P: }{Lwc:Bounds}{:bounds/%d}\n", bounds);
149 stat_str = "unknown";
152 xo_emit_h(xo, "{P: }{Lwc:Dump Status}{:dump_status/%s}\n", stat_str);
165 if ((fp = fopen("bounds", "r")) == NULL) {
167 printf("unable to open bounds file, using 0\n");
171 if (fgets(buf, sizeof buf, fp) == NULL) {
173 syslog(LOG_WARNING, "bounds file is empty, using 0");
175 syslog(LOG_WARNING, "bounds file: %s", strerror(errno));
181 ret = (int)strtol(buf, NULL, 10);
182 if (ret == 0 && (errno == EINVAL || errno == ERANGE))
183 syslog(LOG_WARNING, "invalid value found in bounds, using 0");
189 writebounds(int bounds)
193 if ((fp = fopen("bounds", "w")) == NULL) {
194 syslog(LOG_WARNING, "unable to write to bounds file: %m");
199 printf("bounds number: %d\n", bounds);
201 fprintf(fp, "%d\n", bounds);
206 writekey(const char *keyname, uint8_t *dumpkey, uint32_t dumpkeysize)
210 fd = open(keyname, O_WRONLY | O_CREAT | O_TRUNC, 0600);
212 syslog(LOG_ERR, "Unable to open %s to write the key: %m.",
217 if (write(fd, dumpkey, dumpkeysize) != (ssize_t)dumpkeysize) {
218 syslog(LOG_ERR, "Unable to write the key to %s: %m.", keyname);
228 file_size(const char *path)
232 /* Ignore all errors, those file may not exists. */
233 if (stat(path, &sb) == -1)
239 saved_dump_size(int bounds)
241 static char path[PATH_MAX];
246 (void)snprintf(path, sizeof(path), "info.%d", bounds);
247 dumpsize += file_size(path);
248 (void)snprintf(path, sizeof(path), "vmcore.%d", bounds);
249 dumpsize += file_size(path);
250 (void)snprintf(path, sizeof(path), "vmcore.%d.gz", bounds);
251 dumpsize += file_size(path);
252 (void)snprintf(path, sizeof(path), "textdump.tar.%d", bounds);
253 dumpsize += file_size(path);
254 (void)snprintf(path, sizeof(path), "textdump.tar.%d.gz", bounds);
255 dumpsize += file_size(path);
261 saved_dump_remove(int bounds)
263 static char path[PATH_MAX];
265 (void)snprintf(path, sizeof(path), "info.%d", bounds);
267 (void)snprintf(path, sizeof(path), "vmcore.%d", bounds);
269 (void)snprintf(path, sizeof(path), "vmcore.%d.gz", bounds);
271 (void)snprintf(path, sizeof(path), "textdump.tar.%d", bounds);
273 (void)snprintf(path, sizeof(path), "textdump.tar.%d.gz", bounds);
278 symlinks_remove(void)
281 (void)unlink("info.last");
282 (void)unlink("key.last");
283 (void)unlink("vmcore.last");
284 (void)unlink("vmcore.last.gz");
285 (void)unlink("vmcore_encrypted.last");
286 (void)unlink("vmcore_encrypted.last.gz");
287 (void)unlink("textdump.tar.last");
288 (void)unlink("textdump.tar.last.gz");
292 * Check that sufficient space is available on the disk that holds the
296 check_space(const char *savedir, off_t dumpsize, int bounds)
299 off_t available, minfree, spacefree, totfree, needed;
303 if (statfs(".", &fsbuf) < 0) {
304 syslog(LOG_ERR, "%s: %m", savedir);
307 spacefree = ((off_t) fsbuf.f_bavail * fsbuf.f_bsize) / 1024;
308 totfree = ((off_t) fsbuf.f_bfree * fsbuf.f_bsize) / 1024;
310 if ((fp = fopen("minfree", "r")) == NULL)
313 if (fgets(buf, sizeof(buf), fp) == NULL)
319 minfree = strtoll(buf, &endp, 10);
320 if (minfree == 0 && errno != 0)
323 while (*endp != '\0' && isspace(*endp))
325 if (*endp != '\0' || minfree < 0)
330 "`minfree` didn't contain a valid size "
331 "(`%s`). Defaulting to 0", buf);
336 available = minfree > 0 ? spacefree - minfree : totfree;
337 needed = dumpsize / 1024 + 2; /* 2 for info file */
338 needed -= saved_dump_size(bounds);
339 if (available < needed) {
341 "no dump: not enough free space on device (need at least "
342 "%jdkB for dump; %jdkB available; %jdkB reserved)",
344 (intmax_t)available + minfree,
348 if (spacefree - needed < 0)
350 "dump performed, but free space threshold crossed");
355 compare_magic(const struct kerneldumpheader *kdh, const char *magic)
358 return (strncmp(kdh->magic, magic, sizeof(kdh->magic)) == 0);
361 #define BLOCKSIZE (1<<12)
362 #define BLOCKMASK (~(BLOCKSIZE-1))
365 DoRegularFile(int fd, off_t dumpsize, u_int sectorsize, bool sparse, char *buf,
366 const char *device, const char *filename, FILE *fp)
368 int he, hs, nr, nw, wl;
369 off_t dmpcnt, origsize;
374 while (dumpsize > 0) {
378 nr = read(fd, buf, roundup(wl, sectorsize));
379 if (nr != (int)roundup(wl, sectorsize)) {
382 "WARNING: EOF on dump device");
384 syslog(LOG_ERR, "read error on %s: %m", device);
389 nw = fwrite(buf, 1, wl, fp);
391 for (nw = 0; nw < nr; nw = he) {
392 /* find a contiguous block of zeroes */
393 for (hs = nw; hs < nr; hs += BLOCKSIZE) {
394 for (he = hs; he < nr && buf[he] == 0;
397 /* is the hole long enough to matter? */
398 if (he >= hs + BLOCKSIZE)
402 /* back down to a block boundary */
406 * 1) Don't go beyond the end of the buffer.
407 * 2) If the end of the buffer is less than
408 * BLOCKSIZE bytes away, we're at the end
409 * of the file, so just grab what's left.
411 if (hs + BLOCKSIZE > nr)
415 * At this point, we have a partial ordering:
416 * nw <= hs <= he <= nr
417 * If hs > nw, buf[nw..hs] contains non-zero
418 * data. If he > hs, buf[hs..he] is all zeroes.
421 if (fwrite(buf + nw, hs - nw, 1, fp)
425 if (fseeko(fp, he - hs, SEEK_CUR) == -1)
431 "write error on %s file: %m", filename);
433 "WARNING: vmcore may be incomplete");
439 printf("%llu\r", (unsigned long long)dmpcnt);
444 printf("%s %.1lf%%\n", filename, (100.0 - (100.0 *
445 (double)dumpsize / (double)origsize)));
453 * Specialized version of dump-reading logic for use with textdumps, which
454 * are written backwards from the end of the partition, and must be reversed
455 * before being written to the file. Textdumps are small, so do a bit less
456 * work to optimize/sparsify.
459 DoTextdumpFile(int fd, off_t dumpsize, off_t lasthd, char *buf,
460 const char *device, const char *filename, FILE *fp)
463 off_t dmpcnt, totsize;
468 if ((dumpsize % wl) != 0) {
469 syslog(LOG_ERR, "textdump uneven multiple of 512 on %s",
474 while (dumpsize > 0) {
475 nr = pread(fd, buf, wl, lasthd - (totsize - dumpsize) - wl);
479 "WARNING: EOF on dump device");
481 syslog(LOG_ERR, "read error on %s: %m", device);
485 nw = fwrite(buf, 1, wl, fp);
488 "write error on %s file: %m", filename);
490 "WARNING: textdump may be incomplete");
496 printf("%llu\r", (unsigned long long)dmpcnt);
505 DoFile(const char *savedir, const char *device)
507 xo_handle_t *xostdout, *xoinfo;
508 static char infoname[PATH_MAX], corename[PATH_MAX], linkname[PATH_MAX];
509 static char keyname[PATH_MAX];
510 static char *buf = NULL;
512 struct kerneldumpheader kdhf, kdhl;
514 off_t mediasize, dumpextent, dumplength, firsthd, lasthd;
517 int fd, fdinfo, error;
519 u_int sectorsize, xostyle;
520 uint32_t dumpkeysize;
521 bool iscompressed, isencrypted, istextdump, ret;
523 bounds = getbounds();
526 status = STATUS_UNKNOWN;
528 xostdout = xo_create_to_file(stdout, XO_STYLE_TEXT, 0);
529 if (xostdout == NULL) {
530 syslog(LOG_ERR, "%s: %m", infoname);
534 if (maxdumps > 0 && bounds == maxdumps)
538 buf = malloc(BUFFERSIZE);
540 syslog(LOG_ERR, "%m");
546 printf("checking for kernel dump on device %s\n", device);
548 fd = open(device, (checkfor || keep) ? O_RDONLY : O_RDWR);
550 syslog(LOG_ERR, "%s: %m", device);
554 error = ioctl(fd, DIOCGMEDIASIZE, &mediasize);
556 error = ioctl(fd, DIOCGSECTORSIZE, §orsize);
559 "couldn't find media and/or sector size of %s: %m", device);
564 printf("mediasize = %lld bytes\n", (long long)mediasize);
565 printf("sectorsize = %u bytes\n", sectorsize);
568 if (sectorsize < sizeof(kdhl)) {
570 "Sector size is less the kernel dump header %zu",
575 lasthd = mediasize - sectorsize;
576 temp = malloc(sectorsize);
578 syslog(LOG_ERR, "%m");
581 if (lseek(fd, lasthd, SEEK_SET) != lasthd ||
582 read(fd, temp, sectorsize) != (ssize_t)sectorsize) {
584 "error reading last dump header at offset %lld in %s: %m",
585 (long long)lasthd, device);
588 memcpy(&kdhl, temp, sizeof(kdhl));
589 iscompressed = istextdump = false;
590 if (compare_magic(&kdhl, TEXTDUMPMAGIC)) {
592 printf("textdump magic on last dump header on %s\n",
595 if (dtoh32(kdhl.version) != KERNELDUMP_TEXT_VERSION) {
597 "unknown version (%d) in last dump header on %s",
598 dtoh32(kdhl.version), device);
604 } else if (compare_magic(&kdhl, KERNELDUMPMAGIC)) {
605 if (dtoh32(kdhl.version) != KERNELDUMPVERSION) {
607 "unknown version (%d) in last dump header on %s",
608 dtoh32(kdhl.version), device);
614 switch (kdhl.compression) {
615 case KERNELDUMP_COMP_NONE:
617 case KERNELDUMP_COMP_GZIP:
618 if (compress && verbose)
619 printf("dump is already compressed\n");
624 syslog(LOG_ERR, "unknown compression type %d on %s",
625 kdhl.compression, device);
630 printf("magic mismatch on last dump header on %s\n",
637 if (compare_magic(&kdhl, KERNELDUMPMAGIC_CLEARED)) {
639 printf("forcing magic on %s\n", device);
640 memcpy(kdhl.magic, KERNELDUMPMAGIC, sizeof(kdhl.magic));
642 syslog(LOG_ERR, "unable to force dump - bad magic");
645 if (dtoh32(kdhl.version) != KERNELDUMPVERSION) {
647 "unknown version (%d) in last dump header on %s",
648 dtoh32(kdhl.version), device);
660 if (kerneldump_parity(&kdhl)) {
662 "parity error on last dump header on %s", device);
668 dumpextent = dtoh64(kdhl.dumpextent);
669 dumplength = dtoh64(kdhl.dumplength);
670 dumpkeysize = dtoh32(kdhl.dumpkeysize);
671 firsthd = lasthd - dumpextent - sectorsize - dumpkeysize;
672 if (lseek(fd, firsthd, SEEK_SET) != firsthd ||
673 read(fd, temp, sectorsize) != (ssize_t)sectorsize) {
675 "error reading first dump header at offset %lld in %s: %m",
676 (long long)firsthd, device);
680 memcpy(&kdhf, temp, sizeof(kdhf));
683 printf("First dump headers:\n");
684 printheader(xostdout, &kdhf, device, bounds, -1);
686 printf("\nLast dump headers:\n");
687 printheader(xostdout, &kdhl, device, bounds, -1);
691 if (memcmp(&kdhl, &kdhf, sizeof(kdhl))) {
693 "first and last dump headers disagree on %s", device);
699 status = STATUS_GOOD;
703 printf("A dump exists on %s\n", device);
708 if (kdhl.panicstring[0] != '\0')
709 syslog(LOG_ALERT, "reboot after panic: %.*s",
710 (int)sizeof(kdhl.panicstring), kdhl.panicstring);
712 syslog(LOG_ALERT, "reboot");
715 printf("Checking for available free space\n");
717 if (!check_space(savedir, dumplength, bounds)) {
722 writebounds(bounds + 1);
724 saved_dump_remove(bounds);
726 snprintf(infoname, sizeof(infoname), "info.%d", bounds);
729 * Create or overwrite any existing dump header files.
731 fdinfo = open(infoname, O_WRONLY | O_CREAT | O_TRUNC, 0600);
733 syslog(LOG_ERR, "%s: %m", infoname);
738 oumask = umask(S_IRWXG|S_IRWXO); /* Restrict access to the core file. */
739 isencrypted = (dumpkeysize > 0);
741 snprintf(corename, sizeof(corename), "%s.%d.gz",
742 istextdump ? "textdump.tar" :
743 (isencrypted ? "vmcore_encrypted" : "vmcore"), bounds);
744 fp = zopen(corename, "w");
745 } else if (iscompressed && !isencrypted) {
746 snprintf(corename, sizeof(corename), "vmcore.%d.gz", bounds);
747 fp = fopen(corename, "w");
749 snprintf(corename, sizeof(corename), "%s.%d",
750 istextdump ? "textdump.tar" :
751 (isencrypted ? "vmcore_encrypted" : "vmcore"), bounds);
752 fp = fopen(corename, "w");
755 syslog(LOG_ERR, "%s: %m", corename);
762 info = fdopen(fdinfo, "w");
765 syslog(LOG_ERR, "fdopen failed: %m");
770 xostyle = xo_get_style(NULL);
771 xoinfo = xo_create_to_file(info, xostyle, 0);
772 if (xoinfo == NULL) {
773 syslog(LOG_ERR, "%s: %m", infoname);
777 xo_open_container_h(xoinfo, "crashdump");
780 printheader(xostdout, &kdhl, device, bounds, status);
782 printheader(xoinfo, &kdhl, device, bounds, status);
783 xo_close_container_h(xoinfo, "crashdump");
789 dumpkey = calloc(1, dumpkeysize);
790 if (dumpkey == NULL) {
791 syslog(LOG_ERR, "Unable to allocate kernel dump key.");
796 if (read(fd, dumpkey, dumpkeysize) != (ssize_t)dumpkeysize) {
797 syslog(LOG_ERR, "Unable to read kernel dump key: %m.");
802 snprintf(keyname, sizeof(keyname), "key.%d", bounds);
803 ret = writekey(keyname, dumpkey, dumpkeysize);
804 explicit_bzero(dumpkey, dumpkeysize);
811 syslog(LOG_NOTICE, "writing %s%score to %s/%s",
812 isencrypted ? "encrypted " : "", compress ? "compressed " : "",
816 if (DoTextdumpFile(fd, dumplength, lasthd, buf, device,
820 if (DoRegularFile(fd, dumplength, sectorsize,
821 !(compress || iscompressed || isencrypted), buf, device,
829 if (fclose(fp) < 0) {
830 syslog(LOG_ERR, "error on %s: %m", corename);
836 if (symlink(infoname, "info.last") == -1) {
837 syslog(LOG_WARNING, "unable to create symlink %s/%s: %m",
838 savedir, "info.last");
841 if (symlink(keyname, "key.last") == -1) {
843 "unable to create symlink %s/%s: %m", savedir,
847 if (compress || iscompressed) {
848 snprintf(linkname, sizeof(linkname), "%s.last.gz",
849 istextdump ? "textdump.tar" :
850 (isencrypted ? "vmcore_encrypted" : "vmcore"));
852 snprintf(linkname, sizeof(linkname), "%s.last",
853 istextdump ? "textdump.tar" :
854 (isencrypted ? "vmcore_encrypted" : "vmcore"));
856 if (symlink(corename, linkname) == -1) {
857 syslog(LOG_WARNING, "unable to create symlink %s/%s: %m",
864 printf("dump saved\n");
869 printf("clearing dump header\n");
870 memcpy(kdhl.magic, KERNELDUMPMAGIC_CLEARED, sizeof(kdhl.magic));
871 memcpy(temp, &kdhl, sizeof(kdhl));
872 if (lseek(fd, lasthd, SEEK_SET) != lasthd ||
873 write(fd, temp, sectorsize) != (ssize_t)sectorsize)
875 "error while clearing the dump header: %m");
877 xo_close_container_h(xostdout, "crashdump");
878 xo_finish_h(xostdout);
896 xo_error("%s\n%s\n%s\n",
897 "usage: savecore -c [-v] [device ...]",
898 " savecore -C [-v] [device ...]",
899 " savecore [-fkvz] [-m maxdumps] [directory [device ...]]");
904 main(int argc, char **argv)
906 const char *savedir = ".";
910 checkfor = compress = clear = force = keep = verbose = 0;
911 nfound = nsaved = nerr = 0;
913 openlog("savecore", LOG_PERROR, LOG_DAEMON);
914 signal(SIGINFO, infohandler);
916 argc = xo_parse_args(argc, argv);
920 while ((ch = getopt(argc, argv, "Ccfkm:vz")) != -1)
935 maxdumps = atoi(optarg);
937 syslog(LOG_ERR, "Invalid maxdump value");
951 if (checkfor && (clear || force || keep))
953 if (clear && (compress || keep))
955 if (maxdumps > 0 && (checkfor || clear))
959 if (argc >= 1 && !checkfor && !clear) {
960 error = chdir(argv[0]);
962 syslog(LOG_ERR, "chdir(%s): %m", argv[0]);
974 if (strcmp(fsp->fs_vfstype, "swap") &&
975 strcmp(fsp->fs_vfstype, "dump"))
977 DoFile(savedir, fsp->fs_spec);
981 for (i = 0; i < argc; i++)
982 DoFile(savedir, argv[i]);
985 /* Emit minimal output. */
989 printf("No dump exists\n");
993 syslog(LOG_WARNING, "no dumps found");
994 } else if (nsaved == 0) {
998 "unsaved dumps found but not saved");
1001 syslog(LOG_WARNING, "no unsaved dumps found");
1008 infohandler(int sig __unused)