Browse code

core, lib, modules: restructured source code tree

- new folder src/ to hold the source code for main project applications
- main.c is in src/
- all core files are subfolder are in src/core/
- modules are in src/modules/
- libs are in src/lib/
- application Makefiles are in src/
- application binary is built in src/ (src/kamailio)

Daniel-Constantin Mierla authored on 07/12/2016 11:03:51
Showing 1 changed files
1 1
deleted file mode 100644
... ...
@@ -1,135 +0,0 @@
1
-/*
2
- * Copyright (C) 2001-2003 FhG Fokus
3
- *
4
- * This file is part of Kamailio, a free SIP server.
5
- *
6
- * Permission to use, copy, modify, and distribute this software for any
7
- * purpose with or without fee is hereby granted, provided that the above
8
- * copyright notice and this permission notice appear in all copies.
9
- *
10
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17
- *
18
- *
19
- */
20
-
21
-/**
22
- * \file
23
- * \brief Main definitions for memory manager
24
- * 
25
- * Main definitions for memory manager, like malloc, free and realloc
26
- * \ingroup mem
27
- */
28
-
29
-
30
-#include <stdio.h>
31
-#include <stdlib.h>
32
-#include "../config.h"
33
-#include "../dprint.h"
34
-#include "../globals.h"
35
-#include "mem.h"
36
-
37
-#ifdef PKG_MALLOC
38
-#include "q_malloc.h"
39
-#endif
40
-
41
-#ifdef SHM_MEM
42
-#include "shm_mem.h"
43
-#endif
44
-
45
-#if 0
46
-
47
-#ifdef PKG_MALLOC
48
-	#ifndef DL_MALLOC
49
-	char* mem_pool = 0;
50
-	#endif
51
-
52
-	#ifdef F_MALLOC
53
-		struct fm_block* mem_block = 0;
54
-	#elif defined DL_MALLOC
55
-		/* don't need this */
56
-	#elif defined TLSF_MALLOC
57
-		tlsf_t mem_block = 0;
58
-	#else
59
-		struct qm_block* mem_block = 0;
60
-	#endif
61
-#endif
62
-
63
-
64
-/**
65
- * \brief Initialize private memory pool
66
- * \return 0 if the memory allocation was successful, -1 otherwise
67
- */
68
-int init_pkg_mallocs(void)
69
-{
70
-#ifdef PKG_MALLOC
71
-	/*init mem*/
72
-	#ifndef DL_MALLOC
73
-		if (pkg_mem_size == 0)
74
-			pkg_mem_size = PKG_MEM_POOL_SIZE;
75
-		mem_pool = malloc(pkg_mem_size);
76
-	#endif
77
-	#ifdef F_MALLOC
78
-		if (mem_pool)
79
-			mem_block=fm_malloc_init(mem_pool, pkg_mem_size, MEM_TYPE_PKG);
80
-	#elif DL_MALLOC
81
-		/* don't need this */
82
-	#elif TLSF_MALLOC
83
-		mem_block = tlsf_create_with_pool(mem_pool, pkg_mem_size);
84
-	#else
85
-		if (mem_pool)
86
-			mem_block=qm_malloc_init(mem_pool, pkg_mem_size, MEM_TYPE_PKG);
87
-	#endif
88
-	#ifndef DL_MALLOC
89
-	if (mem_block==0){
90
-		LOG(L_CRIT, "could not initialize memory pool\n");
91
-		fprintf(stderr, "Too much pkg memory demanded: %ld bytes\n",
92
-						pkg_mem_size);
93
-		return -1;
94
-	}
95
-	#endif
96
-#endif
97
-	return 0;
98
-}
99
-
100
-
101
-
102
-/**
103
- * \brief Destroy private memory pool
104
- */
105
-void destroy_pkg_mallocs(void)
106
-{
107
-#ifdef PKG_MALLOC
108
-	#ifndef DL_MALLOC
109
-		if (mem_pool) {
110
-			free(mem_pool);
111
-			mem_pool = 0;
112
-		}
113
-	#endif
114
-#endif /* PKG_MALLOC */
115
-}
116
-
117
-
118
-/**
119
- * \brief Initialize shared memory pool
120
- * \param force_alloc Force allocation of memory, e.g. initialize complete block with zero
121
- * \return 0 if the memory allocation was successful, -1 otherwise
122
- */
123
-int init_shm_mallocs(int force_alloc)
124
-{
125
-#ifdef SHM_MEM
126
-	if (shm_mem_init(force_alloc)<0) {
127
-		LOG(L_CRIT, "could not initialize shared memory pool, exiting...\n");
128
-		 fprintf(stderr, "Too much shared memory demanded: %ld\n",
129
-			shm_mem_size );
130
-		return -1;
131
-	}
132
-#endif
133
-	return 0;
134
-}
135
-#endif 
Browse code

