#### 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,112 +0,0 @@ 1 -/*  2 - * Copyright (C) 2006 iptelorg GmbH 3 - * 4 - * Permission to use, copy, modify, and distribute this software for any 5 - * purpose with or without fee is hereby granted, provided that the above 6 - * copyright notice and this permission notice appear in all copies. 7 - * 8 - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 11 - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14 - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 - */ 16 - 17 -/*! 18 - * \file 19 - * \brief Kamailio core :: atomic operations init 20 - * \ingroup core 21 - * Module: \ref core 22 - */ 23 - 24 - 25 -#include "atomic_ops_init.h" 26 -#include "atomic_ops.h" 27 - 28 -#if defined ATOMIC_OPS_USE_LOCK || defined ATOMIC_OPS_USE_LOCK_SET || \ 29 - defined MEMBAR_USES_LOCK 30 -#include "locking.h" 31 -#endif 32 - 33 -#ifdef MEMBAR_USES_LOCK 34 -gen_lock_t* __membar_lock=0; /* init in atomic_ops.c */ 35 -#endif 36 - 37 -#ifdef ATOMIC_OPS_USE_LOCK_SET 38 -gen_lock_set_t* _atomic_lock_set=0; 39 -#elif defined ATOMIC_OPS_USE_LOCK 40 -gen_lock_t* _atomic_lock=0; 41 -#endif 42 - 43 - 44 -/* returns 0 on success, -1 on error */ 45 -int init_atomic_ops() 46 -{ 47 -  48 -#ifdef MEMBAR_USES_LOCK 49 - if ((__membar_lock=lock_alloc())==0){ 50 - goto error; 51 - } 52 - if (lock_init(__membar_lock)==0){ 53 - lock_dealloc(__membar_lock); 54 - __membar_lock=0; 55 - goto error; 56 - } 57 - _membar_lock; /* start with the lock "taken" so that we can safely use 58 - unlock/lock sequences on it later */ 59 -#endif 60 -#ifdef ATOMIC_OPS_USE_LOCK_SET 61 - if ((_atomic_lock_set=lock_set_alloc(_ATOMIC_LS_SIZE))==0){ 62 - goto error; 63 - } 64 - if (lock_set_init(_atomic_lock_set)==0){ 65 - lock_set_dealloc(_atomic_lock_set); 66 - _atomic_lock_set=0; 67 - goto error; 68 - } 69 -#elif defined ATOMIC_OPS_USE_LOCK 70 - if ((_atomic_lock=lock_alloc())==0){ 71 - goto error; 72 - } 73 - if (lock_init(_atomic_lock)==0){ 74 - lock_dealloc(_atomic_lock); 75 - _atomic_lock=0; 76 - goto error; 77 - } 78 -#endif /* ATOMIC_OPS_USE_LOCK_SET/ATOMIC_OPS_USE_LOCK */ 79 - return 0; 80 -#if defined MEMBAR_USES_LOCK || defined ATOMIC_OPS_USE_LOCK || \ 81 - defined ATOMIC_OPS_USE_LOCK_SET 82 -error: 83 - destroy_atomic_ops(); 84 - return -1; 85 -#endif 86 -} 87 - 88 - 89 - 90 -void destroy_atomic_ops() 91 -{ 92 -#ifdef MEMBAR_USES_LOCK 93 - if (__membar_lock!=0){ 94 - lock_destroy(__membar_lock); 95 - lock_dealloc(__membar_lock); 96 - __membar_lock=0; 97 - } 98 -#endif 99 -#ifdef ATOMIC_OPS_USE_LOCK_SET 100 - if (_atomic_lock_set!=0){ 101 - lock_set_destroy(_atomic_lock_set); 102 - lock_set_dealloc(_atomic_lock_set); 103 - _atomic_lock_set=0; 104 - } 105 -#elif defined ATOMIC_OPS_USE_LOCK 106 - if (_atomic_lock!=0){ 107 - lock_destroy(_atomic_lock); 108 - lock_dealloc(_atomic_lock); 109 - _atomic_lock=0; 110 - } 111 -#endif /* ATOMIC_OPS_USE_LOCK_SET / ATOMIC_OPS_USE_LOCK*/ 112 -}

