freebsd-ports/sysutils/e2fsprogs/files/patch-SIGINFO-e2fck_unix.c
Matthias Andree c34284799a Update to upstream 1.41.11.
See the shipped RELEASE.NOTES for details.

Approved by: garga (mentor)
2010-03-18 11:42:42 +00:00

63 lines
1.4 KiB
C

--- a/e2fsck/unix.c.orig 2009-08-23 04:44:35.000000000 +0200
+++ b/e2fsck/unix.c 2009-10-11 23:12:39.000000000 +0200
@@ -9,8 +9,6 @@
* %End-Header%
*/
-#define _XOPEN_SOURCE 600 /* for inclusion of sa_handler in Solaris */
-
#include <stdio.h>
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
@@ -497,6 +495,24 @@
return 0;
}
+static int e2fsck_progress_once(e2fsck_t ctx, int pass, unsigned long cur, unsigned long max)
+{
+ char buf[80];
+ float percent;
+
+ if (pass == 0)
+ return 0;
+
+ percent = calc_percent(&e2fsck_tbl, pass, cur, max);
+ e2fsck_simple_progress(ctx, ctx->device_name,
+ percent, 0);
+
+ printf("\n");
+ ctx->progress = 0;
+ return 0;
+}
+
+
#define PATH_SET "PATH=/sbin"
static void reserve_stdio_fds(void)
@@ -528,6 +544,17 @@
ctx->progress = e2fsck_update_progress;
}
+static void signal_progress_now(int sig EXT2FS_ATTR((unused)))
+{
+ e2fsck_t ctx = e2fsck_global_ctx;
+
+ if (!ctx)
+ return;
+
+ ctx->progress = e2fsck_progress_once;
+ ctx->progress_fd = 0;
+}
+
static void signal_progress_off(int sig EXT2FS_ATTR((unused)))
{
e2fsck_t ctx = e2fsck_global_ctx;
@@ -862,6 +889,8 @@
sigaction(SIGUSR1, &sa, 0);
sa.sa_handler = signal_progress_off;
sigaction(SIGUSR2, &sa, 0);
+ sa.sa_handler = signal_progress_now;
+ sigaction(SIGINFO, &sa, 0);
#endif
/* Update our PATH to include /sbin if we need to run badblocks */