Changeset 240:42e971738a37 in freeDiameter
- Timestamp:
- Mar 8, 2010, 5:34:42 PM (14 years ago)
- Branch:
- default
- Phase:
- public
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/dbg_monitor/dbg_monitor.c
r202 r240 50 50 EXTENSION_ENTRY("dbg_monitor", monitor_main); 51 51 52 /* Function called on receipt of SIGUSR1 */53 static void got_sig(int signal)54 {55 fd_log_debug("[dbg_monitor] Dumping extra information\n");56 CHECK_FCT_DO(fd_event_send(fd_g_config->cnf_main_ev, FDEV_DUMP_DICT, 0, NULL), /* continue */);57 CHECK_FCT_DO(fd_event_send(fd_g_config->cnf_main_ev, FDEV_DUMP_CONFIG, 0, NULL), /* continue */);58 CHECK_FCT_DO(fd_event_send(fd_g_config->cnf_main_ev, FDEV_DUMP_EXT, 0, NULL), /* continue */);59 }60 52 /* Thread to display periodical debug information */ 61 53 static pthread_t thr; 62 54 static void * mn_thr(void * arg) 63 55 { 64 sigset_t sig;65 56 int i = 0; 66 struct sigaction act;67 57 fd_log_threadname("Monitor thread"); 68 69 /* Catch signal SIGUSR1 */70 memset(&act, 0, sizeof(act));71 act.sa_handler = got_sig;72 CHECK_SYS_DO( sigaction(MONITOR_SIGNAL, &act, NULL), /* conitnue */ );73 sigemptyset(&sig);74 sigaddset(&sig, MONITOR_SIGNAL);75 CHECK_POSIX_DO( pthread_sigmask(SIG_UNBLOCK, &sig, NULL), /* conitnue */ );76 58 77 59 /* Loop */ … … 95 77 } 96 78 79 /* Function called on receipt of MONITOR_SIGNAL */ 80 static void got_sig(int signal) 81 { 82 fd_log_debug("[dbg_monitor] Dumping extra information\n"); 83 CHECK_FCT_DO(fd_event_send(fd_g_config->cnf_main_ev, FDEV_DUMP_DICT, 0, NULL), /* continue */); 84 CHECK_FCT_DO(fd_event_send(fd_g_config->cnf_main_ev, FDEV_DUMP_CONFIG, 0, NULL), /* continue */); 85 CHECK_FCT_DO(fd_event_send(fd_g_config->cnf_main_ev, FDEV_DUMP_EXT, 0, NULL), /* continue */); 86 } 87 88 /* Entry point */ 97 89 static int monitor_main(char * conffile) 98 90 { 99 91 TRACE_ENTRY("%p", conffile); 92 93 /* Catch signal SIGUSR1 */ 94 CHECK_FCT( fd_sig_register(MONITOR_SIGNAL, "dbg_monitor", got_sig)); 95 100 96 CHECK_POSIX( pthread_create( &thr, NULL, mn_thr, NULL ) ); 101 97 return 0; 102 98 } 103 99 100 /* Cleanup */ 104 101 void fd_ext_fini(void) 105 102 {
Note: See TracChangeset
for help on using the changeset viewer.