summaryrefslogtreecommitdiff
path: root/win32
diff options
context:
space:
mode:
authorkosaki <kosaki@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-04-30 14:11:34 +0000
committerkosaki <kosaki@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-04-30 14:11:34 +0000
commit04202dc83dde72db03d72227841c6dddbd41a925 (patch)
tree1e4e936793e2a911c4e90d33dcf6c00374605fab /win32
parent3c68095b8a0d665b9ae94ec3c48fa4f30b3fb86a (diff)
* win32/win32.c (rb_w32_fdcopy): New. This can copy even though
fdset size exceed FD_SETSIZE. * include/ruby/intern.h (rb_fd_copy): use rb_w32_fdcopy() git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31397 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'win32')
-rw-r--r--win32/win32.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/win32/win32.c b/win32/win32.c
index 46c57dc47e..a7abbfb4a6 100644
--- a/win32/win32.c
+++ b/win32/win32.c
@@ -2366,6 +2366,18 @@ rb_w32_fdisset(int fd, fd_set *set)
return ret;
}
+void
+rb_w32_fdcopy(rb_fdset_t *dst, const rb_fdset_t *src)
+{
+ if (dst->capa < src->fdset->fd_count) {
+ dst->capa = (src->fdset->fd_count / FD_SETSIZE + 1) * FD_SETSIZE;
+ dst->fdset = xrealloc(dst->fdset, sizeof(unsigned int) + sizeof(SOCKET) * dst->capa);
+ }
+
+ memcpy(dst->fdset->fd_array, src->fdset->fd_array,
+ src->fdset->fd_count * sizeof(src->fdset->fd_array[0]));
+}
+
//
// Networking trampolines
// These are used to avoid socket startup/shutdown overhead in case