2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
6 * Copyright (C) 1996, 1997, 1998, 1999, 2000 by Ralf Baechle
7 * Copyright (C) 1999, 2000 Silicon Graphics, Inc.
9 #ifndef _ASM_POSIX_TYPES_H
10 #define _ASM_POSIX_TYPES_H
13 * This file is generally used by user-level software, so you need to
14 * be a little careful about namespace pollution etc. Also, we cannot
15 * assume GCC is being used.
18 typedef unsigned int __kernel_dev_t;
19 typedef unsigned int __kernel_ino_t;
20 typedef unsigned int __kernel_mode_t;
21 typedef unsigned int __kernel_nlink_t;
22 typedef long __kernel_off_t;
23 typedef int __kernel_pid_t;
24 typedef int __kernel_ipc_pid_t;
25 typedef int __kernel_uid_t;
26 typedef int __kernel_gid_t;
27 typedef unsigned long __kernel_size_t;
28 typedef long __kernel_ssize_t;
29 typedef long __kernel_ptrdiff_t;
30 typedef long __kernel_time_t;
31 typedef long __kernel_suseconds_t;
32 typedef long __kernel_clock_t;
33 typedef long __kernel_daddr_t;
34 typedef char * __kernel_caddr_t;
36 typedef unsigned short __kernel_uid16_t;
37 typedef unsigned short __kernel_gid16_t;
38 typedef int __kernel_uid32_t;
39 typedef int __kernel_gid32_t;
40 typedef __kernel_uid_t __kernel_old_uid_t;
41 typedef __kernel_gid_t __kernel_old_gid_t;
44 typedef long long __kernel_loff_t;
51 /* Now 32bit compatibility types */
52 typedef unsigned int __kernel_dev_t32;
53 typedef unsigned int __kernel_ino_t32;
54 typedef unsigned int __kernel_mode_t32;
55 typedef unsigned int __kernel_nlink_t32;
56 typedef int __kernel_off_t32;
57 typedef int __kernel_pid_t32;
58 typedef int __kernel_ipc_pid_t32;
59 typedef int __kernel_uid_t32;
60 typedef int __kernel_gid_t32;
61 typedef unsigned int __kernel_size_t32;
62 typedef int __kernel_ssize_t32;
63 typedef int __kernel_ptrdiff_t32;
64 typedef int __kernel_time_t32;
65 typedef int __kernel_suseconds_t32;
66 typedef int __kernel_clock_t32;
67 typedef int __kernel_daddr_t32;
68 typedef unsigned int __kernel_caddr_t32;
69 typedef __kernel_fsid_t __kernel_fsid_t32;
71 #if defined(__KERNEL__) || !defined(__GLIBC__) || (__GLIBC__ < 2)
74 static __inline__ void __FD_SET(unsigned long __fd, __kernel_fd_set *__fdsetp)
76 unsigned long __tmp = __fd / __NFDBITS;
77 unsigned long __rem = __fd % __NFDBITS;
78 __fdsetp->fds_bits[__tmp] |= (1UL<<__rem);
82 static __inline__ void __FD_CLR(unsigned long __fd, __kernel_fd_set *__fdsetp)
84 unsigned long __tmp = __fd / __NFDBITS;
85 unsigned long __rem = __fd % __NFDBITS;
86 __fdsetp->fds_bits[__tmp] &= ~(1UL<<__rem);
90 static __inline__ int __FD_ISSET(unsigned long __fd, const __kernel_fd_set *__p)
92 unsigned long __tmp = __fd / __NFDBITS;
93 unsigned long __rem = __fd % __NFDBITS;
94 return (__p->fds_bits[__tmp] & (1UL<<__rem)) != 0;
98 * This will unroll the loop for the normal constant case (8 ints,
99 * for a 256-bit fd_set)
102 static __inline__ void __FD_ZERO(__kernel_fd_set *__p)
104 unsigned long *__tmp = __p->fds_bits;
107 if (__builtin_constant_p(__FDSET_LONGS)) {
108 switch (__FDSET_LONGS) {
110 __tmp[ 0] = 0; __tmp[ 1] = 0;
111 __tmp[ 2] = 0; __tmp[ 3] = 0;
112 __tmp[ 4] = 0; __tmp[ 5] = 0;
113 __tmp[ 6] = 0; __tmp[ 7] = 0;
114 __tmp[ 8] = 0; __tmp[ 9] = 0;
115 __tmp[10] = 0; __tmp[11] = 0;
116 __tmp[12] = 0; __tmp[13] = 0;
117 __tmp[14] = 0; __tmp[15] = 0;
121 __tmp[ 0] = 0; __tmp[ 1] = 0;
122 __tmp[ 2] = 0; __tmp[ 3] = 0;
123 __tmp[ 4] = 0; __tmp[ 5] = 0;
124 __tmp[ 6] = 0; __tmp[ 7] = 0;
128 __tmp[ 0] = 0; __tmp[ 1] = 0;
129 __tmp[ 2] = 0; __tmp[ 3] = 0;
141 #endif /* defined(__KERNEL__) || !defined(__GLIBC__) || (__GLIBC__ < 2) */
143 #endif /* _ASM_POSIX_TYPES_H */