|
version 1.1.1.2, 2014/07/30 07:55:27
|
version 1.1.1.3, 2019/10/21 14:58:35
|
|
Line 33
|
Line 33
|
| #include <bmon/group.h> |
#include <bmon/group.h> |
| |
|
| int start_time; |
int start_time; |
| int do_quit = 0; |
|
| int is_daemon = 0; |
|
| |
|
| struct reader_timing rtiming; |
struct reader_timing rtiming; |
| |
|
|
Line 88 static void do_shutdown(void)
|
Line 86 static void do_shutdown(void)
|
| } |
} |
| } |
} |
| |
|
| RETSIGTYPE sig_int(int unused) | static void sig_exit(void) |
| { |
{ |
| if (do_quit) |
|
| exit(-1); |
|
| do_quit = 1; |
|
| } |
|
| |
|
| void sig_exit(void) |
|
| { |
|
| do_shutdown(); |
do_shutdown(); |
| } |
} |
| |
|
|
Line 120 void quit(const char *fmt, ...)
|
Line 111 void quit(const char *fmt, ...)
|
| static inline void print_version(void) |
static inline void print_version(void) |
| { |
{ |
| printf("bmon %s\n", PACKAGE_VERSION); |
printf("bmon %s\n", PACKAGE_VERSION); |
| printf("Copyright (C) 2001-2013 by Thomas Graf <tgraf@suug.ch>\n"); | printf("Copyright (C) 2001-2015 by Thomas Graf <tgraf@suug.ch>\n"); |
| printf("Copyright (C) 2013 Red Hat, Inc.\n"); |
printf("Copyright (C) 2013 Red Hat, Inc.\n"); |
| printf("bmon comes with ABSOLUTELY NO WARRANTY. This is free " \ |
printf("bmon comes with ABSOLUTELY NO WARRANTY. This is free " \ |
| "software, and you\nare welcome to redistribute it under " \ |
"software, and you\nare welcome to redistribute it under " \ |
|
Line 136 static void parse_args_pre(int argc, char *argv[])
|
Line 127 static void parse_args_pre(int argc, char *argv[])
|
| char *gostr = "+:hvVf:"; |
char *gostr = "+:hvVf:"; |
| |
|
| struct option long_opts[] = { |
struct option long_opts[] = { |
| {"help", 0, 0, 'h'}, | {"help", 0, NULL, 'h'}, |
| {"version", 0, 0, 'v'}, | {"version", 0, NULL, 'v'}, |
| {"configfile", 1, 0, 'f'}, | {"configfile", 1, NULL, 'f'}, |
| {0, 0, 0, 0}, | {NULL, 0, NULL, 0}, |
| }; |
}; |
| int c = getopt_long(argc, argv, gostr, long_opts, NULL); |
int c = getopt_long(argc, argv, gostr, long_opts, NULL); |
| if (c == -1) |
if (c == -1) |
|
Line 175 static int parse_args_post(int argc, char *argv[])
|
Line 166 static int parse_args_post(int argc, char *argv[])
|
| "L:hvVf:"; |
"L:hvVf:"; |
| |
|
| struct option long_opts[] = { |
struct option long_opts[] = { |
| {"input", 1, 0, 'i'}, | {"input", 1, NULL, 'i'}, |
| {"output", 1, 0, 'o'}, | {"output", 1, NULL, 'o'}, |
| {"policy", 1, 0, 'p'}, | {"policy", 1, NULL, 'p'}, |
| {"read-interval", 1, 0, 'r'}, | {"read-interval", 1, NULL, 'r'}, |
| {"rate-interval", 1, 0, 'R'}, | {"rate-interval", 1, NULL, 'R'}, |
| {"sleep-interval", 1, 0, 's'}, | {"sleep-interval", 1, NULL, 's'}, |
| {"show-all", 0, 0, 'a'}, | {"show-all", 0, NULL, 'a'}, |
| {"use-si", 0, 0, 'U'}, | {"use-si", 0, NULL, 'U'}, |
| {"use-bit", 0, 0, 'b'}, | {"use-bit", 0, NULL, 'b'}, |
| {"lifetime", 1, 0, 'L'}, | {"lifetime", 1, NULL, 'L'}, |
| {0, 0, 0, 0}, | {NULL, 0, NULL, 0}, |
| }; |
}; |
| int c = getopt_long(argc, argv, gostr, long_opts, NULL); |
int c = getopt_long(argc, argv, gostr, long_opts, NULL); |
| if (c == -1) |
if (c == -1) |
|
Line 220 static int parse_args_post(int argc, char *argv[])
|
Line 211 static int parse_args_post(int argc, char *argv[])
|
| break; |
break; |
| |
|
| case 'a': |
case 'a': |
| cfg_setint(cfg, "show_all", 1); | cfg_setbool(cfg, "show_all", cfg_true); |
| break; |
break; |
| |
|
| case 'U': |
case 'U': |
|
Line 270 int main(int argc, char *argv[])
|
Line 261 int main(int argc, char *argv[])
|
| unsigned long sleep_time; |
unsigned long sleep_time; |
| double read_interval; |
double read_interval; |
| |
|
| start_time = time(0); | start_time = time(NULL); |
| memset(&rtiming, 0, sizeof(rtiming)); |
memset(&rtiming, 0, sizeof(rtiming)); |
| rtiming.rt_variance.v_min = FLT_MAX; |
rtiming.rt_variance.v_min = FLT_MAX; |
| |
|
|
Line 361 int main(int argc, char *argv[])
|
Line 352 int main(int argc, char *argv[])
|
| output_post(); |
output_post(); |
| } |
} |
| |
|
| if (do_quit) |
|
| exit(0); |
|
| |
|
| /* |
/* |
| * ST := Configured ST |
* ST := Configured ST |
| */ |
*/ |
|
Line 399 int main(int argc, char *argv[])
|
Line 387 int main(int argc, char *argv[])
|
| static void __init bmon_init(void) |
static void __init bmon_init(void) |
| { |
{ |
| atexit(&sig_exit); |
atexit(&sig_exit); |
| //signal(SIGINT, &sig_int); |
|
| } |
} |