root/include/asm-alpha/posix_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 #ifndef _ALPHA_POSIX_TYPES_H
   2 #define _ALPHA_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 
  10 typedef unsigned int    __dev_t;
  11 typedef unsigned int    __ino_t;
  12 typedef unsigned int    __mode_t;
  13 typedef unsigned short  __nlink_t;
  14 typedef long            __off_t;
  15 typedef int             __pid_t;
  16 typedef unsigned int    __uid_t;
  17 typedef unsigned int    __gid_t;
  18 typedef unsigned long   __size_t;
  19 typedef long            __ssize_t;
  20 typedef long            __ptrdiff_t;
  21 typedef long            __time_t;
  22 typedef long            __clock_t;
  23 typedef int             __daddr_t;
  24 typedef char *          __caddr_t;
  25 
  26 typedef struct {
  27         int     val[2];
  28 } __fsid_t;
  29 
  30 #ifndef __GNUC__
  31 
  32 #define __FD_SET(d, set)        ((set)->fds_bits[__FDELT(d)] |= __FDMASK(d))
  33 #define __FD_CLR(d, set)        ((set)->fds_bits[__FDELT(d)] &= ~__FDMASK(d))
  34 #define __FD_ISSET(d, set)      ((set)->fds_bits[__FDELT(d)] & __FDMASK(d))
  35 #define __FD_ZERO(set)  \
  36   ((void) memset ((__ptr_t) (set), 0, sizeof (__fd_set)))
  37 
  38 #else /* __GNUC__ */
  39 
  40 /* With GNU C, use inline functions instead so args are evaluated only once: */
  41 
  42 #undef __FD_SET
  43 static __inline__ void __FD_SET(unsigned long fd, __fd_set *fdsetp)
     /* [previous][next][first][last][top][bottom][index][help] */
  44 {
  45         unsigned long _tmp = fd / __NFDBITS;
  46         unsigned long _rem = fd % __NFDBITS;
  47         fdsetp->fds_bits[_tmp] |= (1UL<<_rem);
  48 }
  49 
  50 #undef __FD_CLR
  51 static __inline__ void __FD_CLR(unsigned long fd, __fd_set *fdsetp)
     /* [previous][next][first][last][top][bottom][index][help] */
  52 {
  53         unsigned long _tmp = fd / __NFDBITS;
  54         unsigned long _rem = fd % __NFDBITS;
  55         fdsetp->fds_bits[_tmp] &= ~(1UL<<_rem);
  56 }
  57 
  58 #undef __FD_ISSET
  59 static __inline__ int __FD_ISSET(unsigned long fd, __fd_set *p)
     /* [previous][next][first][last][top][bottom][index][help] */
  60 { 
  61         unsigned long _tmp = fd / __NFDBITS;
  62         unsigned long _rem = fd % __NFDBITS;
  63         return (p->fds_bits[_tmp] & (1UL<<_rem)) != 0;
  64 }
  65 
  66 /*
  67  * This will unroll the loop for the normal constant case (8 ints,
  68  * for a 256-bit fd_set)
  69  */
  70 #undef __FD_ZERO
  71 static __inline__ void __FD_ZERO(__fd_set *p)
     /* [previous][next][first][last][top][bottom][index][help] */
  72 {
  73         unsigned int *tmp = p->fds_bits;
  74         int i;
  75 
  76         if (__builtin_constant_p(__FDSET_INTS)) {
  77                 switch (__FDSET_INTS) {
  78                         case 8:
  79                                 tmp[0] = 0; tmp[1] = 0; tmp[2] = 0; tmp[3] = 0;
  80                                 tmp[4] = 0; tmp[5] = 0; tmp[6] = 0; tmp[7] = 0;
  81                                 return;
  82                 }
  83         }
  84         i = __FDSET_INTS;
  85         while (i) {
  86                 i--;
  87                 *tmp = 0;
  88                 tmp++;
  89         }
  90 }
  91 
  92 #endif /* __GNUC__ */
  93 
  94 #endif /* _ALPHA_POSIX_TYPES_H */

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