Print this page
    
remove support for non-ANSI compilation
    
      
        | Split | 
	Close | 
      
      | Expand all | 
      | Collapse all | 
    
    
          --- old/usr/src/uts/common/sys/select.h
          +++ new/usr/src/uts/common/sys/select.h
   1    1  /*
   2    2   * CDDL HEADER START
   3    3   *
   4    4   * The contents of this file are subject to the terms of the
   5    5   * Common Development and Distribution License (the "License").
   6    6   * You may not use this file except in compliance with the License.
   7    7   *
   8    8   * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9    9   * or http://www.opensolaris.org/os/licensing.
  10   10   * See the License for the specific language governing permissions
  11   11   * and limitations under the License.
  12   12   *
  
    | 
      ↓ open down ↓ | 
    12 lines elided | 
    
      ↑ open up ↑ | 
  
  13   13   * When distributing Covered Code, include this CDDL HEADER in each
  14   14   * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15   15   * If applicable, add the following below this CDDL HEADER, with the
  16   16   * fields enclosed by brackets "[]" replaced with your own identifying
  17   17   * information: Portions Copyright [yyyy] [name of copyright owner]
  18   18   *
  19   19   * CDDL HEADER END
  20   20   */
  21   21  
  22   22  /*
       23 + * Copyright 2014 Garrett D'Amore <garrett@damore.org>
       24 + *
  23   25   * Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
  24   26   * Use is subject to license terms.
  25   27   */
  26   28  
  27   29  /*      Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
  28   30  /*        All Rights Reserved   */
  29   31  
  30   32  /*
  31   33   * University Copyright- Copyright (c) 1982, 1986, 1988
  32   34   * The Regents of the University of California
  33   35   * All Rights Reserved
  34   36   *
  35   37   * University Acknowledgment- Portions of this document are derived from
  36   38   * software developed by the University of California, Berkeley, and its
  37   39   * contributors.
  38   40   */
  39   41  
  40   42  #ifndef _SYS_SELECT_H
  41   43  #define _SYS_SELECT_H
  42   44  
  43   45  #include <sys/feature_tests.h>
  44   46  
  45   47  #ifndef _KERNEL
  46   48  #if !defined(__XOPEN_OR_POSIX) || defined(_XPG6) || defined(__EXTENSIONS__)
  47   49  #include <sys/time_impl.h>
  48   50  #endif
  49   51  #include <sys/time.h>
  50   52  #endif /* _KERNEL */
  51   53  
  52   54  #ifdef  __cplusplus
  53   55  extern "C" {
  54   56  #endif
  55   57  
  56   58  
  57   59  #if !defined(__XOPEN_OR_POSIX) || defined(_XPG6) || defined(__EXTENSIONS__)
  58   60  /*
  59   61   * The sigset_t type is defined in <sys/signal.h> and duplicated
  60   62   * in <sys/ucontext.h> as a result of XPG4v2 requirements. XPG6
  61   63   * now allows the visibility of signal.h in this header, however
  62   64   * an order of inclusion problem occurs as a result of inclusion
  63   65   * of <sys/select.h> in <signal.h> under certain conditions.
  64   66   * Rather than include <sys/signal.h> here, we've duplicated
  65   67   * the sigset_t type instead. This type is required for the XPG6
  66   68   * introduced pselect() function also declared in this header.
  67   69   */
  68   70  #ifndef _SIGSET_T
  69   71  #define _SIGSET_T
  70   72  typedef struct {                /* signal set type */
  71   73          unsigned int    __sigbits[4];
  72   74  } sigset_t;
  73   75  #endif  /* _SIGSET_T */
  74   76  
  75   77  #endif /* #if !defined(__XOPEN_OR_POSIX) || defined(_XPG6) ... */
  76   78  
  77   79  /*
  78   80   * Select uses bit masks of file descriptors in longs.
  79   81   * These macros manipulate such bit fields.
  80   82   * FD_SETSIZE may be defined by the user, but the default here
  81   83   * should be >= NOFILE (param.h).
  82   84   */
  83   85  #ifndef FD_SETSIZE
  84   86  #ifdef _LP64
  85   87  #define FD_SETSIZE      65536
  86   88  #else
  87   89  #define FD_SETSIZE      1024
  88   90  #endif  /* _LP64 */
  89   91  #elif FD_SETSIZE > 1024 && !defined(_LP64)
  90   92  #ifdef __PRAGMA_REDEFINE_EXTNAME
  91   93  #pragma redefine_extname        select  select_large_fdset
  92   94  #if !defined(__XOPEN_OR_POSIX) || defined(_XPG6) || defined(__EXTENSIONS__)
  93   95  #pragma redefine_extname        pselect pselect_large_fdset
  94   96  #endif
  95   97  #else   /* __PRAGMA_REDEFINE_EXTNAME */
  96   98  #define select  select_large_fdset
  97   99  #if !defined(__XOPEN_OR_POSIX) || defined(_XPG6) || defined(__EXTENSIONS__)
  98  100  #define pselect pselect_large_fdset
  99  101  #endif
 100  102  #endif  /* __PRAGMA_REDEFINE_EXTNAME */
 101  103  #endif  /* FD_SETSIZE */
 102  104  
 103  105  #if !defined(_XPG4_2) || defined(__EXTENSIONS__)
 104  106  typedef long    fd_mask;
 105  107  #endif
 106  108  typedef long    fds_mask;
 107  109  
 108  110  /*
 109  111   *  The value of _NBBY needs to be consistant with the value
 110  112   *  of NBBY in <sys/param.h>.
 111  113   */
 112  114  #define _NBBY 8
 113  115  #if !defined(_XPG4_2) || defined(__EXTENSIONS__)
 114  116  #ifndef NBBY            /* number of bits per byte */
 115  117  #define NBBY _NBBY
 116  118  #endif
 117  119  #endif /* !defined(_XPG4_2) || defined(__EXTENSIONS__) */
 118  120  
 119  121  #if !defined(_XPG4_2) || defined(__EXTENSIONS__)
 120  122  #define NFDBITS         (sizeof (fd_mask) * NBBY)       /* bits per mask */
 121  123  #endif
 122  124  #define FD_NFDBITS      (sizeof (fds_mask) * _NBBY)     /* bits per mask */
 123  125  
 124  126  #define __howmany(__x, __y)     (((__x)+((__y)-1))/(__y))
 125  127  #if !defined(_XPG4_2) || defined(__EXTENSIONS__)
 126  128  #ifndef howmany
 127  129  #define howmany(x, y)   (((x)+((y)-1))/(y))
 128  130  #endif
 129  131  #endif /* !defined(_XPG4_2) || defined(__EXTENSIONS__) */
 130  132  
 131  133  #if !defined(_XPG4_2) || defined(__EXTENSIONS__)
 132  134  typedef struct fd_set {
 133  135  #else
 134  136  typedef struct __fd_set {
 135  137  #endif
 136  138          long    fds_bits[__howmany(FD_SETSIZE, FD_NFDBITS)];
 137  139  } fd_set;
 138  140  
 139  141  #define FD_SET(__n, __p)        ((__p)->fds_bits[(__n)/FD_NFDBITS] |= \
 140  142                                      (1ul << ((__n) % FD_NFDBITS)))
 141  143  
 142  144  #define FD_CLR(__n, __p)        ((__p)->fds_bits[(__n)/FD_NFDBITS] &= \
 143  145                                      ~(1ul << ((__n) % FD_NFDBITS)))
 144  146  
  
    | 
      ↓ open down ↓ | 
    112 lines elided | 
    
      ↑ open up ↑ | 
  
 145  147  #define FD_ISSET(__n, __p)      (((__p)->fds_bits[(__n)/FD_NFDBITS] & \
 146  148                                      (1ul << ((__n) % FD_NFDBITS))) != 0l)
 147  149  
 148  150  #ifdef _KERNEL
 149  151  #define FD_ZERO(p)      bzero((p), sizeof (*(p)))
 150  152  #else
 151  153  #define FD_ZERO(__p)    (void) memset((__p), 0, sizeof (*(__p)))
 152  154  #endif /* _KERNEL */
 153  155  
 154  156  #ifndef _KERNEL
 155      -#ifdef  __STDC__
 156  157  extern int select(int, fd_set *_RESTRICT_KYWD, fd_set *_RESTRICT_KYWD,
 157  158          fd_set *_RESTRICT_KYWD, struct timeval *_RESTRICT_KYWD);
 158  159  
 159  160  #if !defined(__XOPEN_OR_POSIX) || defined(_XPG6) || defined(__EXTENSIONS__)
 160  161  extern int pselect(int, fd_set *_RESTRICT_KYWD, fd_set *_RESTRICT_KYWD,
 161  162          fd_set *_RESTRICT_KYWD, const struct timespec *_RESTRICT_KYWD,
 162  163          const sigset_t *_RESTRICT_KYWD);
 163  164  #endif
 164  165  
 165      -#else
 166      -extern int select();
 167      -#if !defined(__XOPEN_OR_POSIX) || defined(_XPG6) || defined(__EXTENSIONS__)
 168      -extern int pselect();
 169      -#endif
 170      -#endif  /* __STDC__ */
 171  166  #endif  /* _KERNEL */
 172  167  
 173  168  #ifdef  __cplusplus
 174  169  }
 175  170  #endif
 176  171  
 177  172  #endif  /* _SYS_SELECT_H */
    
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX