#### 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,82 +0,0 @@ 1 -/*  2 - * Copyright (C) 2010 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 :: Shared memory initialization 20 - * \ingroup core 21 - * Module: \ref core 22 - */ 23 - 24 -#include "shm_init.h" 25 -#include "mem/shm.h" 26 -#include "globals.h" 27 - 28 -static int shm_init = 0; 29 -static char *shm_mname = 0; 30 - 31 -/** 32 - * 33 - */ 34 -void shm_set_mname(char *mname) 35 -{ 36 - shm_mname = mname; 37 -} 38 - 39 -/** check if shm is initialized. 40 - * @return 1 if initialized, 0 if not 41 - */ 42 -int shm_initialized() 43 -{ 44 - return shm_init; 45 -} 46 - 47 - 48 - 49 -#ifdef SHM_MEM 50 -/** init shm mem. 51 - * @return 0 on success, < 0 on error 52 - * it _must_ be called: 53 - * - after the shm_mem_size is known 54 - * - after shm_force_alloc is known (mlock_pages should happen at a later 55 - * point so it's not yet needed here) 56 - * - after the user is known (so that in the SYSV sems case the sems will 57 - * have the correct euid) 58 - * - before init_timer and init_tcp 59 - * --andrei 60 - * 61 - * Global vars used: shm_mem_size, shm_force_alloc, user & uid. 62 - * Side effects: it might set uid, gid and shm_mem_size. 63 - */ 64 -int init_shm() 65 -{ 66 - /* set uid if user is set */ 67 - if (user && uid == 0){ 68 - if (user2uid(&uid, &gid, user)<0){ 69 - fprintf(stderr, "bad user name/uid number: -u %s\n", user); 70 - goto error; 71 - } 72 - } 73 - if (shm_init_manager(shm_mname)<0) 74 - goto error; 75 - shm_init=1; 76 - return 0; 77 -error: 78 - return -1; 79 -} 80 -#endif /* SHM_MEM */ 81 - 82 -/* vi: set ts=4 sw=4 tw=79:ai:cindent: */

#### core: share memory initialization updated for new memory management api

Daniel-Constantin Mierla authored on 14/09/2015 07:29:50
Showing 1 changed files
 ... ... @@ -22,11 +22,19 @@ 22 22  */ 23 23   24 24  #include "shm_init.h" 25 -#include "mem/mem.h" 25 +#include "mem/shm.h" 26 26  #include "globals.h" 27 27   28 28  static int shm_init = 0; 29 +static char *shm_mname = 0; 29 30   31 +/** 32 + * 33 + */ 34 +void shm_set_mname(char *mname) 35 +{ 36 + shm_mname = mname; 37 +} 30 38   31 39  /** check if shm is initialized. 32 40  * @return 1 if initialized, 0 if not ... ... @@ -62,9 +70,7 @@ int init_shm() 62 70  goto error; 63 71  } 64 72  } 65 - if (shm_mem_size == 0) 66 - shm_mem_size=SHM_MEM_SIZE * 1024 * 1024; 67 - if (init_shm_mallocs(shm_force_alloc)==-1) 73 + if (shm_init_manager(shm_mname)<0) 68 74  goto error; 69 75  shm_init=1; 70 76  return 0;

#### 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) 2010 iptelorg GmbH 5 3  * 6 4  * Permission to use, copy, modify, and distribute this software for any ... ... @@ -15,14 +13,13 @@ 15 13  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 16 14  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 17 15  */ 18 -/* 19 - * shm_init.c 16 + 17 +/*! 18 + * \file 19 + * \brief Kamailio core :: Shared memory initialization 20 + * \ingroup core 21 + * Module: \ref core 20 22  */ 21 -/* 22 - * History: 23 - * -------- 24 - * 2010-01-10 initial version (andrei) 25 -*/ 26 23   27 24  #include "shm_init.h" 28 25  #include "mem/mem.h"

#### core: moved shm init into separate files

- shm init moved from main.c into shm_init.c and shm_init.h.
 1 1 new file mode 100644 ... ... @@ -0,0 +1,79 @@ 1 +/*  2 + * $Id$ 3 + *  4 + * Copyright (C) 2010 iptelorg GmbH 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 + * shm_init.c 20 + */ 21 +/* 22 + * History: 23 + * -------- 24 + * 2010-01-10 initial version (andrei) 25 +*/ 26 + 27 +#include "shm_init.h" 28 +#include "mem/mem.h" 29 +#include "globals.h" 30 + 31 +static int shm_init = 0; 32 + 33 + 34 +/** check if shm is initialized. 35 + * @return 1 if initialized, 0 if not 36 + */ 37 +int shm_initialized() 38 +{ 39 + return shm_init; 40 +} 41 + 42 + 43 + 44 +#ifdef SHM_MEM 45 +/** init shm mem. 46 + * @return 0 on success, < 0 on error 47 + * it _must_ be called: 48 + * - after the shm_mem_size is known 49 + * - after shm_force_alloc is known (mlock_pages should happen at a later 50 + * point so it's not yet needed here) 51 + * - after the user is known (so that in the SYSV sems case the sems will 52 + * have the correct euid) 53 + * - before init_timer and init_tcp 54 + * --andrei 55 + * 56 + * Global vars used: shm_mem_size, shm_force_alloc, user & uid. 57 + * Side effects: it might set uid, gid and shm_mem_size. 58 + */ 59 +int init_shm() 60 +{ 61 + /* set uid if user is set */ 62 + if (user && uid == 0){ 63 + if (user2uid(&uid, &gid, user)<0){ 64 + fprintf(stderr, "bad user name/uid number: -u %s\n", user); 65 + goto error; 66 + } 67 + } 68 + if (shm_mem_size == 0) 69 + shm_mem_size=SHM_MEM_SIZE * 1024 * 1024; 70 + if (init_shm_mallocs(shm_force_alloc)==-1) 71 + goto error; 72 + shm_init=1; 73 + return 0; 74 +error: 75 + return -1; 76 +} 77 +#endif /* SHM_MEM */ 78 + 79 +/* vi: set ts=4 sw=4 tw=79:ai:cindent: */