Module: kamailio
Branch: master
Commit: 01e8e339149ce1554747929cb63b843866c53aba
URL:
https://github.com/kamailio/kamailio/commit/01e8e339149ce1554747929cb63b843…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2020-09-16T07:22:09+02:00
kex: added pkg.info rpc command
- get details about pkg manager
---
Modified: src/modules/kex/pkg_stats.c
---
Diff:
https://github.com/kamailio/kamailio/commit/01e8e339149ce1554747929cb63b843…
Patch:
https://github.com/kamailio/kamailio/commit/01e8e339149ce1554747929cb63b843…
---
diff --git a/src/modules/kex/pkg_stats.c b/src/modules/kex/pkg_stats.c
index 9a2f4a2d37..ee6c637ace 100644
--- a/src/modules/kex/pkg_stats.c
+++ b/src/modules/kex/pkg_stats.c
@@ -259,11 +259,39 @@ static void rpc_pkg_stats(rpc_t* rpc, void* ctx)
}
}
+/**
+ *
+ */
+static const char* rpc_pkg_info_doc[2] = {
+ "Private memory manager details",
+ 0
+};
+
+/**
+ *
+ */
+static void rpc_pkg_info(rpc_t* rpc, void* ctx)
+{
+ void* th;
+
+ if (rpc->add(ctx, "{", &th) < 0) {
+ rpc->fault(ctx, 500, "Internal error creating rpc");
+ return;
+ }
+ if(rpc->struct_add(th, "su",
+ "name", (_pkg_root.mname)?_pkg_root.mname:"unknown",
+ "size", (unsigned int)pkg_mem_size) <0) {
+ rpc->fault(ctx, 500, "Internal error adding fields");
+ return;
+ }
+}
+
/**
*
*/
rpc_export_t kex_pkg_rpc[] = {
{"pkg.stats", rpc_pkg_stats, rpc_pkg_stats_doc, RET_ARRAY},
+ {"pkg.info", rpc_pkg_info, rpc_pkg_info_doc, 0},
{0, 0, 0, 0}
};