1 #ifndef __ASM_GENERIC_POSIX_TYPES_H
2 #define __ASM_GENERIC_POSIX_TYPES_H
4 #include <asm/bitsperlong.h>
6 * This file is generally used by user-level software, so you need to
7 * be a little careful about namespace pollution etc.
9 * First the types that are often defined in different ways across
10 * architectures, so that you can override them.
13 #ifndef __kernel_ino_t
14 typedef unsigned long __kernel_ino_t
;
17 #ifndef __kernel_mode_t
18 typedef unsigned int __kernel_mode_t
;
21 #ifndef __kernel_nlink_t
22 typedef unsigned long __kernel_nlink_t
;
25 #ifndef __kernel_pid_t
26 typedef int __kernel_pid_t
;
29 #ifndef __kernel_ipc_pid_t
30 typedef int __kernel_ipc_pid_t
;
33 #ifndef __kernel_uid_t
34 typedef unsigned int __kernel_uid_t
;
35 typedef unsigned int __kernel_gid_t
;
38 #ifndef __kernel_suseconds_t
39 typedef long __kernel_suseconds_t
;
42 #ifndef __kernel_daddr_t
43 typedef int __kernel_daddr_t
;
46 #ifndef __kernel_uid32_t
47 typedef __kernel_uid_t __kernel_uid32_t
;
48 typedef __kernel_gid_t __kernel_gid32_t
;
51 #ifndef __kernel_old_uid_t
52 typedef __kernel_uid_t __kernel_old_uid_t
;
53 typedef __kernel_gid_t __kernel_old_gid_t
;
56 #ifndef __kernel_old_dev_t
57 typedef unsigned int __kernel_old_dev_t
;
61 * Most 32 bit architectures use "unsigned int" size_t,
62 * and all 64 bit architectures use "unsigned long" size_t.
64 #ifndef __kernel_size_t
65 #if __BITS_PER_LONG != 64
66 typedef unsigned int __kernel_size_t
;
67 typedef int __kernel_ssize_t
;
68 typedef int __kernel_ptrdiff_t
;
70 typedef unsigned long __kernel_size_t
;
71 typedef long __kernel_ssize_t
;
72 typedef long __kernel_ptrdiff_t
;
77 * anything below here should be completely generic
79 typedef long __kernel_off_t
;
80 typedef long long __kernel_loff_t
;
81 typedef long __kernel_time_t
;
82 typedef long __kernel_clock_t
;
83 typedef int __kernel_timer_t
;
84 typedef int __kernel_clockid_t
;
85 typedef char * __kernel_caddr_t
;
86 typedef unsigned short __kernel_uid16_t
;
87 typedef unsigned short __kernel_gid16_t
;
96 static inline void __FD_SET(unsigned long __fd
, __kernel_fd_set
*__fdsetp
)
98 unsigned long __tmp
= __fd
/ __NFDBITS
;
99 unsigned long __rem
= __fd
% __NFDBITS
;
100 __fdsetp
->fds_bits
[__tmp
] |= (1UL<<__rem
);
104 static inline void __FD_CLR(unsigned long __fd
, __kernel_fd_set
*__fdsetp
)
106 unsigned long __tmp
= __fd
/ __NFDBITS
;
107 unsigned long __rem
= __fd
% __NFDBITS
;
108 __fdsetp
->fds_bits
[__tmp
] &= ~(1UL<<__rem
);
112 static inline int __FD_ISSET(unsigned long __fd
, const __kernel_fd_set
*__p
)
114 unsigned long __tmp
= __fd
/ __NFDBITS
;
115 unsigned long __rem
= __fd
% __NFDBITS
;
116 return (__p
->fds_bits
[__tmp
] & (1UL<<__rem
)) != 0;
120 * This will unroll the loop for the normal constant case (8 ints,
121 * for a 256-bit fd_set)
124 static inline void __FD_ZERO(__kernel_fd_set
*__p
)
126 unsigned long *__tmp
= __p
->fds_bits
;
129 if (__builtin_constant_p(__FDSET_LONGS
)) {
130 switch (__FDSET_LONGS
) {
132 __tmp
[ 0] = 0; __tmp
[ 1] = 0;
133 __tmp
[ 2] = 0; __tmp
[ 3] = 0;
134 __tmp
[ 4] = 0; __tmp
[ 5] = 0;
135 __tmp
[ 6] = 0; __tmp
[ 7] = 0;
136 __tmp
[ 8] = 0; __tmp
[ 9] = 0;
137 __tmp
[10] = 0; __tmp
[11] = 0;
138 __tmp
[12] = 0; __tmp
[13] = 0;
139 __tmp
[14] = 0; __tmp
[15] = 0;
143 __tmp
[ 0] = 0; __tmp
[ 1] = 0;
144 __tmp
[ 2] = 0; __tmp
[ 3] = 0;
145 __tmp
[ 4] = 0; __tmp
[ 5] = 0;
146 __tmp
[ 6] = 0; __tmp
[ 7] = 0;
150 __tmp
[ 0] = 0; __tmp
[ 1] = 0;
151 __tmp
[ 2] = 0; __tmp
[ 3] = 0;
163 #endif /* __KERNEL__ */
165 #endif /* __ASM_GENERIC_POSIX_TYPES_H */