[sr-dev] git:master: core: pkg size can be set via compile option

Daniel-Constantin Mierla miconda at gmail.com
Fri Jul 16 19:14:30 CEST 2010


Module: sip-router
Branch: master
Commit: bdc85a8cdf3e4ec8ae543691ed77e6ab0e458240
URL:    http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=bdc85a8cdf3e4ec8ae543691ed77e6ab0e458240

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date:   Fri Jul 16 19:10:54 2010 +0200

core: pkg size can be set via compile option

- new makefile option PKG_MEM_SIZE that can be used to specify the size
  in MB for PKG memory, e.g., make PKG_MEM_SIZE=8 cfg
- easier way to set the pkg size without messing with c code and defines
  in config.h
- pkg size is printed by -V command line option

---

 Makefile.defs |    3 +++
 config.h      |    5 ++++-
 main.c        |    4 ++--
 3 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/Makefile.defs b/Makefile.defs
index e34f305..f6bf2c4 100644
--- a/Makefile.defs
+++ b/Makefile.defs
@@ -666,6 +666,9 @@ ifeq ($(MEMDBG), 1)
 else
 	C_DEFS+= -DF_MALLOC
 endif
+ifneq ($(PKG_MEM_SIZE),)
+	C_DEFS+= -DPKG_MEM_SIZE=$(PKG_MEM_SIZE)
+endif
 ifeq ($(CORE_TLS), 1)
 	C_DEFS+= -DUSE_TLS -DCORE_TLS
 endif
diff --git a/config.h b/config.h
index 83ba64c..1c5108d 100644
--- a/config.h
+++ b/config.h
@@ -140,7 +140,10 @@
 
 #define SRV_MAX_PREFIX_LEN SRV_TLS_PREFIX_LEN
 
-#define PKG_MEM_POOL_SIZE 4*1024*1024		/*!< used only if PKG_MALLOC is defined*/
+#ifndef PKG_MEM_SIZE
+#define PKG_MEM_SIZE 4
+#endif
+#define PKG_MEM_POOL_SIZE PKG_MEM_SIZE*1024*1024	/*!< used only if PKG_MALLOC is defined*/
 
 #define SHM_MEM_SIZE 32				/*!< used if SH_MEM is defined*/
 
diff --git a/main.c b/main.c
index 8f71731..ea90c43 100644
--- a/main.c
+++ b/main.c
@@ -265,9 +265,9 @@ void print_ct_constants()
 #endif
 */
 	printf("MAX_RECV_BUFFER_SIZE %d, MAX_LISTEN %d,"
-			" MAX_URI_SIZE %d, BUF_SIZE %d\n",
+			" MAX_URI_SIZE %d, BUF_SIZE %d, PKG_SIZE %uMB\n",
 		MAX_RECV_BUFFER_SIZE, MAX_LISTEN, MAX_URI_SIZE,
-		BUF_SIZE );
+		BUF_SIZE, PKG_MEM_SIZE);
 #ifdef USE_TCP
 	printf("poll method support: %s.\n", poll_support);
 #endif




More information about the sr-dev mailing list