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