diff options
| author | Paul Buetow <paul@buetow.org> | 2010-11-21 16:20:55 +0000 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2010-11-21 16:20:55 +0000 |
| commit | 6fde6b0fe90abde84011202edd40fe46eb06af44 (patch) | |
| tree | ef760338c50b4df3ae9cca96347bca962fdbec7e /src/sign.cpp | |
| parent | 55b08bd93257d32df76efc4e8e3f49311c39ee82 (diff) | |
Diffstat (limited to 'src/sign.cpp')
| -rw-r--r-- | src/sign.cpp | 106 |
1 files changed, 21 insertions, 85 deletions
diff --git a/src/sign.cpp b/src/sign.cpp index c5bc835..a85c3fc 100644 --- a/src/sign.cpp +++ b/src/sign.cpp @@ -1,12 +1,11 @@ /*:* *: File: ./src/sign.cpp *: - *: yChat; Homepage: ychat.buetow.org; Version 0.9.0-CURRENT + *: yChat; Homepage: www.yChat.org; Version 0.8.3-CURRENT *: *: Copyright (C) 2003 Paul C. Buetow, Volker Richter *: Copyright (C) 2004 Paul C. Buetow *: Copyright (C) 2005 EXA Digital Solutions GbR - *: Copyright (C) 2006, 2007 Paul C. Buetow *: *: This program is free software; you can redistribute it and/or *: modify it under the terms of the GNU General Public License @@ -28,119 +27,56 @@ #include "sign.h" -struct event sign::ev_sigpipe; -struct event sign::ev_sigusr1; -struct event sign::ev_sigusr2; -struct event sign::ev_sighup; -struct event sign::ev_sigint; -struct event sign::ev_sigterm; -#ifdef CTCSEGV -struct event sign::ev_sigsev; -#endif - void -sign::clean_template_cache() +sign::clean_template_cache(int i_param) { wrap::HTML->clear_cache(); } //<<* void -sign::reload_dlopen_modules() +sign::reload_dlopen_modules(int i_param) { wrap::MODL->reload_modules(); } //*>> +#ifdef CTCSEGV void -sign::terminate_received() -{ - wrap::GCOL->remove_garbage(); //<< - exit(0); -} - -void -sign::handle_sigpipe(int i_fd, short event, void *p_arg) -{ - wrap::system_message(SIGNALR+string("SIGPIPE")); -} - -void -sign::handle_sigusr1(int i_fd, short event, void *p_arg) -{ - wrap::system_message(SIGNALR+string("SIGUSR1")); - clean_template_cache(); -} - -//<<* -void -sign::handle_sigusr2(int i_fd, short event, void *p_arg) -{ - wrap::system_message(SIGNALR+string("SIGUSR2")); - reload_dlopen_modules(); -} -//*>> - -void -sign::handle_sighup(int i_fd, short event, void *p_arg) -{ - wrap::system_message(SIGNALR+string("SIGHUP")); - terminate_received(); -} - -void -sign::handle_sigint(int i_fd, short event, void *p_arg) +sign::sigsev_received(int i_param) { - wrap::system_message(SIGNALR+string("SIGINT")); - terminate_received(); + wrap::system_message(SIGNSEG); } +#endif void -sign::handle_sigterm(int i_fd, short event, void *p_arg) +sign::terminate_received(int i_param) { - wrap::system_message(SIGNALR+string("SIGTERM")); - terminate_received(); -} + //<<* + wrap::GCOL->remove_garbage(); + //*>> -#ifdef CTCSEGV -void -sign::handle_sigsegv(int i_fd, short event, void *p_arg) -{ - wrap::system_message(SIGNALR+string("SIGSEGV")); + exit(0); } -#endif - void -sign::init_event_handlers() +sign::init_signal_handlers() { // Ignore SIGPIPE. otherwise the server will shut down with "Broken pipe" if // a client unexpected disconnects himself from a SOCK_STREAM. - signal_set(&ev_sigpipe, SIGPIPE, handle_sigpipe, NULL); - signal_add(&ev_sigpipe, NULL); - - signal_set(&ev_sigusr1, SIGUSR1, handle_sigusr1, NULL); - signal_add(&ev_sigusr1, NULL); - - //<<* - signal_set(&ev_sigusr2, SIGUSR2, handle_sigusr2, NULL); - signal_add(&ev_sigusr2, NULL); - //*>> - - signal_set(&ev_sighup, SIGHUP, handle_sighup, NULL); - signal_add(&ev_sighup, NULL); - - signal_set(&ev_sigint, SIGINT, handle_sigint, NULL); - signal_add(&ev_sigint, NULL); - - signal_set(&ev_sigterm, SIGTERM, handle_sigterm, NULL); - signal_add(&ev_sigterm, NULL); + signal(SIGPIPE, SIG_IGN); + signal(SIGUSR1, clean_template_cache); + signal(SIGUSR2, reload_dlopen_modules); //<< #ifdef CTCSEGV - signal_set(&ev_sigsev, SIGSEGV, handle_sigsev, NULL); + signal(SIGSEGV, sigsev_received); #endif + signal(SIGHUP, terminate_received); + signal(SIGINT, terminate_received); + signal(SIGTERM, terminate_received); + //signal(SIGWINCH, ); } #endif |
