Dr Andrew Scott G7VAV

My photo
 
April 2024
Mo Tu We Th Fr Sa Su
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30 1 2 3 4 5
6 7 8 9 10 11 12


select.h
001: /* `fd_set' type and related macros, and `select'/`pselect' declarations.
002:    Copyright (C) 1996-2003, 2009, 2011 Free Software Foundation, Inc.
003:    This file is part of the GNU C Library.
004: 
005:    The GNU C Library is free software; you can redistribute it and/or
006:    modify it under the terms of the GNU Lesser General Public
007:    License as published by the Free Software Foundation; either
008:    version 2.1 of the License, or (at your option) any later version.
009: 
010:    The GNU C Library is distributed in the hope that it will be useful,
011:    but WITHOUT ANY WARRANTY; without even the implied warranty of
012:    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
013:    Lesser General Public License for more details.
014: 
015:    You should have received a copy of the GNU Lesser General Public
016:    License along with the GNU C Library; if not, write to the Free
017:    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
018:    02111-1307 USA.  */
019: 
020: /*      POSIX 1003.1g: 6.2 Select from File Descriptor Sets <sys/select.h>  */
021: 
022: #ifndef _SYS_SELECT_H
023: #define _SYS_SELECT_H   1
024: 
025: #include <features.h>
026: 
027: /* Get definition of needed basic types.  */
028: #include <bits/types.h>
029: 
030: /* Get __FD_* definitions.  */
031: #include <bits/select.h>
032: 
033: /* Get __sigset_t.  */
034: #include <bits/sigset.h>
035: 
036: #ifndef __sigset_t_defined
037: # define __sigset_t_defined
038: typedef __sigset_t sigset_t;
039: #endif
040: 
041: /* Get definition of timer specification structures.  */
042: #define __need_time_t
043: #define __need_timespec
044: #include <time.h>
045: #define __need_timeval
046: #include <bits/time.h>
047: 
048: #ifndef __suseconds_t_defined
049: typedef __suseconds_t suseconds_t;
050: # define __suseconds_t_defined
051: #endif
052: 
053: 
054: /* The fd_set member is required to be an array of longs.  */
055: typedef long int __fd_mask;
056: 
057: /* Some versions of <linux/posix_types.h> define this macros.  */
058: #undef  __NFDBITS
059: /* It's easier to assume 8-bit bytes than to get CHAR_BIT.  */
060: #define __NFDBITS       (8 * (int) sizeof (__fd_mask))
061: #define __FD_ELT(d)     ((d) / __NFDBITS)
062: #define __FD_MASK(d)    ((__fd_mask) 1 << ((d) % __NFDBITS))
063: 
064: /* fd_set for select and pselect.  */
065: typedef struct
066:   {
067:     /* XPG4.2 requires this member name.  Otherwise avoid the name
068:        from the global namespace.  */
069: #ifdef __USE_XOPEN
070:     __fd_mask fds_bits[__FD_SETSIZE / __NFDBITS];
071: # define __FDS_BITS(set) ((set)->fds_bits)
072: #else
073:     __fd_mask __fds_bits[__FD_SETSIZE / __NFDBITS];
074: # define __FDS_BITS(set) ((set)->__fds_bits)
075: #endif
076:   } fd_set;
077: 
078: /* Maximum number of file descriptors in `fd_set'.  */
079: #define FD_SETSIZE              __FD_SETSIZE
080: 
081: #ifdef __USE_MISC
082: /* Sometimes the fd_set member is assumed to have this type.  */
083: typedef __fd_mask fd_mask;
084: 
085: /* Number of bits per word of `fd_set' (some code assumes this is 32).  */
086: # define NFDBITS                __NFDBITS
087: #endif
088: 
089: 
090: /* Access macros for `fd_set'.  */
091: #define FD_SET(fd, fdsetp)      __FD_SET (fd, fdsetp)
092: #define FD_CLR(fd, fdsetp)      __FD_CLR (fd, fdsetp)
093: #define FD_ISSET(fd, fdsetp)    __FD_ISSET (fd, fdsetp)
094: #define FD_ZERO(fdsetp)         __FD_ZERO (fdsetp)
095: 
096: 
097: __BEGIN_DECLS
098: 
099: /* Check the first NFDS descriptors each in READFDS (if not NULL) for read
100:    readiness, in WRITEFDS (if not NULL) for write readiness, and in EXCEPTFDS
101:    (if not NULL) for exceptional conditions.  If TIMEOUT is not NULL, time out
102:    after waiting the interval specified therein.  Returns the number of ready
103:    descriptors, or -1 for errors.
104: 
105:    This function is a cancellation point and therefore not marked with
106:    __THROW.  */
107: extern int select (int __nfds, fd_set *__restrict __readfds,
108:                    fd_set *__restrict __writefds,
109:                    fd_set *__restrict __exceptfds,
110:                    struct timeval *__restrict __timeout);
111: 
112: #ifdef __USE_XOPEN2K
113: /* Same as above only that the TIMEOUT value is given with higher
114:    resolution and a sigmask which is been set temporarily.  This version
115:    should be used.
116: 
117:    This function is a cancellation point and therefore not marked with
118:    __THROW.  */
119: extern int pselect (int __nfds, fd_set *__restrict __readfds,
120:                     fd_set *__restrict __writefds,
121:                     fd_set *__restrict __exceptfds,
122:                     const struct timespec *__restrict __timeout,
123:                     const __sigset_t *__restrict __sigmask);
124: #endif
125: 
126: 
127: /* Define some inlines helping to catch common problems.  */
128: #if __USE_FORTIFY_LEVEL > 0 && defined __GNUC__
129: # include <bits/select2.h>
130: #endif
131: 
132: __END_DECLS
133: 
134: #endif /* sys/select.h */
135: 


for client 3.133.108.241
© Andrew Scott 2006 - 2024,
All Rights Reserved
http://www.andrew-scott.uk/
Andrew Scott
http://www.andrew-scott.co.uk/