Project

General

Profile

Bug #1338 ยป fix_select_crash.patch

macks (Kengo Matsuyama), 03/31/2009 05:42 PM

View differences:

include/ruby/intern.h (working copy)
void rb_fd_clr(int, rb_fdset_t *);
int rb_fd_isset(int, const rb_fdset_t *);
void rb_fd_copy(rb_fdset_t *, const fd_set *, int);
void rb_fd_resize(int, rb_fdset_t *);
int rb_fd_select(int, rb_fdset_t *, rb_fdset_t *, rb_fdset_t *, struct timeval *);
#define rb_fd_ptr(f) ((f)->fdset)
......
void rb_fd_set(int, rb_fdset_t *);
#define rb_fd_clr(n, f) rb_w32_fdclr(n, (f)->fdset)
#define rb_fd_isset(n, f) rb_w32_fdisset(n, (f)->fdset)
#define rb_fd_resize(n, f) (void)(f)
#define rb_fd_select(n, rfds, wfds, efds, timeout) rb_w32_select(n, (rfds) ? ((rb_fdset_t*)rfds)->fdset : NULL, (wfds) ? ((rb_fdset_t*)wfds)->fdset : NULL, (efds) ? ((rb_fdset_t*)efds)->fdset: NULL, timeout)
#define rb_fd_ptr(f) ((f)->fdset)
......
#define rb_fd_clr(n, f) FD_CLR(n, f)
#define rb_fd_isset(n, f) FD_ISSET(n, f)
#define rb_fd_copy(d, s, n) (*(d) = *(s))
#define rb_fd_resize(n, f) (void)(f)
#define rb_fd_ptr(f) (f)
#define rb_fd_init(f) FD_ZERO(f)
#define rb_fd_term(f) (void)(f)
io.c (working copy)
ep = 0;
}
if (rp) { rb_fd_resize(max, &fds[0]); rp = rb_fd_ptr(&fds[0]); }
if (wp) { rb_fd_resize(max, &fds[1]); wp = rb_fd_ptr(&fds[1]); }
if (ep) { rb_fd_resize(max, &fds[2]); ep = rb_fd_ptr(&fds[2]); }
max++;
n = rb_thread_select(max, rp, wp, ep, tp);
thread.c (working copy)
}
}
static void
void
rb_fd_resize(int n, rb_fdset_t *fds)
{
int m = howmany(n + 1, NFDBITS) * sizeof(fd_mask);
    (1-1/1)