Changeset 781897bd0a05bbae82234e01395da26f6542a4ae

Show
Ignore:
Timestamp:
05/15/09 12:34:27 (6 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
  • src/noitd.c

    r88a7178 r781897b  
    176176    else { 
    177177      int sig = -1, exit_val = -1; 
     178      signal(SIGHUP, SIG_IGN); 
    178179      while(1) { 
    179180        unsigned long ltt; 
     
    212213} 
    213214 
     215static int __reload_needed = 0; 
     216static void request_conf_reload(int sig) { 
     217  if(sig == SIGHUP) { 
     218    __reload_needed = 1; 
     219  } 
     220} 
    214221static int watchdog_tick(eventer_t e, int mask, void *unused, struct timeval *now) { 
    215222  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  } 
    216231  return 0; 
    217232} 
     
    225240    exit(-1); 
    226241  } 
     242 
     243  signal(SIGHUP, request_conf_reload); 
    227244 
    228245  /* initialize the eventer */