3 Copyright 1998 Cygnus Solutions.
5 This file is part of Cygwin.
7 This software is a copyrighted work licensed under the terms of the
8 Cygwin license. Please consult the file "CYGWIN_LICENSE" for
11 /* Winsock select() types and macros */
14 * Use this struct to interface to
15 * the system provided select.
17 typedef struct winsock_fd_set
19 unsigned int fd_count;
20 HANDLE fd_array[1024]; /* Dynamically allocated. */
24 * Define the Win32 winsock definitions to have a prefix WINSOCK_
25 * so we can be explicit when we are using them.
27 #define WINSOCK_FD_ISSET(fd, set) __WSAFDIsSet ((SOCKET)fd, (fd_set *)set)
28 #define WINSOCK_FD_SET(fd, set) do { \
29 (set)->fd_array[(set)->fd_count++]=fd;\
31 #define WINSOCK_FD_ZERO(set) ((set)->fd_count = 0)
32 #define WINSOCK_FD_CLR(fd, set) do { \
34 for (__i = 0; __i < (set)->fd_count ; __i++) { \
35 if ((set)->fd_array[__i] == fd) { \
36 while (__i < (set)->fd_count-1) { \
37 (set)->fd_array[__i] = \
38 (set)->fd_array[__i+1]; \
47 extern "C" int PASCAL __WSAFDIsSet(SOCKET, fd_set*);
48 extern "C" int PASCAL win32_select(int, fd_set*, fd_set*, fd_set*, const struct timeval*);
51 * call to winsock's select() -
52 * type coercion need to appease confused prototypes
54 #define WINSOCK_SELECT(nfd, rd, wr, ex, timeo) \
55 win32_select (nfd, (fd_set *)rd, (fd_set *)wr, (fd_set *)ex, timeo)