From 2a4f53a3c6b839a546bf6badc731510c7651d3ae Mon Sep 17 00:00:00 2001 From: akr Date: Sun, 30 Mar 2008 06:38:05 +0000 Subject: * io.c: IO.copy_stream implemented. [ruby-dev:33843] * thread.c (rb_fd_select): new function. * configure.in (sys/sendfile.h): check the header file. (sendfile): check the function. (pread): check the function. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@15858 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- thread.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'thread.c') diff --git a/thread.c b/thread.c index 8fc6dd924..bdf1d4acc 100644 --- a/thread.c +++ b/thread.c @@ -1702,6 +1702,25 @@ rb_fd_copy(rb_fdset_t *dst, const fd_set *src, int max) memcpy(dst->fdset, src, size); } +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); +} + #undef FD_ZERO #undef FD_SET #undef FD_CLR -- cgit