diff options
Diffstat (limited to 'usr.sbin/ppp/timer.c')
-rw-r--r-- | usr.sbin/ppp/timer.c | 29 |
1 files changed, 3 insertions, 26 deletions
diff --git a/usr.sbin/ppp/timer.c b/usr.sbin/ppp/timer.c index b9f0acf..66d7141 100644 --- a/usr.sbin/ppp/timer.c +++ b/usr.sbin/ppp/timer.c @@ -25,6 +25,7 @@ #include <sys/time.h> #include <signal.h> #include "timeout.h" +#include "sig.h" #ifdef SIGALRM #include <errno.h> #endif @@ -138,24 +139,6 @@ struct pppTimer *tp; tp->state = TIMER_STOPPED; } -/* - This is used to decide at the top level if it's time for a TimerService() - call. This'll work fine as long as select() is interrupted by the - SIGALRM. -*/ -int TimerServiceRequest = 0; - -void -SetTimerServiceRequest( int Sig ) -{ - /* Maybe a bit cautious.... */ - if( TimerServiceRequest >= 0 ) - TimerServiceRequest++; -#ifdef DEBUG - logprintf( "Setting TimerServiceRequest\n" ); -#endif -} - void TimerService() { @@ -287,13 +270,7 @@ void usleep( u_int usec) void InitTimerService( void ) { struct itimerval itimer; - /* - Let's not do this - it's a bit dangerous (potential recursion into the - likes of malloc() etc. - - signal(SIGALRM, (void (*)(int))TimerService); - */ - signal(SIGALRM, SetTimerServiceRequest); + pending_signal(SIGALRM, (void (*)(int))TimerService); itimer.it_interval.tv_sec = itimer.it_value.tv_sec = 0; itimer.it_interval.tv_usec = itimer.it_value.tv_usec = TICKUNIT; setitimer(ITIMER_REAL, &itimer, NULL); @@ -309,6 +286,6 @@ void TermTimerService( void ) { * Notes: after disabling timer here, we will get one * SIGALRM will be got. */ - signal(SIGALRM, SIG_IGN); + pending_signal(SIGALRM, SIG_IGN); } #endif |