Magellan Linux

Annotation of /trunk/mkinitrd-magellan/klibc/usr/klibc/alarm.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 532 - (hide annotations) (download)
Sat Sep 1 22:45:15 2007 UTC (16 years, 9 months ago) by niro
File MIME type: text/plain
File size: 409 byte(s)
-import if magellan mkinitrd; it is a fork of redhats mkinitrd-5.0.8 with all magellan patches and features; deprecates magellan-src/mkinitrd

1 niro 532 /*
2     * alarm.c
3     */
4    
5     #include <sys/time.h>
6     #include <sys/syscall.h>
7    
8     #ifndef __NR_alarm
9    
10     /* Emulate alarm() via setitimer() */
11    
12     unsigned int alarm(unsigned int seconds)
13     {
14     struct itimerval iv;
15    
16     iv.it_interval.tv_sec = iv.it_interval.tv_usec = 0;
17     iv.it_value.tv_sec = seconds;
18     iv.it_value.tv_usec = 0;
19    
20     setitimer(ITIMER_REAL, &iv, &iv);
21    
22     return iv.it_value.tv_sec + (iv.it_value.tv_usec ? 1 : 0);
23     }
24    
25     #endif