diff options
Diffstat (limited to 'plugins/check_load.c')
-rw-r--r-- | plugins/check_load.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/plugins/check_load.c b/plugins/check_load.c index 78daa945..2925bff3 100644 --- a/plugins/check_load.c +++ b/plugins/check_load.c | |||
@@ -65,7 +65,7 @@ typedef struct { | |||
65 | int errorcode; | 65 | int errorcode; |
66 | char **top_processes; | 66 | char **top_processes; |
67 | } top_processes_result; | 67 | } top_processes_result; |
68 | static top_processes_result print_top_consuming_processes(int /*n_procs_to_show*/); | 68 | static top_processes_result print_top_consuming_processes(unsigned long n_procs_to_show); |
69 | 69 | ||
70 | typedef struct { | 70 | typedef struct { |
71 | mp_range load[3]; | 71 | mp_range load[3]; |
@@ -248,7 +248,7 @@ int main(int argc, char **argv) { | |||
248 | xasprintf(&top_proc_sc.output, "Top %lu CPU time consuming processes", config.n_procs_to_show); | 248 | xasprintf(&top_proc_sc.output, "Top %lu CPU time consuming processes", config.n_procs_to_show); |
249 | 249 | ||
250 | if (top_proc.errorcode == OK) { | 250 | if (top_proc.errorcode == OK) { |
251 | for (int i = 0; i < config.n_procs_to_show; i++) { | 251 | for (unsigned long i = 0; i < config.n_procs_to_show; i++) { |
252 | xasprintf(&top_proc_sc.output, "%s\n%s", top_proc_sc.output, top_proc.top_processes[i]); | 252 | xasprintf(&top_proc_sc.output, "%s\n%s", top_proc_sc.output, top_proc.top_processes[i]); |
253 | } | 253 | } |
254 | } | 254 | } |
@@ -337,7 +337,7 @@ static check_load_config_wrapper process_arguments(int argc, char **argv) { | |||
337 | print_help(); | 337 | print_help(); |
338 | exit(STATE_UNKNOWN); | 338 | exit(STATE_UNKNOWN); |
339 | case 'n': | 339 | case 'n': |
340 | result.config.n_procs_to_show = atoi(optarg); | 340 | result.config.n_procs_to_show = (unsigned long)atol(optarg); |
341 | break; | 341 | break; |
342 | case '?': /* help */ | 342 | case '?': /* help */ |
343 | usage5(); | 343 | usage5(); |
@@ -441,7 +441,7 @@ int cmpstringp(const void *p1, const void *p2) { | |||
441 | } | 441 | } |
442 | #endif /* PS_USES_PROCPCPU */ | 442 | #endif /* PS_USES_PROCPCPU */ |
443 | 443 | ||
444 | static top_processes_result print_top_consuming_processes(int n_procs_to_show) { | 444 | static top_processes_result print_top_consuming_processes(unsigned long n_procs_to_show) { |
445 | top_processes_result result = { | 445 | top_processes_result result = { |
446 | .errorcode = OK, | 446 | .errorcode = OK, |
447 | }; | 447 | }; |
@@ -462,7 +462,7 @@ static top_processes_result print_top_consuming_processes(int n_procs_to_show) { | |||
462 | #ifdef PS_USES_PROCPCPU | 462 | #ifdef PS_USES_PROCPCPU |
463 | qsort(chld_out.line + 1, chld_out.lines - 1, sizeof(char *), cmpstringp); | 463 | qsort(chld_out.line + 1, chld_out.lines - 1, sizeof(char *), cmpstringp); |
464 | #endif /* PS_USES_PROCPCPU */ | 464 | #endif /* PS_USES_PROCPCPU */ |
465 | int lines_to_show = chld_out.lines < (size_t)(n_procs_to_show + 1) ? (int)chld_out.lines : n_procs_to_show + 1; | 465 | unsigned long lines_to_show = chld_out.lines < (size_t)(n_procs_to_show + 1) ? chld_out.lines : n_procs_to_show + 1; |
466 | 466 | ||
467 | result.top_processes = calloc(lines_to_show, sizeof(char *)); | 467 | result.top_processes = calloc(lines_to_show, sizeof(char *)); |
468 | if (result.top_processes == NULL) { | 468 | if (result.top_processes == NULL) { |
@@ -471,7 +471,7 @@ static top_processes_result print_top_consuming_processes(int n_procs_to_show) { | |||
471 | return result; | 471 | return result; |
472 | } | 472 | } |
473 | 473 | ||
474 | for (int i = 0; i < lines_to_show; i += 1) { | 474 | for (unsigned long i = 0; i < lines_to_show; i += 1) { |
475 | xasprintf(&result.top_processes[i], "%s", chld_out.line[i]); | 475 | xasprintf(&result.top_processes[i], "%s", chld_out.line[i]); |
476 | } | 476 | } |
477 | 477 | ||