Changeset 496
- Timestamp:
- Dec 7, 2015, 7:04:28 PM (9 years ago)
- Location:
- trunk
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/sh_inotify.h
r481 r496 45 45 void sh_inotify_remove(sh_watches * watches); 46 46 void sh_inotify_init(sh_watches * watches); 47 void sh_inotify_close(); 47 48 48 49 char * sh_inotify_search_item(sh_watches * watches, int watch, -
trunk/include/sh_modules.h
r259 r496 7 7 enum 8 8 { 9 SH_MODFL_NOTIMER = (1 << 0) 9 SH_MODFL_NOTIMER = (1 << 0), 10 SH_MODFL_NEEDPAUSED = (1 << 1), 11 SH_MODFL_ISPAUSED = (1 << 2) 10 12 }; 11 13 -
trunk/src/samhain.c
r489 r496 1250 1250 1251 1251 sh_thread_pause_flag = S_TRUE; 1252 1253 for (modnum = 0; modList[modnum].name != NULL; ++modnum) 1254 { 1255 if (0 != (SH_MODFL_NEEDPAUSED & modList[modnum].flags) && 1256 modList[modnum].initval == SH_MOD_THREAD) 1257 { 1258 int count = 50; 1259 while (count && 0 == (SH_MODFL_ISPAUSED & modList[modnum].flags)) 1260 retry_msleep(0, 100), --count; 1261 } 1262 } 1252 1263 1253 1264 #if defined(WITH_EXTERNAL) -
trunk/src/sh_fInotify.c
r488 r496 52 52 53 53 static int ShfInotifyActive = S_FALSE; 54 static int ShfInotifyClose = S_FALSE; /* for reconf, mark instance for closing */ 54 55 55 56 static unsigned long ShfInotifyWatches = 0; … … 154 155 { 155 156 /* Reconfigure from main thread */ 156 /* sh_fInotify_init_internal(); */ 157 157 158 SH_INOTIFY_IFUSED( sh.flag.inotify |= SH_INOTIFY_DOSCAN; ); 158 159 SH_INOTIFY_IFUSED( sh.flag.inotify |= SH_INOTIFY_NEEDINIT; ); … … 175 176 { 176 177 return SH_MOD_FAILED; 178 } 179 180 if (ShfInotifyClose == S_TRUE) 181 { 182 ShfInotifyClose = S_FALSE; 183 sh_inotify_close(); 177 184 } 178 185 … … 261 268 } 262 269 270 /* This runs in the main thread, so it won't close 271 * the (threadspecific) inotify instance. 272 */ 263 273 int sh_fInotify_reconf() 264 274 { … … 267 277 ShfInotifyWatches = 0; 268 278 ShfInotifyActive = 0; 279 280 ShfInotifyClose = S_TRUE; 269 281 270 282 return sh_fInotify_cleanup(); -
trunk/src/sh_inotify.c
r481 r496 427 427 } 428 428 429 429 void sh_inotify_close() 430 { 431 int ifd = sh_inotify_getfd(); 432 433 if (ifd >= 0) 434 close(ifd); 435 sh_set_inotify_fd(-1); 436 437 return; 438 } 439 440 430 441 /* This function removes all watches from the list, 431 442 * and closes the inode file descriptor in this thread. … … 433 444 void sh_inotify_remove(sh_watches * watches) 434 445 { 435 int ifd = sh_inotify_getfd();436 446 zAVLTree * all_watches; 437 447 … … 446 456 SH_MUTEX_UNLOCK(mutex_watches); 447 457 448 if (ifd >= 0) 449 close(ifd); 450 sh_set_inotify_fd(-1); 451 458 sh_inotify_close(); 452 459 return; 453 460 } -
trunk/src/sh_modules.c
r481 r496 160 160 N_("INOTIFY"), 161 161 -1, 162 0,162 SH_MODFL_NEEDPAUSED, 163 163 sh_fInotify_init, 164 164 sh_fInotify_timer, -
trunk/src/sh_pthread.c
r408 r496 184 184 while (1) 185 185 { 186 if (sh_thread_pause_flag != S_TRUE && 187 0 != this_module->mod_timer(time(NULL))) 186 if (sh_thread_pause_flag != S_TRUE) 188 187 { 189 /* If module has been de-activated on reconfigure, 190 * mod_check() must return non-zero. 191 * The mod_cleanup() routine must then enable the 192 * module to be re-activated eventually. 193 */ 194 if (0 != this_module->mod_check()) 195 break; 196 pthread_testcancel(); 188 this_module->flags &= ~SH_MODFL_ISPAUSED; 189 190 if (0 != this_module->mod_timer(time(NULL))) 191 { 192 /* If module has been de-activated on reconfigure, 193 * mod_check() must return non-zero. 194 * The mod_cleanup() routine must then enable the 195 * module to be re-activated eventually. 196 */ 197 if (0 != this_module->mod_check()) 198 break; 199 pthread_testcancel(); 200 } 197 201 } 198 if (0 == (SH_MODFL_NOTIMER & this_module->flags)) 202 else 203 { 204 this_module->flags |= SH_MODFL_ISPAUSED; 205 } 206 if (0 == (SH_MODFL_NOTIMER & this_module->flags) || 207 sh_thread_pause_flag == S_TRUE) 199 208 retry_msleep(1,0); 200 209 }
Note:
See TracChangeset
for help on using the changeset viewer.