Lines Matching +full:int +full:- +full:threshold

1 /*-
2 * SPDX-License-Identifier: BSD-3-Clause
66 static int linkchk(FTSENT *);
71 static int ignorep(FTSENT *);
72 static void siginfo(int __unused);
74 static int nodumpflag = 0;
75 static int Aflag, hflag;
85 int
86 main(int argc, char *argv[]) in main()
91 off_t threshold, threshold_sign; in main() local
92 int ftsoptions; in main()
93 int depth; in main()
94 int Hflag, Lflag, aflag, sflag, dflag, cflag; in main()
95 int lflag, ch, notused, rval; in main()
106 threshold = 0; in main()
118 long_options, NULL)) != -1) in main()
189 if (expand_number(optarg, &threshold) != 0 || in main()
190 threshold == 0) { in main()
191 xo_warnx("invalid threshold: %s", optarg); in main()
193 } else if (threshold < 0) in main()
194 threshold_sign = -1; in main()
208 argc -= optind; in main()
217 * that we'd have to re-implement the kernel's symbolic link traversing in main()
253 if (threshold != 0) in main()
254 threshold = howmany(threshold / DEV_BSIZE * cblocksize, in main()
266 xo_open_container("disk-usage-information"); in main()
269 switch (p->fts_info) { in main()
279 howmany(p->fts_statp->st_size, cblocksize) : in main()
280 howmany(p->fts_statp->st_blocks, cblocksize); in main()
281 p->fts_parent->fts_bignum += p->fts_bignum += in main()
284 if (p->fts_level <= depth && threshold <= in main()
285 threshold_sign * howmany(p->fts_bignum * in main()
290 p->fts_bignum); in main()
291 xo_emit("\t{:path/%s}\n", p->fts_path); in main()
294 (intmax_t)howmany(p->fts_bignum * in main()
296 p->fts_path); in main()
302 (void)printf("\t%s\n", p->fts_path); in main()
310 xo_warnx("%s: %s", p->fts_path, strerror(p->fts_errno)); in main()
317 if (lflag == 0 && p->fts_statp->st_nlink > 1 && in main()
322 howmany(p->fts_statp->st_size, cblocksize) : in main()
323 howmany(p->fts_statp->st_blocks, cblocksize); in main()
325 if (aflag || p->fts_level == 0) { in main()
329 xo_emit("\t{:path/%s}\n", p->fts_path); in main()
334 p->fts_path); in main()
339 p->fts_parent->fts_bignum += curblocks; in main()
341 savednumber = p->fts_parent->fts_bignum; in main()
350 prthumanval("{:total-blocks/%4s}\ttotal\n", in main()
353 xo_emit("{:total-blocks/%jd}\ttotal\n", in main()
360 xo_close_container("disk-usage-information"); in main()
366 static int
372 int links; in linkchk()
385 int hash; in linkchk()
387 st = p->fts_statp; in linkchk()
408 free_list = le->next; in linkchk()
422 buckets[i] = le->next; in linkchk()
425 hash = (le->dev ^ le->ino) % new_size; in linkchk()
428 new_buckets[hash]->previous = in linkchk()
430 le->next = new_buckets[hash]; in linkchk()
431 le->previous = NULL; in linkchk()
442 hash = ( st->st_dev ^ st->st_ino ) % number_buckets; in linkchk()
443 for (le = buckets[hash]; le != NULL; le = le->next) { in linkchk()
444 if (le->dev == st->st_dev && le->ino == st->st_ino) { in linkchk()
449 if (--le->links <= 0) { in linkchk()
450 if (le->previous != NULL) in linkchk()
451 le->previous->next = le->next; in linkchk()
452 if (le->next != NULL) in linkchk()
453 le->next->previous = le->previous; in linkchk()
455 buckets[hash] = le->next; in linkchk()
456 number_entries--; in linkchk()
461 le->next = free_list; in linkchk()
476 free_list = le->next; in linkchk()
485 le->dev = st->st_dev; in linkchk()
486 le->ino = st->st_ino; in linkchk()
487 le->links = st->st_nlink - 1; in linkchk()
489 le->next = buckets[hash]; in linkchk()
490 le->previous = NULL; in linkchk()
492 buckets[hash]->previous = le; in linkchk()
501 int flags; in prthumanval()
519 "usage: du [-Aclnx] [-H | -L | -P] [-g | -h | -k | -m] " in usage()
520 "[-a | -s | -d depth] [-B blocksize] [-I mask] " in usage()
521 "[-t threshold] [file ...]\n"); in usage()
533 ign->mask = strdup(mask); in ignoreadd()
534 if (ign->mask == NULL) in ignoreadd()
547 free(ign->mask); in ignoreclean()
552 static int
557 if (nodumpflag && (ent->fts_statp->st_flags & UF_NODUMP)) in ignorep()
560 if (fnmatch(ign->mask, ent->fts_name, 0) != FNM_NOMATCH) in ignorep()
566 siginfo(int sig __unused) in siginfo()