2 * (C) Copyright 2000 - 2002
3 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
5 * (C) Copyright 2007, taken from asm-ppc/posix_types.h
6 * Daniel Hellstrom, Gaisler Research, daniel@gaisler.com.
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License as
10 * published by the Free Software Foundation; either version 2 of
11 * the License, or (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
25 #ifndef __SPARC_POSIX_TYPES_H__
26 #define __SPARC_POSIX_TYPES_H__
29 * This file is generally used by user-level software, so you need to
30 * be a little careful about namespace pollution etc. Also, we cannot
31 * assume GCC is being used.
34 typedef unsigned int __kernel_dev_t;
35 typedef unsigned int __kernel_ino_t;
36 typedef unsigned int __kernel_mode_t;
37 typedef unsigned short __kernel_nlink_t;
38 typedef long __kernel_off_t;
39 typedef int __kernel_pid_t;
40 typedef unsigned int __kernel_uid_t;
41 typedef unsigned int __kernel_gid_t;
42 typedef unsigned int __kernel_size_t;
43 typedef int __kernel_ssize_t;
44 typedef long __kernel_ptrdiff_t;
45 typedef long __kernel_time_t;
46 typedef long __kernel_suseconds_t;
47 typedef long __kernel_clock_t;
48 typedef int __kernel_daddr_t;
49 typedef char *__kernel_caddr_t;
50 typedef short __kernel_ipc_pid_t;
51 typedef unsigned short __kernel_uid16_t;
52 typedef unsigned short __kernel_gid16_t;
53 typedef unsigned int __kernel_uid32_t;
54 typedef unsigned int __kernel_gid32_t;
56 typedef unsigned int __kernel_old_uid_t;
57 typedef unsigned int __kernel_old_gid_t;
60 typedef long long __kernel_loff_t;
69 #define __FD_SET(d, set) ((set)->fds_bits[__FDELT(d)] |= __FDMASK(d))
70 #define __FD_CLR(d, set) ((set)->fds_bits[__FDELT(d)] &= ~__FDMASK(d))
71 #define __FD_ISSET(d, set) ((set)->fds_bits[__FDELT(d)] & __FDMASK(d))
72 #define __FD_ZERO(set) \
73 ((void) memset ((__ptr_t) (set), 0, sizeof (__kernel_fd_set)))
77 #if defined(__KERNEL__) || !defined(__GLIBC__) || (__GLIBC__ < 2) \
78 || (__GLIBC__ == 2 && __GLIBC_MINOR__ == 0)
79 /* With GNU C, use inline functions instead so args are evaluated only once: */
82 static __inline__ void __FD_SET(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__ void __FD_CLR(unsigned long fd, __kernel_fd_set * fdsetp)
92 unsigned long _tmp = fd / __NFDBITS;
93 unsigned long _rem = fd % __NFDBITS;
94 fdsetp->fds_bits[_tmp] &= ~(1UL << _rem);
98 static __inline__ int __FD_ISSET(unsigned long fd, __kernel_fd_set * p)
100 unsigned long _tmp = fd / __NFDBITS;
101 unsigned long _rem = fd % __NFDBITS;
102 return (p->fds_bits[_tmp] & (1UL << _rem)) != 0;
106 * This will unroll the loop for the normal constant case (8 ints,
107 * for a 256-bit fd_set)
110 static __inline__ void __FD_ZERO(__kernel_fd_set * p)
112 unsigned int *tmp = (unsigned int *)p->fds_bits;
115 if (__builtin_constant_p(__FDSET_LONGS)) {
116 switch (__FDSET_LONGS) {
137 #endif /* defined(__KERNEL__) || !defined(__GLIBC__) || (__GLIBC__ < 2) */
138 #endif /* __GNUC__ */
139 #endif /* _SPARC_POSIX_TYPES_H */