uboot/arch/sh/include/asm/posix_types.h
<<
>>
Prefs
   1#ifndef __ASM_SH_POSIX_TYPES_H
   2#define __ASM_SH_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
  10typedef unsigned short  __kernel_dev_t;
  11typedef unsigned long   __kernel_ino_t;
  12typedef unsigned short  __kernel_mode_t;
  13typedef unsigned short  __kernel_nlink_t;
  14typedef long            __kernel_off_t;
  15typedef int             __kernel_pid_t;
  16typedef unsigned short  __kernel_ipc_pid_t;
  17typedef unsigned short  __kernel_uid_t;
  18typedef unsigned short  __kernel_gid_t;
  19typedef unsigned int    __kernel_size_t;
  20typedef int             __kernel_ssize_t;
  21typedef int             __kernel_ptrdiff_t;
  22typedef long            __kernel_time_t;
  23typedef long            __kernel_suseconds_t;
  24typedef long            __kernel_clock_t;
  25typedef int             __kernel_timer_t;
  26typedef int             __kernel_clockid_t;
  27typedef int             __kernel_daddr_t;
  28typedef char *          __kernel_caddr_t;
  29typedef unsigned short  __kernel_uid16_t;
  30typedef unsigned short  __kernel_gid16_t;
  31typedef unsigned int    __kernel_uid32_t;
  32typedef unsigned int    __kernel_gid32_t;
  33
  34typedef unsigned short  __kernel_old_uid_t;
  35typedef unsigned short  __kernel_old_gid_t;
  36typedef unsigned short  __kernel_old_dev_t;
  37
  38#ifdef __GNUC__
  39typedef long long       __kernel_loff_t;
  40#endif
  41
  42typedef struct {
  43#if defined(__KERNEL__) || defined(__USE_ALL)
  44        int     val[2];
  45#else /* !defined(__KERNEL__) && !defined(__USE_ALL) */
  46        int     __val[2];
  47#endif /* !defined(__KERNEL__) && !defined(__USE_ALL) */
  48} __kernel_fsid_t;
  49
  50#if defined(__KERNEL__) || !defined(__GLIBC__) || (__GLIBC__ < 2)
  51
  52#undef  __FD_SET
  53static __inline__ void __FD_SET(unsigned long __fd, __kernel_fd_set *__fdsetp)
  54{
  55        unsigned long __tmp = __fd / __NFDBITS;
  56        unsigned long __rem = __fd % __NFDBITS;
  57        __fdsetp->fds_bits[__tmp] |= (1UL<<__rem);
  58}
  59
  60#undef  __FD_CLR
  61static __inline__ void __FD_CLR(unsigned long __fd, __kernel_fd_set *__fdsetp)
  62{
  63        unsigned long __tmp = __fd / __NFDBITS;
  64        unsigned long __rem = __fd % __NFDBITS;
  65        __fdsetp->fds_bits[__tmp] &= ~(1UL<<__rem);
  66}
  67
  68
  69#undef  __FD_ISSET
  70static __inline__ int __FD_ISSET(unsigned long __fd, const __kernel_fd_set *__p)
  71{
  72        unsigned long __tmp = __fd / __NFDBITS;
  73        unsigned long __rem = __fd % __NFDBITS;
  74        return (__p->fds_bits[__tmp] & (1UL<<__rem)) != 0;
  75}
  76
  77/*
  78 * This will unroll the loop for the normal constant case (8 ints,
  79 * for a 256-bit fd_set)
  80 */
  81#undef  __FD_ZERO
  82static __inline__ void __FD_ZERO(__kernel_fd_set *__p)
  83{
  84        unsigned long *__tmp = __p->fds_bits;
  85        int __i;
  86
  87        if (__builtin_constant_p(__FDSET_LONGS)) {
  88                switch (__FDSET_LONGS) {
  89                case 16:
  90                        __tmp[ 0] = 0; __tmp[ 1] = 0;
  91                        __tmp[ 2] = 0; __tmp[ 3] = 0;
  92                        __tmp[ 4] = 0; __tmp[ 5] = 0;
  93                        __tmp[ 6] = 0; __tmp[ 7] = 0;
  94                        __tmp[ 8] = 0; __tmp[ 9] = 0;
  95                        __tmp[10] = 0; __tmp[11] = 0;
  96                        __tmp[12] = 0; __tmp[13] = 0;
  97                        __tmp[14] = 0; __tmp[15] = 0;
  98                        return;
  99
 100                case 8:
 101                        __tmp[ 0] = 0; __tmp[ 1] = 0;
 102                        __tmp[ 2] = 0; __tmp[ 3] = 0;
 103                        __tmp[ 4] = 0; __tmp[ 5] = 0;
 104                        __tmp[ 6] = 0; __tmp[ 7] = 0;
 105                        return;
 106
 107                case 4:
 108                        __tmp[ 0] = 0; __tmp[ 1] = 0;
 109                        __tmp[ 2] = 0; __tmp[ 3] = 0;
 110                        return;
 111                }
 112        }
 113        __i = __FDSET_LONGS;
 114        while (__i) {
 115                __i--;
 116                *__tmp = 0;
 117                __tmp++;
 118        }
 119}
 120
 121#endif /* defined(__KERNEL__) || !defined(__GLIBC__) || (__GLIBC__ < 2) */
 122
 123#endif /* __ASM_SH_POSIX_TYPES_H */
 124