changeset 1302:1253f0c3dd53 draft

Convert bootchartd to generic_signal().
author Rob Landley <rob@landley.net>
date Wed, 21 May 2014 07:57:48 -0500
parents 1c25b5119072
children 2b89b13df19e
files toys/pending/bootchartd.c
diffstat 1 files changed, 2 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/toys/pending/bootchartd.c	Wed May 21 07:51:11 2014 -0500
+++ b/toys/pending/bootchartd.c	Wed May 21 07:57:48 2014 -0500
@@ -26,14 +26,12 @@
 
 #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 @@
     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 signal_handler(int sig)
-{
-  TT.got_signal = sig;
-}
-
 void bootchartd_main()
 {
   pid_t lgr_pid, self_pid = getpid();
@@ -291,7 +284,7 @@
   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");