]> git.ipfire.org Git - people/ms/u-boot.git/blame_incremental - arch/sparc/include/asm/posix_types.h
Replace "#include <asm-$ARCH/$FILE>" with "#include <asm/$FILE>"
[people/ms/u-boot.git] / arch / sparc / include / asm / posix_types.h
... / ...
CommitLineData
1/*
2 * (C) Copyright 2000 - 2002
3 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
4 *
5 * (C) Copyright 2007, taken from asm-ppc/posix_types.h
6 * Daniel Hellstrom, Gaisler Research, daniel@gaisler.com.
7 *
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.
12 *
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.
17 *
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,
21 * MA 02111-1307 USA
22 *
23 */
24
25#ifndef __SPARC_POSIX_TYPES_H__
26#define __SPARC_POSIX_TYPES_H__
27
28/*
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.
32 */
33
34typedef unsigned int __kernel_dev_t;
35typedef unsigned int __kernel_ino_t;
36typedef unsigned int __kernel_mode_t;
37typedef unsigned short __kernel_nlink_t;
38typedef long __kernel_off_t;
39typedef int __kernel_pid_t;
40typedef unsigned int __kernel_uid_t;
41typedef unsigned int __kernel_gid_t;
42typedef unsigned int __kernel_size_t;
43typedef int __kernel_ssize_t;
44typedef long __kernel_ptrdiff_t;
45typedef long __kernel_time_t;
46typedef long __kernel_suseconds_t;
47typedef long __kernel_clock_t;
48typedef int __kernel_daddr_t;
49typedef char *__kernel_caddr_t;
50typedef short __kernel_ipc_pid_t;
51typedef unsigned short __kernel_uid16_t;
52typedef unsigned short __kernel_gid16_t;
53typedef unsigned int __kernel_uid32_t;
54typedef unsigned int __kernel_gid32_t;
55
56typedef unsigned int __kernel_old_uid_t;
57typedef unsigned int __kernel_old_gid_t;
58
59#ifdef __GNUC__
60typedef long long __kernel_loff_t;
61#endif
62
63typedef struct {
64 int val[2];
65} __kernel_fsid_t;
66
67#ifndef __GNUC__
68
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)))
74
75#else /* __GNUC__ */
76
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: */
80
81#undef __FD_SET
82static __inline__ void __FD_SET(unsigned long fd, __kernel_fd_set * fdsetp)
83{
84 unsigned long _tmp = fd / __NFDBITS;
85 unsigned long _rem = fd % __NFDBITS;
86 fdsetp->fds_bits[_tmp] |= (1UL << _rem);
87}
88
89#undef __FD_CLR
90static __inline__ void __FD_CLR(unsigned long fd, __kernel_fd_set * fdsetp)
91{
92 unsigned long _tmp = fd / __NFDBITS;
93 unsigned long _rem = fd % __NFDBITS;
94 fdsetp->fds_bits[_tmp] &= ~(1UL << _rem);
95}
96
97#undef __FD_ISSET
98static __inline__ int __FD_ISSET(unsigned long fd, __kernel_fd_set * p)
99{
100 unsigned long _tmp = fd / __NFDBITS;
101 unsigned long _rem = fd % __NFDBITS;
102 return (p->fds_bits[_tmp] & (1UL << _rem)) != 0;
103}
104
105/*
106 * This will unroll the loop for the normal constant case (8 ints,
107 * for a 256-bit fd_set)
108 */
109#undef __FD_ZERO
110static __inline__ void __FD_ZERO(__kernel_fd_set * p)
111{
112 unsigned int *tmp = (unsigned int *)p->fds_bits;
113 int i;
114
115 if (__builtin_constant_p(__FDSET_LONGS)) {
116 switch (__FDSET_LONGS) {
117 case 8:
118 tmp[0] = 0;
119 tmp[1] = 0;
120 tmp[2] = 0;
121 tmp[3] = 0;
122 tmp[4] = 0;
123 tmp[5] = 0;
124 tmp[6] = 0;
125 tmp[7] = 0;
126 return;
127 }
128 }
129 i = __FDSET_LONGS;
130 while (i) {
131 i--;
132 *tmp = 0;
133 tmp++;
134 }
135}
136
137#endif /* defined(__KERNEL__) || !defined(__GLIBC__) || (__GLIBC__ < 2) */
138#endif /* __GNUC__ */
139#endif /* _SPARC_POSIX_TYPES_H */