mem: old pkg management disabled

Daniel-Constantin Mierla authored on 14/09/2015 07:23:22
Showing 1 changed files
... ...
@@ -42,6 +42,8 @@
42 42
 #include "shm_mem.h"
43 43
 #endif
44 44
 
45
+#if 0
46
+
45 47
 #ifdef PKG_MALLOC
46 48
 	#ifndef DL_MALLOC
47 49
 	char* mem_pool = 0;
... ...
@@ -130,3 +132,4 @@ int init_shm_mallocs(int force_alloc)
130 132
 #endif
131 133
 	return 0;
132 134
 }
135
+#endif 
Browse code

mem: TLSF integration for pkg memory

Camille Oudot authored on 23/04/2015 15:25:29
Showing 1 changed files
... ...
@@ -51,6 +51,8 @@
51 51
 		struct fm_block* mem_block = 0;
52 52
 	#elif defined DL_MALLOC
53 53
 		/* don't need this */
54
+	#elif defined TLSF_MALLOC
55
+		tlsf_t mem_block = 0;
54 56
 	#else
55 57
 		struct qm_block* mem_block = 0;
56 58
 	#endif
... ...
@@ -75,6 +77,8 @@ int init_pkg_mallocs(void)
75 77
 			mem_block=fm_malloc_init(mem_pool, pkg_mem_size, MEM_TYPE_PKG);
76 78
 	#elif DL_MALLOC
77 79
 		/* don't need this */
80
+	#elif TLSF_MALLOC
81
+		mem_block = tlsf_create_with_pool(mem_pool, pkg_mem_size);
78 82
 	#else
79 83
 		if (mem_pool)
80 84
 			mem_block=qm_malloc_init(mem_pool, pkg_mem_size, MEM_TYPE_PKG);
Browse code

mem Remove SVN ID, remove history

Olle E. Johansson authored on 25/02/2015 08:12:38
Showing 1 changed files
... ...
@@ -1,7 +1,7 @@
1 1
 /*
2 2
  * Copyright (C) 2001-2003 FhG Fokus
3 3
  *
4
- * This file is part of sip-router, a free SIP server.
4
+ * This file is part of Kamailio, a free SIP server.
5 5
  *
6 6
  * Permission to use, copy, modify, and distribute this software for any
7 7
  * purpose with or without fee is hereby granted, provided that the above
... ...
@@ -16,10 +16,6 @@
16 16
  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 17
  *
18 18
  *
19
- * History:
20
- * --------
21
- *  2003-04-08  init_mallocs split into init_{pkg,shm}_malloc (andrei)
22
- * 
23 19
  */
24 20
 
25 21
 /**
Browse code

pkg/mem: set pkg type when intializing memory pool

Daniel-Constantin Mierla authored on 03/05/2014 18:01:23
Showing 1 changed files
... ...
@@ -76,12 +76,12 @@ int init_pkg_mallocs(void)
76 76
 	#endif
77 77
 	#ifdef F_MALLOC
78 78
 		if (mem_pool)
79
-			mem_block=fm_malloc_init(mem_pool, pkg_mem_size);
79
+			mem_block=fm_malloc_init(mem_pool, pkg_mem_size, MEM_TYPE_PKG);
80 80
 	#elif DL_MALLOC
81 81
 		/* don't need this */
82 82
 	#else
83 83
 		if (mem_pool)
84
-			mem_block=qm_malloc_init(mem_pool, pkg_mem_size);
84
+			mem_block=qm_malloc_init(mem_pool, pkg_mem_size, MEM_TYPE_PKG);
85 85
 	#endif
