lib/dmallocmsg.c

説明を見る。
00001 /* 
00002    samba -- Unix SMB/CIFS implementation.
00003    Copyright (C) 2002 by Martin Pool
00004    
00005    This program is free software; you can redistribute it and/or modify
00006    it under the terms of the GNU General Public License as published by
00007    the Free Software Foundation; either version 2 of the License, or
00008    (at your option) any later version.
00009    
00010    This program is distributed in the hope that it will be useful,
00011    but WITHOUT ANY WARRANTY; without even the implied warranty of
00012    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013    GNU General Public License for more details.
00014    
00015    You should have received a copy of the GNU General Public License
00016    along with this program; if not, write to the Free Software
00017    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00018 */
00019 
00020 #include "includes.h"
00021 
00022 /**
00023  * @file dmallocmsg.c
00024  *
00025  * Glue code to cause dmalloc info to come out when we receive a prod
00026  * over samba messaging.
00027  **/
00028 
00029 #ifdef ENABLE_DMALLOC
00030 static unsigned long our_dm_mark = 0;
00031 #endif /* ENABLE_DMALLOC */
00032 
00033 
00034 /**
00035  * Respond to a POOL_USAGE message by sending back string form of memory
00036  * usage stats.
00037  **/
00038 static void msg_req_dmalloc_mark(int UNUSED(msg_type),
00039                                  struct process_id UNUSED(src_pid),
00040                                  void *UNUSED(buf), size_t UNUSED(len),
00041                                  void *private_data)
00042 {
00043 #ifdef ENABLE_DMALLOC
00044         our_dm_mark = dmalloc_mark();
00045         DEBUG(2,("Got MSG_REQ_DMALLOC_MARK: mark set\n"));
00046 #else
00047         DEBUG(2,("Got MSG_REQ_DMALLOC_MARK but dmalloc not in this process\n"));
00048 #endif
00049 }
00050 
00051 
00052 
00053 static void msg_req_dmalloc_log_changed(int UNUSED(msg_type),
00054                                         struct process_id UNUSED(src_pid),
00055                                         void *UNUSED(buf), size_t UNUSED(len),
00056                                         void *private_data)
00057 {
00058 #ifdef ENABLE_DMALLOC
00059         dmalloc_log_changed(our_dm_mark, True, True, True);
00060         DEBUG(2,("Got MSG_REQ_DMALLOC_LOG_CHANGED: done\n"));
00061 #else
00062         DEBUG(2,("Got MSG_REQ_DMALLOC_LOG_CHANGED but dmalloc not in this process\n"));
00063 #endif
00064 }
00065 
00066 
00067 /**
00068  * Register handler for MSG_REQ_POOL_USAGE
00069  **/
00070 void register_dmalloc_msgs(void)
00071 {
00072         message_register(MSG_REQ_DMALLOC_MARK, msg_req_dmalloc_mark, NULL);
00073         message_register(MSG_REQ_DMALLOC_LOG_CHANGED,
00074                          msg_req_dmalloc_log_changed, NULL);
00075         DEBUG(2, ("Registered MSG_REQ_DMALLOC_MARK and LOG_CHANGED\n"));
00076 }       

Sambaに対してSat Aug 29 21:22:58 2009に生成されました。  doxygen 1.4.7