#### core: Modify doxygen, remove history, remove SVN IDs, change "ser" and "sip-router" to "KAMAILIO"

Olle E. Johansson authored on 16/01/2015 16:38:46
Showing 1 changed files
 ... ... @@ -16,7 +16,7 @@ 16 16   17 17  /*! 18 18  * \file 19 - * \brief SIP-router core :: atomic operations init 19 + * \brief Kamailio core :: atomic operations init 20 20  * \ingroup core 21 21  * Module: \ref core 22 22  */

#### core Update headers, change "SIP-router" to "Kamailio", update doxygen file headers

Olle E. Johansson authored on 03/01/2015 14:15:58
Showing 1 changed files
 ... ... @@ -13,13 +13,10 @@ 13 13  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14 14  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 15  */ 16 -/* 17 - * atomic operations init 18 - */ 19 16   20 17  /*! 21 18  * \file 22 - * \brief SIP-router core ::  19 + * \brief SIP-router core :: atomic operations init 23 20  * \ingroup core 24 21  * Module: \ref core 25 22  */

#### Core Removed history, svn $id$ and doxygen udpates on the .c files

Olle E. Johansson authored on 03/01/2015 09:53:17
Showing 1 changed files
 ... ... @@ -1,6 +1,4 @@ 1 1  /*  2 - * $Id$ 3 - *  4 2  * Copyright (C) 2006 iptelorg GmbH 5 3  * 6 4  * Permission to use, copy, modify, and distribute this software for any ... ... @@ -18,12 +16,7 @@ 18 16  /* 19 17  * atomic operations init 20 18  */ 21 -/*  22 - * History: 23 - * -------- 24 - * 2006-03-08 created by andrei 25 - * 2007-05-11 added lock_set support (andrei) 26 - */ 19 + 27 20  /*! 28 21  * \file 29 22  * \brief SIP-router core ::

#### Adding doxygen template to all core .c files

Please fill in after the :: to explain the function of this file.

oej authored on 10/10/2009 13:54:13
Showing 1 changed files
 ... ... @@ -24,6 +24,13 @@ 24 24  * 2006-03-08 created by andrei 25 25  * 2007-05-11 added lock_set support (andrei) 26 26  */ 27 +/*! 28 + * \file 29 + * \brief SIP-router core ::  30 + * \ingroup core 31 + * Module: \ref core 32 + */ 33 + 27 34   28 35  #include "atomic_ops_init.h" 29 36  #include "atomic_ops.h"

#### - atomic_add & atomic_cmpxchg added to ppc - atomic_unkown (used when the procesor does not suport atomic ops or is not among the supported ones), tries now to use a "hash" of locks if GEN_LOCK_SET_T_UNLIMITED is defined => less contention on multi-cpus - atomic_ops.h defines *_UNLIMITED macros when the number of locks or set size are limited only by the available memory (everything exept SYSV sems) - license changes: all the atomic* stuff and the locks are now under a BSD (OpenBSD) style license

