1 #ifndef _LINUX_POSIX_TYPES_H
2 #define _LINUX_POSIX_TYPES_H
3
4 /*
5 * This file is generally used by user-level software, so you need to
6 * be a little careful about namespace pollution etc. Also, we cannot
7 * assume GCC is being used.
8 */
9
10 #ifndef NULL
11 # define NULL ((void *) 0)
12 #endif
13
14 /*
15 * This allows for 256 file descriptors: if NR_OPEN is ever grown
16 * beyond that you'll have to change this too. But 256 fd's seem to be
17 * enough even for such "real" unices like SunOS, so hopefully this is
18 * one limit that doesn't have to be changed.
19 *
20 * Note that POSIX wants the FD_CLEAR(fd,fdsetp) defines to be in
21 * <sys/time.h> (and thus <linux/time.h>) - but this is a more logical
22 * place for them. Solved by having dummy defines in <sys/time.h>.
23 */
24
25 /*
26 * Those macros may have been defined in <gnu/types.h>. But we always
27 * use the ones here.
28 */
29 #undef __NFDBITS
30 #define __NFDBITS (8 * sizeof(unsigned int))
31
32 #undef __FD_SETSIZE
33 #define __FD_SETSIZE 256
34
35 #undef __FDSET_INTS
36 #define __FDSET_INTS (__FD_SETSIZE/__NFDBITS)
37
38 #undef __FDELT
39 #define __FDELT(d) ((d) / __NFDBITS)
40
41 #undef __FDMASK
42 #define __FDMASK(d) (1 << ((d) % __NFDBITS))
43
44 typedef struct fd_set {
45 unsigned int fds_bits [__FDSET_INTS];
46 } __kernel_fd_set;
47
48 #include <asm/posix_types.h>
49
50 #endif /* _LINUX_POSIX_TYPES_H */