| 
            Last change
 on this file since 153 was             149, checked in by katerina, 18 years ago           | 
        
        
          | 
             
Make sh_hash.c thread-safe, remove plenty of tiny allocations, improve sh_mem_dump, modify port check to run as thread, and fix unsetting of sh_thread_pause_flag (was too early). 
 
           | 
        
        
          | 
            File size:
            2.2 KB
           | 
        
      
      
| Line |   | 
|---|
| 1 | #include "config_xor.h"
 | 
|---|
| 2 | 
 | 
|---|
| 3 | #include <stdio.h>
 | 
|---|
| 4 | #include <time.h>
 | 
|---|
| 5 | 
 | 
|---|
| 6 | #if defined (SH_WITH_CLIENT) || defined (SH_STANDALONE) 
 | 
|---|
| 7 | 
 | 
|---|
| 8 | #include "sh_modules.h"
 | 
|---|
| 9 | #include "sh_pthread.h"
 | 
|---|
| 10 | 
 | 
|---|
| 11 | #include "sh_utmp.h"
 | 
|---|
| 12 | #include "sh_mounts.h"
 | 
|---|
| 13 | #include "sh_userfiles.h"
 | 
|---|
| 14 | #include "sh_kern.h"
 | 
|---|
| 15 | #include "sh_suidchk.h"
 | 
|---|
| 16 | #include "sh_processcheck.h"
 | 
|---|
| 17 | #include "sh_portcheck.h"
 | 
|---|
| 18 | 
 | 
