From 3567a062c85b03e5d8b1c084068237088070f8d3 Mon Sep 17 00:00:00 2001 From: yugui Date: Thu, 4 Dec 2008 05:19:30 +0000 Subject: merges r20444 and r20447 from trunk into ruby_1_9_1. add comment for select behavior on file descriptors over FD_SETSIZE. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_1@20486 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- thread.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'thread.c') diff --git a/thread.c b/thread.c index 25cdde28c2..805d3a123e 100644 --- a/thread.c +++ b/thread.c @@ -2003,6 +2003,34 @@ rb_thread_priority_set(VALUE thread, VALUE prio) /* for IO */ #if defined(NFDBITS) && defined(HAVE_RB_FD_INIT) + +/* + * several Unix platform supports file descriptors bigger than FD_SETSIZE + * in select(2) system call. + * + * - Linux 2.2.12 (?) + * - NetBSD 1.2 (src/sys/kern/sys_generic.c:1.25) + * select(2) documents how to allocate fd_set dynamically. + * http://netbsd.gw.com/cgi-bin/man-cgi?select++NetBSD-4.0 + * - FreeBSD 2.2 (src/sys/kern/sys_generic.c:1.19) + * - OpenBSD 2.0 (src/sys/kern/sys_generic.c:1.4) + * select(2) documents how to allocate fd_set dynamically. + * http://www.openbsd.org/cgi-bin/man.cgi?query=select&manpath=OpenBSD+4.4 + * - HP-UX documents how to allocate fd_set dynamically. + * http://docs.hp.com/en/B2355-60105/select.2.html + * - Solaris 8 has select_large_fdset + * + * When fd_set is not big enough to hold big file descriptors, + * it should be allocated dynamically. + * Note that this assumes fd_set is structured as bitmap. + * + * rb_fd_init allocates the memory. + * rb_fd_term free the memory. + * rb_fd_set may re-allocates bitmap. + * + * So rb_fd_set doesn't reject file descriptors bigger than FD_SETSIZE. + */ + void rb_fd_init(volatile rb_fdset_t *fds) { -- cgit v1.2.3