Changeset 781897bd0a05bbae82234e01395da26f6542a4ae
- Timestamp:
- 05/15/09 12:34:27
(4 years ago)
- Author:
- Theo Schlossnagle <jesus@omniti.com>
- git-committer:
- Theo Schlossnagle <jesus@omniti.com> 1242390867 +0000
- git-parent:
[ea6ba4161f18ddc6b87d887e6bda5c05ae18ceef]
- git-author:
- Theo Schlossnagle <jesus@omniti.com> 1242390867 +0000
- Message:
Make SIGHUP perform reload, fixes #124
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| r88a7178 |
r781897b |
|
| 176 | 176 | else { |
|---|
| 177 | 177 | int sig = -1, exit_val = -1; |
|---|
| | 178 | signal(SIGHUP, SIG_IGN); |
|---|
| 178 | 179 | while(1) { |
|---|
| 179 | 180 | unsigned long ltt; |
|---|
| … | … | |
| 212 | 213 | } |
|---|
| 213 | 214 | |
|---|
| | 215 | static int __reload_needed = 0; |
|---|
| | 216 | static void request_conf_reload(int sig) { |
|---|
| | 217 | if(sig == SIGHUP) { |
|---|
| | 218 | __reload_needed = 1; |
|---|
| | 219 | } |
|---|
| | 220 | } |
|---|
| 214 | 221 | static int watchdog_tick(eventer_t e, int mask, void *unused, struct timeval *now) { |
|---|
| 215 | 222 | it_ticks(); |
|---|
| | 223 | if(__reload_needed) { |
|---|
| | 224 | noitL(noit_error, "SIGHUP received, performing reload\n"); |
|---|
| | 225 | if(noit_conf_load(config_file) == -1) { |
|---|
| | 226 | noitL(noit_error, "Cannot load config: '%s'\n", config_file); |
|---|
| | 227 | exit(-1); |
|---|
| | 228 | } |
|---|
| | 229 | __reload_needed = 0; |
|---|
| | 230 | } |
|---|
| 216 | 231 | return 0; |
|---|
| 217 | 232 | } |
|---|
| … | … | |
| 225 | 240 | exit(-1); |
|---|
| 226 | 241 | } |
|---|
| | 242 | |
|---|
| | 243 | signal(SIGHUP, request_conf_reload); |
|---|
| 227 | 244 | |
|---|
| 228 | 245 | /* initialize the eventer */ |
|---|