diff options
author | Volker Lendecke <vl@samba.org> | 2015-02-11 15:31:26 +0000 |
---|---|---|
committer | Stefan Metzmacher <metze@samba.org> | 2015-02-14 01:59:19 +0100 |
commit | 6f41a78c0ec9b5c0e0df18d8dd63facf0e457c05 (patch) | |
tree | 837abd80ee97589cc91f77027138f15f309b48fb /source4/lib/messaging/messaging.c | |
parent | 8bc5b7369d2a2106ca9e0774cf9c95068968602b (diff) | |
download | samba-6f41a78c0ec9b5c0e0df18d8dd63facf0e457c05.tar.gz samba-6f41a78c0ec9b5c0e0df18d8dd63facf0e457c05.tar.xz samba-6f41a78c0ec9b5c0e0df18d8dd63facf0e457c05.zip |
messaging4: Enable POOL_USAGE
With this you can watch "samba"'s talloc hierarchy live using
smbcontrol <pid> pool-usage
Enjoy :-)
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Sat Feb 14 01:59:19 CET 2015 on sn-devel-104
Diffstat (limited to 'source4/lib/messaging/messaging.c')
-rw-r--r-- | source4/lib/messaging/messaging.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/source4/lib/messaging/messaging.c b/source4/lib/messaging/messaging.c index cad2d64233..66f9f1c1d0 100644 --- a/source4/lib/messaging/messaging.c +++ b/source4/lib/messaging/messaging.c @@ -33,6 +33,7 @@ #include "../lib/util/tevent_ntstatus.h" #include "lib/param/param.h" #include "lib/util/server_id_db.h" +#include "lib/util/talloc_report.h" #include "../source3/lib/messages_dgm.h" #include "../source3/lib/messages_dgm_ref.h" #include "../source3/lib/messages_util.h" @@ -115,6 +116,22 @@ static void ping_message(struct imessaging_context *msg, void *private_data, imessaging_send(msg, src, MSG_PONG, data); } +static void pool_message(struct imessaging_context *msg, void *private_data, + uint32_t msg_type, struct server_id src, + DATA_BLOB *data) +{ + char *report; + + report = talloc_report_str(msg, NULL); + + if (report != NULL) { + DATA_BLOB blob = { .data = (uint8_t *)report, + .length = talloc_get_size(report) - 1}; + imessaging_send(msg, src, MSG_POOL_USAGE, &blob); + } + talloc_free(report); +} + /* return uptime of messaging server via irpc */ @@ -377,6 +394,7 @@ struct imessaging_context *imessaging_init(TALLOC_CTX *mem_ctx, } imessaging_register(msg, NULL, MSG_PING, ping_message); + imessaging_register(msg, NULL, MSG_REQ_POOL_USAGE, pool_message); imessaging_register(msg, NULL, MSG_IRPC, irpc_handler); IRPC_REGISTER(msg, irpc, IRPC_UPTIME, irpc_uptime, msg); |