7 /***********************************************************
8 Copyright 1991-1995 by Stichting Mathematisch Centrum, Amsterdam,
13 Permission to use, copy, modify, and distribute this software and its
14 documentation for any purpose and without fee is hereby granted,
15 provided that the above copyright notice appear in all copies and that
16 both that copyright notice and this permission notice appear in
17 supporting documentation, and that the names of Stichting Mathematisch
18 Centrum or CWI not be used in advertising or publicity pertaining to
19 distribution of the software without specific, written prior permission.
21 STICHTING MATHEMATISCH CENTRUM DISCLAIMS ALL WARRANTIES WITH REGARD TO
22 THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
23 FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH CENTRUM BE LIABLE
24 FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
25 WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
26 ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
27 OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
29 ******************************************************************/
31 /* Include file for users of select() */
33 /* NB caller must include <sys/types.h> */
35 #ifdef HAVE_SYS_SELECT_H
37 #include <sys/select.h>
39 #ifdef SYS_SELECT_WITH_SYS_TIME
41 #else /* !SYS_SELECT_WITH_SYS_TIME */
43 #endif /* !SYS_SELECT_WITH_SYS_TIME */
45 #else /* !HAVE_SYS_SELECT_H */
49 #endif /* !HAVE_SYS_SELECT_H */
51 /* If the fd manipulation macros aren't defined,
52 here is a set that should do the job */
55 #define FD_SETSIZE 256
62 #define NFDBITS (sizeof(fd_mask) * NBBY) /* bits per mask */
64 #define howmany(x, y) (((x)+((y)-1))/(y))
67 typedef struct fd_set
{
68 fd_mask fds_bits
[howmany(FD_SETSIZE
, NFDBITS
)];
71 #define FD_SET(n, p) ((p)->fds_bits[(n)/NFDBITS] |= (1 << ((n) % NFDBITS)))
72 #define FD_CLR(n, p) ((p)->fds_bits[(n)/NFDBITS] &= ~(1 << ((n) % NFDBITS)))
73 #define FD_ISSET(n, p) ((p)->fds_bits[(n)/NFDBITS] & (1 << ((n) % NFDBITS)))
74 #define FD_ZERO(p) memset((char *)(p), '\0', sizeof(*(p)))
81 #endif /* !Py_MYSELECT_H */