浏览代码

- split init_mallocs into init_pkg_mallocs & init_shm_mallocs
- init_shm_mallocs called after cmd. line parsing (so -m is not ignored any more)

Andrei Pelinescu-Onciul 22 年之前
父节点
当前提交
90907c3f1e
共有 5 个文件被更改,包括 40 次插入13 次删除
  1. 5 2
      Makefile
  2. 1 1
      Makefile.defs
  3. 16 7
      main.c
  4. 14 2
      mem/mem.c
  5. 4 1
      mem/mem.h

+ 5 - 2
Makefile

@@ -13,6 +13,7 @@
 #               by Maxim Sobolev   <[email protected]> and 
 #                  Tomas Björklund <[email protected]>
 #  2003-03-11  PREFIX & LOCALBASE must also be exported (andrei)
+#  2003-04-07  hacked to work with solaris install (andrei)
 #
 
 auto_gen=lex.yy.c cfg.tab.c   #lexx, yacc etc
@@ -20,8 +21,10 @@ auto_gen=lex.yy.c cfg.tab.c   #lexx, yacc etc
 #include  source related defs
 include Makefile.sources
 
-override exclude_modules:=CVS cpl cpl-c ext radius_acc radius_auth snmp jabber sms pa extcmd msilo \
-	$(exclude_modules)
+override exclude_modules:=CVS cpl cpl-c ext radius_acc radius_auth snmp \
+							jabber sms pa extcmd msilo \
+							auth_radius group_radius uri_radius \
+							$(exclude_modules)
 static_modules=
 static_modules_path=$(addprefix modules/, $(static_modules))
 extra_sources=$(wildcard $(addsuffix /*.c, $(static_modules_path)))

+ 1 - 1
Makefile.defs

@@ -21,7 +21,7 @@
 VERSION = 0
 PATCHLEVEL = 8
 SUBLEVEL =   11
-EXTRAVERSION = pre13
+EXTRAVERSION = pre14
 
 RELEASE=$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)
 OS = $(shell uname -s | sed -e s/SunOS/solaris/ | tr "[A-Z]" "[a-z]")

+ 16 - 7
main.c

@@ -32,6 +32,8 @@
  *  2003-03-29  pkg cleaners for fifo and script callbacks introduced (jiri)
  *  2003-03-31  removed snmp part (obsolete & no place in core) (andrei)
  *  2003-04-06  child_init called in all processes (janakj)
+ *  2003-04-08  init_mallocs split into init_{pkg,shm}_mallocs and 
+ *               init_shm_mallocs called after cmd. line parsing (andrei)
  *
  */
 
@@ -1088,8 +1090,8 @@ int main(int argc, char** argv)
 	ret=-1;
 	my_argc=argc; my_argv=argv;
 	
-	/*init mallocs (before parsing cfg or cmd line !)*/
-	if (init_mallocs()==-1)
+	/*init pkg mallocs (before parsing cfg or cmd line !)*/
+	if (init_pkg_mallocs()==-1)
 		goto error;
 
 	/* added by jku: add exit handler */
@@ -1308,6 +1310,13 @@ try_again:
 	
 
 
+	/*init shm mallocs (before parsing cfg !)
+	 *  this must be here to allow setting shm mem size from the command line
+	 *  and it must also be before init_timer and init_tcp
+	 *  => if shm_mem should be settable from the cfg file move everything
+	 *  after --andrei */
+	if (init_shm_mallocs()==-1)
+		goto error;
 	/*init timer, before parsing the cfg!*/
 	if (init_timer()<0){
 		LOG(L_CRIT, "could not initialize timer, exiting...\n");
@@ -1335,14 +1344,14 @@ try_again:
 		fprintf(stderr, "ERROR: bad config file (%d errors)\n", cfg_errors);
 		goto error;
 	}
-
-
-
+	
+	
+	
 	print_rl();
-
+	
 	/* fix parameters */
 	if (port_no<=0) port_no=SIP_PORT;
-
+	
 	
 	if (children_no<=0) children_no=CHILD_NO;
 #ifdef USE_TCP

+ 14 - 2
mem/mem.c

@@ -23,6 +23,12 @@
  * 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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ *
+ * History:
+ * --------
+ *  2003-04-08  init_mallocs split into init_{pkg,shm}_malloc (andrei)
+ * 
  */
 
 
@@ -55,7 +61,8 @@
 	#endif
 #endif
 
-int init_mallocs()
+
+int init_pkg_mallocs()
 {
 #ifdef PKG_MALLOC
 	/*init mem*/
@@ -73,7 +80,13 @@ int init_mallocs()
 		return -1;
 	}
 #endif
+	return 0;
+}
 
+
+
+int init_shm_mallocs()
+{
 #ifdef SHM_MEM
 	if (shm_mem_init()<0) {
 		LOG(L_CRIT, "could not initialize shared memory pool, exiting...\n");
@@ -83,7 +96,6 @@ int init_mallocs()
 	}
 #endif
 	return 0;
-
 }
 
 

+ 4 - 1
mem/mem.h

@@ -31,6 +31,8 @@
  * --------
  *  2003-03-10  __FUNCTION__ is a gcc-ism, defined it to "" for sun cc
  *               (andrei)
+ *  2003-03-07  split init_malloc into init_pkg_mallocs & init_shm_mallocs 
+ *               (andrei)
  */
 
 
@@ -109,6 +111,7 @@
 #	define pkg_status()
 #endif
 
-int init_mallocs();
+int init_pkg_mallocs();
+int init_shm_mallocs();
 
 #endif