root/include/asm-sparc/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 /* $Id: types.h,v 1.8 1995/11/25 02:33:08 davem Exp $ */
   2 #ifndef _SPARC_TYPES_H
   3 #define _SPARC_TYPES_H
   4 
   5 /*
   6  * _xx is ok: it doesn't pollute the POSIX namespace. Use these in the
   7  * header files exported to user space   <-- Linus sez this
   8  */
   9 
  10 #ifndef _SIZE_T
  11 #define _SIZE_T
  12 #ifdef __svr4__
  13 typedef unsigned int size_t;      /* solaris sucks */
  14 #else
  15 typedef long unsigned int size_t; /* sunos is much better */
  16 #endif /* !(__svr4__) */
  17 #endif
  18 
  19 #ifndef _SSIZE_T
  20 #define _SSIZE_T
  21 typedef int ssize_t;
  22 #endif
  23 
  24 #ifndef _PTRDIFF_T
  25 #define _PTRDIFF_T
  26 typedef long int 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 typedef int pid_t;
  40 typedef unsigned short uid_t;
  41 typedef unsigned short gid_t;
  42 typedef unsigned short dev_t;
  43 typedef unsigned long ino_t;
  44 typedef unsigned short mode_t;
  45 typedef unsigned short umode_t;
  46 typedef short nlink_t;
  47 typedef long daddr_t;
  48 typedef long off_t;
  49 
  50 typedef signed char __s8;
  51 typedef unsigned char __u8;
  52 
  53 typedef signed short __s16;
  54 typedef unsigned short __u16;
  55 
  56 typedef signed int __s32;
  57 typedef unsigned int __u32;
  58 
  59 typedef signed long long __s64;
  60 typedef unsigned long long __u64;
  61 
  62 #ifdef __KERNEL__
  63 
  64 typedef signed char s8;
  65 typedef unsigned char u8;
  66 
  67 typedef signed short s16;
  68 typedef unsigned short u16;
  69 
  70 typedef signed int s32;
  71 typedef unsigned int u32;
  72 
  73 typedef signed long long s64;
  74 typedef unsigned long long u64;
  75 
  76 #endif /* __KERNEL__ */
  77 
  78 #undef __FD_SET
  79 static __inline__ void __FD_SET(unsigned long fd, fd_set *fdsetp)
     /* [previous][next][first][last][top][bottom][index][help] */
  80 {
  81         unsigned long _tmp = fd / __NFDBITS;
  82         unsigned long _rem = fd % __NFDBITS;
  83         fdsetp->fds_bits[_tmp] |= (1UL<<_rem);
  84 }
  85 
  86 #undef __FD_CLR
  87 static __inline__ void __FD_CLR(unsigned long fd, fd_set *fdsetp)
     /* [previous][next][first][last][top][bottom][index][help] */
  88 {
  89         unsigned long _tmp = fd / __NFDBITS;
  90         unsigned long _rem = fd % __NFDBITS;
  91         fdsetp->fds_bits[_tmp] &= ~(1UL<<_rem);
  92 }
  93 
  94 #undef __FD_ISSET
  95 static __inline__ int __FD_ISSET(unsigned long fd, fd_set *p)
     /* [previous][next][first][last][top][bottom][index][help] */
  96 { 
  97         unsigned long _tmp = fd / __NFDBITS;
  98         unsigned long _rem = fd % __NFDBITS;
  99         return (p->fds_bits[_tmp] & (1UL<<_rem)) != 0;
 100 }
 101 
 102 /*
 103  * This will unroll the loop for the normal constant cases (4 or 8 longs,
 104  * for 256 and 512-bit fd_sets respectively)
 105  */
 106 #undef __FD_ZERO
 107 static __inline__ void __FD_ZERO(fd_set *p)
     /* [previous][next][first][last][top][bottom][index][help] */
 108 {
 109         unsigned int *tmp = p->fds_bits;
 110         int i;
 111 
 112         if (__builtin_constant_p(__FDSET_INTS)) {
 113                 switch (__FDSET_INTS) {
 114                         case 8:
 115                                 tmp[0] = 0; tmp[1] = 0; tmp[2] = 0; tmp[3] = 0;
 116                                 tmp[4] = 0; tmp[5] = 0; tmp[6] = 0; tmp[7] = 0;
 117                                 return;
 118                         case 4:
 119                                 tmp[0] = 0; tmp[1] = 0; tmp[2] = 0; tmp[3] = 0;
 120                                 return;
 121                 }
 122         }
 123         i = __FDSET_INTS;
 124         while (i) {
 125                 i--;
 126                 *tmp = 0;
 127                 tmp++;
 128         }
 129 }
 130 
 131 #endif /* defined(_SPARC_TYPES_H) */

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