~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/include/asm-generic/posix_types.h

Version: ~ [ linux-6.1-rc7 ] ~ [ linux-6.0.10 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.80 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.156 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.225 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.267 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.300 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.334 ] ~ [ linux-4.8.17 ] ~ [ linux-4.7.10 ] ~ [ linux-4.6.7 ] ~ [ linux-4.5.7 ] ~ [ linux-4.4.302 ] ~ [ linux-4.3.6 ] ~ [ linux-4.2.8 ] ~ [ linux-4.1.52 ] ~ [ linux-4.0.9 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 #ifndef __ASM_GENERIC_POSIX_TYPES_H
  2 #define __ASM_GENERIC_POSIX_TYPES_H
  3 
  4 #include <asm/bitsperlong.h>
  5 /*
  6  * This file is generally used by user-level software, so you need to
  7  * be a little careful about namespace pollution etc.
  8  *
  9  * First the types that are often defined in different ways across
 10  * architectures, so that you can override them.
 11  */
 12 
 13 #ifndef __kernel_ino_t
 14 typedef unsigned long   __kernel_ino_t;
 15 #endif
 16 
 17 #ifndef __kernel_mode_t
 18 typedef unsigned int    __kernel_mode_t;
 19 #endif
 20 
 21 #ifndef __kernel_nlink_t
 22 typedef unsigned long   __kernel_nlink_t;
 23 #endif
 24 
 25 #ifndef __kernel_pid_t
 26 typedef int             __kernel_pid_t;
 27 #endif
 28 
 29 #ifndef __kernel_ipc_pid_t
 30 typedef int             __kernel_ipc_pid_t;
 31 #endif
 32 
 33 #ifndef __kernel_uid_t
 34 typedef unsigned int    __kernel_uid_t;
 35 typedef unsigned int    __kernel_gid_t;
 36 #endif
 37 
 38 #ifndef __kernel_suseconds_t
 39 typedef long            __kernel_suseconds_t;
 40 #endif
 41 
 42 #ifndef __kernel_daddr_t
 43 typedef int             __kernel_daddr_t;
 44 #endif
 45 
 46 #ifndef __kernel_uid32_t
 47 typedef __kernel_uid_t  __kernel_uid32_t;
 48 typedef __kernel_gid_t  __kernel_gid32_t;
 49 #endif
 50 
 51 #ifndef __kernel_old_uid_t
 52 typedef __kernel_uid_t  __kernel_old_uid_t;
 53 typedef __kernel_gid_t  __kernel_old_gid_t;
 54 #endif
 55 
 56 #ifndef __kernel_old_dev_t
 57 typedef unsigned int    __kernel_old_dev_t;
 58 #endif
 59 
 60 /*
 61  * Most 32 bit architectures use "unsigned int" size_t,
 62  * and all 64 bit architectures use "unsigned long" size_t.
 63  */
 64 #ifndef __kernel_size_t
 65 #if __BITS_PER_LONG != 64
 66 typedef unsigned int    __kernel_size_t;
 67 typedef int             __kernel_ssize_t;
 68 typedef int             __kernel_ptrdiff_t;
 69 #else
 70 typedef unsigned long   __kernel_size_t;
 71 typedef long            __kernel_ssize_t;
 72 typedef long            __kernel_ptrdiff_t;
 73 #endif
 74 #endif
 75 
 76 /*
 77  * anything below here should be completely generic
 78  */
 79 typedef long            __kernel_off_t;
 80 typedef long long       __kernel_loff_t;
 81 typedef long            __kernel_time_t;
 82 typedef long            __kernel_clock_t;
 83 typedef int             __kernel_timer_t;
 84 typedef int             __kernel_clockid_t;
 85 typedef char *          __kernel_caddr_t;
 86 typedef unsigned short  __kernel_uid16_t;
 87 typedef unsigned short  __kernel_gid16_t;
 88 
 89 typedef struct {
 90         int     val[2];
 91 } __kernel_fsid_t;
 92 
 93 #ifdef __KERNEL__
 94 
 95 #undef __FD_SET
 96 static inline void __FD_SET(unsigned long __fd, __kernel_fd_set *__fdsetp)
 97 {
 98         unsigned long __tmp = __fd / __NFDBITS;
 99         unsigned long __rem = __fd % __NFDBITS;
100         __fdsetp->fds_bits[__tmp] |= (1UL<<__rem);
101 }
102 
103 #undef __FD_CLR
104 static inline void __FD_CLR(unsigned long __fd, __kernel_fd_set *__fdsetp)
105 {
106         unsigned long __tmp = __fd / __NFDBITS;
107         unsigned long __rem = __fd % __NFDBITS;
108         __fdsetp->fds_bits[__tmp] &= ~(1UL<<__rem);
109 }
110 
111 #undef __FD_ISSET
112 static inline int __FD_ISSET(unsigned long __fd, const __kernel_fd_set *__p)
113 {
114         unsigned long __tmp = __fd / __NFDBITS;
115         unsigned long __rem = __fd % __NFDBITS;
116         return (__p->fds_bits[__tmp] & (1UL<<__rem)) != 0;
117 }
118 
119 /*
120  * This will unroll the loop for the normal constant case (8 ints,
121  * for a 256-bit fd_set)
122  */
123 #undef __FD_ZERO
124 static inline void __FD_ZERO(__kernel_fd_set *__p)
125 {
126         unsigned long *__tmp = __p->fds_bits;
127         int __i;
128 
129         if (__builtin_constant_p(__FDSET_LONGS)) {
130                 switch (__FDSET_LONGS) {
131                 case 16:
132                         __tmp[ 0] = 0; __tmp[ 1] = 0;
133                         __tmp[ 2] = 0; __tmp[ 3] = 0;
134                         __tmp[ 4] = 0; __tmp[ 5] = 0;
135                         __tmp[ 6] = 0; __tmp[ 7] = 0;
136                         __tmp[ 8] = 0; __tmp[ 9] = 0;
137                         __tmp[10] = 0; __tmp[11] = 0;
138                         __tmp[12] = 0; __tmp[13] = 0;
139                         __tmp[14] = 0; __tmp[15] = 0;
140                         return;
141 
142                 case 8:
143                         __tmp[ 0] = 0; __tmp[ 1] = 0;
144                         __tmp[ 2] = 0; __tmp[ 3] = 0;
145                         __tmp[ 4] = 0; __tmp[ 5] = 0;
146                         __tmp[ 6] = 0; __tmp[ 7] = 0;
147                         return;
148 
149                 case 4:
150                         __tmp[ 0] = 0; __tmp[ 1] = 0;
151                         __tmp[ 2] = 0; __tmp[ 3] = 0;
152                         return;
153                 }
154         }
155         __i = __FDSET_LONGS;
156         while (__i) {
157                 __i--;
158                 *__tmp = 0;
159                 __tmp++;
160         }
161 }
162 
163 #endif /* __KERNEL__ */
164 
165 #endif /* __ASM_GENERIC_POSIX_TYPES_H */
166 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | Wiki (Japanese) | Wiki (English) | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

osdn.jp