mirror of
https://github.com/troglobit/finit.git
synced 2026-11-13 17:00:16 +00:00
Merge pull request #459 from rical/add-mem-to-initctl-json
initctl: add memory field to JSON status output
This commit is contained in:
1 file changed
+10
@@ -1048,6 +1048,16 @@ static int json_status_one(FILE *fp, svc_t *svc, char *indent, int prev)
|
|||||||
"%s \"starts\": %d,\n", indent, svc->once);
|
"%s \"starts\": %d,\n", indent, svc->once);
|
||||||
fprintf(fp,
|
fprintf(fp,
|
||||||
"%s \"restarts\": %d,\n", indent, svc->restart_tot); /* XXX: add restart_cnt and restart_max */
|
"%s \"restarts\": %d,\n", indent, svc->restart_tot); /* XXX: add restart_cnt and restart_max */
|
||||||
|
|
||||||
|
/* Add memory information if cgroup support is available */
|
||||||
|
if (cgrp && svc->pid > 1) {
|
||||||
|
char *group = pid_cgroup(svc->pid);
|
||||||
|
if (group) {
|
||||||
|
fprintf(fp, "%s \"memory\": %lu,\n", indent, cgroup_memory(group));
|
||||||
|
free(group);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fprintf(fp,
|
fprintf(fp,
|
||||||
"%s \"pidfile\": \"%s\",\n"
|
"%s \"pidfile\": \"%s\",\n"
|
||||||
"%s \"pid\": %d,\n"
|
"%s \"pid\": %d,\n"
|
||||||
|
|||||||
Reference in new issue
Block a user