Import 2.3.1
[davej-history.git] / include / asm-mips / posix_types.h
blob057a44df810bac24e03b3e964abe95ae326772e1
1 /* $Id: posix_types.h,v 1.5 1998/08/17 13:59:34 ralf Exp $
3 * This file is subject to the terms and conditions of the GNU General Public
4 * License. See the file "COPYING" in the main directory of this archive
5 * for more details.
7 * Copyright (C) 1996, 1997, 1998 by Ralf Baechle
8 */
9 #ifndef __ARCH_MIPS_POSIX_TYPES_H
10 #define __ARCH_MIPS_POSIX_TYPES_H
12 #define __need_size_t
13 #define __need_ptrdiff_t
14 #include <stddef.h>
17 * This file is generally used by user-level software, so you need to
18 * be a little careful about namespace pollution etc. Also, we cannot
19 * assume GCC is being used.
22 typedef unsigned long __kernel_dev_t;
23 typedef unsigned long __kernel_ino_t;
24 typedef unsigned long __kernel_mode_t;
25 typedef unsigned long __kernel_nlink_t;
26 typedef long __kernel_off_t;
27 typedef long __kernel_pid_t;
28 typedef long __kernel_ipc_pid_t;
29 typedef long __kernel_uid_t;
30 typedef long __kernel_gid_t;
31 typedef __SIZE_TYPE__ __kernel_size_t;
32 typedef __SSIZE_TYPE__ __kernel_ssize_t;
33 typedef int __kernel_ptrdiff_t;
34 typedef long __kernel_time_t;
35 typedef long __kernel_suseconds_t;
36 typedef long __kernel_clock_t;
37 typedef long __kernel_daddr_t;
38 typedef char * __kernel_caddr_t;
40 #ifdef __GNUC__
41 typedef long long __kernel_loff_t;
42 #endif
44 typedef struct {
45 long val[2];
46 } __kernel_fsid_t;
48 #if defined(__KERNEL__) || !defined(__GLIBC__) || (__GLIBC__ < 2)
50 #undef __FD_SET
51 static __inline__ void __FD_SET(unsigned long __fd, __kernel_fd_set *__fdsetp)
53 unsigned long __tmp = __fd / __NFDBITS;
54 unsigned long __rem = __fd % __NFDBITS;
55 __fdsetp->fds_bits[__tmp] |= (1UL<<__rem);
58 #undef __FD_CLR
59 static __inline__ void __FD_CLR(unsigned long __fd, __kernel_fd_set *__fdsetp)
61 unsigned long __tmp = __fd / __NFDBITS;
62 unsigned long __rem = __fd % __NFDBITS;
63 __fdsetp->fds_bits[__tmp] &= ~(1UL<<__rem);
66 #undef __FD_ISSET
67 static __inline__ int __FD_ISSET(unsigned long __fd, const __kernel_fd_set *__p)
69 unsigned long __tmp = __fd / __NFDBITS;
70 unsigned long __rem = __fd % __NFDBITS;
71 return (__p->fds_bits[__tmp] & (1UL<<__rem)) != 0;
75 * This will unroll the loop for the normal constant case (8 ints,
76 * for a 256-bit fd_set)
78 #undef __FD_ZERO
79 static __inline__ void __FD_ZERO(__kernel_fd_set *__p)
81 unsigned long *__tmp = __p->fds_bits;
82 int __i;
84 if (__builtin_constant_p(__FDSET_LONGS)) {
85 switch (__FDSET_LONGS) {
86 case 16:
87 __tmp[ 0] = 0; __tmp[ 1] = 0;
88 __tmp[ 2] = 0; __tmp[ 3] = 0;
89 __tmp[ 4] = 0; __tmp[ 5] = 0;
90 __tmp[ 6] = 0; __tmp[ 7] = 0;
91 __tmp[ 8] = 0; __tmp[ 9] = 0;
92 __tmp[10] = 0; __tmp[11] = 0;
93 __tmp[12] = 0; __tmp[13] = 0;
94 __tmp[14] = 0; __tmp[15] = 0;
95 return;
97 case 8:
98 __tmp[ 0] = 0; __tmp[ 1] = 0;
99 __tmp[ 2] = 0; __tmp[ 3] = 0;
100 __tmp[ 4] = 0; __tmp[ 5] = 0;
101 __tmp[ 6] = 0; __tmp[ 7] = 0;
102 return;
104 case 4:
105 __tmp[ 0] = 0; __tmp[ 1] = 0;
106 __tmp[ 2] = 0; __tmp[ 3] = 0;
107 return;
110 __i = __FDSET_LONGS;
111 while (__i) {
112 __i--;
113 *__tmp = 0;
114 __tmp++;
118 #endif /* defined(__KERNEL__) || !defined(__GLIBC__) || (__GLIBC__ < 2) */
120 #endif /* __ARCH_MIPS_POSIX_TYPES_H */