diff options
author | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-03-30 06:38:05 +0000 |
---|---|---|
committer | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-03-30 06:38:05 +0000 |
commit | 2a4f53a3c6b839a546bf6badc731510c7651d3ae (patch) | |
tree | dfe1062409fef2f44e7848ded9089a273809c7e5 /thread.c | |
parent | edc6b366a13c230732df46a77553f4e3c7bd800b (diff) | |
download | ruby-2a4f53a3c6b839a546bf6badc731510c7651d3ae.tar.gz ruby-2a4f53a3c6b839a546bf6badc731510c7651d3ae.tar.xz ruby-2a4f53a3c6b839a546bf6badc731510c7651d3ae.zip |
* 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
Diffstat (limited to 'thread.c')
-rw-r--r-- | thread.c | 19 |
1 files changed, 19 insertions, 0 deletions
@@ -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 |