Andrei Pelinescu-Onciul authored on 11/05/2007 20:44:15
Showing 1 changed files
 ... ... @@ -3,26 +3,17 @@ 3 3  *  4 4  * Copyright (C) 2006 iptelorg GmbH 5 5  * 6 - * This file is part of ser, a free SIP server. 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. 7 9  * 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 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. 26 17  */ 27 18  /* 28 19  * atomic operations init ... ... @@ -31,12 +22,14 @@ 31 22  * History: 32 23  * -------- 33 24  * 2006-03-08 created by andrei 25 + * 2007-05-11 added lock_set support (andrei) 34 26  */ 35 27   36 28  #include "atomic_ops_init.h" 37 29  #include "atomic_ops.h" 38 30   39 -#if defined ATOMIC_OPS_USE_LOCK || defined MEMBAR_USES_LOCK 31 +#if defined ATOMIC_OPS_USE_LOCK || defined ATOMIC_OPS_USE_LOCK_SET || \ 32 + defined MEMBAR_USES_LOCK 40 33  #include "locking.h" 41 34  #endif 42 35   ... ... @@ -44,7 +37,9 @@ 44 37  gen_lock_t* __membar_lock=0; /* init in atomic_ops.c */ 45 38  #endif 46 39   47 -#ifdef ATOMIC_OPS_USE_LOCK 40 +#ifdef ATOMIC_OPS_USE_LOCK_SET 41 +gen_lock_set_t* _atomic_lock_set=0; 42 +#elif defined ATOMIC_OPS_USE_LOCK 48 43  gen_lock_t* _atomic_lock=0; 49 44  #endif 50 45   ... ... @@ -65,7 +60,16 @@ int init_atomic_ops() 65 60  _membar_lock; /* start with the lock "taken" so that we can safely use 66 61  unlock/lock sequences on it later */ 67 62  #endif 68 -#ifdef ATOMIC_OPS_USE_LOCK 63 +#ifdef ATOMIC_OPS_USE_LOCK_SET 64 + if ((_atomic_lock_set=lock_set_alloc(_ATOMIC_LS_SIZE))==0){ 65 + goto error; 66 + } 67 + if (lock_set_init(_atomic_lock_set)==0){ 68 + lock_set_dealloc(_atomic_lock_set); 69 + _atomic_lock_set=0; 70 + goto error; 71 + } 72 +#elif defined ATOMIC_OPS_USE_LOCK 69 73  if ((_atomic_lock=lock_alloc())==0){ 70 74  goto error; 71 75  } ... ... @@ -74,9 +78,10 @@ int init_atomic_ops() 74 78  _atomic_lock=0; 75 79  goto error; 76 80  } 77 -#endif 81 +#endif /* ATOMIC_OPS_USE_LOCK_SET/ATOMIC_OPS_USE_LOCK */ 78 82  return 0; 79 -#if defined MEMBAR_USES_LOCK || defined ATOMIC_OPS_USE_LOCK 83 +#if defined MEMBAR_USES_LOCK || defined ATOMIC_OPS_USE_LOCK || \ 84 + defined ATOMIC_OPS_USE_LOCK_SET 80 85  error: 81 86  destroy_atomic_ops(); 82 87  return -1; ... ... @@ -94,11 +99,17 @@ void destroy_atomic_ops() 94 99  __membar_lock=0; 95 100  } 96 101  #endif 97 -#ifdef ATOMIC_OPS_USE_LOCK 102 +#ifdef ATOMIC_OPS_USE_LOCK_SET 103 + if (_atomic_lock_set!=0){ 104 + lock_set_destroy(_atomic_lock_set); 105 + lock_set_dealloc(_atomic_lock_set); 106 + _atomic_lock_set=0; 107 + } 108 +#elif defined ATOMIC_OPS_USE_LOCK 98 109  if (_atomic_lock!=0){ 99 110  lock_destroy(_atomic_lock); 100 111  lock_dealloc(_atomic_lock); 101 112  _atomic_lock=0; 102 113  } 103 -#endif 114 +#endif /* ATOMIC_OPS_USE_LOCK_SET / ATOMIC_OPS_USE_LOCK*/ 104 115  }

#### - typo fixed

Andrei Pelinescu-Onciul authored on 04/04/2006 11:08:31
Showing 1 changed files
 ... ... @@ -36,7 +36,7 @@ 36 36  #include "atomic_ops_init.h" 37 37  #include "atomic_ops.h" 38 38   39 -#if defined ATOMIC_OPS_USE_LOCK || defines MEMBAR_USES_LOCK 39 +#if defined ATOMIC_OPS_USE_LOCK || defined MEMBAR_USES_LOCK 40 40  #include "locking.h" 41 41  #endif 42 42 

#### - s/atomic_ops_destroy/destroy_atomic_ops - fixed membar w/ locks (should be unlock; lock) - added a separate lock for membar w/ locks (unkown arch).

