From: William Lallemand Date: Mon, 1 Apr 2019 09:30:03 +0000 (+0200) Subject: MINOR: mworker/cli: show programs in 'show proc' X-Git-Tag: v2.0-dev3~343 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ad53d6dd75fdc9e76d48f790e803acfdce976258;p=thirdparty%2Fhaproxy.git MINOR: mworker/cli: show programs in 'show proc' Show the programs in 'show proc' Example: # programs 2285 dataplane-api - 0 0d 00h00m12s # old programs 2261 dataplane-api - 1 0d 00h00m53s --- diff --git a/src/mworker.c b/src/mworker.c index d847ee9006..ac5d1a0400 100644 --- a/src/mworker.c +++ b/src/mworker.c @@ -442,6 +442,38 @@ static int cli_io_handler_show_proc(struct appctx *appctx) free(msg); } + /* displays external process */ + chunk_appendf(&trash, "# programs\n"); + old = 0; + list_for_each_entry(child, &proc_list, list) { + up = now.tv_sec - child->timestamp; + + if (child->type != 'e') + continue; + + if (child->reloads > 0) { + old++; + continue; + } + chunk_appendf(&trash, "%-15u %-15s %-15s %-15d %dd %02dh%02dm%02ds\n", child->pid, child->id, "-", child->reloads, up / 86400, (up % 86400) / 3600, (up % 3600) / 60, (up % 60)); + } + + if (old) { + chunk_appendf(&trash, "# old programs\n"); + list_for_each_entry(child, &proc_list, list) { + up = now.tv_sec - child->timestamp; + + if (child->type != 'e') + continue; + + if (child->reloads > 0) { + chunk_appendf(&trash, "%-15u %-15s %-15s %-15d %dd %02dh%02dm%02ds\n", child->pid, child->id, "-", child->reloads, up / 86400, (up % 86400) / 3600, (up % 3600) / 60, (up % 60)); + } + } + } + + + if (ci_putchk(si_ic(si), &trash) == -1) { si_rx_room_blk(si); return 0;