86 86
 	#ifndef DL_MALLOC
87 87
 	if (mem_block==0){
Browse code

mem: small def./decl. fix for a bunch of internal functions, use void argument

Henning Westerholt authored on 13/07/2011 22:16:38
Showing 1 changed files
... ...
@@ -65,7 +65,7 @@
65 65
  * \brief Initialize private memory pool
66 66
  * \return 0 if the memory allocation was successful, -1 otherwise
67 67
  */
68
-int init_pkg_mallocs()
68
+int init_pkg_mallocs(void)
69 69
 {
70 70
 #ifdef PKG_MALLOC
71 71
 	/*init mem*/
... ...
@@ -100,7 +100,7 @@ int init_pkg_mallocs()
100 100
 /**
101 101
  * \brief Destroy private memory pool
102 102
  */
103
-void destroy_pkg_mallocs()
103
+void destroy_pkg_mallocs(void)
104 104
 {
105 105
 #ifdef PKG_MALLOC
106 106
 	#ifndef DL_MALLOC
Browse code

mem: initial doxygen documentation for MM, small whitespace changes

Henning Westerholt authored on 13/07/2011 22:11:48
Showing 1 changed files
... ...
@@ -1,6 +1,4 @@
1 1
 /*
2
- * $Id$
3
- *
4 2
  * Copyright (C) 2001-2003 FhG Fokus
5 3
  *
6 4
  * This file is part of sip-router, a free SIP server.
... ...
@@ -24,6 +22,14 @@
24 22
  * 
25 23
  */
26 24
 
25
+/**
26
+ * \file
27
+ * \brief Main definitions for memory manager
28
+ * 
29
+ * Main definitions for memory manager, like malloc, free and realloc
30
+ * \ingroup mem
31
+ */
32
+
27 33
 
28 34
 #include <stdio.h>
29 35
 #include <stdlib.h>
... ...
@@ -55,6 +61,10 @@
55 61
 #endif
56 62
 
57 63
 
64
+/**
65
+ * \brief Initialize private memory pool
66
+ * \return 0 if the memory allocation was successful, -1 otherwise
67
+ */
58 68
 int init_pkg_mallocs()
59 69
 {
60 70
 #ifdef PKG_MALLOC
... ...
@@ -87,6 +97,9 @@ int init_pkg_mallocs()
87 97
 
88 98
 
89 99
 
100
+/**
101
+ * \brief Destroy private memory pool
102
+ */
90 103
 void destroy_pkg_mallocs()
91 104
 {
92 105
 #ifdef PKG_MALLOC
... ...
@@ -100,7 +113,11 @@ void destroy_pkg_mallocs()
100 113
 }
101 114
 
102 115
 
103
-
116
+/**
117
+ * \brief Initialize shared memory pool
118
+ * \param force_alloc Force allocation of memory, e.g. initialize complete block with zero
119
+ * \return 0 if the memory allocation was successful, -1 otherwise
120
+ */
104 121
 int init_shm_mallocs(int force_alloc)
105 122
 {
106 123
 #ifdef SHM_MEM
... ...
@@ -113,5 +130,3 @@ int init_shm_mallocs(int force_alloc)
113 130
 #endif
114 131
 	return 0;
115 132
 }
116
-
117
-
Browse code

core: pkg mem size configurable form the cmd line

The pkg mem size used can be configured by using the "-M"
parameter on the command line, e.g.:
ser -M 8 -f test.cfg # start ser with 8mb of pkg memory
The default remains 4Mb.

Andrei Pelinescu-Onciul authored on 12/04/2011 19:54:07
Showing 1 changed files
... ...
@@ -26,6 +26,7 @@
26 26
 
27 27
 
28 28
 #include <stdio.h>
29
+#include <stdlib.h>
29 30
 #include "../config.h"
30 31
 #include "../dprint.h"
31 32
 #include "../globals.h"
... ...
@@ -41,15 +42,15 @@
41 42
 
42 43
 #ifdef PKG_MALLOC
43 44
 	#ifndef DL_MALLOC
44
-	char mem_pool[PKG_MEM_POOL_SIZE];
45
+	char* mem_pool = 0;
45 46
 	#endif
46 47
 
47 48
 	#ifdef F_MALLOC
48
-		struct fm_block* mem_block;
49
+		struct fm_block* mem_block = 0;
49 50
 	#elif defined DL_MALLOC
50 51
 		/* don't need this */
51 52
 	#else
52
-		struct qm_block* mem_block;
53
+		struct qm_block* mem_block = 0;
53 54
 	#endif
54 55
 #endif
55 56
 
... ...
@@ -58,18 +59,25 @@ int init_pkg_mallocs()
58 59
 {
59 60
 #ifdef PKG_MALLOC
60 61
 	/*init mem*/
62
+	#ifndef DL_MALLOC
63
+		if (pkg_mem_size == 0)
64
+			pkg_mem_size = PKG_MEM_POOL_SIZE;
65
+		mem_pool = malloc(pkg_mem_size);
66
+	#endif
61 67
 	#ifdef F_MALLOC
62
-		mem_block=fm_malloc_init(mem_pool, PKG_MEM_POOL_SIZE);
68
+		if (mem_pool)
69
+			mem_block=fm_malloc_init(mem_pool, pkg_mem_size);
63 70
 	#elif DL_MALLOC
64 71
 		/* don't need this */
65 72
 	#else
66
-		mem_block=qm_malloc_init(mem_pool, PKG_MEM_POOL_SIZE);
73
+		if (mem_pool)
74
+			mem_block=qm_malloc_init(mem_pool, pkg_mem_size);
67 75
 	#endif
68 76
 	#ifndef DL_MALLOC
69 77
 	if (mem_block==0){
70 78
 		LOG(L_CRIT, "could not initialize memory pool\n");
71
-		fprintf(stderr, "Too much pkg memory demanded: %d\n",
72
-			PKG_MEM_POOL_SIZE );
79
+		fprintf(stderr, "Too much pkg memory demanded: %ld bytes\n",
80
+						pkg_mem_size);
73 81
 		return -1;
74 82
 	}
75 83
 	#endif
... ...
@@ -79,6 +87,20 @@ int init_pkg_mallocs()
79 87
 
80 88
 
81 89
 
90
+void destroy_pkg_mallocs()
91
+{
92
+#ifdef PKG_MALLOC
93
+	#ifndef DL_MALLOC
94
+		if (mem_pool) {
95
+			free(mem_pool);
96
+			mem_pool = 0;
97
+		}
98
+	#endif
99
+#endif /* PKG_MALLOC */
100
+}
101
+
102
+
103
+
82 104
 int init_shm_mallocs(int force_alloc)
83 105
 {
84 106
 #ifdef SHM_MEM
Browse code

core: mem dbg options updates + cleanups

- memlog and memdbg can now be changed at runtime
- double define warning fix for fm_malloc (when compiled with -DF_MALLOC)
- nicer qm_status() & qm_sums() output
- BSD licence for mem/*

Andrei Pelinescu-Onciul authored on 29/09/2009 13:25:50
Showing 1 changed files
... ...
@@ -3,26 +3,19 @@
3 3
  *
4 4
  * Copyright (C) 2001-2003 FhG Fokus
5 5
  *
6
- * This file is part of ser, a free SIP server.
6
+ * This file is part of sip-router, a free SIP server.
7 7
  *
8
- * ser is free software; you can redistribute it and/or modify
9
- * it under the terms of the GNU General Public License as published by
10
- * the Free Software Foundation; either version 2 of the License, or
11
- * (at your option) any later version
8
+ * Permission to use, copy, modify, and distribute this software for any
9
+ * purpose with or without fee is hereby granted, provided that the above
10
+ * copyright notice and this permission notice appear in all copies.
12 11
  *
13
- * For a license to use the ser software under conditions
14
- * other than those described here, or to purchase support for this
15
- * software, please contact iptel.org by e-mail at the following addresses:
16
- *    info@iptel.org
17
- *
18
- * ser is distributed in the hope that it will be useful,
19
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
20
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21
- * GNU General Public License for more details.
22
- *
23
- * You should have received a copy of the GNU General Public License 
24
- * along with this program; if not, write to the Free Software 
25
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
12
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
13
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
14
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
15
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
16
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
17
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
18
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
26 19
  *
27 20
  *
28 21
  * History:
Browse code

core: remove VQ_MALLOC memory manager

attached patch removes the VQ_MALLOC memory manager from the
sip-router core. As discussed some time ago, this memory manager
doesn't provide a realloc implementation, and is thus not really
usable for the modules, as some of them needs this. We removed
this in kamailio in the last year, so far nobody missed it.

Signed-off-by: Andrei Pelinescu-Onciul <andrei@iptel.org>

Henning Westerholt authored on 17/03/2009 12:24:42 • Andrei Pelinescu-Onciul committed on 29/09/2009 17:03:41
Showing 1 changed files
... ...
@@ -39,11 +39,7 @@
39 39
 #include "mem.h"
40 40
 
41 41
 #ifdef PKG_MALLOC
42
-	#ifdef VQ_MALLOC
43
-		#include "vq_malloc.h"
44
-	#else
45
-		#include "q_malloc.h"
46
-	#endif
42
+#include "q_malloc.h"
47 43
 #endif
48 44
 
49 45
 #ifdef SHM_MEM
... ...
@@ -55,9 +51,7 @@
55 51
 	char mem_pool[PKG_MEM_POOL_SIZE];
56 52
 	#endif
57 53
 
58
-	#ifdef VQ_MALLOC
59
-		struct vqm_block* mem_block;
60
-	#elif defined F_MALLOC
54
+	#ifdef F_MALLOC
61 55
 		struct fm_block* mem_block;
62 56
 	#elif defined DL_MALLOC
63 57
 		/* don't need this */
... ...
@@ -71,9 +65,7 @@ int init_pkg_mallocs()
71 65
 {
72 66
 #ifdef PKG_MALLOC
73 67
 	/*init mem*/
74
-	#ifdef VQ_MALLOC
75
-		mem_block=vqm_malloc_init(mem_pool, PKG_MEM_POOL_SIZE);
76
-	#elif F_MALLOC
68
+	#ifdef F_MALLOC
77 69
 		mem_block=fm_malloc_init(mem_pool, PKG_MEM_POOL_SIZE);
78 70
 	#elif DL_MALLOC
79 71
 		/* don't need this */
Browse code

- support for pre-faulting the shm mem. pages (memset(0))

Andrei Pelinescu-Onciul authored on 07/06/2007 21:49:53
Showing 1 changed files
... ...
@@ -94,10 +94,10 @@ int init_pkg_mallocs()
94 94
 
95 95
 
96 96
 
97
-int init_shm_mallocs()
97
+int init_shm_mallocs(int force_alloc)
98 98
 {
99 99
 #ifdef SHM_MEM
100
-	if (shm_mem_init()<0) {
100
+	if (shm_mem_init(force_alloc)<0) {
101 101
 		LOG(L_CRIT, "could not initialize shared memory pool, exiting...\n");
102 102
 		 fprintf(stderr, "Too much shared memory demanded: %ld\n",
103 103
 			shm_mem_size );
Browse code

Add a new memory allocator (-DDL_MALLOC) which is based on Doug Lea's dl_malloc implementation (http://g.oswego.edu/dl/html/malloc.html). Patch has been provided by Jan Andres <jan.andres@freenet-ag.de>

Notes:
- very fast, esp. on shm_malloc() in comparison to other algorithms
- has been in production use at freenet(.de) for 6+ months
- is picky about buffer overruns (aka detects and crashes on them)
- disabled by default (set -DDL_MALLOC in Makefile.defs)
- closes SER-278

Hendrik Scholz authored on 01/06/2007 09:20:34
Showing 1 changed files
... ...
@@ -51,11 +51,16 @@
51 51
 #endif
52 52
 
53 53
 #ifdef PKG_MALLOC
54
+	#ifndef DL_MALLOC
54 55
 	char mem_pool[PKG_MEM_POOL_SIZE];
56
+	#endif
57
+
55 58
 	#ifdef VQ_MALLOC
56 59
 		struct vqm_block* mem_block;
57 60
 	#elif defined F_MALLOC
58 61
 		struct fm_block* mem_block;
62
+	#elif defined DL_MALLOC
63
+		/* don't need this */
59 64
 	#else
60 65
 		struct qm_block* mem_block;
61 66
 	#endif
... ...
@@ -70,15 +75,19 @@ int init_pkg_mallocs()
70 75
 		mem_block=vqm_malloc_init(mem_pool, PKG_MEM_POOL_SIZE);
71 76
 	#elif F_MALLOC
72 77
 		mem_block=fm_malloc_init(mem_pool, PKG_MEM_POOL_SIZE);
78
+	#elif DL_MALLOC
79
+		/* don't need this */
73 80
 	#else
74 81
 		mem_block=qm_malloc_init(mem_pool, PKG_MEM_POOL_SIZE);
75 82
 	#endif
83
+	#ifndef DL_MALLOC
76 84
 	if (mem_block==0){
77 85
 		LOG(L_CRIT, "could not initialize memory pool\n");
78 86
 		fprintf(stderr, "Too much pkg memory demanded: %d\n",
79 87
 			PKG_MEM_POOL_SIZE );
80 88
 		return -1;
81 89
 	}
90
+	#endif
82 91
 #endif
83 92
 	return 0;
84 93
 }
Browse code

- more than 4Gb memory support (ser -m 5192 will work and use 5Gb of memory)

Andrei Pelinescu-Onciul authored on 10/11/2004 21:51:24
Showing 1 changed files
... ...
@@ -90,7 +90,7 @@ int init_shm_mallocs()
90 90
 #ifdef SHM_MEM
91 91
 	if (shm_mem_init()<0) {
92 92
 		LOG(L_CRIT, "could not initialize shared memory pool, exiting...\n");
93
-		 fprintf(stderr, "Too much shared memory demanded: %d\n",
93
+		 fprintf(stderr, "Too much shared memory demanded: %ld\n",
94 94
 			shm_mem_size );
95 95
 		return -1;
96 96
 	}
Browse code

- Spelling checked - READMEs updated

Jan Janak authored on 24/08/2004 08:58:23
Showing 1 changed files
... ...
@@ -1,7 +1,7 @@
1 1
 /*
2 2
  * $Id$
3 3
  *
4
- * Copyright (C) 2001-2003 Fhg Fokus
4
+ * Copyright (C) 2001-2003 FhG Fokus
5 5
  *
6 6
  * This file is part of ser, a free SIP server.
7 7
  *
Browse code

- 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 authored on 08/04/2003 16:02:43
Showing 1 changed files
... ...
@@ -23,6 +23,12 @@
23 23
  * You should have received a copy of the GNU General Public License 
24 24
  * along with this program; if not, write to the Free Software 
25 25
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
26
+ *
27
+ *
28
+ * History:
29
+ * --------
30
+ *  2003-04-08  init_mallocs split into init_{pkg,shm}_malloc (andrei)
31
+ * 
26 32
  */
27 33
 
28 34
 
... ...
@@ -55,7 +61,8 @@
55 61
 	#endif
56 62
 #endif
57 63
 
58
-int init_mallocs()
64
+
65
+int init_pkg_mallocs()
59 66
 {
60 67
 #ifdef PKG_MALLOC
61 68
 	/*init mem*/
... ...
@@ -73,7 +80,13 @@ int init_mallocs()
73 80
 		return -1;
74 81
 	}
75 82
 #endif
83
+	return 0;
84
+}
76 85
 
86
+
87
+
88
+int init_shm_mallocs()
89
+{
77 90
 #ifdef SHM_MEM
78 91
 	if (shm_mem_init()<0) {
79 92
 		LOG(L_CRIT, "could not initialize shared memory pool, exiting...\n");
... ...
@@ -83,7 +96,6 @@ int init_mallocs()
83 96
 	}
84 97
 #endif
85 98
 	return 0;
86
-
87 99
 }
88 100
 
89 101
 
Browse code

GPLization banner introduced to *.[hc] files

Jiri Kuthan authored on 19/09/2002 12:23:52
Showing 1 changed files
... ...
@@ -1,7 +1,31 @@
1 1
 /*
2
- * $Id: *
2
+ * $Id$
3
+ *
4
+ * Copyright (C) 2001-2003 Fhg Fokus
5
+ *
6
+ * This file is part of ser, a free SIP server.
7
+ *
8
+ * ser is free software; you can redistribute it and/or modify
9
+ * it under the terms of the GNU General Public License as published by
10
+ * the Free Software Foundation; either version 2 of the License, or
11
+ * (at your option) any later version
12
+ *
13
+ * For a license to use the ser software under conditions
14
+ * other than those described here, or to purchase support for this
15
+ * software, please contact iptel.org by e-mail at the following addresses:
16
+ *    info@iptel.org
17
+ *
18
+ * ser is distributed in the hope that it will be useful,
19
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
20
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21
+ * GNU General Public License for more details.
22
+ *
23
+ * You should have received a copy of the GNU General Public License 
24
+ * along with this program; if not, write to the Free Software 
25
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
3 26
  */
4 27
 
28
+
5 29
 #include <stdio.h>
6 30
 #include "../config.h"
7 31
 #include "../dprint.h"
Browse code

CVS substitutes introduced

Jiri Kuthan authored on 19/09/2002 11:51:26
Showing 1 changed files
... ...
@@ -1,5 +1,5 @@
1 1
 /*
2
- * $Id *
2
+ * $Id: *
3 3
  */
4 4
 
5 5
 #include <stdio.h>
Browse code

bignag change -- lot of things primarily added in relationship with refurbushing TM; see [sr] archive (2002-08-14) -- "ser update" and "TM update" for a long list of details

Jiri Kuthan authored on 15/08/2002 08:13:29
Showing 1 changed files
... ...
@@ -2,8 +2,10 @@
2 2
  * $Id *
3 3
  */
4 4
 
5
+#include <stdio.h>
5 6
 #include "../config.h"
6 7
 #include "../dprint.h"
8
+#include "../globals.h"
7 9
 #include "mem.h"
8 10
 
9 11
 #ifdef PKG_MALLOC
... ...
@@ -42,6 +44,8 @@ int init_mallocs()
42 44
 	#endif
43 45
 	if (mem_block==0){
44 46
 		LOG(L_CRIT, "could not initialize memory pool\n");
47
+		fprintf(stderr, "Too much pkg memory demanded: %d\n",
48
+			PKG_MEM_POOL_SIZE );
45 49
 		return -1;
46 50
 	}
47 51
 #endif
... ...
@@ -49,6 +53,8 @@ int init_mallocs()
49 53
 #ifdef SHM_MEM
50 54
 	if (shm_mem_init()<0) {
51 55
 		LOG(L_CRIT, "could not initialize shared memory pool, exiting...\n");
56
+		 fprintf(stderr, "Too much shared memory demanded: %d\n",
57
+			shm_mem_size );
52 58
 		return -1;
53 59
 	}
54 60
 #endif
Browse code

- fixed almost all warnings in ser core (gcc-3.0 -Wall, icc, sun cc). (=> fixed a lot of format string bugs) - replaced some of the remaining mallocs w/ pkg_malloc

Andrei Pelinescu-Onciul authored on 02/03/2002 02:20:00
Showing 1 changed files
... ...
@@ -7,11 +7,15 @@
7 7
 #include "mem.h"
8 8
 
9 9
 #ifdef PKG_MALLOC
10
-#	ifdef VQ_MALLOC
11
-#		include "vq_malloc.h"
12
-#	else
13
-#		include "q_malloc.h"
14
-#	endif
10
+	#ifdef VQ_MALLOC
11
+		#include "vq_malloc.h"
12
+	#else
13
+		#include "q_malloc.h"
14
+	#endif
15
+#endif
16
+
17
+#ifdef SHM_MEM
18
+#include "shm_mem.h"
15 19
 #endif
16 20
 
17 21
 #ifdef PKG_MALLOC
Browse code

- first attempt at sparc64 asm sync

Andrei Pelinescu-Onciul authored on 12/02/2002 20:09:20
Showing 1 changed files
... ...
@@ -28,25 +28,25 @@
28 28
 int init_mallocs()
29 29
 {
30 30
 #ifdef PKG_MALLOC
31
-        /*init mem*/
31
+	/*init mem*/
32 32
 	#ifdef VQ_MALLOC
33
-        	mem_block=vqm_malloc_init(mem_pool, PKG_MEM_POOL_SIZE);
33
+		mem_block=vqm_malloc_init(mem_pool, PKG_MEM_POOL_SIZE);
34 34
 	#elif F_MALLOC
35 35
 		mem_block=fm_malloc_init(mem_pool, PKG_MEM_POOL_SIZE);
36 36
 	#else
37
-        	mem_block=qm_malloc_init(mem_pool, PKG_MEM_POOL_SIZE);
37
+		mem_block=qm_malloc_init(mem_pool, PKG_MEM_POOL_SIZE);
38 38
 	#endif
39
-        if (mem_block==0){
40
-                LOG(L_CRIT, "could not initialize memory pool\n");
39
+	if (mem_block==0){
40
+		LOG(L_CRIT, "could not initialize memory pool\n");
41 41
 		return -1;
42
-        }
42
+	}
43 43
 #endif
44 44
 
45 45
 #ifdef SHM_MEM
46
-        if (shm_mem_init()<0) {
47
-                LOG(L_CRIT, "could not initialize shared memory pool, exiting...\n");
48
-                return -1;
49
-        }
46
+	if (shm_mem_init()<0) {
47
+		LOG(L_CRIT, "could not initialize shared memory pool, exiting...\n");
48
+		return -1;
49
+	}
50 50
 #endif
51 51
 	return 0;
52 52
 
Browse code

- updated Makefiles ( gcc-3.0 specific options, arch. specific defines section, a.s.o) - fixed gcc-3.0 warnings - added f_malloc, an even faster malloc

Andrei Pelinescu-Onciul authored on 11/02/2002 17:56:22
Showing 1 changed files
... ...
@@ -18,6 +18,8 @@
18 18
 	char mem_pool[PKG_MEM_POOL_SIZE];
19 19
 	#ifdef VQ_MALLOC
20 20
 		struct vqm_block* mem_block;
21
+	#elif defined F_MALLOC
22
+		struct fm_block* mem_block;
21 23
 	#else
22 24
 		struct qm_block* mem_block;
23 25
 	#endif
... ...
@@ -29,6 +31,8 @@ int init_mallocs()
29 31
         /*init mem*/
30 32
 	#ifdef VQ_MALLOC
31 33
         	mem_block=vqm_malloc_init(mem_pool, PKG_MEM_POOL_SIZE);
34
+	#elif F_MALLOC
35
+		mem_block=fm_malloc_init(mem_pool, PKG_MEM_POOL_SIZE);
32 36
 	#else
33 37
         	mem_block=qm_malloc_init(mem_pool, PKG_MEM_POOL_SIZE);
34 38
 	#endif
Browse code

performance and bug fixes

Jiri Kuthan authored on 07/01/2002 04:39:49
Showing 1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,51 @@
1
+/*
2
+ * $Id *
3
+ */
4
+
5
+#include "../config.h"
6
+#include "../dprint.h"
7
+#include "mem.h"
8
+
9
+#ifdef PKG_MALLOC
10
+#	ifdef VQ_MALLOC
11
+#		include "vq_malloc.h"
12
+#	else
13
+#		include "q_malloc.h"
14
+#	endif
15
+#endif
16
+
17
+#ifdef PKG_MALLOC
18
+	char mem_pool[PKG_MEM_POOL_SIZE];
19
+	#ifdef VQ_MALLOC
20
+		struct vqm_block* mem_block;
21
+	#else
22
+		struct qm_block* mem_block;
23
+	#endif
24
+#endif
25
+
26
+int init_mallocs()
27
+{
28
+#ifdef PKG_MALLOC
29
+        /*init mem*/
30
+	#ifdef VQ_MALLOC
31
+        	mem_block=vqm_malloc_init(mem_pool, PKG_MEM_POOL_SIZE);
32
+	#else
33
+        	mem_block=qm_malloc_init(mem_pool, PKG_MEM_POOL_SIZE);
34
+	#endif
35
+        if (mem_block==0){
36
+                LOG(L_CRIT, "could not initialize memory pool\n");
37
+		return -1;
38
+        }
39
+#endif
40
+
41
+#ifdef SHM_MEM
42
+        if (shm_mem_init()<0) {
43
+                LOG(L_CRIT, "could not initialize shared memory pool, exiting...\n");
44
+                return -1;
45
+        }
46
+#endif
47
+	return 0;
48
+
49
+}
50
+
51
+