summaryrefslogtreecommitdiff
path: root/source3/utils
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/utils
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/utils')
-rw-r--r--source3/utils/net_ads.c4
-rw-r--r--source3/utils/net_rpc.c12
-rw-r--r--source3/utils/net_rpc_join.c2
-rw-r--r--source3/utils/net_rpc_samsync.c6
-rw-r--r--source3/utils/smbcacls.c2
-rw-r--r--source3/utils/smbcontrol.c38
6 files changed, 51 insertions, 13 deletions
diff --git a/source3/utils/net_ads.c b/source3/utils/net_ads.c
index f0ea82d87c..72dbe49c16 100644
--- a/source3/utils/net_ads.c
+++ b/source3/utils/net_ads.c
@@ -180,7 +180,7 @@ static int net_ads_workgroup(int argc, const char **argv)
if (!(ads = ads_startup())) return -1;
- if (!(ctx = talloc_init_named("net_ads_workgroup"))) {
+ if (!(ctx = talloc_init("net_ads_workgroup"))) {
return -1;
}
@@ -748,7 +748,7 @@ static int net_ads_printer_publish(int argc, const char **argv)
struct in_addr server_ip;
NTSTATUS nt_status;
extern char *opt_workgroup;
- TALLOC_CTX *mem_ctx = talloc_init();
+ TALLOC_CTX *mem_ctx = talloc_init("net_ads_printer_publish");
ADS_MODLIST mods = ads_init_mods(mem_ctx);
char *prt_dn, *srv_dn, **srv_cn;
void *res = NULL;
diff --git a/source3/utils/net_rpc.c b/source3/utils/net_rpc.c
index 092d625ae5..2b2a69eb99 100644
--- a/source3/utils/net_rpc.c
+++ b/source3/utils/net_rpc.c
@@ -62,7 +62,7 @@ static DOM_SID *net_get_remote_domain_sid(struct cli_state *cli)
goto error;
}
- if (!(mem_ctx=talloc_init()))
+ if (!(mem_ctx=talloc_init("net_get_remote_domain_sid")))
{
DEBUG(0,("net_get_remote_domain_sid: talloc_init returned NULL!\n"));
goto error;
@@ -138,7 +138,7 @@ static int run_rpc_command(struct cli_state *cli_arg, const int pipe_idx, int co
/* Create mem_ctx */
- if (!(mem_ctx = talloc_init())) {
+ if (!(mem_ctx = talloc_init("run_rpc_command"))) {
DEBUG(0, ("talloc_init() failed\n"));
cli_shutdown(cli);
return -1;
@@ -374,7 +374,7 @@ rpc_info_internals(const DOM_SID *domain_sid, struct cli_state *cli,
result = cli_samr_query_dom_info(cli, mem_ctx, &domain_pol,
2, &ctr);
if (NT_STATUS_IS_OK(result)) {
- TALLOC_CTX *ctx = talloc_init();
+ TALLOC_CTX *ctx = talloc_init("rpc_info_internals");
d_printf("Domain Name: %s\n", unistr2_tdup(ctx, &ctr.info.inf2.uni_domain));
d_printf("Domain SID: %s\n", sid_str);
d_printf("Sequence number: %u\n", ctr.info.inf2.seq_num);
@@ -1721,7 +1721,7 @@ static int rpc_trustdom_establish(int argc, const char **argv)
return -1;
}
- if (!(mem_ctx = talloc_init_named("establishing trust relationship to domain %s",
+ if (!(mem_ctx = talloc_init("establishing trust relationship to domain %s",
domain_name))) {
DEBUG(0, ("talloc_init() failed\n"));
cli_shutdown(cli);
@@ -1743,7 +1743,7 @@ static int rpc_trustdom_establish(int argc, const char **argv)
* Call LsaOpenPolicy and LsaQueryInfo
*/
- if (!(mem_ctx = talloc_init())) {
+ if (!(mem_ctx = talloc_init("rpc_trustdom_establish"))) {
DEBUG(0, ("talloc_init() failed\n"));
cli_shutdown(cli);
return -1;
@@ -1903,7 +1903,7 @@ static int rpc_trustdom_list(int argc, const char **argv)
* Listing trusted domains (stored in secrets.tdb, if local)
*/
- mem_ctx = talloc_init_named("trust relationships listing");
+ mem_ctx = talloc_init("trust relationships listing");
/*
* set domain and pdc name to local samba server (default)
diff --git a/source3/utils/net_rpc_join.c b/source3/utils/net_rpc_join.c
index 4b78b7d283..1b711f7b43 100644
--- a/source3/utils/net_rpc_join.c
+++ b/source3/utils/net_rpc_join.c
@@ -141,7 +141,7 @@ int net_rpc_join_newstyle(int argc, const char **argv)
if (!(cli = net_make_ipc_connection(NET_FLAGS_PDC)))
return 1;
- if (!(mem_ctx = talloc_init())) {
+ if (!(mem_ctx = talloc_init("net_rpc_join_newstyle"))) {
DEBUG(0, ("Could not initialise talloc context\n"));
goto done;
}
diff --git a/source3/utils/net_rpc_samsync.c b/source3/utils/net_rpc_samsync.c
index 34d926ab61..1bd39e3ebb 100644
--- a/source3/utils/net_rpc_samsync.c
+++ b/source3/utils/net_rpc_samsync.c
@@ -128,7 +128,7 @@ static void dump_database(struct cli_state *cli, unsigned db_type, DOM_CRED *ret
SAM_DELTA_CTR *deltas;
uint32 num_deltas;
- if (!(mem_ctx = talloc_init())) {
+ if (!(mem_ctx = talloc_init("dump_database"))) {
return;
}
@@ -452,7 +452,7 @@ fetch_group_mem_info(uint32 rid, SAM_GROUP_MEM_INFO *delta)
d_printf("Group members of %s: ", grp->gr_name);
- if (!(t = talloc_init())) {
+ if (!(t = talloc_init("fetch_group_mem_info"))) {
DEBUG(0, ("could not talloc_init\n"));
return NT_STATUS_NO_MEMORY;
}
@@ -656,7 +656,7 @@ fetch_database(struct cli_state *cli, unsigned db_type, DOM_CRED *ret_creds,
SAM_DELTA_CTR *deltas;
uint32 num_deltas;
- if (!(mem_ctx = talloc_init())) {
+ if (!(mem_ctx = talloc_init("fetch_database"))) {
return;
}
diff --git a/source3/utils/smbcacls.c b/source3/utils/smbcacls.c
index 043aa689cc..07b2aa7fec 100644
--- a/source3/utils/smbcacls.c
+++ b/source3/utils/smbcacls.c
@@ -777,7 +777,7 @@ You can string acls together with spaces, commas or newlines\n\
struct cli_state *cli;
- ctx=talloc_init();
+ ctx=talloc_init("main");
setlinebuf(stdout);
diff --git a/source3/utils/smbcontrol.c b/source3/utils/smbcontrol.c
index 72ac2dd095..f4d197147f 100644
--- a/source3/utils/smbcontrol.c
+++ b/source3/utils/smbcontrol.c
@@ -43,6 +43,7 @@ static struct {
{"dmalloc-log-changed", MSG_REQ_DMALLOC_LOG_CHANGED },
{"shutdown", MSG_SHUTDOWN },
{"drvupgrade", MSG_PRINTER_DRVUPGRADE},
+ {"tallocdump", MSG_REQ_TALLOC_USAGE},
{NULL, -1}
};
@@ -75,8 +76,10 @@ static void usage(BOOL doexit)
static int pong_count;
static BOOL got_level;
+static BOOL got_pool;
static BOOL pong_registered = False;
static BOOL debuglevel_registered = False;
+static BOOL poolusage_registered = False;
static BOOL profilelevel_registered = False;
@@ -109,6 +112,22 @@ void pong_function(int msg_type, pid_t src, void *buf, size_t len)
}
/****************************************************************************
+ Prints out the current talloc list.
+****************************************************************************/
+void tallocdump_function(int msg_type, pid_t src, void *buf, size_t len)
+{
+ char *info = (char *)buf;
+
+ printf("Current talloc contexts for process %u\n", (unsigned int)src );
+ if (len == 0)
+ printf("None returned\n");
+ else
+ printf(info);
+ printf("\n");
+ got_pool = True;
+}
+
+/****************************************************************************
Prints out the current Debug level returned by MSG_DEBUGLEVEL
****************************************************************************/
void debuglevel_function(int msg_type, pid_t src, void *buf, size_t len)
@@ -347,6 +366,25 @@ static BOOL do_command(char *dest, char *msg_name, int iparams, char **params)
}
break;
+ case MSG_REQ_TALLOC_USAGE:
+ if (!poolusage_registered) {
+ message_register(MSG_TALLOC_USAGE, tallocdump_function);
+ poolusage_registered = True;
+ }
+ got_pool = False;
+ retval = send_message(dest, MSG_REQ_TALLOC_USAGE, NULL, 0, True);
+ if (retval) {
+ timeout_start = time(NULL);
+ while (!got_pool) {
+ message_dispatch();
+ if ((time(NULL) - timeout_start) > MAX_WAIT) {
+ fprintf(stderr,"tallocdump timeout\n");
+ break;
+ }
+ }
+ }
+ break;
+
case MSG_REQ_DEBUGLEVEL:
if (!debuglevel_registered) {
message_register(MSG_DEBUGLEVEL, debuglevel_function);