Andrei Pelinescu-Onciul authored on 03/04/2006 13:32:53
Showing 1 changed files
 ... ... @@ -36,39 +36,64 @@ 36 36  #include "atomic_ops_init.h" 37 37  #include "atomic_ops.h" 38 38   39 -#ifdef ATOMIC_OPS_USE_LOCK 40 - 39 +#if defined ATOMIC_OPS_USE_LOCK || defines MEMBAR_USES_LOCK 41 40  #include "locking.h" 41 +#endif 42 42   43 -gen_lock_t* _atomic_lock; 43 +#ifdef MEMBAR_USES_LOCK 44 +gen_lock_t* __membar_lock=0; /* init in atomic_ops.c */ 45 +#endif 46 + 47 +#ifdef ATOMIC_OPS_USE_LOCK 48 +gen_lock_t* _atomic_lock=0; 44 49  #endif 45 50   46 51   47 52  /* returns 0 on success, -1 on error */ 48 53  int init_atomic_ops() 49 54  { 50 - int ret; 51 55   52 - ret=0; 56 +#ifdef MEMBAR_USES_LOCK 57 + if ((__membar_lock=lock_alloc())==0){ 58 + goto error; 59 + } 60 + if (lock_init(__membar_lock)==0){ 61 + lock_dealloc(__membar_lock); 62 + __membar_lock=0; 63 + goto error; 64 + } 65 + _membar_lock; /* start with the lock "taken" so that we can safely use 66 + unlock/lock sequences on it later */ 67 +#endif 53 68  #ifdef ATOMIC_OPS_USE_LOCK 54 69  if ((_atomic_lock=lock_alloc())==0){ 55 - ret=-1; 56 - goto end; 70 + goto error; 57 71  } 58 72  if (lock_init(_atomic_lock)==0){ 59 - ret=-1; 60 - atomic_ops_destroy(); 61 - goto end; 73 + lock_dealloc(_atomic_lock); 74 + _atomic_lock=0; 75 + goto error; 62 76  } 63 -end: 64 77  #endif 65 - return ret; 78 + return 0; 79 +#if defined MEMBAR_USES_LOCK || defined ATOMIC_OPS_USE_LOCK 80 +error: 81 + destroy_atomic_ops(); 82 + return -1; 83 +#endif 66 84  } 67 85   68 86   69 87   70 88  void destroy_atomic_ops() 71 89  { 90 +#ifdef MEMBAR_USES_LOCK 91 + if (__membar_lock!=0){ 92 + lock_destroy(__membar_lock); 93 + lock_dealloc(__membar_lock); 94 + __membar_lock=0; 95 + } 96 +#endif 72 97  #ifdef ATOMIC_OPS_USE_LOCK 73 98  if (_atomic_lock!=0){ 74 99  lock_destroy(_atomic_lock);

#### - makefile: - compile in 64bit mode by default on sparc64 - sparc <= v8 support - -CC_GCC_LIKE_ASM is defined when the compiler supports gcc style inline asm (gcc and icc)

- atomic operations and memory barriers support for:
- x86
- x86_64
- mips (only in NOSMP mode and if it supports ll and sc)
- mips2 (mips32, isa >= 2)
- mips64
- powerpc
- powerpc64
- sparc <= v8 (only memory barriers, the atomic operations are implemented
using locks because there is no hardware support for them)
- sparc64 - both 32 (v8plus) and 64 bit mode
If there is no support for the compiler/arch. combination, it falls back to
locks.

