summaryrefslogtreecommitdiff
path: root/source3/utils/smbcontrol.c
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2002-12-20 20:23:06 +0000
committerJeremy Allison <jra@samba.org>2002-12-20 20:23:06 +0000
commit7f23546730e49569d41a5edd0c47bb559c4f812d (patch)
tree7d7d2229881b2e9f05130a07c6cb2dd912c89098 /source3/utils/smbcontrol.c
parent45a6532727888c710d537c6e1e03466af2a87881 (diff)
downloadsamba-7f23546730e49569d41a5edd0c47bb559c4f812d.tar.gz
samba-7f23546730e49569d41a5edd0c47bb559c4f812d.tar.bz2
samba-7f23546730e49569d41a5edd0c47bb559c4f812d.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 842e08e52a665ae678eea239759bb2de1a0d7b33)
Diffstat (limited to 'source3/utils/smbcontrol.c')
-rw-r--r--source3/utils/smbcontrol.c38
1 files changed, 38 insertions, 0 deletions
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);