1
0
mirror of https://github.com/samba-team/samba.git synced 2025-03-27 22:50:26 +03:00

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
This commit is contained in:
Volker Lendecke 2015-02-11 15:31:26 +00:00 committed by Stefan Metzmacher
parent 8bc5b7369d
commit 6f41a78c0e
4 changed files with 24 additions and 2 deletions

View File

@ -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);

View File

@ -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

View File

@ -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
)

View File

@ -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();