summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2015-02-11 15:31:26 +0000
committerStefan Metzmacher <metze@samba.org>2015-02-14 01:59:19 +0100
commit6f41a78c0ec9b5c0e0df18d8dd63facf0e457c05 (patch)
tree837abd80ee97589cc91f77027138f15f309b48fb
parent8bc5b7369d2a2106ca9e0774cf9c95068968602b (diff)
downloadsamba-6f41a78c0ec9b5c0e0df18d8dd63facf0e457c05.tar.gz
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
-rw-r--r--source4/lib/messaging/messaging.c18
-rw-r--r--source4/lib/messaging/messaging.h4
-rw-r--r--source4/lib/messaging/wscript_build2
-rw-r--r--source4/smbd/server.c2
4 files changed, 24 insertions, 2 deletions
diff --git a/source4/lib/messaging/messaging.c b/source4/lib/messaging/messaging.c
index cad2d64233d..66f9f1c1d03 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);
diff --git a/source4/lib/messaging/messaging.h b/source4/lib/messaging/messaging.h
index b84f5d8286f..920e39d2c5c 100644
--- a/source4/lib/messaging/messaging.h
+++ b/source4/lib/messaging/messaging.h
@@ -34,7 +34,9 @@ struct imessaging_context;
#define MSG_IRPC 6
#define MSG_PVFS_NOTIFY 7
#define MSG_NTVFS_OPLOCK_BREAK 8
-#define MSG_DREPL_ALLOCATE_RID 9
+#define MSG_REQ_POOL_USAGE 9
+#define MSG_POOL_USAGE 10
+#define MSG_DREPL_ALLOCATE_RID 11
/* temporary messaging endpoints are allocated above this line */
#define MSG_TMP_BASE 1000
diff --git a/source4/lib/messaging/wscript_build b/source4/lib/messaging/wscript_build
index efe1f79afd6..adcb2cce4be 100644
--- a/source4/lib/messaging/wscript_build
+++ b/source4/lib/messaging/wscript_build
@@ -3,7 +3,7 @@
bld.SAMBA_LIBRARY('MESSAGING',
source='messaging.c',
- public_deps='samba-util NDR_IRPC UNIX_PRIVS cluster ndr dcerpc messages_util server_id_db',
+ public_deps='samba-util NDR_IRPC UNIX_PRIVS cluster ndr dcerpc messages_util server_id_db talloc_report',
private_library=True
)
diff --git a/source4/smbd/server.c b/source4/smbd/server.c
index 1c80934a472..b0f67c97f07 100644
--- a/source4/smbd/server.c
+++ b/source4/smbd/server.c
@@ -360,6 +360,8 @@ static int binary_smbd_main(const char *binary_name, int argc, const char *argv[
poptFreeContext(pc);
+ talloc_enable_null_tracking();
+
setup_logging(binary_name, opt_interactive?DEBUG_STDOUT:DEBUG_FILE);
setup_signals();