root/include/asm-sparc/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 __ARCH_SPARC_POSIX_TYPES_H
   2 #define __ARCH_SPARC_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 /* When cross-compilation is no longer an issue, fix this. */
  11 #ifdef __svr4__
  12 typedef unsigned int           __kernel_size_t;      /* solaris sucks */
  13 #else
  14 typedef long unsigned int      __kernel_size_t;      /* sunos is much better */
  15 #endif /* !(__svr4__) */
  16 
  17 typedef int                    __kernel_ssize_t;
  18 typedef long int               __kernel_ptrdiff_t;
  19 typedef long                   __kernel_time_t;
  20 typedef long                   __kernel_clock_t;
  21 typedef int                    __kernel_pid_t;
  22 typedef unsigned short         __kernel_uid_t;
  23 typedef unsigned short         __kernel_gid_t;
  24 typedef unsigned short         __kernel_dev_t;
  25 typedef unsigned long          __kernel_ino_t;
  26 typedef unsigned short         __kernel_mode_t;
  27 typedef unsigned short         __kernel_umode_t;
  28 typedef short                  __kernel_nlink_t;
  29 typedef long                   __kernel_daddr_t;
  30 typedef long                   __kernel_off_t;
  31 typedef char *                 __kernel_caddr_t;
  32 
  33 #ifdef __GNUC__
  34 typedef long long       __kernel_loff_t;
  35 #endif
  36 
  37 #undef __FD_SET
  38 static __inline__ void __FD_SET(unsigned long fd, __kernel_fd_set *fdsetp)
     /* [previous][next][first][last][top][bottom][index][help] */
  39 {
  40         unsigned long _tmp = fd / __NFDBITS;
  41         unsigned long _rem = fd % __NFDBITS;
  42         fdsetp->fds_bits[_tmp] |= (1UL<<_rem);
  43 }
  44 
  45 #undef __FD_CLR
  46 static __inline__ void __FD_CLR(unsigned long fd, __kernel_fd_set *fdsetp)
     /* [previous][next][first][last][top][bottom][index][help] */
  47 {
  48         unsigned long _tmp = fd / __NFDBITS;
  49         unsigned long _rem = fd % __NFDBITS;
  50         fdsetp->fds_bits[_tmp] &= ~(1UL<<_rem);
  51 }
  52 
  53 #undef __FD_ISSET
  54 static __inline__ int __FD_ISSET(unsigned long fd, __kernel_fd_set *p)
     /* [previous][next][first][last][top][bottom][index][help] */
  55 { 
  56         unsigned long _tmp = fd / __NFDBITS;
  57         unsigned long _rem = fd % __NFDBITS;
  58         return (p->fds_bits[_tmp] & (1UL<<_rem)) != 0;
  59 }
  60 
  61 /*
  62  * This will unroll the loop for the normal constant cases (4 or 8 longs,
  63  * for 256 and 512-bit fd_sets respectively)
  64  */
  65 #undef __FD_ZERO
  66 static __inline__ void __FD_ZERO(__kernel_fd_set *p)
     /* [previous][next][first][last][top][bottom][index][help] */
  67 {
  68         unsigned int *tmp = p->fds_bits;
  69         int i;
  70 
  71         if (__builtin_constant_p(__FDSET_INTS)) {
  72                 switch (__FDSET_INTS) {
  73                         case 8:
  74                                 tmp[0] = 0; tmp[1] = 0; tmp[2] = 0; tmp[3] = 0;
  75                                 tmp[4] = 0; tmp[5] = 0; tmp[6] = 0; tmp[7] = 0;
  76                                 return;
  77                         case 4:
  78                                 tmp[0] = 0; tmp[1] = 0; tmp[2] = 0; tmp[3] = 0;
  79                                 return;
  80                 }
  81         }
  82         i = __FDSET_INTS;
  83         while (i) {
  84                 i--;
  85                 *tmp = 0;
  86                 tmp++;
  87         }
  88 }
  89 
  90 #endif /* !(__ARCH_SPARC_POSIX_TYPES_H) */

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