Magellan Linux

Contents of /trunk/mkinitrd-magellan/klibc/usr/include/sys/time.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 532 - (show annotations) (download)
Sat Sep 1 22:45:15 2007 UTC (16 years, 8 months ago) by niro
File MIME type: text/plain
File size: 1568 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 /*
2 * sys/time.h
3 */
4
5 #ifndef _SYS_TIME_H
6 #define _SYS_TIME_H
7
8 #include <klibc/extern.h>
9 #include <stddef.h>
10 #include <sys/types.h>
11 #include <linux/time.h>
12
13 /* The 2.6.20 Linux headers always #define FD_ZERO __FD_ZERO, etc, in
14 <linux/time.h> but not all architectures define the
15 double-underscore ones, except __NFDBITS, __FD_SETSIZE and
16 __FDSET_LONGS which are defined in <linux/posix_types.h>.
17
18 Unfortunately, some architectures define the double-underscore ones
19 as inlines, so we can't use a simple #ifdef test. Thus, the only
20 safe option remaining is to #undef the top-level macros. */
21
22 #undef FD_ZERO
23 #undef FD_SET
24 #undef FD_CLR
25 #undef FD_ISSET
26
27 __extern void *memset(void *, int, size_t);
28 static inline void FD_ZERO(fd_set *__fdsetp)
29 {
30 memset(__fdsetp, 0, sizeof(fd_set));
31 }
32 static inline void FD_SET(int __fd, fd_set *__fdsetp)
33 {
34 __fdsetp->fds_bits[__fd/BITS_PER_LONG] |=
35 (1UL << (__fd % BITS_PER_LONG));
36 }
37 static inline void FD_CLR(int __fd, fd_set *__fdsetp)
38 {
39 __fdsetp->fds_bits[__fd/BITS_PER_LONG] &=
40 ~(1UL << (__fd % BITS_PER_LONG));
41 }
42 static inline int FD_ISSET(int __fd, fd_set *__fdsetp)
43 {
44 return (__fdsetp->fds_bits[__fd/BITS_PER_LONG] >>
45 (__fd % BITS_PER_LONG)) & 1;
46 }
47
48 __extern int gettimeofday(struct timeval *, struct timezone *);
49 __extern int settimeofday(const struct timeval *, const struct timezone *);
50 __extern int getitimer(int, struct itimerval *);
51 __extern int setitimer(int, const struct itimerval *, struct itimerval *);
52 __extern int utimes(const char *, const struct timeval *);
53
54 #endif /* _SYS_TIME_H */