timer.c (25616) | timer.c (25630) |
---|---|
1/* 2 * PPP Timer Processing Module 3 * 4 * Written by Toshiharu OHNO (tony-o@iij.ad.jp) 5 * 6 * Copyright (C) 1993, Internet Initiative Japan, Inc. All rights reserverd. 7 * 8 * Redistribution and use in source and binary forms are permitted 9 * provided that the above copyright notice and this paragraph are 10 * duplicated in all such forms and that any documentation, 11 * advertising materials, and other materials related to such 12 * distribution and use acknowledge that the software was developed 13 * by the Internet Initiative Japan, Inc. The name of the 14 * IIJ may not be used to endorse or promote products derived 15 * from this software without specific prior written permission. 16 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR 17 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED 18 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. 19 * | 1/* 2 * PPP Timer Processing Module 3 * 4 * Written by Toshiharu OHNO (tony-o@iij.ad.jp) 5 * 6 * Copyright (C) 1993, Internet Initiative Japan, Inc. All rights reserverd. 7 * 8 * Redistribution and use in source and binary forms are permitted 9 * provided that the above copyright notice and this paragraph are 10 * duplicated in all such forms and that any documentation, 11 * advertising materials, and other materials related to such 12 * distribution and use acknowledge that the software was developed 13 * by the Internet Initiative Japan, Inc. The name of the 14 * IIJ may not be used to endorse or promote products derived 15 * from this software without specific prior written permission. 16 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR 17 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED 18 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. 19 * |
20 * $Id: timer.c,v 1.14 1997/03/13 12:45:26 brian Exp $ | 20 * $Id: timer.c,v 1.15 1997/05/09 20:48:21 brian Exp $ |
21 * 22 * TODO: 23 */ 24#include "defs.h" 25#include <sys/time.h> 26#include <signal.h> 27#include "timeout.h" 28#ifdef SIGALRM --- 240 unchanged lines hidden (view full) --- 269} 270 271void InitTimerService( void ) { 272 struct itimerval itimer; 273 274 pending_signal(SIGALRM, (void (*)(int))TimerService); 275 itimer.it_interval.tv_sec = itimer.it_value.tv_sec = 0; 276 itimer.it_interval.tv_usec = itimer.it_value.tv_usec = TICKUNIT; | 21 * 22 * TODO: 23 */ 24#include "defs.h" 25#include <sys/time.h> 26#include <signal.h> 27#include "timeout.h" 28#ifdef SIGALRM --- 240 unchanged lines hidden (view full) --- 269} 270 271void InitTimerService( void ) { 272 struct itimerval itimer; 273 274 pending_signal(SIGALRM, (void (*)(int))TimerService); 275 itimer.it_interval.tv_sec = itimer.it_value.tv_sec = 0; 276 itimer.it_interval.tv_usec = itimer.it_value.tv_usec = TICKUNIT; |
277 setitimer(ITIMER_REAL, &itimer, NULL); | 277 if (setitimer(ITIMER_REAL, &itimer, NULL) == -1) { 278 logprintf("Unable to set itimer.\n"); 279 } |
278} 279 280void TermTimerService( void ) { 281 struct itimerval itimer; 282 283 itimer.it_interval.tv_usec = itimer.it_interval.tv_sec = 0; 284 itimer.it_value.tv_usec = itimer.it_value.tv_sec = 0; | 280} 281 282void TermTimerService( void ) { 283 struct itimerval itimer; 284 285 itimer.it_interval.tv_usec = itimer.it_interval.tv_sec = 0; 286 itimer.it_value.tv_usec = itimer.it_value.tv_sec = 0; |
285 setitimer(ITIMER_REAL, &itimer, NULL); | 287 if (setitimer(ITIMER_REAL, &itimer, NULL) == -1) { 288 logprintf("Unable to set itimer.\n"); 289 } |
286 pending_signal(SIGALRM, SIG_IGN); 287} 288#endif | 290 pending_signal(SIGALRM, SIG_IGN); 291} 292#endif |