globals.c

Go to the documentation of this file.
00001 
00057 #include "globals.h"
00058 #include "utils.h"
00059 
00060 #ifdef CDP_FOR_SER
00061 
00062 #else
00063     unsigned long shm_mem_size = SHM_MEM_SIZE;
00064     int memlog = L_ERR;
00065     int memdbg = L_MEM;
00066     int debug = L_MEM;
00067     int log_facility = 1;
00068     int log_stderr = 1;
00069     int process_no=0;
00070 #endif
00071 
00072 
00073 
00074 //str aaa_fqdn={"unset_fqdn",10};
00075 //str aaa_realm={"unset_realm",11};
00076 //str aaa_identity={"unset_identity",14};
00077 
00079 int init_memory(int show_status)
00080 {
00081 #ifdef PKG_MALLOC
00082     if (init_pkg_mallocs()==-1)
00083         goto error;
00084     if (show_status){
00085         LOG(memlog, "Memory status (pkg):\n");
00086         pkg_status();
00087     }
00088 #endif
00089 
00090 #ifdef SHM_MEM
00091     if (init_shm_mallocs()==-1)
00092         goto error;
00093     if (show_status){
00094         LOG(memlog, "Memory status (shm):\n");
00095         shm_status();
00096     }
00097 #endif
00098     return 1;
00099 error:
00100     return 0;
00101 }   
00102 
00104 void destroy_memory(int show_status)
00105 {
00106     /*clean-up*/
00107     if (mem_lock)
00108         shm_unlock(); /* hack: force-unlock the shared memory lock in case
00109                                  some process crashed and let it locked; this will
00110                                  allow an almost gracious shutdown */
00111 #ifdef SHM_MEM
00112     if (show_status){
00113         LOG(memlog, "Memory status (shm):\n");
00114         //shm_status();
00115         shm_sums();
00116     }
00117     /* zero all shmem alloc vars that we still use */
00118     shm_mem_destroy();
00119 #endif
00120 #ifdef PKG_MALLOC
00121     if (show_status){
00122         LOG(memlog, "Memory status (pkg):\n");
00123         //pkg_status();
00124         pkg_sums();
00125     }
00126 #endif
00127 }
00128 
00129 

Generated on Sat Sep 6 04:17:47 2008 for Open IMS Core CSCFs by  doxygen 1.5.2