Module: kamailio
Branch: master
Commit: 61c368b406f9fd3bf40f548b2866fc254ca11670
URL:
https://github.com/kamailio/kamailio/commit/61c368b406f9fd3bf40f548b2866fc2…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2018-12-28T09:56:26+01:00
core: new rpc command - core.psa
- print attributes stored in process table, similar to core.psx, but
also prints the rank and status fields
---
Modified: src/core/core_cmd.c
---
Diff:
https://github.com/kamailio/kamailio/commit/61c368b406f9fd3bf40f548b2866fc2…
Patch:
https://github.com/kamailio/kamailio/commit/61c368b406f9fd3bf40f548b2866fc2…
---
diff --git a/src/core/core_cmd.c b/src/core/core_cmd.c
index bfa962b567..ea38e60bae 100644
--- a/src/core/core_cmd.c
+++ b/src/core/core_cmd.c
@@ -438,6 +438,28 @@ static void core_psx(rpc_t* rpc, void* c)
}
}
+static const char* core_psa_doc[] = {
+ "Return all the attributes of running.",
+ /* Documentation string */
+ 0 /* Method signature(s) */
+};
+
+
+static void core_psa(rpc_t* rpc, void* c)
+{
+ int p;
+ void *handle;
+
+ for (p=0; p<*process_count;p++) {
+ rpc->add(c, "{", &handle);
+ rpc->struct_add(handle, "dddds",
+ "index", p,
+ "pid", pt[p].pid,
+ "status", pt[p].status,
+ "rank", pt[p].rank,
+ "description", pt[p].desc);
+ }
+}
static const char* core_pwd_doc[] = {
"Returns the working directory of server.", /* Documentation string */
@@ -1058,6 +1080,7 @@ static rpc_export_t core_rpc_methods[] = {
{"core.uptime", core_uptime, core_uptime_doc,
0 },
{"core.ps", core_ps, core_ps_doc,
RET_ARRAY},
{"core.psx", core_psx, core_psx_doc,
RET_ARRAY},
+ {"core.psa", core_psa, core_psa_doc,
RET_ARRAY},
{"core.pwd", core_pwd, core_pwd_doc,
RET_ARRAY},
{"core.arg", core_arg, core_arg_doc,
RET_ARRAY},
{"core.kill", core_kill, core_kill_doc,
0 },