summaryrefslogtreecommitdiff
path: root/thread.c
diff options
context:
space:
mode:
authorkosaki <kosaki@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-05-15 14:57:35 +0000
committerkosaki <kosaki@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-05-15 14:57:35 +0000
commitd734c9dea245305b31a3097387949bcf56351f71 (patch)
tree396c3862a129c9449bfd4a7c8da2629715fc9060 /thread.c
parent2b7996e83978097552b4a280ec9f9983401810e5 (diff)
* include/ruby/intern.h: resurrect old rb_fd_copy().
* thread.c (rb_fd_copy): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31581 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'thread.c')
-rw-r--r--thread.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/thread.c b/thread.c
index 88c396e185..6f7118de47 100644
--- a/thread.c
+++ b/thread.c
@@ -2392,6 +2392,17 @@ rb_fd_isset(int n, const rb_fdset_t *fds)
}
void
+rb_fd_copy(rb_fdset_t *dst, const fd_set *src, int max)
+{
+ size_t size = howmany(max, NFDBITS) * sizeof(fd_mask);
+
+ if (size < sizeof(fd_set)) size = sizeof(fd_set);
+ dst->maxfd = max;
+ dst->fdset = xrealloc(dst->fdset, size);
+ memcpy(dst->fdset, src, size);
+}
+
+void
rb_fd_dup(rb_fdset_t *dst, const rb_fdset_t *src)
{
size_t size = howmany(rb_fd_max(src), NFDBITS) * sizeof(fd_mask);