continue;
}
- mem_ctx = talloc_init_named("auth_get_challenge for module %s", auth_method->name);
+ mem_ctx = talloc_init("auth_get_challenge for module %s", auth_method->name);
if (!mem_ctx) {
- smb_panic("talloc_init_named() failed!");
+ smb_panic("talloc_init() failed!");
}
challenge = auth_method->get_chal(auth_context, &auth_method->private_data, mem_ctx);
return NT_STATUS_LOGON_FAILURE;
for (auth_method = auth_context->auth_method_list;auth_method; auth_method = auth_method->next) {
- mem_ctx = talloc_init_named("%s authentication for user %s\\%s", auth_method->name,
+ mem_ctx = talloc_init("%s authentication for user %s\\%s", auth_method->name,
user_info->domain.str, user_info->smb_name.str);
nt_status = auth_method->auth(auth_context, auth_method->private_data, mem_ctx, user_info, server_info);
{
TALLOC_CTX *mem_ctx;
- mem_ctx = talloc_init_named("authentication context");
+ mem_ctx = talloc_init("authentication context");
*auth_context = talloc(mem_ctx, sizeof(**auth_context));
if (!*auth_context) {
**/
typedef struct talloc_ctx TALLOC_CTX;
-TALLOC_CTX *talloc_init_named(char const *fmt, ...) PRINTF_ATTRIBUTE(1, 2);
+TALLOC_CTX *talloc_init(char const *fmt, ...) PRINTF_ATTRIBUTE(1, 2);
char *talloc_vasprintf(TALLOC_CTX *t, const char *fmt, va_list ap)
PRINTF_ATTRIBUTE(2, 0);
/** Create a new talloc context. **/
-TALLOC_CTX *talloc_init(void)
+static TALLOC_CTX *talloc_init_internal(void)
{
TALLOC_CTX *t;
* Please call this in preference to talloc_init().
**/
- TALLOC_CTX *talloc_init_named(char const *fmt, ...)
+ TALLOC_CTX *talloc_init(char const *fmt, ...)
{
TALLOC_CTX *t;
va_list ap;
- t = talloc_init();
+ t = talloc_init_internal();
if (t && fmt) {
/*
* t->name must not be talloced.
void *UNUSED(buf), size_t UNUSED(len))
{
char *reply;
- TALLOC_CTX *reply_pool = talloc_init_named("msg_pool_usage");
+ TALLOC_CTX *reply_pool = talloc_init("msg_pool_usage");
SMB_ASSERT(msg_type == MSG_REQ_POOL_USAGE);
*res = NULL;
- if (!(ctx = talloc_init()))
+ if (!(ctx = talloc_init("ads_do_paged_search")))
return ADS_ERROR(LDAP_NO_MEMORY);
/* 0 means the conversion worked but the result was empty
char *utf8_exp, *utf8_path, **search_attrs = NULL;
TALLOC_CTX *ctx;
- if (!(ctx = talloc_init())) {
+ if (!(ctx = talloc_init("ads_do_search"))) {
DEBUG(1,("ads_do_search: talloc_init() failed!"));
return ADS_ERROR(LDAP_NO_MEMORY);
}
char *psp;
unsigned acct_control;
- if (!(ctx = talloc_init_named("machine_account")))
+ if (!(ctx = talloc_init("machine_account")))
return ADS_ERROR(LDAP_NO_MEMORY);
ret = ADS_ERROR(LDAP_NO_MEMORY);
SEC_DESC *psd = 0;
TALLOC_CTX *ctx = 0;
- if (!(ctx = talloc_init_named("sec_io_desc")))
+ if (!(ctx = talloc_init("sec_io_desc")))
return;
/* prepare data */
void *msg;
TALLOC_CTX *ctx;
- if (!(ctx = talloc_init()))
+ if (!(ctx = talloc_init("ads_process_results")))
return;
for (msg = ads_first_entry(ads, res); msg;
msg = ads_first_entry(ads, res);
ads_pull_sid(ads, msg, attrs[1], &sid);
- if (!(ctx = talloc_init_named("sec_io_desc"))) {
+ if (!(ctx = talloc_init("sec_io_desc"))) {
ret = ADS_ERROR(LDAP_NO_MEMORY);
goto ads_set_sd_error;
}
char *timestr;
TALLOC_CTX *ctx;
- if (!(ctx = talloc_init())) {
+ if (!(ctx = talloc_init("ads_server_info"))) {
return ADS_ERROR(LDAP_NO_MEMORY);
}
if (fullname && *fullname) name = fullname;
else name = user;
- if (!(ctx = talloc_init_named("ads_add_user_acct")))
+ if (!(ctx = talloc_init("ads_add_user_acct")))
return ADS_ERROR(LDAP_NO_MEMORY);
status = ADS_ERROR(LDAP_NO_MEMORY);
char *new_dn;
const char *objectClass[] = {"top", "group", NULL};
- if (!(ctx = talloc_init_named("ads_add_group_acct")))
+ if (!(ctx = talloc_init("ads_add_group_acct")))
return ADS_ERROR(LDAP_NO_MEMORY);
status = ADS_ERROR(LDAP_NO_MEMORY);
if (!cli->outbuf || !cli->inbuf)
goto error;
- if ((cli->mem_ctx = talloc_init_named("cli based talloc")) == NULL)
+ if ((cli->mem_ctx = talloc_init("cli based talloc")) == NULL)
goto error;
memset(cli->outbuf, 0, cli->bufsize);
prs_struct pd;
BOOL ret = False;
- if ((mem_ctx = talloc_init()) == NULL) {
+ if ((mem_ctx = talloc_init("cli_set_secdesc")) == NULL) {
DEBUG(0,("talloc_init failed.\n"));
goto cleanup;
}
* semantics that if a write lock is added, then it will be first in the array.
*/
- if ((l_ctx = talloc_init()) == NULL) {
+ if ((l_ctx = talloc_init("set_posix_lock")) == NULL) {
DEBUG(0,("set_posix_lock: unable to init talloc context.\n"));
return True; /* Not a fatal error. */
}
}
}
- if ((ul_ctx = talloc_init()) == NULL) {
+ if ((ul_ctx = talloc_init("release_posix_lock")) == NULL) {
DEBUG(0,("release_posix_lock: unable to init talloc context.\n"));
return True; /* Not a fatal error. */
}
sys_select_signal();
}
+/*******************************************************************
+ 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!
message_register(MSG_FORCE_ELECTION, nmbd_message_election);
message_register(MSG_WINS_NEW_ENTRY, nmbd_wins_new_entry);
message_register(MSG_SHUTDOWN, nmbd_terminate);
+ message_register(MSG_REQ_TALLOC_USAGE, return_all_talloc_info);
DEBUG( 3, ( "Opening sockets %d\n", global_nmb_port ) );
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
/**************************************************************************** **
}
register_msg_pool_usage();
+ message_register(MSG_REQ_TALLOC_USAGE, return_all_talloc_info);
/* Loop waiting for requests */
ads = ads_cached_connection(domain);
if (!ads) return NT_STATUS_UNSUCCESSFUL;
- if (!(ctx = talloc_init_named("alternate_name"))) {
+ if (!(ctx = talloc_init("alternate_name"))) {
return NT_STATUS_NO_MEMORY;
}
TALLOC_CTX *mem_ctx;
NTSTATUS status;
- if (!(mem_ctx = talloc_init_named("fill_grent_mem(%s)", domain->name)))
+ if (!(mem_ctx = talloc_init("fill_grent_mem(%s)", domain->name)))
return False;
/* Initialise group membership information */
if (ent->got_sam_entries)
return False;
- if (!(mem_ctx = talloc_init_named("get_sam_group_entries(%s)",
+ if (!(mem_ctx = talloc_init("get_sam_group_entries(%s)",
ent->domain_name))) {
DEBUG(1, ("get_sam_group_entries: could not create talloc context!\n"));
return False;
DEBUG(3, ("[%5d]: getgroups %s\n", state->pid,
state->request.data.username));
- if (!(mem_ctx = talloc_init_named("winbindd_getgroups(%s)",
+ if (!(mem_ctx = talloc_init("winbindd_getgroups(%s)",
state->request.data.username)))
return WINBINDD_ERROR;
DEBUG(3, ("[%5d]: pam auth %s\n", state->pid,
state->request.data.auth.user));
- if (!(mem_ctx = talloc_init_named("winbind pam auth for %s", state->request.data.auth.user))) {
+ if (!(mem_ctx = talloc_init("winbind pam auth for %s", state->request.data.auth.user))) {
DEBUG(0, ("winbindd_pam_auth: could not talloc_init()!\n"));
result = NT_STATUS_NO_MEMORY;
goto done;
/* Ensure null termination */
state->request.data.auth_crap.domain[sizeof(state->request.data.auth_crap.domain)-1]='\0';
- if (!(mem_ctx = talloc_init_named("winbind pam auth crap for (utf8) %s", state->request.data.auth_crap.user))) {
+ if (!(mem_ctx = talloc_init("winbind pam auth crap for (utf8) %s", state->request.data.auth_crap.user))) {
DEBUG(0, ("winbindd_pam_auth_crap: could not talloc_init()!\n"));
result = NT_STATUS_NO_MEMORY;
goto done;
ctr.sam.info1 = &info1;
- ctx2 = talloc_init_named("winbindd dispinfo");
+ ctx2 = talloc_init("winbindd dispinfo");
if (!ctx2) {
result = NT_STATUS_NO_MEMORY;
goto done;
uint32 count = 0, start = *num_entries;
TALLOC_CTX *mem_ctx2;
- mem_ctx2 = talloc_init_named("enum_dom_groups[rpc]");
+ mem_ctx2 = talloc_init("enum_dom_groups[rpc]");
status = cli_samr_enum_dom_groups(hnd->cli, mem_ctx2, &dom_pol,
&start,
uint32 count = 0, start = *num_entries;
TALLOC_CTX *mem_ctx2;
- mem_ctx2 = talloc_init_named("enum_dom_local_groups[rpc]");
+ mem_ctx2 = talloc_init("enum_dom_local_groups[rpc]");
result = cli_samr_enum_als_groups( hnd->cli, mem_ctx2, &dom_pol,
&start, 0xFFFF, &info2, &count);
DEBUG(3,("rpc: name_to_sid name=%s\n", name));
- if (!(mem_ctx = talloc_init_named("name_to_sid[rpc] for [%s]\\[%s]", domain->name, name))) {
+ if (!(mem_ctx = talloc_init("name_to_sid[rpc] for [%s]\\[%s]", domain->name, name))) {
DEBUG(0, ("talloc_init failed!\n"));
return NT_STATUS_NO_MEMORY;
}
*seq = DOM_SEQUENCE_NONE;
- if (!(mem_ctx = talloc_init_named("sequence_number[rpc]")))
+ if (!(mem_ctx = talloc_init("sequence_number[rpc]")))
return NT_STATUS_NO_MEMORY;
/* Get sam handle */
DEBUG(3,("rpc: domain_sid\n"));
- if (!(mem_ctx = talloc_init_named("domain_sid[rpc]")))
+ if (!(mem_ctx = talloc_init("domain_sid[rpc]")))
return NT_STATUS_NO_MEMORY;
/* Get sam handle */
from the winbind_lookup_by_name() call and use it in a
winbind_lookup_userinfo() */
- if (!(mem_ctx = talloc_init_named("winbindd_getpwnam([%s]\\[%s])",
+ if (!(mem_ctx = talloc_init("winbindd_getpwnam([%s]\\[%s])",
name_domain, name_user))) {
DEBUG(1, ("out of memory\n"));
return WINBINDD_ERROR;
/* Get some user info */
- if (!(mem_ctx = talloc_init_named("winbind_getpwuid(%d)",
+ if (!(mem_ctx = talloc_init("winbind_getpwuid(%d)",
state->request.data.uid))) {
DEBUG(1, ("out of memory\n"));
if (ent->num_sam_entries)
return False;
- if (!(mem_ctx = talloc_init_named("get_sam_user_entries(%s)",
+ if (!(mem_ctx = talloc_init("get_sam_user_entries(%s)",
ent->domain_name)))
return False;
DEBUG(3, ("[%5d]: list users\n", state->pid));
- if (!(mem_ctx = talloc_init_named("winbindd_list_users")))
+ if (!(mem_ctx = talloc_init("winbindd_list_users")))
return WINBINDD_ERROR;
/* Enumerate over trusted domains */
DEBUG(1, ("scanning trusted domain list\n"));
- if (!(mem_ctx = talloc_init_named("init_domain_list")))
+ if (!(mem_ctx = talloc_init("init_domain_list")))
return;
for (domain = _domain_list; domain; domain = domain->next) {
/* Lookup name */
- if (!(mem_ctx = talloc_init_named("winbindd_lookup_name_by_sid")))
+ if (!(mem_ctx = talloc_init("winbindd_lookup_name_by_sid")))
return False;
result = domain->methods->sid_to_name(domain, mem_ctx, sid, &names, type);
#endif
if (!lp_talloc)
- lp_talloc = talloc_init_named("lp_talloc");
+ lp_talloc = talloc_init("lp_talloc");
ret = (char *)talloc(lp_talloc, len + 100); /* leave room for substitution */
TALLOC_CTX *mem_ctx;
NTSTATUS nt_status;
- mem_ctx = talloc_init_named("passdb internal SAM_ACCOUNT allocation");
+ mem_ctx = talloc_init("passdb internal SAM_ACCOUNT allocation");
if (!mem_ctx) {
DEBUG(0,("pdb_init_sam: error while doing talloc_init()\n"));
{
TALLOC_CTX *mem_ctx;
- mem_ctx = talloc_init_named("pdb_context internal allocation context");
+ mem_ctx = talloc_init("pdb_context internal allocation context");
if (!mem_ctx) {
DEBUG(0, ("make_pdb_context: talloc init failed!\n"));
return;
if (!send_ctx)
- send_ctx = talloc_init_named("print notify queue");
+ send_ctx = talloc_init("print notify queue");
if (!send_ctx)
goto fail;
static WERROR publish_it(NT_PRINTER_INFO_LEVEL *printer)
{
ADS_STATUS ads_rc;
- TALLOC_CTX *ctx = talloc_init();
+ TALLOC_CTX *ctx = talloc_init("publish_it");
ADS_MODLIST mods = ads_init_mods(ctx);
char *prt_dn = NULL, *srv_dn, **srv_cn;
void *res = NULL;
* saved to tdb.
*/
- if ((ctx = talloc_init()) == NULL)
+ if ((ctx = talloc_init("save_driver_init_2")) == NULL)
return WERR_NOMEM;
if ((nt_devmode = (NT_DEVICEMODE*)malloc(sizeof(NT_DEVICEMODE))) == NULL) {
fstring key;
WERROR status;
- mem_ctx = talloc_init();
+ mem_ctx = talloc_init("nt_printing_setsec");
if (mem_ctx == NULL)
return WERR_NOMEM;
/* Get printer security descriptor */
- if(!(mem_ctx = talloc_init())) {
+ if(!(mem_ctx = talloc_init("print_access_check"))) {
errno = ENOMEM;
return False;
}
void regsubkey_ctr_init( REGSUBKEY_CTR *ctr )
{
if ( !ctr->ctx )
- ctr->ctx = talloc_init();
+ ctr->ctx = talloc_init("regsubkey_ctr_init for ctr %p", ctr);
}
/***********************************************************************
void regval_ctr_init( REGVAL_CTR *ctr )
{
if ( !ctr->ctx )
- ctr->ctx = talloc_init();
+ ctr->ctx = talloc_init("regval_ctr_init for ctr %p", ctr);
}
/***********************************************************************
TALLOC_CTX *main_loop_talloc_get(void)
{
if (!main_loop_talloc) {
- main_loop_talloc = talloc_init_named("main loop talloc (mainly parse_misc)");
+ main_loop_talloc = talloc_init("main loop talloc (mainly parse_misc)");
if (!main_loop_talloc)
smb_panic("main_loop_talloc: malloc fail\n");
}
ZERO_STRUCTP(p);
- if ((p->mem_ctx = talloc_init()) == NULL) {
+ if ((p->mem_ctx = talloc_init("pipe %s %p", pipe_name, p)) == NULL) {
DEBUG(0,("open_rpc_pipe_p: talloc_init failed.\n"));
SAFE_FREE(p);
return NULL;
DEBUG(3,("free_pipe_context: destroying talloc pool of size %u\n", talloc_pool_size(p->mem_ctx) ));
talloc_destroy_pool(p->mem_ctx);
} else {
- p->mem_ctx = talloc_init();
+ p->mem_ctx = talloc_init("pipe %s %p", p->name, p);
if (p->mem_ctx == NULL)
p->fault_state = True;
}
fstrcpy(sid_str,"(NULL)");
}
- mem_ctx = talloc_init_named("samr_info for domain sid %s", sid_str);
+ mem_ctx = talloc_init("samr_info for domain sid %s", sid_str);
if ((info = (struct samr_info *)talloc(mem_ctx, sizeof(struct samr_info))) == NULL)
return NULL;
if ( !ctr )
return;
- ctr->ctx = talloc_init();
+ ctr->ctx = talloc_init("notify_msg_ctr_init %p", ctr);
return;
}
fstring key;
BOOL ret = False;
- mem_ctx = talloc_init();
+ mem_ctx = talloc_init("set_share_security");
if (mem_ctx == NULL)
return False;
NT_USER_TOKEN *token = NULL;
BOOL ret = True;
- mem_ctx = talloc_init();
+ mem_ctx = talloc_init("share_access_check");
if (mem_ctx == NULL)
return False;
SEC_DESC_BUF *sec_desc_buf=NULL;
BOOL domain = False;
- ctx=talloc_init();
+ ctx=talloc_init("cmd_samr_query_sec_obj");
if ((argc < 1) || (argc > 2)) {
printf("Usage: %s [rid|-d]\n", argv[0]);
if (got_domain_sid) return;
- if (!(mem_ctx=talloc_init()))
+ if (!(mem_ctx=talloc_init("fetch_machine_sid")))
{
DEBUG(0,("fetch_machine_sid: talloc_init returned NULL!\n"));
goto error;
/* Create mem_ctx */
- if (!(mem_ctx = talloc_init())) {
+ if (!(mem_ctx = talloc_init("do_cmd"))) {
DEBUG(0, ("talloc_init() failed\n"));
goto done;
}
* 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;
}
*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);
}
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!
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);
/* register our message handlers */
message_register(MSG_SMB_FORCE_TDIS, msg_force_tdis);
- talloc_init_named("dummy!");
smbd_process();
if (mem_ctx == NULL) {
/* Create mem_ctx */
- if (!(mem_ctx = talloc_init())) {
+ if (!(mem_ctx = talloc_init("do_cmd"))) {
DEBUG(0, ("talloc_init() failed\n"));
goto done;
}
if (!(ads = ads_startup())) return -1;
- if (!(ctx = talloc_init_named("net_ads_workgroup"))) {
+ if (!(ctx = talloc_init("net_ads_workgroup"))) {
return -1;
}
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;
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;
/* 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;
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);
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);
* 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;
* 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)
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;
}
SAM_DELTA_CTR *deltas;
uint32 num_deltas;
- if (!(mem_ctx = talloc_init())) {
+ if (!(mem_ctx = talloc_init("dump_database"))) {
return;
}
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;
}
SAM_DELTA_CTR *deltas;
uint32 num_deltas;
- if (!(mem_ctx = talloc_init())) {
+ if (!(mem_ctx = talloc_init("fetch_database"))) {
return;
}
struct cli_state *cli;
- ctx=talloc_init();
+ ctx=talloc_init("main");
setlinebuf(stdout);
{"dmalloc-log-changed", MSG_REQ_DMALLOC_LOG_CHANGED },
{"shutdown", MSG_SHUTDOWN },
{"drvupgrade", MSG_PRINTER_DRVUPGRADE},
+ {"tallocdump", MSG_REQ_TALLOC_USAGE},
{NULL, -1}
};
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;
printf("PONG from PID %u\n",(unsigned int)src);
}
+/****************************************************************************
+ 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
****************************************************************************/
}
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);
}
/* Initialise the memory context */
- mem_ctx=talloc_init_named("wins repl talloc ctx");
+ mem_ctx=talloc_init("wins repl talloc ctx");
/* initialise the global partners table */
partner_count=init_wins_partner_table();