aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2014-05-21 07:57:48 -0500
committerRob Landley <rob@landley.net>2014-05-21 07:57:48 -0500
commitf8e940c52cd4016821e582cfbf1458084d4229c8 (patch)
tree05e9b3ef5a9819219935725c6a9f6c6783dd5bd5
parent755e040916d94d0124162a6c345cb783c0931b77 (diff)
downloadtoybox-f8e940c52cd4016821e582cfbf1458084d4229c8.tar.gz
Convert bootchartd to generic_signal().
-rw-r--r--toys/pending/bootchartd.c11
1 files changed, 2 insertions, 9 deletions
diff --git a/toys/pending/bootchartd.c b/toys/pending/bootchartd.c
index 9b943215..6839b2ca 100644
--- a/toys/pending/bootchartd.c
+++ b/toys/pending/bootchartd.c
@@ -26,14 +26,12 @@ config BOOTCHARTD
#define FOR_bootchartd
#include "toys.h"
-#include <signal.h>
GLOBALS(
char buf[32];
long smpl_period_usec;
int proc_accounting;
int is_login;
- int got_signal;
void *head;
)
@@ -171,7 +169,7 @@ static void start_logging()
acct("kernel_procs_acct");
}
memset(TT.buf, 0, sizeof(TT.buf));
- while (--tcnt && !TT.got_signal) {
+ while (--tcnt && !toys.signal) {
int i = 0, j = 0, fd = open("/proc/uptime", O_RDONLY);
if (fd < 0) goto wait_usec;
char *line = get_line(fd);
@@ -250,11 +248,6 @@ static void stop_logging(char *tmp_dir, char *prog)
}
}
-static void signal_handler(int sig)
-{
- TT.got_signal = sig;
-}
-
void bootchartd_main()
{
pid_t lgr_pid, self_pid = getpid();
@@ -291,7 +284,7 @@ void bootchartd_main()
if (!(lgr_pid = fork())) {
char *tmp_dir = create_tmp_dir();
- sigatexit(signal_handler);
+ sigatexit(generic_signal);
raise(SIGSTOP);
if (!bchartd_opt && !getenv("PATH"))
putenv("PATH=/sbin:/usr/sbin:/bin:/usr/bin");