diff options
author | hasso <hasso> | 2004-08-28 19:04:33 +0200 |
---|---|---|
committer | hasso <hasso> | 2004-08-28 19:04:33 +0200 |
commit | e42f5a37462b22c49235f04a3b582b97c1deb84c (patch) | |
tree | 830ca9ab54224b7aac003c11b9c209472ddff860 /ospf6d | |
parent | Add start/stop scripts for the rc.d framework used by (diff) | |
download | frr-e42f5a37462b22c49235f04a3b582b97c1deb84c.tar.xz frr-e42f5a37462b22c49235f04a3b582b97c1deb84c.zip |
Port ospf6d to sigevent and rename signal handling functions in vtysh not to
conflict the ones in lib/sigevent.c. Fixes compiling with --disable-shared.
Diffstat (limited to 'ospf6d')
-rw-r--r-- | ospf6d/ChangeLog | 4 | ||||
-rw-r--r-- | ospf6d/ospf6_main.c | 70 |
2 files changed, 28 insertions, 46 deletions
diff --git a/ospf6d/ChangeLog b/ospf6d/ChangeLog index 0d5ea9af4..b9181d0d5 100644 --- a/ospf6d/ChangeLog +++ b/ospf6d/ChangeLog @@ -1,3 +1,7 @@ +2004-08-28 Hasso Tepper <hasso at quagga.net> + + * ospf6_main.c: Modify for sigevents. + 2004-08-26 Hasso Tepper <hasso@estpak.ee> * ospf6_interface.c, ospf6_top.c, ospf6d.c: for vtysh. diff --git a/ospf6d/ospf6_main.c b/ospf6d/ospf6_main.c index 2a0b2dc94..b5e640335 100644 --- a/ospf6d/ospf6_main.c +++ b/ospf6d/ospf6_main.c @@ -33,6 +33,7 @@ #include "prefix.h" #include "plist.h" #include "privs.h" +#include "sigevent.h" #include "ospf6d.h" @@ -119,14 +120,14 @@ Report bugs to zebra@zebra.org\n", progname); /* SIGHUP handler. */ void -sighup (int sig) +sighup (void) { zlog_info ("SIGHUP received"); } /* SIGINT handler. */ void -sigint (int sig) +sigint (void) { zlog_info ("SIGINT received"); exit (0); @@ -134,7 +135,7 @@ sigint (int sig) /* SIGTERM handler. */ void -sigterm (int sig) +sigterm (void) { zlog_info ("SIGTERM received"); exit (0); @@ -142,54 +143,31 @@ sigterm (int sig) /* SIGUSR1 handler. */ void -sigusr1 (int sig) +sigusr1 (void) { zlog_info ("SIGUSR1 received"); zlog_rotate (NULL); } -/* Signale wrapper. */ -RETSIGTYPE * -signal_set (int signo, void (*func)(int)) +struct quagga_signal_t ospf6_signals[] = { - int ret; - struct sigaction sig; - struct sigaction osig; - - sig.sa_handler = func; - sigemptyset (&sig.sa_mask); - sig.sa_flags = 0; -#ifdef SA_RESTART - sig.sa_flags |= SA_RESTART; -#endif /* SA_RESTART */ - - ret = sigaction (signo, &sig, &osig); - - if (ret < 0) - return (SIG_ERR); - else - return (osig.sa_handler); -} - -/* Initialization of signal handles. */ -void -signal_init () -{ - signal_set (SIGHUP, sighup); - signal_set (SIGINT, sigint); - signal_set (SIGTERM, sigterm); - signal_set (SIGPIPE, SIG_IGN); -#ifdef SIGTSTP - signal_set (SIGTSTP, SIG_IGN); -#endif -#ifdef SIGTTIN - signal_set (SIGTTIN, SIG_IGN); -#endif -#ifdef SIGTTOU - signal_set (SIGTTOU, SIG_IGN); -#endif - signal_set (SIGUSR1, sigusr1); -} + { + .signal = SIGHUP, + .handler = &sighup, + }, + { + .signal = SIGINT, + .handler = &sigint, + }, + { + .signal = SIGTERM, + .handler = &sigterm, + }, + { + .signal = SIGUSR1, + .handler = &sigusr1, + }, +}; /* Main routine of ospf6d. Treatment of argument and starting ospf finite state machine is handled here. */ @@ -275,7 +253,7 @@ main (int argc, char *argv[], char *envp[]) LOG_DAEMON); zprivs_init (&ospf6d_privs); /* initialize zebra libraries */ - signal_init (); + signal_init (master, Q_SIGC(ospf6_signals), ospf6_signals); cmd_init (1); vty_init (master); memory_init (); |