main.c revision 331722
1/*
2 * Copyright (c) 1980, 1986, 1993
3 *	The Regents of the University of California.  All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 *    notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 *    notice, this list of conditions and the following disclaimer in the
12 *    documentation and/or other materials provided with the distribution.
13 * 4. Neither the name of the University nor the names of its contributors
14 *    may be used to endorse or promote products derived from this software
15 *    without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20 * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
28 */
29
30#if 0
31#ifndef lint
32static const char copyright[] =
33"@(#) Copyright (c) 1980, 1986, 1993\n\
34	The Regents of the University of California.  All rights reserved.\n";
35#endif /* not lint */
36
37#ifndef lint
38static char sccsid[] = "@(#)main.c	8.6 (Berkeley) 5/14/95";
39#endif /* not lint */
40#endif
41#include <sys/cdefs.h>
42__FBSDID("$FreeBSD: stable/11/sbin/fsck_ffs/main.c 331722 2018-03-29 02:50:57Z eadler $");
43
44#include <sys/param.h>
45#include <sys/file.h>
46#include <sys/mount.h>
47#include <sys/resource.h>
48#include <sys/stat.h>
49#include <sys/sysctl.h>
50#include <sys/uio.h>
51#include <sys/disklabel.h>
52
53#include <ufs/ufs/dinode.h>
54#include <ufs/ffs/fs.h>
55
56#include <err.h>
57#include <errno.h>
58#include <fstab.h>
59#include <grp.h>
60#include <inttypes.h>
61#include <mntopts.h>
62#include <paths.h>
63#include <stdint.h>
64#include <string.h>
65#include <time.h>
66
67#include "fsck.h"
68
69int	restarts;
70
71static void usage(void) __dead2;
72static intmax_t argtoimax(int flag, const char *req, const char *str, int base);
73static int checkfilesys(char *filesys);
74static int chkdoreload(struct statfs *mntp);
75static struct statfs *getmntpt(const char *);
76
77int
78main(int argc, char *argv[])
79{
80	int ch;
81	struct rlimit rlimit;
82	struct itimerval itimerval;
83	int fsret;
84	int ret = 0;
85
86	sync();
87	skipclean = 1;
88	inoopt = 0;
89	while ((ch = getopt(argc, argv, "b:Bc:CdEfFm:npRrSyZ")) != -1) {
90		switch (ch) {
91		case 'b':
92			skipclean = 0;
93			bflag = argtoimax('b', "number", optarg, 10);
94			printf("Alternate super block location: %jd\n", bflag);
95			break;
96
97		case 'B':
98			bkgrdflag = 1;
99			break;
100
101		case 'c':
102			skipclean = 0;
103			cvtlevel = argtoimax('c', "conversion level", optarg,
104			    10);
105			if (cvtlevel < 3)
106				errx(EEXIT, "cannot do level %d conversion",
107				    cvtlevel);
108			break;
109
110		case 'd':
111			debug++;
112			break;
113
114		case 'E':
115			Eflag++;
116			break;
117
118		case 'f':
119			skipclean = 0;
120			break;
121
122		case 'F':
123			bkgrdcheck = 1;
124			break;
125
126		case 'm':
127			lfmode = argtoimax('m', "mode", optarg, 8);
128			if (lfmode &~ 07777)
129				errx(EEXIT, "bad mode to -m: %o", lfmode);
130			printf("** lost+found creation mode %o\n", lfmode);
131			break;
132
133		case 'n':
134			nflag++;
135			yflag = 0;
136			break;
137
138		case 'p':
139			preen++;
140			/*FALLTHROUGH*/
141
142		case 'C':
143			ckclean++;
144			break;
145
146		case 'R':
147			wantrestart = 1;
148			break;
149		case 'r':
150			inoopt++;
151			break;
152
153		case 'S':
154			surrender = 1;
155			break;
156
157		case 'y':
158			yflag++;
159			nflag = 0;
160			break;
161
162		case 'Z':
163			Zflag++;
164			break;
165
166		default:
167			usage();
168		}
169	}
170	argc -= optind;
171	argv += optind;
172
173	if (!argc)
174		usage();
175
176	if (signal(SIGINT, SIG_IGN) != SIG_IGN)
177		(void)signal(SIGINT, catch);
178	if (ckclean)
179		(void)signal(SIGQUIT, catchquit);
180	signal(SIGINFO, infohandler);
181	if (bkgrdflag) {
182		signal(SIGALRM, alarmhandler);
183		itimerval.it_interval.tv_sec = 5;
184		itimerval.it_interval.tv_usec = 0;
185		itimerval.it_value.tv_sec = 5;
186		itimerval.it_value.tv_usec = 0;
187		setitimer(ITIMER_REAL, &itimerval, NULL);
188	}
189	/*
190	 * Push up our allowed memory limit so we can cope
191	 * with huge file systems.
192	 */
193	if (getrlimit(RLIMIT_DATA, &rlimit) == 0) {
194		rlimit.rlim_cur = rlimit.rlim_max;
195		(void)setrlimit(RLIMIT_DATA, &rlimit);
196	}
197	while (argc > 0) {
198		if ((fsret = checkfilesys(*argv)) == ERESTART)
199			continue;
200		ret |= fsret;
201		argc--;
202		argv++;
203	}
204
205	if (returntosingle)
206		ret = 2;
207	exit(ret);
208}
209
210static intmax_t
211argtoimax(int flag, const char *req, const char *str, int base)
212{
213	char *cp;
214	intmax_t ret;
215
216	ret = strtoimax(str, &cp, base);
217	if (cp == str || *cp)
218		errx(EEXIT, "-%c flag requires a %s", flag, req);
219	return (ret);
220}
221
222/*
223 * Check the specified file system.
224 */
225/* ARGSUSED */
226static int
227checkfilesys(char *filesys)
228{
229	ufs2_daddr_t n_ffree, n_bfree;
230	struct dups *dp;
231	struct statfs *mntp;
232	struct stat snapdir;
233	struct group *grp;
234	struct iovec *iov;
235	char errmsg[255];
236	int ofsmodified;
237	int iovlen;
238	int cylno;
239	intmax_t blks, files;
240	size_t size;
241
242	iov = NULL;
243	iovlen = 0;
244	errmsg[0] = '\0';
245	fsutilinit();
246	fsckinit();
247
248	cdevname = filesys;
249	if (debug && ckclean)
250		pwarn("starting\n");
251	/*
252	 * Make best effort to get the disk name. Check first to see
253	 * if it is listed among the mounted file systems. Failing that
254	 * check to see if it is listed in /etc/fstab.
255	 */
256	mntp = getmntpt(filesys);
257	if (mntp != NULL)
258		filesys = mntp->f_mntfromname;
259	else
260		filesys = blockcheck(filesys);
261	/*
262	 * If -F flag specified, check to see whether a background check
263	 * is possible and needed. If possible and needed, exit with
264	 * status zero. Otherwise exit with status non-zero. A non-zero
265	 * exit status will cause a foreground check to be run.
266	 */
267	sblock_init();
268	if (bkgrdcheck) {
269		if ((fsreadfd = open(filesys, O_RDONLY)) < 0 || readsb(0) == 0)
270			exit(3);	/* Cannot read superblock */
271		close(fsreadfd);
272		/* Earlier background failed or journaled */
273		if (sblock.fs_flags & (FS_NEEDSFSCK | FS_SUJ))
274			exit(4);
275		if ((sblock.fs_flags & FS_DOSOFTDEP) == 0)
276			exit(5);	/* Not running soft updates */
277		size = MIBSIZE;
278		if (sysctlnametomib("vfs.ffs.adjrefcnt", adjrefcnt, &size) < 0)
279			exit(6);	/* Lacks kernel support */
280		if ((mntp == NULL && sblock.fs_clean == 1) ||
281		    (mntp != NULL && (sblock.fs_flags & FS_UNCLEAN) == 0))
282			exit(7);	/* Filesystem clean, report it now */
283		exit(0);
284	}
285	if (ckclean && skipclean) {
286		/*
287		 * If file system is gjournaled, check it here.
288		 */
289		if ((fsreadfd = open(filesys, O_RDONLY)) < 0 || readsb(0) == 0)
290			exit(3);	/* Cannot read superblock */
291		close(fsreadfd);
292		if ((sblock.fs_flags & FS_GJOURNAL) != 0) {
293			//printf("GJournaled file system detected on %s.\n",
294			//    filesys);
295			if (sblock.fs_clean == 1) {
296				pwarn("FILE SYSTEM CLEAN; SKIPPING CHECKS\n");
297				exit(0);
298			}
299			if ((sblock.fs_flags & (FS_UNCLEAN | FS_NEEDSFSCK)) == 0) {
300				gjournal_check(filesys);
301				if (chkdoreload(mntp) == 0)
302					exit(0);
303				exit(4);
304			} else {
305				pfatal(
306			    "UNEXPECTED INCONSISTENCY, CANNOT RUN FAST FSCK\n");
307			}
308		}
309	}
310	/*
311	 * If we are to do a background check:
312	 *	Get the mount point information of the file system
313	 *	create snapshot file
314	 *	return created snapshot file
315	 *	if not found, clear bkgrdflag and proceed with normal fsck
316	 */
317	if (bkgrdflag) {
318		if (mntp == NULL) {
319			bkgrdflag = 0;
320			pfatal("NOT MOUNTED, CANNOT RUN IN BACKGROUND\n");
321		} else if ((mntp->f_flags & MNT_SOFTDEP) == 0) {
322			bkgrdflag = 0;
323			pfatal(
324			  "NOT USING SOFT UPDATES, CANNOT RUN IN BACKGROUND\n");
325		} else if ((mntp->f_flags & MNT_RDONLY) != 0) {
326			bkgrdflag = 0;
327			pfatal("MOUNTED READ-ONLY, CANNOT RUN IN BACKGROUND\n");
328		} else if ((fsreadfd = open(filesys, O_RDONLY)) >= 0) {
329			if (readsb(0) != 0) {
330				if (sblock.fs_flags & (FS_NEEDSFSCK | FS_SUJ)) {
331					bkgrdflag = 0;
332					pfatal(
333			"UNEXPECTED INCONSISTENCY, CANNOT RUN IN BACKGROUND\n");
334				}
335				if ((sblock.fs_flags & FS_UNCLEAN) == 0 &&
336				    skipclean && ckclean) {
337					/*
338					 * file system is clean;
339					 * skip snapshot and report it clean
340					 */
341					pwarn(
342					"FILE SYSTEM CLEAN; SKIPPING CHECKS\n");
343					goto clean;
344				}
345			}
346			close(fsreadfd);
347		}
348		if (bkgrdflag) {
349			snprintf(snapname, sizeof snapname, "%s/.snap",
350			    mntp->f_mntonname);
351			if (stat(snapname, &snapdir) < 0) {
352				if (errno != ENOENT) {
353					bkgrdflag = 0;
354					pfatal(
355	"CANNOT FIND SNAPSHOT DIRECTORY %s: %s, CANNOT RUN IN BACKGROUND\n",
356					    snapname, strerror(errno));
357				} else if ((grp = getgrnam("operator")) == NULL ||
358					   mkdir(snapname, 0770) < 0 ||
359					   chown(snapname, -1, grp->gr_gid) < 0 ||
360					   chmod(snapname, 0770) < 0) {
361					bkgrdflag = 0;
362					pfatal(
363	"CANNOT CREATE SNAPSHOT DIRECTORY %s: %s, CANNOT RUN IN BACKGROUND\n",
364					    snapname, strerror(errno));
365				}
366			} else if (!S_ISDIR(snapdir.st_mode)) {
367				bkgrdflag = 0;
368				pfatal(
369			"%s IS NOT A DIRECTORY, CANNOT RUN IN BACKGROUND\n",
370				    snapname);
371			}
372		}
373		if (bkgrdflag) {
374			snprintf(snapname, sizeof snapname,
375			    "%s/.snap/fsck_snapshot", mntp->f_mntonname);
376			build_iovec(&iov, &iovlen, "fstype", "ffs", 4);
377			build_iovec(&iov, &iovlen, "from", snapname,
378			    (size_t)-1);
379			build_iovec(&iov, &iovlen, "fspath", mntp->f_mntonname,
380			    (size_t)-1);
381			build_iovec(&iov, &iovlen, "errmsg", errmsg,
382			    sizeof(errmsg));
383			build_iovec(&iov, &iovlen, "update", NULL, 0);
384			build_iovec(&iov, &iovlen, "snapshot", NULL, 0);
385
386			while (nmount(iov, iovlen, mntp->f_flags) < 0) {
387				if (errno == EEXIST && unlink(snapname) == 0)
388					continue;
389				bkgrdflag = 0;
390				pfatal("CANNOT CREATE SNAPSHOT %s: %s %s\n",
391				    snapname, strerror(errno), errmsg);
392				break;
393			}
394			if (bkgrdflag != 0)
395				filesys = snapname;
396		}
397	}
398
399	switch (setup(filesys)) {
400	case 0:
401		if (preen)
402			pfatal("CAN'T CHECK FILE SYSTEM.");
403		return (0);
404	case -1:
405	clean:
406		pwarn("clean, %ld free ", (long)(sblock.fs_cstotal.cs_nffree +
407		    sblock.fs_frag * sblock.fs_cstotal.cs_nbfree));
408		printf("(%jd frags, %jd blocks, %.1f%% fragmentation)\n",
409		    (intmax_t)sblock.fs_cstotal.cs_nffree,
410		    (intmax_t)sblock.fs_cstotal.cs_nbfree,
411		    sblock.fs_cstotal.cs_nffree * 100.0 / sblock.fs_dsize);
412		return (0);
413	}
414	/*
415	 * Determine if we can and should do journal recovery.
416	 */
417	if ((sblock.fs_flags & FS_SUJ) == FS_SUJ) {
418		if ((sblock.fs_flags & FS_NEEDSFSCK) != FS_NEEDSFSCK && skipclean) {
419			if (preen || reply("USE JOURNAL")) {
420				if (suj_check(filesys) == 0) {
421					printf("\n***** FILE SYSTEM MARKED CLEAN *****\n");
422					if (chkdoreload(mntp) == 0)
423						exit(0);
424					exit(4);
425				}
426			}
427			printf("** Skipping journal, falling through to full fsck\n\n");
428		}
429		/*
430		 * Write the superblock so we don't try to recover the
431		 * journal on another pass. If this is the only change
432		 * to the filesystem, we do not want it to be called
433		 * out as modified.
434		 */
435		sblock.fs_mtime = time(NULL);
436		sbdirty();
437		ofsmodified = fsmodified;
438		flush(fswritefd, &sblk);
439		fsmodified = ofsmodified;
440	}
441
442	/*
443	 * Cleared if any questions answered no. Used to decide if
444	 * the superblock should be marked clean.
445	 */
446	resolved = 1;
447	/*
448	 * 1: scan inodes tallying blocks used
449	 */
450	if (preen == 0) {
451		printf("** Last Mounted on %s\n", sblock.fs_fsmnt);
452		if (mntp != NULL && mntp->f_flags & MNT_ROOTFS)
453			printf("** Root file system\n");
454		printf("** Phase 1 - Check Blocks and Sizes\n");
455	}
456	clock_gettime(CLOCK_REALTIME_PRECISE, &startprog);
457	pass1();
458	IOstats("Pass1");
459
460	/*
461	 * 1b: locate first references to duplicates, if any
462	 */
463	if (duplist) {
464		if (preen || usedsoftdep)
465			pfatal("INTERNAL ERROR: dups with %s%s%s",
466			    preen ? "-p" : "",
467			    (preen && usedsoftdep) ? " and " : "",
468			    usedsoftdep ? "softupdates" : "");
469		printf("** Phase 1b - Rescan For More DUPS\n");
470		pass1b();
471		IOstats("Pass1b");
472	}
473
474	/*
475	 * 2: traverse directories from root to mark all connected directories
476	 */
477	if (preen == 0)
478		printf("** Phase 2 - Check Pathnames\n");
479	pass2();
480	IOstats("Pass2");
481
482	/*
483	 * 3: scan inodes looking for disconnected directories
484	 */
485	if (preen == 0)
486		printf("** Phase 3 - Check Connectivity\n");
487	pass3();
488	IOstats("Pass3");
489
490	/*
491	 * 4: scan inodes looking for disconnected files; check reference counts
492	 */
493	if (preen == 0)
494		printf("** Phase 4 - Check Reference Counts\n");
495	pass4();
496	IOstats("Pass4");
497
498	/*
499	 * 5: check and repair resource counts in cylinder groups
500	 */
501	if (preen == 0)
502		printf("** Phase 5 - Check Cyl groups\n");
503	pass5();
504	IOstats("Pass5");
505
506	/*
507	 * print out summary statistics
508	 */
509	n_ffree = sblock.fs_cstotal.cs_nffree;
510	n_bfree = sblock.fs_cstotal.cs_nbfree;
511	files = maxino - ROOTINO - sblock.fs_cstotal.cs_nifree - n_files;
512	blks = n_blks +
513	    sblock.fs_ncg * (cgdmin(&sblock, 0) - cgsblock(&sblock, 0));
514	blks += cgsblock(&sblock, 0) - cgbase(&sblock, 0);
515	blks += howmany(sblock.fs_cssize, sblock.fs_fsize);
516	blks = maxfsblock - (n_ffree + sblock.fs_frag * n_bfree) - blks;
517	if (bkgrdflag && (files > 0 || blks > 0)) {
518		countdirs = sblock.fs_cstotal.cs_ndir - countdirs;
519		pwarn("Reclaimed: %ld directories, %jd files, %jd fragments\n",
520		    countdirs, files - countdirs, blks);
521	}
522	pwarn("%ld files, %jd used, %ju free ",
523	    (long)n_files, (intmax_t)n_blks,
524	    (uintmax_t)n_ffree + sblock.fs_frag * n_bfree);
525	printf("(%ju frags, %ju blocks, %.1f%% fragmentation)\n",
526	    (uintmax_t)n_ffree, (uintmax_t)n_bfree,
527	    n_ffree * 100.0 / sblock.fs_dsize);
528	if (debug) {
529		if (files < 0)
530			printf("%jd inodes missing\n", -files);
531		if (blks < 0)
532			printf("%jd blocks missing\n", -blks);
533		if (duplist != NULL) {
534			printf("The following duplicate blocks remain:");
535			for (dp = duplist; dp; dp = dp->next)
536				printf(" %jd,", (intmax_t)dp->dup);
537			printf("\n");
538		}
539	}
540	duplist = (struct dups *)0;
541	muldup = (struct dups *)0;
542	inocleanup();
543	if (fsmodified) {
544		sblock.fs_time = time(NULL);
545		sbdirty();
546	}
547	if (cvtlevel && sblk.b_dirty) {
548		/*
549		 * Write out the duplicate super blocks
550		 */
551		for (cylno = 0; cylno < sblock.fs_ncg; cylno++)
552			blwrite(fswritefd, (char *)&sblock,
553			    fsbtodb(&sblock, cgsblock(&sblock, cylno)),
554			    SBLOCKSIZE);
555	}
556	if (rerun)
557		resolved = 0;
558	finalIOstats();
559
560	/*
561	 * Check to see if the file system is mounted read-write.
562	 */
563	if (bkgrdflag == 0 && mntp != NULL && (mntp->f_flags & MNT_RDONLY) == 0)
564		resolved = 0;
565	ckfini(resolved);
566
567	for (cylno = 0; cylno < sblock.fs_ncg; cylno++)
568		if (inostathead[cylno].il_stat != NULL)
569			free((char *)inostathead[cylno].il_stat);
570	free((char *)inostathead);
571	inostathead = NULL;
572	if (fsmodified && !preen)
573		printf("\n***** FILE SYSTEM WAS MODIFIED *****\n");
574	if (rerun) {
575		if (wantrestart && (restarts++ < 10) &&
576		    (preen || reply("RESTART")))
577			return (ERESTART);
578		printf("\n***** PLEASE RERUN FSCK *****\n");
579	}
580	if (chkdoreload(mntp) != 0) {
581		if (!fsmodified)
582			return (0);
583		if (!preen)
584			printf("\n***** REBOOT NOW *****\n");
585		sync();
586		return (4);
587	}
588	return (rerun ? ERERUN : 0);
589}
590
591static int
592chkdoreload(struct statfs *mntp)
593{
594	struct iovec *iov;
595	int iovlen;
596	char errmsg[255];
597
598	if (mntp == NULL)
599		return (0);
600
601	iov = NULL;
602	iovlen = 0;
603	errmsg[0] = '\0';
604	/*
605	 * We modified a mounted file system.  Do a mount update on
606	 * it unless it is read-write, so we can continue using it
607	 * as safely as possible.
608	 */
609	if (mntp->f_flags & MNT_RDONLY) {
610		build_iovec(&iov, &iovlen, "fstype", "ffs", 4);
611		build_iovec(&iov, &iovlen, "from", mntp->f_mntfromname,
612		    (size_t)-1);
613		build_iovec(&iov, &iovlen, "fspath", mntp->f_mntonname,
614		    (size_t)-1);
615		build_iovec(&iov, &iovlen, "errmsg", errmsg,
616		    sizeof(errmsg));
617		build_iovec(&iov, &iovlen, "update", NULL, 0);
618		build_iovec(&iov, &iovlen, "reload", NULL, 0);
619		/*
620		 * XX: We need the following line until we clean up
621		 * nmount parsing of root mounts and NFS root mounts.
622		 */
623		build_iovec(&iov, &iovlen, "ro", NULL, 0);
624		if (nmount(iov, iovlen, mntp->f_flags) == 0) {
625			return (0);
626		}
627		pwarn("mount reload of '%s' failed: %s %s\n\n",
628		    mntp->f_mntonname, strerror(errno), errmsg);
629		return (1);
630	}
631	return (0);
632}
633
634/*
635 * Get the mount point information for name.
636 */
637static struct statfs *
638getmntpt(const char *name)
639{
640	struct stat devstat, mntdevstat;
641	char device[sizeof(_PATH_DEV) - 1 + MNAMELEN];
642	char *ddevname;
643	struct statfs *mntbuf, *statfsp;
644	int i, mntsize, isdev;
645
646	if (stat(name, &devstat) != 0)
647		return (NULL);
648	if (S_ISCHR(devstat.st_mode) || S_ISBLK(devstat.st_mode))
649		isdev = 1;
650	else
651		isdev = 0;
652	mntsize = getmntinfo(&mntbuf, MNT_NOWAIT);
653	for (i = 0; i < mntsize; i++) {
654		statfsp = &mntbuf[i];
655		ddevname = statfsp->f_mntfromname;
656		if (*ddevname != '/') {
657			if (strlen(_PATH_DEV) + strlen(ddevname) + 1 >
658			    sizeof(statfsp->f_mntfromname))
659				continue;
660			strcpy(device, _PATH_DEV);
661			strcat(device, ddevname);
662			strcpy(statfsp->f_mntfromname, device);
663		}
664		if (isdev == 0) {
665			if (strcmp(name, statfsp->f_mntonname))
666				continue;
667			return (statfsp);
668		}
669		if (stat(ddevname, &mntdevstat) == 0 &&
670		    mntdevstat.st_rdev == devstat.st_rdev)
671			return (statfsp);
672	}
673	statfsp = NULL;
674	return (statfsp);
675}
676
677static void
678usage(void)
679{
680	(void) fprintf(stderr,
681"usage: %s [-BCdEFfnpRrSyZ] [-b block] [-c level] [-m mode] filesystem ...\n",
682	    getprogname());
683	exit(1);
684}
685
686void
687infohandler(int sig __unused)
688{
689	got_siginfo = 1;
690}
691
692void
693alarmhandler(int sig __unused)
694{
695	got_sigalarm = 1;
696}
697