|---|
| 19 | sh_mtype modList[] = {
 | 
|---|
| 20 | #ifdef SH_USE_UTMP
 | 
|---|
| 21 |   {
 | 
|---|
| 22 |     N_("UTMP"),
 | 
|---|
| 23 |     -1,
 | 
|---|
| 24 |     sh_utmp_init,
 | 
|---|
| 25 |     sh_utmp_timer,
 | 
|---|
| 26 |     sh_utmp_check,
 | 
|---|
| 27 |     sh_utmp_end,
 | 
|---|
| 28 |     sh_utmp_reconf,
 | 
|---|
| 29 | 
 | 
|---|
| 30 |     N_("[Utmp]"),
 | 
|---|
| 31 |     sh_utmp_table,
 | 
|---|
| 32 |     PTHREAD_MUTEX_INITIALIZER,
 | 
|---|
| 33 |   },
 | 
|---|
| 34 | #endif
 | 
|---|
| 35 | 
 | 
|---|
| 36 | #ifdef SH_USE_MOUNTS
 | 
|---|
| 37 |   {
 | 
|---|
| 38 |     N_("MOUNTS"),
 | 
|---|
| 39 |     -1,
 | 
|---|
| 40 |     sh_mounts_init,
 | 
|---|
| 41 |     sh_mounts_timer,
 | 
|---|
| 42 |     sh_mounts_check,
 | 
|---|
| 43 |     sh_mounts_cleanup,
 | 
|---|
| 44 |     sh_mounts_reconf,
 | 
|---|
| 45 | 
 | 
|---|
| 46 |     N_("[Mounts]"),
 | 
|---|
| 47 |     sh_mounts_table,
 | 
|---|
| 48 |     PTHREAD_MUTEX_INITIALIZER,
 | 
|---|
| 49 |   },
 | 
|---|
| 50 | #endif
 | 
|---|
| 51 | 
 | 
|---|
| 52 | #ifdef SH_USE_USERFILES
 | 
|---|
| 53 |   {
 | 
|---|
| 54 |     N_("USERFILES"),
 | 
|---|
| 55 |     -1,
 | 
|---|
| 56 |     sh_userfiles_init,
 | 
|---|
| 57 |     sh_userfiles_timer,
 | 
|---|
| 58 |     sh_userfiles_check,
 | 
|---|
| 59 |     sh_userfiles_cleanup,
 | 
|---|
| 60 |     sh_userfiles_reconf,
 | 
|---|
| 61 | 
 | 
|---|
| 62 |     N_("[UserFiles]"),
 | 
|---|
| 63 |     sh_userfiles_table,
 | 
|---|
| 64 |     PTHREAD_MUTEX_INITIALIZER,
 | 
|---|
| 65 |   },
 | 
|---|
| 66 | #endif
 | 
|---|
| 67 | 
 | 
|---|
| 68 | #ifdef SH_USE_KERN
 | 
|---|
| 69 |   {
 | 
|---|
| 70 |     N_("KERNEL"),
 | 
|---|
| 71 |     -1,
 | 
|---|
| 72 |     sh_kern_init,
 | 
|---|
| 73 |     sh_kern_timer,
 | 
|---|
| 74 |     sh_kern_check,
 | 
|---|
| 75 |     sh_kern_end,
 | 
|---|
| 76 |     sh_kern_null,
 | 
|---|
| 77 | 
 | 
|---|
| 78 |     N_("[Kernel]"),
 | 
|---|
| 79 |     sh_kern_table,
 | 
|---|
| 80 |     PTHREAD_MUTEX_INITIALIZER,
 | 
|---|
| 81 |   },
 | 
|---|
| 82 | #endif
 | 
|---|
| 83 | 
 | 
|---|
| 84 | #ifdef SH_USE_SUIDCHK
 | 
|---|
| 85 |   {
 | 
|---|
| 86 |     N_("SUIDCHECK"),
 | 
|---|
| 87 |     -1,
 | 
|---|
| 88 |     sh_suidchk_init,
 | 
|---|
| 89 |     sh_suidchk_timer,
 | 
|---|
| 90 |     sh_suidchk_check,
 | 
|---|
| 91 |     sh_suidchk_end,
 | 
|---|
| 92 |     sh_suidchk_reconf,
 | 
|---|
| 93 | 
 | 
|---|
| 94 |     N_("[SuidCheck]"),
 | 
|---|
| 95 |     sh_suidchk_table,
 | 
|---|
| 96 |     PTHREAD_MUTEX_INITIALIZER,
 | 
|---|
| 97 |   },
 | 
|---|
| 98 | #endif
 | 
|---|
| 99 | 
 | 
|---|
| 100 | #ifdef SH_USE_PROCESSCHECK
 | 
|---|
| 101 |   {
 | 
|---|
| 102 |     N_("PROCESSCHECK"),
 | 
|---|
| 103 |     -1,
 | 
|---|
| 104 |     sh_prochk_init,
 | 
|---|
| 105 |     sh_prochk_timer,
 | 
|---|
| 106 |     sh_prochk_check,
 | 
|---|
| 107 |     sh_prochk_cleanup,
 | 
|---|
| 108 |     sh_prochk_reconf,
 | 
|---|
| 109 | 
 | 
|---|
| 110 |     N_("[ProcessCheck]"),
 | 
|---|
| 111 |     sh_prochk_table,
 | 
|---|
| 112 |     PTHREAD_MUTEX_INITIALIZER,
 | 
|---|
| 113 |   },
 | 
|---|
| 114 | #endif
 | 
|---|
| 115 | 
 | 
|---|
| 116 | #ifdef SH_USE_PORTCHECK
 | 
|---|
| 117 |   {
 | 
|---|
| 118 |     N_("PORTCHECK"),
 | 
|---|
| 119 |     -1,
 | 
|---|
| 120 |     sh_portchk_init,
 | 
|---|
| 121 |     sh_portchk_timer,
 | 
|---|
| 122 |     sh_portchk_check,
 | 
|---|
| 123 |     sh_portchk_cleanup,
 | 
|---|
| 124 |     sh_portchk_reconf,
 | 
|---|
| 125 | 
 | 
|---|
| 126 |     N_("[PortCheck]"),
 | 
|---|
| 127 |     sh_portchk_table,
 | 
|---|
| 128 |     PTHREAD_MUTEX_INITIALIZER,
 | 
|---|
| 129 |   },
 | 
|---|
| 130 | #endif
 | 
|---|
| 131 | 
 | 
|---|
| 132 |   {
 | 
|---|
| 133 |     NULL,
 | 
|---|
| 134 |     -1,
 | 
|---|
| 135 | 
 | 
|---|
| 136 |     NULL,
 | 
|---|
| 137 |     NULL,
 | 
|---|
| 138 |     NULL,
 | 
|---|
| 139 |     NULL,
 | 
|---|
| 140 |     NULL,
 | 
|---|
| 141 | 
 | 
|---|
| 142 |     NULL,
 | 
|---|
| 143 |     NULL,
 | 
|---|
| 144 |     PTHREAD_MUTEX_INITIALIZER,
 | 
|---|
| 145 |   },
 | 
|---|
| 146 | };
 | 
|---|
| 147 | 
 | 
|---|
| 148 | #endif
 | 
|---|
| 149 | 
 | 
|---|
       
      
  Note:
 See   
TracBrowser
 for help on using the repository browser.