root/include/asm-mips/types.h

/* [previous][next][first][last][top][bottom][index][help] */

INCLUDED FROM


DEFINITIONS

This source file includes following definitions.
  1. __FD_SET
  2. __FD_CLR
  3. __FD_ISSET
  4. __FD_ZERO

   1 /*
   2  * include/asm-mips/types.h
   3  *
   4  * This file is subject to the terms and conditions of the GNU General Public
   5  * License.  See the file "COPYING" in the main directory of this archive
   6  * for more details.
   7  *
   8  * Copyright (C) 1994, 1995 by Waldorf GMBH
   9  * written by Ralf Baechle
  10  */
  11 #ifndef __ASM_MIPS_TYPES_H
  12 #define __ASM_MIPS_TYPES_H
  13 
  14 #ifndef _SIZE_T
  15 #define _SIZE_T
  16 typedef __SIZE_TYPE__ size_t;
  17 #endif
  18 
  19 #ifndef _SSIZE_T
  20 #define _SSIZE_T
  21 typedef __SSIZE_TYPE__ ssize_t;
  22 #endif
  23 
  24 #ifndef _PTRDIFF_T
  25 #define _PTRDIFF_T
  26 typedef __PTRDIFF_TYPE__ ptrdiff_t;
  27 #endif
  28 
  29 #ifndef _TIME_T
  30 #define _TIME_T
  31 typedef long time_t;
  32 #endif
  33 
  34 #ifndef _CLOCK_T
  35 #define _CLOCK_T
  36 typedef long clock_t;
  37 #endif
  38 
  39 /*
  40  * __xx is ok: it doesn't pollute the POSIX namespace. Use these in the
  41  * header files exported to user space
  42  */
  43 
  44 typedef __signed__ char __s8;
  45 typedef unsigned char __u8;
  46 
  47 typedef __signed__ short __s16;
  48 typedef unsigned short __u16;
  49 
  50 typedef __signed__ int __s32;
  51 typedef unsigned int __u32;
  52 
  53 #if ((~0UL) == 0xffffffff)
  54 
  55 #if defined(__GNUC__) && !defined(__STRICT_ANSI__)
  56 typedef __signed__ long long __s64;
  57 typedef unsigned long long __u64;
  58 #endif
  59   
  60 #else
  61   
  62 typedef __signed__ long __s64;
  63 typedef unsigned long __u64;
  64 
  65 #endif
  66 
  67 /*
  68  * These aren't exported outside the kernel to avoid name space clashes
  69  */
  70 #ifdef __KERNEL__
  71 
  72 typedef __signed char s8;
  73 typedef unsigned char u8;
  74 
  75 typedef __signed short s16;
  76 typedef unsigned short u16;
  77 
  78 typedef __signed int s32;
  79 typedef unsigned int u32;
  80 
  81 #if ((~0UL) == 0xffffffff)
  82 
  83 #if defined(__GNUC__) && !defined(__STRICT_ANSI__)
  84 typedef __signed__ long long s64;
  85 typedef unsigned long long u64;
  86 #endif
  87   
  88 #else
  89   
  90 typedef __signed__ long s64;
  91 typedef unsigned long u64;
  92 
  93 #endif
  94 
  95 #endif /* __KERNEL__ */
  96 
  97 typedef __s32 pid_t;
  98 typedef __s32 uid_t;
  99 typedef __s32 gid_t;
 100 typedef __u32 dev_t;
 101 typedef __u32 ino_t;
 102 typedef __u32 mode_t;
 103 typedef __u32 umode_t;
 104 typedef __u32 nlink_t;
 105 typedef long daddr_t;
 106 typedef long off_t;
 107 
 108 #undef __FD_SET
 109 static __inline__ void __FD_SET(unsigned long fd, fd_set *fdsetp)
     /* [previous][next][first][last][top][bottom][index][help] */
 110 {
 111         unsigned long _tmp = fd / __NFDBITS;
 112         unsigned long _rem = fd % __NFDBITS;
 113         fdsetp->fds_bits[_tmp] |= (1UL<<_rem);
 114 }
 115 
 116 #undef __FD_CLR
 117 static __inline__ void __FD_CLR(unsigned long fd, fd_set *fdsetp)
     /* [previous][next][first][last][top][bottom][index][help] */
 118 {
 119         unsigned long _tmp = fd / __NFDBITS;
 120         unsigned long _rem = fd % __NFDBITS;
 121         fdsetp->fds_bits[_tmp] &= ~(1UL<<_rem);
 122 }
 123 
 124 #undef __FD_ISSET
 125 static __inline__ int __FD_ISSET(unsigned long fd, fd_set *p)
     /* [previous][next][first][last][top][bottom][index][help] */
 126 { 
 127         unsigned long _tmp = fd / __NFDBITS;
 128         unsigned long _rem = fd % __NFDBITS;
 129         return (p->fds_bits[_tmp] & (1UL<<_rem)) != 0;
 130 }
 131 
 132 /*
 133  * This will unroll the loop for the normal constant case (8 ints,
 134  * for a 256-bit fd_set)
 135  */
 136 #undef __FD_ZERO
 137 static __inline__ void __FD_ZERO(fd_set *p)
     /* [previous][next][first][last][top][bottom][index][help] */
 138 {
 139         unsigned int *tmp = p->fds_bits;
 140         int i;
 141 
 142         if (__builtin_constant_p(__FDSET_INTS)) {
 143                 switch (__FDSET_INTS) {
 144                         case 8:
 145                                 tmp[0] = 0; tmp[1] = 0; tmp[2] = 0; tmp[3] = 0;
 146                                 tmp[4] = 0; tmp[5] = 0; tmp[6] = 0; tmp[7] = 0;
 147                                 return;
 148                 }
 149         }
 150         i = __FDSET_INTS;
 151         while (i) {
 152                 i--;
 153                 *tmp = 0;
 154                 tmp++;
 155         }
 156 }
 157 
 158 #endif /* __ASM_MIPS_TYPES_H */

/* [previous][next][first][last][top][bottom][index][help] */