11590Srgrimes/* 21590Srgrimes * Copyright (c) 1989, 1993, 1994 31590Srgrimes * The Regents of the University of California. All rights reserved. 41590Srgrimes * 51590Srgrimes * This code is derived from software contributed to Berkeley by 61590Srgrimes * Chris Newcomb. 71590Srgrimes * 81590Srgrimes * Redistribution and use in source and binary forms, with or without 91590Srgrimes * modification, are permitted provided that the following conditions 101590Srgrimes * are met: 111590Srgrimes * 1. Redistributions of source code must retain the above copyright 121590Srgrimes * notice, this list of conditions and the following disclaimer. 131590Srgrimes * 2. Redistributions in binary form must reproduce the above copyright 141590Srgrimes * notice, this list of conditions and the following disclaimer in the 151590Srgrimes * documentation and/or other materials provided with the distribution. 161590Srgrimes * 4. Neither the name of the University nor the names of its contributors 171590Srgrimes * may be used to endorse or promote products derived from this software 181590Srgrimes * without specific prior written permission. 191590Srgrimes * 201590Srgrimes * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 211590Srgrimes * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 221590Srgrimes * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 231590Srgrimes * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 241590Srgrimes * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 251590Srgrimes * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 261590Srgrimes * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 271590Srgrimes * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 281590Srgrimes * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 291590Srgrimes * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 301590Srgrimes * SUCH DAMAGE. 311590Srgrimes */ 321590Srgrimes 331590Srgrimes#ifndef lint 3441568Sarchiestatic const char copyright[] = 351590Srgrimes"@(#) Copyright (c) 1989, 1993, 1994\n\ 361590Srgrimes The Regents of the University of California. All rights reserved.\n"; 371590Srgrimes#endif /* not lint */ 381590Srgrimes 391590Srgrimes#ifndef lint 4056597Smharo#if 0 4141568Sarchiestatic const char sccsid[] = "@(#)du.c 8.5 (Berkeley) 5/4/95"; 4256597Smharo#endif 431590Srgrimes#endif /* not lint */ 4499112Sobrien#include <sys/cdefs.h> 4599112Sobrien__FBSDID("$FreeBSD$"); 461590Srgrimes 471590Srgrimes#include <sys/param.h> 4878158Sroam#include <sys/queue.h> 491590Srgrimes#include <sys/stat.h> 501590Srgrimes 511590Srgrimes#include <err.h> 521590Srgrimes#include <errno.h> 5378158Sroam#include <fnmatch.h> 541590Srgrimes#include <fts.h> 55129678Spjd#include <libutil.h> 56132201Stjr#include <locale.h> 57139813Spjd#include <stdint.h> 581590Srgrimes#include <stdio.h> 591590Srgrimes#include <stdlib.h> 601590Srgrimes#include <string.h> 6156597Smharo#include <sysexits.h> 6223693Speter#include <unistd.h> 631590Srgrimes 6478158SroamSLIST_HEAD(ignhead, ignentry) ignores; 6578158Sroamstruct ignentry { 6678158Sroam char *mask; 6778158Sroam SLIST_ENTRY(ignentry) next; 6878158Sroam}; 6978158Sroam 70128772Skientzlestatic int linkchk(FTSENT *); 7192920Simpstatic void usage(void); 72184656Smlaierstatic void prthumanval(int64_t); 73184656Smlaierstatic void ignoreadd(const char *); 74184656Smlaierstatic void ignoreclean(void); 75184656Smlaierstatic int ignorep(FTSENT *); 76191677Simpstatic void siginfo(int __unused); 771590Srgrimes 78184656Smlaierstatic int nodumpflag = 0; 79184733Smlaierstatic int Aflag; 80184733Smlaierstatic long blocksize, cblocksize; 81191677Simpstatic volatile sig_atomic_t info; 82158339Smaxim 831590Srgrimesint 84100822Sdwmalonemain(int argc, char *argv[]) 851590Srgrimes{ 8632097Sjkh FTS *fts; 8732097Sjkh FTSENT *p; 88184733Smlaier off_t savednumber, curblocks; 89209362Sbrian off_t threshold, threshold_sign; 9032097Sjkh int ftsoptions; 9132097Sjkh int listall; 9232097Sjkh int depth; 93229992Sjilles int Hflag, Lflag, aflag, sflag, dflag, cflag; 94176561Skeramida int hflag, lflag, ch, notused, rval; 9532097Sjkh char **save; 9687216Smarkm static char dot[] = "."; 971590Srgrimes 98132201Stjr setlocale(LC_ALL, ""); 99132201Stjr 100229992Sjilles Hflag = Lflag = aflag = sflag = dflag = cflag = hflag = 101184733Smlaier lflag = Aflag = 0; 102128772Skientzle 1031590Srgrimes save = argv; 104229992Sjilles ftsoptions = FTS_PHYSICAL; 105184654Smlaier savednumber = 0; 106209362Sbrian threshold = 0; 107209362Sbrian threshold_sign = 1; 108184733Smlaier cblocksize = DEV_BSIZE; 109184733Smlaier blocksize = 0; 11019120Sscrappy depth = INT_MAX; 11178158Sroam SLIST_INIT(&ignores); 112128772Skientzle 113247538Sdes while ((ch = getopt(argc, argv, "AB:HI:LPasd:cghklmnrt:x")) != -1) 1141590Srgrimes switch (ch) { 115184733Smlaier case 'A': 116184733Smlaier Aflag = 1; 117184733Smlaier break; 118184733Smlaier case 'B': 119184733Smlaier errno = 0; 120184733Smlaier cblocksize = atoi(optarg); 121184733Smlaier if (errno == ERANGE || cblocksize <= 0) { 122184733Smlaier warnx("invalid argument to option B: %s", 123184733Smlaier optarg); 124184733Smlaier usage(); 125184733Smlaier } 126184733Smlaier break; 127184654Smlaier case 'H': 128184654Smlaier Hflag = 1; 129229992Sjilles Lflag = 0; 130184654Smlaier break; 131184654Smlaier case 'I': 132184654Smlaier ignoreadd(optarg); 133184654Smlaier break; 134184654Smlaier case 'L': 135184654Smlaier Lflag = 1; 136229992Sjilles Hflag = 0; 137184654Smlaier break; 138184654Smlaier case 'P': 139229992Sjilles Hflag = Lflag = 0; 140184654Smlaier break; 141184654Smlaier case 'a': 142184654Smlaier aflag = 1; 143184654Smlaier break; 144184654Smlaier case 's': 145184654Smlaier sflag = 1; 146184654Smlaier break; 147184654Smlaier case 'd': 148184654Smlaier dflag = 1; 149184654Smlaier errno = 0; 150184654Smlaier depth = atoi(optarg); 151184654Smlaier if (errno == ERANGE || depth < 0) { 152184654Smlaier warnx("invalid argument to option d: %s", 153184654Smlaier optarg); 154184654Smlaier usage(); 155184654Smlaier } 156184654Smlaier break; 157184654Smlaier case 'c': 158184654Smlaier cflag = 1; 159184654Smlaier break; 160247538Sdes case 'g': 161247538Sdes hflag = 0; 162247538Sdes blocksize = 1073741824; 163247538Sdes break; 164184654Smlaier case 'h': 165184654Smlaier hflag = 1; 166184654Smlaier break; 167184654Smlaier case 'k': 168184654Smlaier hflag = 0; 169184733Smlaier blocksize = 1024; 170184654Smlaier break; 171184654Smlaier case 'l': 172184654Smlaier lflag = 1; 173184654Smlaier break; 174184654Smlaier case 'm': 175184654Smlaier hflag = 0; 176184733Smlaier blocksize = 1048576; 177184654Smlaier break; 178184654Smlaier case 'n': 179184654Smlaier nodumpflag = 1; 180184654Smlaier break; 181184654Smlaier case 'r': /* Compatibility. */ 182184654Smlaier break; 183209362Sbrian case 't' : 184209362Sbrian if (expand_number(optarg, &threshold) != 0 || 185209362Sbrian threshold == 0) { 186209362Sbrian warnx("invalid threshold: %s", optarg); 187209362Sbrian usage(); 188209362Sbrian } else if (threshold < 0) 189209362Sbrian threshold_sign = -1; 190209362Sbrian break; 191184654Smlaier case 'x': 192184654Smlaier ftsoptions |= FTS_XDEV; 193184654Smlaier break; 194184654Smlaier case '?': 195184654Smlaier default: 196184654Smlaier usage(); 197184654Smlaier /* NOTREACHED */ 1981590Srgrimes } 19932097Sjkh 2001590Srgrimes argc -= optind; 2011590Srgrimes argv += optind; 2021590Srgrimes 2031590Srgrimes /* 2041590Srgrimes * XXX 2051590Srgrimes * Because of the way that fts(3) works, logical walks will not count 2061590Srgrimes * the blocks actually used by symbolic links. We rationalize this by 2071590Srgrimes * noting that users computing logical sizes are likely to do logical 2081590Srgrimes * copies, so not counting the links is correct. The real reason is 2091590Srgrimes * that we'd have to re-implement the kernel's symbolic link traversing 2101590Srgrimes * algorithm to get this right. If, for example, you have relative 2111590Srgrimes * symbolic links referencing other relative symbolic links, it gets 2121590Srgrimes * very nasty, very fast. The bottom line is that it's documented in 2131590Srgrimes * the man page, so it's a feature. 2141590Srgrimes */ 21532097Sjkh 2161590Srgrimes if (Hflag) 2171590Srgrimes ftsoptions |= FTS_COMFOLLOW; 218229992Sjilles if (Lflag) { 219229992Sjilles ftsoptions &= ~FTS_PHYSICAL; 2201590Srgrimes ftsoptions |= FTS_LOGICAL; 221229992Sjilles } 2221590Srgrimes 223184733Smlaier if (!Aflag && (cblocksize % DEV_BSIZE) != 0) 224184733Smlaier cblocksize = howmany(cblocksize, DEV_BSIZE) * DEV_BSIZE; 225184733Smlaier 22632097Sjkh listall = 0; 22732097Sjkh 2281590Srgrimes if (aflag) { 22919120Sscrappy if (sflag || dflag) 2301590Srgrimes usage(); 23132097Sjkh listall = 1; 23219120Sscrappy } else if (sflag) { 23319120Sscrappy if (dflag) 23419120Sscrappy usage(); 23532097Sjkh depth = 0; 2361590Srgrimes } 2371590Srgrimes 2381590Srgrimes if (!*argv) { 2391590Srgrimes argv = save; 24087216Smarkm argv[0] = dot; 2411590Srgrimes argv[1] = NULL; 2421590Srgrimes } 2431590Srgrimes 244184733Smlaier if (blocksize == 0) 245184733Smlaier (void)getbsize(¬used, &blocksize); 2461590Srgrimes 247184733Smlaier if (!Aflag) { 248184733Smlaier cblocksize /= DEV_BSIZE; 249184733Smlaier blocksize /= DEV_BSIZE; 250184733Smlaier } 251184733Smlaier 252209362Sbrian if (threshold != 0) 253209362Sbrian threshold = howmany(threshold / DEV_BSIZE * cblocksize, 254209362Sbrian blocksize); 255209362Sbrian 25632097Sjkh rval = 0; 257128772Skientzle 258191677Simp (void)signal(SIGINFO, siginfo); 259191677Simp 2601590Srgrimes if ((fts = fts_open(argv, ftsoptions, NULL)) == NULL) 26132097Sjkh err(1, "fts_open"); 2621590Srgrimes 26332097Sjkh while ((p = fts_read(fts)) != NULL) { 2641590Srgrimes switch (p->fts_info) { 265184654Smlaier case FTS_D: /* Ignore. */ 266184654Smlaier if (ignorep(p)) 267184654Smlaier fts_set(fts, p, FTS_SKIP); 268184654Smlaier break; 269184654Smlaier case FTS_DP: 270184654Smlaier if (ignorep(p)) 2711590Srgrimes break; 27278158Sroam 273184733Smlaier curblocks = Aflag ? 274184733Smlaier howmany(p->fts_statp->st_size, cblocksize) : 275184733Smlaier howmany(p->fts_statp->st_blocks, cblocksize); 276184654Smlaier p->fts_parent->fts_bignum += p->fts_bignum += 277184733Smlaier curblocks; 278128772Skientzle 279209362Sbrian if (p->fts_level <= depth && threshold <= 280209362Sbrian threshold_sign * howmany(p->fts_bignum * 281209362Sbrian cblocksize, blocksize)) { 282184654Smlaier if (hflag) { 283184733Smlaier prthumanval(p->fts_bignum); 284184654Smlaier (void)printf("\t%s\n", p->fts_path); 285184654Smlaier } else { 286184654Smlaier (void)printf("%jd\t%s\n", 287184742Smlaier (intmax_t)howmany(p->fts_bignum * 288184742Smlaier cblocksize, blocksize), 289184742Smlaier p->fts_path); 29058601Scharnier } 291184654Smlaier } 292191677Simp if (info) { 293191677Simp info = 0; 294191677Simp (void)printf("\t%s\n", p->fts_path); 295191677Simp } 296184654Smlaier break; 297184654Smlaier case FTS_DC: /* Ignore. */ 298184654Smlaier break; 299184654Smlaier case FTS_DNR: /* Warn, continue. */ 300184654Smlaier case FTS_ERR: 301184654Smlaier case FTS_NS: 302184654Smlaier warnx("%s: %s", p->fts_path, strerror(p->fts_errno)); 303184654Smlaier rval = 1; 304184654Smlaier break; 305184654Smlaier default: 306184654Smlaier if (ignorep(p)) 30732097Sjkh break; 308184654Smlaier 309184654Smlaier if (lflag == 0 && p->fts_statp->st_nlink > 1 && 310184654Smlaier linkchk(p)) 31132097Sjkh break; 31278158Sroam 313184733Smlaier curblocks = Aflag ? 314184733Smlaier howmany(p->fts_statp->st_size, cblocksize) : 315184733Smlaier howmany(p->fts_statp->st_blocks, cblocksize); 316184733Smlaier 317184654Smlaier if (listall || p->fts_level == 0) { 318184654Smlaier if (hflag) { 319184733Smlaier prthumanval(curblocks); 320184654Smlaier (void)printf("\t%s\n", p->fts_path); 321184654Smlaier } else { 322184654Smlaier (void)printf("%jd\t%s\n", 323184742Smlaier (intmax_t)howmany(curblocks * 324184742Smlaier cblocksize, blocksize), 325184742Smlaier p->fts_path); 32658601Scharnier } 327184654Smlaier } 32832097Sjkh 329184733Smlaier p->fts_parent->fts_bignum += curblocks; 3301590Srgrimes } 331139813Spjd savednumber = p->fts_parent->fts_bignum; 33232097Sjkh } 33332097Sjkh 3341590Srgrimes if (errno) 3351590Srgrimes err(1, "fts_read"); 33632097Sjkh 33758601Scharnier if (cflag) { 33856597Smharo if (hflag) { 339184733Smlaier prthumanval(savednumber); 340184654Smlaier (void)printf("\ttotal\n"); 34156597Smharo } else { 342184654Smlaier (void)printf("%jd\ttotal\n", (intmax_t)howmany( 343184733Smlaier savednumber * cblocksize, blocksize)); 34456597Smharo } 34558601Scharnier } 34632097Sjkh 34778158Sroam ignoreclean(); 34828891Swosch exit(rval); 3491590Srgrimes} 3501590Srgrimes 351128772Skientzlestatic int 352128772Skientzlelinkchk(FTSENT *p) 353128772Skientzle{ 354128772Skientzle struct links_entry { 355128806Skientzle struct links_entry *next; 356128806Skientzle struct links_entry *previous; 357128806Skientzle int links; 358128806Skientzle dev_t dev; 359128806Skientzle ino_t ino; 360128772Skientzle }; 361128806Skientzle static const size_t links_hash_initial_size = 8192; 362128806Skientzle static struct links_entry **buckets; 363128806Skientzle static struct links_entry *free_list; 364128806Skientzle static size_t number_buckets; 365128806Skientzle static unsigned long number_entries; 366128806Skientzle static char stop_allocating; 367128806Skientzle struct links_entry *le, **new_buckets; 368128806Skientzle struct stat *st; 369128806Skientzle size_t i, new_size; 370144840Sstefanf int hash; 37132097Sjkh 372128772Skientzle st = p->fts_statp; 37332097Sjkh 374128772Skientzle /* If necessary, initialize the hash table. */ 375128772Skientzle if (buckets == NULL) { 376128772Skientzle number_buckets = links_hash_initial_size; 377128772Skientzle buckets = malloc(number_buckets * sizeof(buckets[0])); 378128772Skientzle if (buckets == NULL) 379128834Skientzle errx(1, "No memory for hardlink detection"); 380128772Skientzle for (i = 0; i < number_buckets; i++) 381128772Skientzle buckets[i] = NULL; 382128772Skientzle } 3831590Srgrimes 384128772Skientzle /* If the hash table is getting too full, enlarge it. */ 385128772Skientzle if (number_entries > number_buckets * 10 && !stop_allocating) { 386128772Skientzle new_size = number_buckets * 2; 387128772Skientzle new_buckets = malloc(new_size * sizeof(struct links_entry *)); 388128772Skientzle 389128772Skientzle /* Try releasing the free list to see if that helps. */ 390128772Skientzle if (new_buckets == NULL && free_list != NULL) { 391128772Skientzle while (free_list != NULL) { 392128772Skientzle le = free_list; 393128772Skientzle free_list = le->next; 394128772Skientzle free(le); 395128772Skientzle } 396184654Smlaier new_buckets = malloc(new_size * 397184654Smlaier sizeof(new_buckets[0])); 398128772Skientzle } 399128772Skientzle 400128772Skientzle if (new_buckets == NULL) { 401128772Skientzle stop_allocating = 1; 402128834Skientzle warnx("No more memory for tracking hard links"); 403128772Skientzle } else { 404128772Skientzle memset(new_buckets, 0, 405128772Skientzle new_size * sizeof(struct links_entry *)); 406128772Skientzle for (i = 0; i < number_buckets; i++) { 407128772Skientzle while (buckets[i] != NULL) { 408128772Skientzle /* Remove entry from old bucket. */ 409128772Skientzle le = buckets[i]; 410128772Skientzle buckets[i] = le->next; 411128772Skientzle 412128772Skientzle /* Add entry to new bucket. */ 413128772Skientzle hash = (le->dev ^ le->ino) % new_size; 414128772Skientzle 415128772Skientzle if (new_buckets[hash] != NULL) 416128772Skientzle new_buckets[hash]->previous = 417128772Skientzle le; 418128772Skientzle le->next = new_buckets[hash]; 419128772Skientzle le->previous = NULL; 420128772Skientzle new_buckets[hash] = le; 421128772Skientzle } 422128772Skientzle } 423128772Skientzle free(buckets); 424128772Skientzle buckets = new_buckets; 425128772Skientzle number_buckets = new_size; 426128772Skientzle } 427128772Skientzle } 428128772Skientzle 429128772Skientzle /* Try to locate this entry in the hash table. */ 430128772Skientzle hash = ( st->st_dev ^ st->st_ino ) % number_buckets; 431128772Skientzle for (le = buckets[hash]; le != NULL; le = le->next) { 432128772Skientzle if (le->dev == st->st_dev && le->ino == st->st_ino) { 433128772Skientzle /* 434128772Skientzle * Save memory by releasing an entry when we've seen 435128772Skientzle * all of it's links. 436128772Skientzle */ 437128772Skientzle if (--le->links <= 0) { 438128772Skientzle if (le->previous != NULL) 439128772Skientzle le->previous->next = le->next; 440128772Skientzle if (le->next != NULL) 441128772Skientzle le->next->previous = le->previous; 442128772Skientzle if (buckets[hash] == le) 443128772Skientzle buckets[hash] = le->next; 444128772Skientzle number_entries--; 445128772Skientzle /* Recycle this node through the free list */ 446128772Skientzle if (stop_allocating) { 447128772Skientzle free(le); 448128772Skientzle } else { 449128772Skientzle le->next = free_list; 450128772Skientzle free_list = le; 451128772Skientzle } 452128772Skientzle } 453128772Skientzle return (1); 454128772Skientzle } 455128772Skientzle } 456128772Skientzle 457128772Skientzle if (stop_allocating) 458128772Skientzle return (0); 459128772Skientzle 460128772Skientzle /* Add this entry to the links cache. */ 461128772Skientzle if (free_list != NULL) { 462128772Skientzle /* Pull a node from the free list if we can. */ 463128772Skientzle le = free_list; 464128772Skientzle free_list = le->next; 465128772Skientzle } else 466128772Skientzle /* Malloc one if we have to. */ 467128772Skientzle le = malloc(sizeof(struct links_entry)); 468128772Skientzle if (le == NULL) { 469128772Skientzle stop_allocating = 1; 470128834Skientzle warnx("No more memory for tracking hard links"); 471128772Skientzle return (0); 472128772Skientzle } 473128772Skientzle le->dev = st->st_dev; 474128772Skientzle le->ino = st->st_ino; 475128772Skientzle le->links = st->st_nlink - 1; 476128772Skientzle number_entries++; 477128772Skientzle le->next = buckets[hash]; 478128772Skientzle le->previous = NULL; 479128772Skientzle if (buckets[hash] != NULL) 480128772Skientzle buckets[hash]->previous = le; 481128772Skientzle buckets[hash] = le; 4821590Srgrimes return (0); 4831590Srgrimes} 4841590Srgrimes 485184656Smlaierstatic void 486129678Spjdprthumanval(int64_t bytes) 48756597Smharo{ 488129678Spjd char buf[5]; 48956597Smharo 490184733Smlaier bytes *= cblocksize; 491184733Smlaier if (!Aflag) 492184733Smlaier bytes *= DEV_BSIZE; 49356597Smharo 494129678Spjd humanize_number(buf, sizeof(buf), bytes, "", HN_AUTOSCALE, 495129678Spjd HN_B | HN_NOSPACE | HN_DECIMAL); 49656597Smharo 497129678Spjd (void)printf("%4s", buf); 49856597Smharo} 49956597Smharo 50027099Scharnierstatic void 501100822Sdwmaloneusage(void) 5021590Srgrimes{ 5031590Srgrimes (void)fprintf(stderr, 504229340Sgjb "usage: du [-Aclnx] [-H | -L | -P] [-h | -k | -m ] " 505229340Sgjb "[-a | -s | -d depth] [-B blocksize] [-I mask] " 506229340Sgjb "[-t threshold] [file ...]\n"); 50756597Smharo exit(EX_USAGE); 5081590Srgrimes} 50978158Sroam 510184656Smlaierstatic void 511100822Sdwmaloneignoreadd(const char *mask) 51278158Sroam{ 51378158Sroam struct ignentry *ign; 51478158Sroam 51578158Sroam ign = calloc(1, sizeof(*ign)); 51678158Sroam if (ign == NULL) 51778158Sroam errx(1, "cannot allocate memory"); 51878158Sroam ign->mask = strdup(mask); 51978158Sroam if (ign->mask == NULL) 52078158Sroam errx(1, "cannot allocate memory"); 52178158Sroam SLIST_INSERT_HEAD(&ignores, ign, next); 52278158Sroam} 52378158Sroam 524184656Smlaierstatic void 525100822Sdwmaloneignoreclean(void) 52678158Sroam{ 52778158Sroam struct ignentry *ign; 52878158Sroam 52978158Sroam while (!SLIST_EMPTY(&ignores)) { 53078158Sroam ign = SLIST_FIRST(&ignores); 53178158Sroam SLIST_REMOVE_HEAD(&ignores, next); 53278158Sroam free(ign->mask); 53378158Sroam free(ign); 53478158Sroam } 53578158Sroam} 53678158Sroam 537184656Smlaierstatic int 538100822Sdwmaloneignorep(FTSENT *ent) 53978158Sroam{ 54078158Sroam struct ignentry *ign; 54178158Sroam 542158339Smaxim if (nodumpflag && (ent->fts_statp->st_flags & UF_NODUMP)) 543158339Smaxim return 1; 54478158Sroam SLIST_FOREACH(ign, &ignores, next) 54578158Sroam if (fnmatch(ign->mask, ent->fts_name, 0) != FNM_NOMATCH) 54678158Sroam return 1; 54778158Sroam return 0; 54878158Sroam} 549191677Simp 550191677Simpstatic void 551191677Simpsiginfo(int sig __unused) 552191677Simp{ 553191677Simp 554191677Simp info = 1; 555191677Simp} 556