This commit is contained in:
manojampalam 2016-03-05 13:51:19 -08:00
parent 10acae4a83
commit 36c8b94217
4 changed files with 8 additions and 8 deletions

View File

@ -7,7 +7,6 @@
#include <memory.h>
#define fd_set w32_fd_set
#undef FD_ZERO
#define FD_ZERO(set) (memset( (set), 0, sizeof(w32_fd_set)))
#undef FD_SET

View File

@ -5,5 +5,6 @@
*/
#include "..\w32posix.h"
#define fd_set w32_fd_set
#define select w32_select

View File

@ -10,8 +10,8 @@
#include <stdio.h>
#include "defs.h"
//File Descriptor definitions
#define MAX_FDS 128 //a 2^n number
/* total fds that can be allotted */
#define MAX_FDS 256 /* a 2^n number */
typedef struct w32_fd_set_ {
unsigned char bitmap[MAX_FDS >> 3];
@ -50,7 +50,7 @@ FILE* w32_fdopen(int fd, const char *mode);
/*common i/o*/
#define fcntl w32_fcntl
int w32_close(int fd);
int w32_select(int fds, fd_set* readfds, fd_set* writefds, fd_set* exceptfds,
int w32_select(int fds, w32_fd_set* readfds, w32_fd_set* writefds, w32_fd_set* exceptfds,
const struct timeval *timeout);
int w32_fcntl(int fd, int cmd, ... /* arg */);
int w32_dup(int oldfd);

View File

@ -411,18 +411,18 @@ w32_fcntl(int fd, int cmd, ... /* arg */) {
}
int
w32_select(int fds, fd_set* readfds, fd_set* writefds, fd_set* exceptfds,
w32_select(int fds, w32_fd_set* readfds, w32_fd_set* writefds, w32_fd_set* exceptfds,
const struct timeval *timeout) {
ULONGLONG ticks_start = GetTickCount64(), ticks_now;
fd_set read_ready_fds, write_ready_fds;
w32_fd_set read_ready_fds, write_ready_fds;
HANDLE events[32];
int num_events = 0;
int in_set_fds = 0, out_ready_fds = 0, i;
unsigned int time_milliseconds = timeout->tv_sec * 100 + timeout->tv_usec / 1000;
errno = 0;
memset(&read_ready_fds, 0, sizeof(fd_set));
memset(&write_ready_fds, 0, sizeof(fd_set));
memset(&read_ready_fds, 0, sizeof(w32_fd_set));
memset(&write_ready_fds, 0, sizeof(w32_fd_set));
if (fds > MAX_FDS) {
errno = EINVAL;