aboutsummaryrefslogtreecommitdiff
path: root/usr.bin/du
diff options
context:
space:
mode:
authorWarner Losh <imp@FreeBSD.org>2009-04-30 01:24:53 +0000
committerWarner Losh <imp@FreeBSD.org>2009-04-30 01:24:53 +0000
commitd1588599c02456200eae5f7fcf7f9d309f7bac8e (patch)
treed9f2e763d7ca9ed134585b941f1873411a81de19 /usr.bin/du
parent09c8a4cc212b620d82f621032c41074a52f9c640 (diff)
Report the next directory being scanned when a ^T is pressed (or any
SIGINFO). Provides some progress report for the impatient. This won't report that we're blocking in our walk due to disk/network problems, however. There's no really good way to report that condition that I'm aware of...
Notes
svn path=/head/; revision=191677
Diffstat (limited to 'usr.bin/du')
-rw-r--r--usr.bin/du/du.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/usr.bin/du/du.c b/usr.bin/du/du.c
index f5e7f055b3e4..63677f5f94ce 100644
--- a/usr.bin/du/du.c
+++ b/usr.bin/du/du.c
@@ -77,10 +77,12 @@ static void prthumanval(int64_t);
static void ignoreadd(const char *);
static void ignoreclean(void);
static int ignorep(FTSENT *);
+static void siginfo(int __unused);
static int nodumpflag = 0;
static int Aflag;
static long blocksize, cblocksize;
+static volatile sig_atomic_t info;
int
main(int argc, char *argv[])
@@ -248,6 +250,8 @@ main(int argc, char *argv[])
rval = 0;
+ (void)signal(SIGINFO, siginfo);
+
if ((fts = fts_open(argv, ftsoptions, NULL)) == NULL)
err(1, "fts_open");
@@ -278,6 +282,10 @@ main(int argc, char *argv[])
p->fts_path);
}
}
+ if (info) {
+ info = 0;
+ (void)printf("\t%s\n", p->fts_path);
+ }
break;
case FTS_DC: /* Ignore. */
break;
@@ -531,3 +539,10 @@ ignorep(FTSENT *ent)
return 1;
return 0;
}
+
+static void
+siginfo(int sig __unused)
+{
+
+ info = 1;
+}