From 25b1c37f6f67570dcfaff6081a74114d172dde1b Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Mon, 7 Apr 2003 06:13:36 +0000 Subject: Remove duplicate "tallocdump" message from tdb messaging system. The same functionality exists as "pool-usage". Move initialisation of this and dmalloc messages inside message_init(). (This used to be commit af6ecafcbbf65dbedc49b3a86da39ce608bdadac) --- source3/include/messages.h | 4 ---- source3/lib/messages.c | 5 +++++ source3/nmbd/nmbd.c | 20 -------------------- source3/nsswitch/winbindd.c | 23 +---------------------- source3/smbd/server.c | 23 ----------------------- source3/utils/smbcontrol.c | 22 +--------------------- 6 files changed, 7 insertions(+), 90 deletions(-) (limited to 'source3') diff --git a/source3/include/messages.h b/source3/include/messages.h index ce167a772d..37e9372cda 100644 --- a/source3/include/messages.h +++ b/source3/include/messages.h @@ -43,10 +43,6 @@ #define MSG_SHUTDOWN 13 -/* Dump out the talloc useage. */ -#define MSG_REQ_TALLOC_USAGE 14 -#define MSG_TALLOC_USAGE 15 - /* nmbd messages */ #define MSG_FORCE_ELECTION 1001 #define MSG_WINS_NEW_ENTRY 1002 diff --git a/source3/lib/messages.c b/source3/lib/messages.c index c078472880..0615cc1883 100644 --- a/source3/lib/messages.c +++ b/source3/lib/messages.c @@ -111,6 +111,11 @@ BOOL message_init(void) message_register(MSG_PING, ping_message); + /* Register some debugging related messages */ + + register_msg_pool_usage(); + register_dmalloc_msgs(); + return True; } diff --git a/source3/nmbd/nmbd.c b/source3/nmbd/nmbd.c index 013ef9ddb7..f87ab97798 100644 --- a/source3/nmbd/nmbd.c +++ b/source3/nmbd/nmbd.c @@ -101,25 +101,6 @@ static void sig_hup(int sig) 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! @@ -710,7 +691,6 @@ static BOOL open_sockets(BOOL isdaemon, int port) 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 ) ); diff --git a/source3/nsswitch/winbindd.c b/source3/nsswitch/winbindd.c index cd72a4f572..5cdddb6222 100644 --- a/source3/nsswitch/winbindd.c +++ b/source3/nsswitch/winbindd.c @@ -52,25 +52,6 @@ static BOOL reload_services_file(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 /**************************************************************************** ** @@ -916,14 +897,12 @@ int main(int argc, char **argv) } poptFreeContext(pc); - register_msg_pool_usage(); - message_register(MSG_REQ_TALLOC_USAGE, return_all_talloc_info); - /* Loop waiting for requests */ process_loop(); trustdom_cache_shutdown(); uni_group_cache_shutdown(); + return 0; } diff --git a/source3/smbd/server.c b/source3/smbd/server.c index ae587ea251..8ce20c87a4 100644 --- a/source3/smbd/server.c +++ b/source3/smbd/server.c @@ -501,25 +501,6 @@ 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! @@ -821,10 +802,6 @@ static BOOL init_structs(void ) 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); diff --git a/source3/utils/smbcontrol.c b/source3/utils/smbcontrol.c index ec4f41cad6..44b18d57cd 100644 --- a/source3/utils/smbcontrol.c +++ b/source3/utils/smbcontrol.c @@ -43,7 +43,6 @@ static const struct { {"dmalloc-log-changed", MSG_REQ_DMALLOC_LOG_CHANGED }, {"shutdown", MSG_SHUTDOWN }, {"drvupgrade", MSG_PRINTER_DRVUPGRADE}, - {"tallocdump", MSG_REQ_TALLOC_USAGE}, {NULL, -1} }; @@ -176,7 +175,7 @@ void profilelevel_function(int msg_type, pid_t src, void *buf, size_t len) **/ static void pool_usage_cb(int msg_type, pid_t src_pid, void *buf, size_t len) { - printf("Got POOL_USAGE reply from pid%u:\n%.*s", + printf("Got POOL_USAGE reply from pid %u:\n%.*s", (unsigned int) src_pid, (int) len, (const char *) buf); } @@ -363,25 +362,6 @@ 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); -- cgit