From 6c7050ea95001c6de6085f93e3d6332ed2c3aa60 Mon Sep 17 00:00:00 2001 From: Martin Pool Date: Wed, 9 Jan 2002 08:27:15 +0000 Subject: Add two more memory-debug smbcontrol messages: these ones should prompt dmalloc to log information about what happening, so you can see in flight why smbd is getting bloated. (This used to be commit bcb443c5c4bf97fe6b5b0993e42496c2e64f0124) --- source3/lib/dmallocmsg.c | 70 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 source3/lib/dmallocmsg.c (limited to 'source3/lib/dmallocmsg.c') diff --git a/source3/lib/dmallocmsg.c b/source3/lib/dmallocmsg.c new file mode 100644 index 0000000000..9d6ac87aeb --- /dev/null +++ b/source3/lib/dmallocmsg.c @@ -0,0 +1,70 @@ +/* + samba -- Unix SMB/Netbios implementation. + Copyright (C) 2002 by Martin Pool + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#include "includes.h" + +/** + * @file dmallocmsg.c + * + * Glue code to cause dmalloc info to come out when we receive a prod + * over samba messaging. + **/ + +static unsigned long our_dm_mark = 0; + + +/** + * Respond to a POOL_USAGE message by sending back string form of memory + * usage stats. + **/ +static void msg_req_dmalloc_mark(int UNUSED(msg_type), pid_t UNUSED(src_pid), + void *UNUSED(buf), size_t UNUSED(len)) +{ +#ifdef ENABLE_DMALLOC + our_dm_mark = dmalloc_mark(); + DEBUG(2,("Got MSG_REQ_DMALLOC_MARK: mark set\n")); +#else + DEBUG(2,("Got MSG_REQ_DMALLOC_MARK but dmalloc not in this process\n")); +#endif +} + + + +static void msg_req_dmalloc_log_changed(int UNUSED(msg_type), + pid_t UNUSED(src_pid), + void *UNUSED(buf), size_t UNUSED(len)) +{ +#ifdef ENABLE_DMALLOC + dmalloc_log_changed(our_dm_mark, True, True, True); + DEBUG(2,("Got MSG_REQ_DMALLOC_LOG_CHANGED: done\n")); +#else + DEBUG(2,("Got MSG_REQ_DMALLOC_LOG_CHANGED but dmalloc not in this process\n")); +#endif +} + + +/** + * Register handler for MSG_REQ_POOL_USAGE + **/ +void register_dmalloc_msgs(void) +{ + message_register(MSG_REQ_DMALLOC_MARK, msg_req_dmalloc_mark); + message_register(MSG_REQ_DMALLOC_LOG_CHANGED, msg_req_dmalloc_log_changed); + DEBUG(2, ("Registered MSG_REQ_DMALLOC_MARK and LOG_CHANGED\n")); +} -- cgit From 17745322abab7c80efbd5beacc0e6e0a1243eb07 Mon Sep 17 00:00:00 2001 From: Martin Pool Date: Tue, 15 Jan 2002 01:49:06 +0000 Subject: #ifdef variable that's not used without dmalloc (This used to be commit bf513668cb76fd20b04b8142c86c263280b05bb6) --- source3/lib/dmallocmsg.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'source3/lib/dmallocmsg.c') diff --git a/source3/lib/dmallocmsg.c b/source3/lib/dmallocmsg.c index 9d6ac87aeb..bae9f36062 100644 --- a/source3/lib/dmallocmsg.c +++ b/source3/lib/dmallocmsg.c @@ -26,7 +26,9 @@ * over samba messaging. **/ +#ifdef ENABLE_DMALLOC static unsigned long our_dm_mark = 0; +#endif /* ENABLE_DMALLOC */ /** -- cgit From cd68afe31256ad60748b34f7318a180cfc2127cc Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Wed, 30 Jan 2002 06:08:46 +0000 Subject: Removed version number from file header. Changed "SMB/Netbios" to "SMB/CIFS" in file header. (This used to be commit 6a58c9bd06d0d7502a24bf5ce5a2faf0a146edfa) --- source3/lib/dmallocmsg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/lib/dmallocmsg.c') diff --git a/source3/lib/dmallocmsg.c b/source3/lib/dmallocmsg.c index bae9f36062..a83ed518d7 100644 --- a/source3/lib/dmallocmsg.c +++ b/source3/lib/dmallocmsg.c @@ -1,5 +1,5 @@ /* - samba -- Unix SMB/Netbios implementation. + samba -- Unix SMB/CIFS implementation. Copyright (C) 2002 by Martin Pool This program is free software; you can redistribute it and/or modify -- cgit From 54abd2aa66069e6baf7769c496f46d9dba18db39 Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Fri, 30 Sep 2005 17:13:37 +0000 Subject: r10656: BIG merge from trunk. Features not copied over * \PIPE\unixinfo * winbindd's {group,alias}membership new functions * winbindd's lookupsids() functionality * swat (trunk changes to be reverted as per discussion with Deryck) (This used to be commit 939c3cb5d78e3a2236209b296aa8aba8bdce32d3) --- source3/lib/dmallocmsg.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source3/lib/dmallocmsg.c') diff --git a/source3/lib/dmallocmsg.c b/source3/lib/dmallocmsg.c index a83ed518d7..1b2308ecba 100644 --- a/source3/lib/dmallocmsg.c +++ b/source3/lib/dmallocmsg.c @@ -35,7 +35,7 @@ static unsigned long our_dm_mark = 0; * Respond to a POOL_USAGE message by sending back string form of memory * usage stats. **/ -static void msg_req_dmalloc_mark(int UNUSED(msg_type), pid_t UNUSED(src_pid), +static void msg_req_dmalloc_mark(int UNUSED(msg_type), struct process_id UNUSED(src_pid), void *UNUSED(buf), size_t UNUSED(len)) { #ifdef ENABLE_DMALLOC @@ -49,7 +49,7 @@ static void msg_req_dmalloc_mark(int UNUSED(msg_type), pid_t UNUSED(src_pid), static void msg_req_dmalloc_log_changed(int UNUSED(msg_type), - pid_t UNUSED(src_pid), + struct process_id UNUSED(src_pid), void *UNUSED(buf), size_t UNUSED(len)) { #ifdef ENABLE_DMALLOC -- cgit From caf8c6a76be051559ffcfe97084edca43e0a3cee Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Tue, 30 Jan 2007 22:22:06 +0000 Subject: r21064: The core of this patch is void message_register(int msg_type, void (*fn)(int msg_type, struct process_id pid, - void *buf, size_t len)) + void *buf, size_t len, + void *private_data), + void *private_data) { struct dispatch_fns *dfn; So this adds a (so far unused) private pointer that is passed from message_register to the message handler. A prerequisite to implement a tiny samba4-API compatible wrapper around our messaging system. That itself is necessary for the Samba4 notify system. Yes, I know, I could import the whole Samba4 messaging system, but I want to do it step by step and I think getting notify in is more important in this step. Volker (This used to be commit c8ae60ed65dcce9660ee39c75488f2838cf9a28b) --- source3/lib/dmallocmsg.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'source3/lib/dmallocmsg.c') diff --git a/source3/lib/dmallocmsg.c b/source3/lib/dmallocmsg.c index 1b2308ecba..fed7bf59c5 100644 --- a/source3/lib/dmallocmsg.c +++ b/source3/lib/dmallocmsg.c @@ -35,8 +35,10 @@ static unsigned long our_dm_mark = 0; * Respond to a POOL_USAGE message by sending back string form of memory * usage stats. **/ -static void msg_req_dmalloc_mark(int UNUSED(msg_type), struct process_id UNUSED(src_pid), - void *UNUSED(buf), size_t UNUSED(len)) +static void msg_req_dmalloc_mark(int UNUSED(msg_type), + struct process_id UNUSED(src_pid), + void *UNUSED(buf), size_t UNUSED(len), + void *private_data) { #ifdef ENABLE_DMALLOC our_dm_mark = dmalloc_mark(); @@ -50,7 +52,8 @@ static void msg_req_dmalloc_mark(int UNUSED(msg_type), struct process_id UNUSED( static void msg_req_dmalloc_log_changed(int UNUSED(msg_type), struct process_id UNUSED(src_pid), - void *UNUSED(buf), size_t UNUSED(len)) + void *UNUSED(buf), size_t UNUSED(len), + void *private_data) { #ifdef ENABLE_DMALLOC dmalloc_log_changed(our_dm_mark, True, True, True); @@ -66,7 +69,8 @@ static void msg_req_dmalloc_log_changed(int UNUSED(msg_type), **/ void register_dmalloc_msgs(void) { - message_register(MSG_REQ_DMALLOC_MARK, msg_req_dmalloc_mark); - message_register(MSG_REQ_DMALLOC_LOG_CHANGED, msg_req_dmalloc_log_changed); + message_register(MSG_REQ_DMALLOC_MARK, msg_req_dmalloc_mark, NULL); + message_register(MSG_REQ_DMALLOC_LOG_CHANGED, + msg_req_dmalloc_log_changed, NULL); DEBUG(2, ("Registered MSG_REQ_DMALLOC_MARK and LOG_CHANGED\n")); } -- cgit From e6383f47629368d9dd4e803f17566a24e9d7359e Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Mon, 7 May 2007 09:35:35 +0000 Subject: r22736: Start to merge the low-hanging fruit from the now 7000-line cluster patch. This changes "struct process_id" to "struct server_id", keeping both is just too much hassle. No functional change (I hope ;-)) Volker (This used to be commit 0ad4b1226c9d91b72136310d3bbb640d2c5d67b8) --- source3/lib/dmallocmsg.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source3/lib/dmallocmsg.c') diff --git a/source3/lib/dmallocmsg.c b/source3/lib/dmallocmsg.c index fed7bf59c5..bccede3515 100644 --- a/source3/lib/dmallocmsg.c +++ b/source3/lib/dmallocmsg.c @@ -36,7 +36,7 @@ static unsigned long our_dm_mark = 0; * usage stats. **/ static void msg_req_dmalloc_mark(int UNUSED(msg_type), - struct process_id UNUSED(src_pid), + struct server_id UNUSED(src_pid), void *UNUSED(buf), size_t UNUSED(len), void *private_data) { @@ -51,7 +51,7 @@ static void msg_req_dmalloc_mark(int UNUSED(msg_type), static void msg_req_dmalloc_log_changed(int UNUSED(msg_type), - struct process_id UNUSED(src_pid), + struct server_id UNUSED(src_pid), void *UNUSED(buf), size_t UNUSED(len), void *private_data) { -- cgit From 4d5f58c2b945e7a2263ba42749f73c7ba72ab3c7 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sat, 19 May 2007 21:53:28 +0000 Subject: r23015: Make message_(de)register static to messages.c (This used to be commit a8082a3c7c3d1e68c27fc3bf42f3d44402cc6f9f) --- source3/lib/dmallocmsg.c | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) (limited to 'source3/lib/dmallocmsg.c') diff --git a/source3/lib/dmallocmsg.c b/source3/lib/dmallocmsg.c index bccede3515..7e52e93a10 100644 --- a/source3/lib/dmallocmsg.c +++ b/source3/lib/dmallocmsg.c @@ -35,10 +35,11 @@ static unsigned long our_dm_mark = 0; * Respond to a POOL_USAGE message by sending back string form of memory * usage stats. **/ -static void msg_req_dmalloc_mark(int UNUSED(msg_type), - struct server_id UNUSED(src_pid), - void *UNUSED(buf), size_t UNUSED(len), - void *private_data) +static void msg_req_dmalloc_mark(struct messaging_context *msg, + void *private_data, + uint32_t msg_type, + struct server_id server_id, + DATA_BLOB *data) { #ifdef ENABLE_DMALLOC our_dm_mark = dmalloc_mark(); @@ -50,10 +51,11 @@ static void msg_req_dmalloc_mark(int UNUSED(msg_type), -static void msg_req_dmalloc_log_changed(int UNUSED(msg_type), - struct server_id UNUSED(src_pid), - void *UNUSED(buf), size_t UNUSED(len), - void *private_data) +static void msg_req_dmalloc_log_changed(struct messaging_context *msg, + void *private_data, + uint32_t msg_type, + struct server_id server_id, + DATA_BLOB *data) { #ifdef ENABLE_DMALLOC dmalloc_log_changed(our_dm_mark, True, True, True); @@ -67,10 +69,11 @@ static void msg_req_dmalloc_log_changed(int UNUSED(msg_type), /** * Register handler for MSG_REQ_POOL_USAGE **/ -void register_dmalloc_msgs(void) +void register_dmalloc_msgs(struct messaging_context *msg_ctx) { - message_register(MSG_REQ_DMALLOC_MARK, msg_req_dmalloc_mark, NULL); - message_register(MSG_REQ_DMALLOC_LOG_CHANGED, - msg_req_dmalloc_log_changed, NULL); + messaging_register(msg_ctx, NULL, MSG_REQ_DMALLOC_MARK, + msg_req_dmalloc_mark); + messaging_register(msg_ctx, NULL, MSG_REQ_DMALLOC_LOG_CHANGED, + msg_req_dmalloc_log_changed); DEBUG(2, ("Registered MSG_REQ_DMALLOC_MARK and LOG_CHANGED\n")); } -- cgit From d824b98f80ba186030cbb70b3a1e5daf80469ecd Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Mon, 9 Jul 2007 19:25:36 +0000 Subject: r23779: Change from v2 or later to v3 or later. Jeremy. (This used to be commit 407e6e695b8366369b7c76af1ff76869b45347b3) --- source3/lib/dmallocmsg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/lib/dmallocmsg.c') diff --git a/source3/lib/dmallocmsg.c b/source3/lib/dmallocmsg.c index 7e52e93a10..fe8b9816b4 100644 --- a/source3/lib/dmallocmsg.c +++ b/source3/lib/dmallocmsg.c @@ -4,7 +4,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or + the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, -- cgit From 5e54558c6dea67b56bbfaba5698f3a434d3dffb6 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Tue, 10 Jul 2007 00:52:41 +0000 Subject: r23784: use the GPLv3 boilerplate as recommended by the FSF and the license text (This used to be commit b0132e94fc5fef936aa766fb99a306b3628e9f07) --- source3/lib/dmallocmsg.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'source3/lib/dmallocmsg.c') diff --git a/source3/lib/dmallocmsg.c b/source3/lib/dmallocmsg.c index fe8b9816b4..935fc1de1a 100644 --- a/source3/lib/dmallocmsg.c +++ b/source3/lib/dmallocmsg.c @@ -13,8 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + along with this program. If not, see . */ #include "includes.h" -- cgit