int rb_fd_select(int n, rb_fdset_t *readfds, rb_fdset_t *writefds, rb_fdset_t *exceptfds, struct timeval *timeout) { fd_set *r = NULL, *w = NULL, *e = NULL; if (readfds) { rb_fd_resize(n - 1, readfds); r = rb_fd_ptr(readfds); } if (writefds) { rb_fd_resize(n - 1, writefds); w = rb_fd_ptr(writefds); } if (exceptfds) { rb_fd_resize(n - 1, exceptfds); e = rb_fd_ptr(exceptfds); } return select(n, r, w, e, timeout); }
static int native_fd_select(int n, rb_fdset_t *readfds, rb_fdset_t *writefds, rb_fdset_t *exceptfds, struct timeval *timeout, rb_thread_t *th) { fd_set *r = NULL, *w = NULL, *e = NULL; if (readfds) { rb_fd_resize(n - 1, readfds); r = rb_fd_ptr(readfds); } if (writefds) { rb_fd_resize(n - 1, writefds); w = rb_fd_ptr(writefds); } if (exceptfds) { rb_fd_resize(n - 1, exceptfds); e = rb_fd_ptr(exceptfds); } return rb_w32_select_with_thread(n, r, w, e, timeout, th); }
void rb_fd_set(int n, rb_fdset_t *fds) { rb_fd_resize(n, fds); FD_SET(n, fds->fdset); }