Displaying 1 result from an estimated 1 matches for "a_sig_handl".
Did you mean:
a_sig_handler
2007 Oct 02
3
[PATCH] SIGTERM and SIGINT handler to flush xentop -b outputs
...6:29:43 2007 -0600
+++ b/tools/xenstat/xentop/xentop.c Tue Oct 02 09:09:55 2007 +0800
@@ -31,6 +31,7 @@
#if defined(__linux__)
#include <linux/kdev_t.h>
#endif
+#include <signal.h>
#include <xenstat.h>
@@ -1011,6 +1012,13 @@ static void top(void)
free(domains);
}
+
+void a_sig_handler(int n)
+{
+ fflush(stdout);
+ exit(0);
+}
+
int main(int argc, char **argv)
{
int opt, optind = 0;
@@ -1102,6 +1110,8 @@ int main(int argc, char **argv)
ch = getch();
} while (handle_key(ch));
} else {
+ signal(SIGTERM, a_sig_handler);
+ signal(SIGINT, a_sig_handler);
do {...