1 #include <stdio.h> 2 #include <signal.h> 3 #include <sys/ras.h> 4 #include <sys/time.h> 5 6 #define COUNT 10 7 8 __volatile int handled = 0; 9 __volatile int count = 0; 10 struct itimerval itv; 11 12 void handler(int); 13 14 void 15 handler(int sig) 16 { 17 18 handled++; 19 } 20 21 int 22 main(void) 23 { 24 25 signal(SIGVTALRM, handler); 26 27 itv.it_interval.tv_sec = 0; 28 itv.it_interval.tv_usec = 0; 29 itv.it_value.tv_sec = 10; 30 itv.it_value.tv_usec = 0; 31 setitimer(ITIMER_VIRTUAL, &itv, NULL); 32 33 if (rasctl((caddr_t)&&start, (caddr_t)&&end - (caddr_t)&&start, 34 RAS_INSTALL) < 0) 35 return (1); 36 37 start: 38 count++; 39 if (count > COUNT) 40 goto end; 41 42 while (!handled) { 43 continue; 44 } 45 end: 46 47 return (handled != 0); 48 } 49