diff options
author | Nick Mathewson <nickm@torproject.org> | 2005-01-05 06:40:47 +0000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2005-01-05 06:40:47 +0000 |
commit | dcd228585db1224d9af9b37beffe5b36cb8bff74 (patch) | |
tree | 9cc0b16b0447ef2548cb3d593500b50ae872664f /src/or/main.c | |
parent | b4fedc7f14dd805d148dece8b9b6759081004fa9 (diff) | |
download | tor-dcd228585db1224d9af9b37beffe5b36cb8bff74.tar tor-dcd228585db1224d9af9b37beffe5b36cb8bff74.tar.gz |
Implement SIGNAL control command.
svn:r3307
Diffstat (limited to 'src/or/main.c')
-rw-r--r-- | src/or/main.c | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/src/or/main.c b/src/or/main.c index b65bc3a53..43c0ebaf5 100644 --- a/src/or/main.c +++ b/src/or/main.c @@ -922,6 +922,41 @@ static int do_main_loop(void) { } } +/** Used to implement the SIGNAL control command: if we accept + * <b>the_signal</b> as a remote pseudo-signal, then act on it and + * return 0. Else return -1. */ +/* We don't re-use catch() here because: + * 1. We handle a different set of signals than those allowed in catch. + * 2. Platforms without signal() are unlikely to define SIGfoo. + * 3. The control spec is defined to use fixed numeric signal values + * which just happen to match the unix values. + */ +int +control_signal_act(int the_signal) +{ + switch(the_signal) + { + case 1: + please_reset = 1; + break; + case 2: + please_shutdown = 1; + break; + case 10: + please_dumpstats = 1; + break; + case 12: + please_debug = 1; + break; + case 15: + please_die = 1; + break; + default: + return -1; + } + return 0; +} + /** Unix signal handler. */ static void catch(int the_signal) { |