[sr-dev] git:carstenbock/ims: - Cleanup: memlog is not defined within Kamailio/ sip-router.org

Daniel-Constantin Mierla miconda at gmail.com
Fri Jan 7 14:20:11 CET 2011



On 1/7/11 2:17 PM, Carsten Bock wrote:
> Module: sip-router
> Branch: carstenbock/ims
> Commit: 099c1575d65681890893c72aba7d06bc14738176
> URL:    http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=099c1575d65681890893c72aba7d06bc14738176
>
> Author: Carsten Bock<carsten at bock.info>
> Committer: Carsten Bock<carsten at bock.info>
> Date:   Fri Jan  7 14:16:37 2011 +0100
>
> - Cleanup: memlog is not defined within Kamailio/sip-router.org
memlog is in kamailio, but probably is part of cfg framework and not a 
global variable - so you need cfg framework functions to get its value. 
The default config for 3.x has memlog parameter set as well.

Cheers,
Daniel

> - several code parts removed due to lack of use (ifedefs)
>
> ---
>
>   modules/cdp/acceptor.c      |   13 -------------
>   modules/cdp/diameter_peer.c |   26 --------------------------
>   modules/cdp/globals.c       |   30 ++++--------------------------
>   modules/cdp/globals.h       |    7 -------
>   modules/cdp/receiver.c      |   15 ---------------
>   modules/cdp/timer.c         |   14 --------------
>   modules/cdp/worker.c        |   11 -----------
>   7 files changed, 4 insertions(+), 112 deletions(-)
>
> diff --git a/modules/cdp/acceptor.c b/modules/cdp/acceptor.c
> index 75dd693..7321121 100644
> --- a/modules/cdp/acceptor.c
> +++ b/modules/cdp/acceptor.c
> @@ -109,19 +109,6 @@ void acceptor_process(dp_config *cfg)
>   		close(listening_socks[i]);
>   	
>   	if (listening_socks) pkg_free(listening_socks);
> -#ifdef CDP_FOR_SER
> -#else
> -#ifdef PKG_MALLOC
> -	#ifdef PKG_MALLOC
> -		LOG(memlog, "Acceptor Memory status (pkg):\n");
> -		//pkg_status();
> -		#ifdef pkg_sums
> -			pkg_sums();
> -		#endif
> -	#endif
> -#endif
> -		dp_del_pid(getpid());		
> -#endif		
>   done:		
>   	LOG(L_INFO,"INFO:... Acceptor process finished\n");
>   	exit(0);
> diff --git a/modules/cdp/diameter_peer.c b/modules/cdp/diameter_peer.c
> index 9147eb1..3fa8c85 100644
> --- a/modules/cdp/diameter_peer.c
> +++ b/modules/cdp/diameter_peer.c
> @@ -477,8 +477,6 @@ int diameter_peer_start(int blocking)
>   	return 1;
>   }
>
> -extern int memlog;
> -
>   /**
>    * Shutdown the CDiameterPeer nicely.
>    * It stops the workers, disconnects peers, drops timers and wait for all processes to exit.
> @@ -565,30 +563,6 @@ void diameter_peer_destroy()
>   		
>   	free_dp_config(config);	
>   	LOG(L_CRIT,"INFO:destroy_diameter_peer(): Bye Bye from C Diameter Peer test\n");
> -
> -#ifndef CDP_FOR_SER
> -
> -#ifdef WHARF
> -	
> -#else	
> -	#ifdef PKG_MALLOC
> -		LOG(memlog, "Memory status (pkg):\n");
> -		//pkg_status();
> -		#ifdef pkg_sums
> -			pkg_sums();
> -		#endif
> -	#endif
> -	#ifdef SHM_MEM
> -		LOG(memlog, "Memory status (shm):\n");
> -		//shm_status();
> -		#ifdef shm_sums
> -			shm_sums();
> -		#endif
> -		/* zero all shmem alloc vars that we still use */
> -		shm_mem_destroy();
> -	#endif
> -#endif		
> -#endif	
>   }
>
>
> diff --git a/modules/cdp/globals.c b/modules/cdp/globals.c
> index fc2ef9e..691da48 100644
> --- a/modules/cdp/globals.c
> +++ b/modules/cdp/globals.c
> @@ -57,28 +57,6 @@
>   #include "globals.h"
>   #include "utils.h"
>
> -#ifdef CDP_FOR_SER
> -
> -#else
> -
> -#ifdef WHARF
> -
> -#else
> -
> -	unsigned long shm_mem_size = SHM_MEM_SIZE;
> -	int memlog = L_ERR;
> -	int memdbg = L_INFO;
> -	int debug = L_INFO;
> -	int log_facility = 1;
> -	int log_stderr = 1;
> -	int process_no=0;
> -	
> -#endif
> -	
> -#endif
> -
> -
> -
>   //str aaa_fqdn={"unset_fqdn",10};
>   //str aaa_realm={"unset_realm",11};
>   //str aaa_identity={"unset_identity",14};
> @@ -90,7 +68,7 @@ int init_memory(int show_status)
>   	if (init_pkg_mallocs()==-1)
>   		goto error;
>   	if (show_status){
> -		LOG(memlog, "Memory status (pkg):\n");
> +		LOG(L_DBG, "Memory status (pkg):\n");
>   		pkg_status();
>   	}
>   #endif
> @@ -104,7 +82,7 @@ int init_memory(int show_status)
>   		)==-1)
>   		goto error;
>   	if (show_status){
> -		LOG(memlog, "Memory status (shm):\n");
> +		LOG(L_DBG, "Memory status (shm):\n");
>   		shm_status();
>   	}
>   #endif
> @@ -123,7 +101,7 @@ void destroy_memory(int show_status)
>   	                             allow an almost gracious shutdown */
>   #ifdef SHM_MEM
>   	if (show_status){
> -		LOG(memlog, "Memory status (shm):\n");
> +		LOG(L_INFO, "Memory status (shm):\n");
>   		//shm_status();
>   #ifndef SER_MOD_INTERFACE
>   		shm_sums();
> @@ -138,7 +116,7 @@ void destroy_memory(int show_status)
>   #endif
>   #ifdef PKG_MALLOC
>   	if (show_status){
> -		LOG(memlog, "Memory status (pkg):\n");
> +		LOG(L_INFO, "Memory status (pkg):\n");
>   		//pkg_status();
>   #ifndef SER_MOD_INTERFACE
>   		pkg_sums();
> diff --git a/modules/cdp/globals.h b/modules/cdp/globals.h
> index b33f91f..aa3c31d 100644
> --- a/modules/cdp/globals.h
> +++ b/modules/cdp/globals.h
> @@ -62,13 +62,6 @@
>   #define DPNAME "CDiameterPeer"
>   #define DPVERSION "0.0.2"
>
> -
> -#ifdef CDP_FOR_SER
> -#else
> -extern unsigned long shm_mem_size;
> -extern int memlog;
> -#endif
> -
>   extern int process_no;
>
>   int init_memory(int show_status);
> diff --git a/modules/cdp/receiver.c b/modules/cdp/receiver.c
> index c7b6261..a2b5d88 100644
> --- a/modules/cdp/receiver.c
> +++ b/modules/cdp/receiver.c
> @@ -487,21 +487,6 @@ done:
>   	}
>   	/* remove pid from list of running processes */
>   	dp_del_pid(getpid());
> -	
> -#ifdef CDP_FOR_SER
> -			
> -#else
> -#ifdef PKG_MALLOC
> -	#ifdef PKG_MALLOC
> -		LOG(memlog, "Receiver[%.*s] Memory status (pkg):\n",
> -				p?p->fqdn.len:0,p?p->fqdn.s:0);
> -		//pkg_status();
> -		#ifdef pkg_sums
> -			pkg_sums();
> -		#endif
> -	#endif
> -#endif
> -#endif		
>   		
>   	LOG(L_INFO,"INFO:receiver_process(): [%.*s]... Receiver process finished.\n",
>   			p?p->fqdn.len:0,p?p->fqdn.s:0);
> diff --git a/modules/cdp/timer.c b/modules/cdp/timer.c
> index 9e75f9d..b4324e8 100644
> --- a/modules/cdp/timer.c
> +++ b/modules/cdp/timer.c
> @@ -215,20 +215,6 @@ void timer_process(int returns)
>   	
>   	LOG(L_INFO,"INFO:... Timer process finished\n");
>   	if (!returns) {
> -#ifdef CDP_FOR_SER
> -#else
> -#ifdef PKG_MALLOC
> -	#ifdef PKG_MALLOC
> -		LOG(memlog, "Timer Memory status (pkg):\n");
> -		//pkg_status();
> -		#ifdef pkg_sums
> -			pkg_sums();
> -		#endif
> -	#endif
> -#endif
> -		dp_del_pid(getpid());		
> -#endif		
> -		
>   		exit(0);
>   	}
>   }
> diff --git a/modules/cdp/worker.c b/modules/cdp/worker.c
> index 026d279..9ae872b 100644
> --- a/modules/cdp/worker.c
> +++ b/modules/cdp/worker.c
> @@ -406,17 +406,6 @@ void worker_process(int id)
>   	}
>   	worker_poison_queue();
>   	LOG(L_INFO,"INFO:[%d]... Worker process finished\n",id);	
> -#ifdef CDP_FOR_SER
> -#else
> -	#ifdef PKG_MALLOC
> -		LOG(memlog, "Worker[%d] Memory status (pkg):\n",id);
> -		//pkg_status();
> -		#ifdef pkg_sums
> -			pkg_sums();
> -		#endif
> -	#endif
> -	dp_del_pid(getpid());	
> -#endif
>   	exit(0);
>   }
>
>
>
> _______________________________________________
> sr-dev mailing list
> sr-dev at lists.sip-router.org
> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev

-- 
Daniel-Constantin Mierla
Kamailio (OpenSER) Advanced Training
Jan 24-26, 2011, Irvine, CA, USA
http://www.asipto.com




More information about the sr-dev mailing list