This source file includes following definitions.
- __FD_SET
- __FD_CLR
- __FD_ISSET
- __FD_ZERO
1 #ifndef _PPC_TYPES_H
2 #define _PPC_TYPES_H
3
4 #ifndef _SIZE_T
5 #define _SIZE_T
6 typedef unsigned int size_t;
7 #endif
8
9 #ifndef _SSIZE_T
10 #define _SSIZE_T
11 typedef int ssize_t;
12 #endif
13
14 #ifndef _PTRDIFF_T
15 #define _PTRDIFF_T
16 typedef int ptrdiff_t;
17 #endif
18
19 #ifndef _TIME_T
20 #define _TIME_T
21 typedef long time_t;
22 #endif
23
24 #ifndef _CLOCK_T
25 #define _CLOCK_T
26 typedef long clock_t;
27 #endif
28
29 typedef int pid_t;
30 typedef unsigned int uid_t;
31 typedef unsigned int gid_t;
32 typedef unsigned int dev_t;
33 typedef unsigned int ino_t;
34 typedef unsigned int mode_t;
35 typedef unsigned int umode_t;
36 typedef unsigned short nlink_t;
37 typedef int daddr_t;
38 typedef long off_t;
39
40
41
42
43
44
45 typedef __signed__ char __s8;
46 typedef unsigned char __u8;
47
48 typedef __signed__ short __s16;
49 typedef unsigned short __u16;
50
51 typedef __signed__ long __s32;
52 typedef unsigned long __u32;
53
54 #if defined(__GNUC__) && !defined(__STRICT_ANSI__)
55 typedef __signed__ long long __s64;
56 typedef unsigned long long __u64;
57 #endif
58
59
60
61
62 #ifdef __KERNEL__
63
64 typedef signed char s8;
65 typedef unsigned char u8;
66
67 typedef signed short s16;
68 typedef unsigned short u16;
69
70 typedef signed long s32;
71 typedef unsigned long u32;
72
73 typedef signed long long s64;
74 typedef unsigned long long u64;
75
76 #endif
77
78 #undef __FD_SET
79 static __inline__ void __FD_SET(unsigned long fd, fd_set *fdsetp)
80 {
81 unsigned long _tmp = fd / __NFDBITS;
82 unsigned long _rem = fd % __NFDBITS;
83 fdsetp->fds_bits[_tmp] |= (1UL<<_rem);
84 }
85
86 #undef __FD_CLR
87 static __inline__ void __FD_CLR(unsigned long fd, fd_set *fdsetp)
88 {
89 unsigned long _tmp = fd / __NFDBITS;
90 unsigned long _rem = fd % __NFDBITS;
91 fdsetp->fds_bits[_tmp] &= ~(1UL<<_rem);
92 }
93
94 #undef __FD_ISSET
95 static __inline__ int __FD_ISSET(unsigned long fd, fd_set *p)
96 {
97 unsigned long _tmp = fd / __NFDBITS;
98 unsigned long _rem = fd % __NFDBITS;
99 return (p->fds_bits[_tmp] & (1UL<<_rem)) != 0;
100 }
101
102
103
104
105
106 #undef __FD_ZERO
107 static __inline__ void __FD_ZERO(fd_set *p)
108 {
109 unsigned int *tmp = p->fds_bits;
110 int i;
111
112 if (__builtin_constant_p(__FDSET_INTS)) {
113 switch (__FDSET_INTS) {
114 case 8:
115 tmp[0] = 0; tmp[1] = 0; tmp[2] = 0; tmp[3] = 0;
116 tmp[4] = 0; tmp[5] = 0; tmp[6] = 0; tmp[7] = 0;
117 return;
118 }
119 }
120 i = __FDSET_INTS;
121 while (i) {
122 i--;
123 *tmp = 0;
124 tmp++;
125 }
126 }
127
128 #endif