summaryrefslogtreecommitdiff
path: root/source3/smbd
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2002-12-20 20:21:31 +0000
committerJeremy Allison <jra@samba.org>2002-12-20 20:21:31 +0000
commitef8bd7c4f7ae8192ea05db070962ecf0ff3615f3 (patch)
tree09644a4bc94784b1f097a7cfb6259dad6c33ae0e /source3/smbd
parent8c93138982da3f9444bdef63cf48de37876866ed (diff)
downloadsamba-ef8bd7c4f7ae8192ea05db070962ecf0ff3615f3.tar.gz
samba-ef8bd7c4f7ae8192ea05db070962ecf0ff3615f3.tar.bz2
samba-ef8bd7c4f7ae8192ea05db070962ecf0ff3615f3.zip
Forward port the change to talloc_init() to make all talloc contexts
named. Ensure we can query them. Jeremy. (This used to be commit 09a218a9f6fb0bd922940467bf8500eb4f1bcf84)
Diffstat (limited to 'source3/smbd')
-rw-r--r--source3/smbd/nttrans.c4
-rw-r--r--source3/smbd/server.c31
2 files changed, 26 insertions, 9 deletions
diff --git a/source3/smbd/nttrans.c b/source3/smbd/nttrans.c
index bdefa6c4c1..740f450db6 100644
--- a/source3/smbd/nttrans.c
+++ b/source3/smbd/nttrans.c
@@ -985,7 +985,7 @@ static NTSTATUS set_sd(files_struct *fsp, char *data, uint32 sd_len, uint32 secu
* Init the parse struct we will unmarshall from.
*/
- if ((mem_ctx = talloc_init()) == NULL) {
+ if ((mem_ctx = talloc_init("set_sd")) == NULL) {
DEBUG(0,("set_sd: talloc_init failed.\n"));
return NT_STATUS_NO_MEMORY;
}
@@ -1538,7 +1538,7 @@ static int call_nt_transact_query_security_desc(connection_struct *conn,
*ppparams = params;
- if ((mem_ctx = talloc_init()) == NULL) {
+ if ((mem_ctx = talloc_init("call_nt_transact_query_security_desc")) == NULL) {
DEBUG(0,("call_nt_transact_query_security_desc: talloc_init failed.\n"));
return ERROR_DOS(ERRDOS,ERRnomem);
}
diff --git a/source3/smbd/server.c b/source3/smbd/server.c
index 342c7c85cf..7581eb6001 100644
--- a/source3/smbd/server.c
+++ b/source3/smbd/server.c
@@ -463,6 +463,25 @@ BOOL reload_services(BOOL test)
return(ret);
}
+/*******************************************************************
+ Print out all talloc memory info.
+********************************************************************/
+
+void return_all_talloc_info(int msg_type, pid_t src_pid, void *buf, size_t len)
+{
+ TALLOC_CTX *ctx = talloc_init("info context");
+ char *info = NULL;
+
+ if (!ctx)
+ return;
+
+ info = talloc_describe_all(ctx);
+ if (info)
+ DEBUG(10,(info));
+ message_send_pid(src_pid, MSG_TALLOC_USAGE, info, info ? strlen(info) + 1 : 0, True);
+ talloc_destroy(ctx);
+}
+
#if DUMP_CORE
/*******************************************************************
prepare to dump a core file - carefully!
@@ -759,19 +778,18 @@ static BOOL init_structs(void )
setpgid( (pid_t)0, (pid_t)0);
#endif
- if (!directory_exist(lp_lockdir(), NULL)) {
+ if (!directory_exist(lp_lockdir(), NULL))
mkdir(lp_lockdir(), 0755);
- }
- if (is_daemon) {
+ if (is_daemon)
pidfile_create("smbd");
- }
- if (!message_init()) {
+ if (!message_init())
exit(1);
- }
+
register_msg_pool_usage();
register_dmalloc_msgs();
+ message_register(MSG_REQ_TALLOC_USAGE, return_all_talloc_info);
if (!print_backend_init())
exit(1);
@@ -840,7 +858,6 @@ static BOOL init_structs(void )
/* register our message handlers */
message_register(MSG_SMB_FORCE_TDIS, msg_force_tdis);
- talloc_init_named("dummy!");
smbd_process();