The code is tested (only basic tests: it runs and the results are ok, but no
parallel tests) on x86, x86_64, mips2, powerpc, sparc64 (both modes).
The sparc version runs ok on sparc64 (so it's most likely ok).
powerpc64 and mips64 not tested due to no access to the corresponding
hardware, but they do compile ok.
For more details see the comments at the beginning of atomic_ops.h.

Andrei Pelinescu-Onciul authored on 30/03/2006 19:56:06
Showing 1 changed files
 ... ... @@ -33,28 +33,31 @@ 33 33  * 2006-03-08 created by andrei 34 34  */ 35 35   36 +#include "atomic_ops_init.h" 36 37  #include "atomic_ops.h" 37 38   38 -#ifdef ATOMIC_USE_LOCK 39 +#ifdef ATOMIC_OPS_USE_LOCK 40 + 41 +#include "locking.h" 42 + 39 43  gen_lock_t* _atomic_lock; 40 44  #endif 41 45   42 46   43 47  /* returns 0 on success, -1 on error */ 44 -int atomic_ops_init() 48 +int init_atomic_ops() 45 49  { 46 50  int ret; 47 51   48 52  ret=0; 49 -#ifdef ATOMIC_USE_LOCK 53 +#ifdef ATOMIC_OPS_USE_LOCK 50 54  if ((_atomic_lock=lock_alloc())==0){ 51 55  ret=-1; 52 56  goto end; 53 57  } 54 58  if (lock_init(_atomic_lock)==0){ 55 59  ret=-1; 56 - lock_destroy(_atomic_lock); 57 - _atomic_lock=0; 60 + atomic_ops_destroy(); 58 61  goto end; 59 62  } 60 63  end: ... ... @@ -62,3 +65,15 @@ end: 62 65  return ret; 63 66  } 64 67   68 + 69 + 70 +void destroy_atomic_ops() 71 +{ 72 +#ifdef ATOMIC_OPS_USE_LOCK 73 + if (_atomic_lock!=0){ 74 + lock_destroy(_atomic_lock); 75 + lock_dealloc(_atomic_lock); 76 + _atomic_lock=0; 77 + } 78 +#endif 79 +}

#### - timer: proper includes for no fast lock case - Makefile: mips gcc params fixes - atomic_* updates [work in progress]

Andrei Pelinescu-Onciul authored on 13/03/2006 20:20:48
Showing 1 changed files
 ... ... @@ -36,7 +36,7 @@ 36 36  #include "atomic_ops.h" 37 37   38 38  #ifdef ATOMIC_USE_LOCK 39 -gen_lock_t* atomic_lock; 39 +gen_lock_t* _atomic_lock; 40 40  #endif 41 41   42 42   ... ... @@ -47,14 +47,14 @@ int atomic_ops_init() 47 47   48 48  ret=0; 49 49  #ifdef ATOMIC_USE_LOCK 50 - if ((atomic_lock=lock_alloc())==0){ 50 + if ((_atomic_lock=lock_alloc())==0){ 51 51  ret=-1; 52 52  goto end; 53 53  } 54 - if (lock_init(atomic_lock)==0){ 54 + if (lock_init(_atomic_lock)==0){ 55 55  ret=-1; 56 - lock_destroy(atomic_lock); 57 - atomic_lock=0; 56 + lock_destroy(_atomic_lock); 57 + _atomic_lock=0; 58 58  goto end; 59 59  } 60 60  end:

#### - advanced synchronization functions: atomic operations (inc, dec, inc_and_test, dec_and_test, or, and) and memory barriers. [ work in progress, for now: x86, x86_64 and mips2 ]

Andrei Pelinescu-Onciul authored on 09/03/2006 20:44:08
Showing 1 changed files
 1 1 new file mode 100644 ... ... @@ -0,0 +1,64 @@ 1 +/*  2 + * $Id$ 3 + *  4 + * Copyright (C) 2006 iptelorg GmbH 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 26 + */ 27 +/* 28 + * atomic operations init 29 + */ 30 +/*  31 + * History: 32 + * -------- 33 + * 2006-03-08 created by andrei 34 + */ 35 + 36 +#include "atomic_ops.h" 37 + 38 +#ifdef ATOMIC_USE_LOCK 39 +gen_lock_t* atomic_lock; 40 +#endif 41 + 42 + 43 +/* returns 0 on success, -1 on error */ 44 +int atomic_ops_init() 45 +{ 46 + int ret; 47 +  48 + ret=0; 49 +#ifdef ATOMIC_USE_LOCK 50 + if ((atomic_lock=lock_alloc())==0){ 51 + ret=-1; 52 + goto end; 53 + } 54 + if (lock_init(atomic_lock)==0){ 55 + ret=-1; 56 + lock_destroy(atomic_lock); 57 + atomic_lock=0; 58 + goto end; 59 + } 60 +end: 61 +#endif 62 + return ret; 63 +} 64 +