1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* io.c (UPDATE_MAXFD): removed.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32581 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
akr 2011-07-19 07:27:26 +00:00
parent bd793165ae
commit b1c03685bc
2 changed files with 11 additions and 11 deletions

View file

@ -1,3 +1,7 @@
Tue Jul 19 16:25:15 2011 Tanaka Akira <akr@fsij.org>
* io.c (UPDATE_MAXFD): removed.
Tue Jul 19 16:07:45 2011 Tanaka Akira <akr@fsij.org>
* io.c (rb_update_max_fd): new function.

18
io.c
View file

@ -151,14 +151,10 @@ struct argf {
};
static int max_file_descriptor = NOFILE;
#define UPDATE_MAXFD(fd) \
do { \
if (max_file_descriptor < (fd)) max_file_descriptor = (fd); \
} while (0)
void
rb_update_max_fd(int fd)
{
UPDATE_MAXFD(fd);
if (max_file_descriptor < (fd)) max_file_descriptor = (fd);
}
#define argf_of(obj) (*(struct argf *)DATA_PTR(obj))
@ -531,7 +527,7 @@ ruby_dup(int orig)
rb_sys_fail(0);
}
}
UPDATE_MAXFD(fd);
rb_update_max_fd(fd);
return fd;
}
@ -4622,7 +4618,7 @@ rb_sysopen(VALUE fname, int oflags, mode_t perm)
rb_sys_fail(RSTRING_PTR(fname));
}
}
UPDATE_MAXFD(fd);
rb_update_max_fd(fd);
return fd;
}
@ -4915,8 +4911,8 @@ rb_pipe(int *pipes)
}
}
if (ret == 0) {
UPDATE_MAXFD(pipes[0]);
UPDATE_MAXFD(pipes[1]);
rb_update_max_fd(pipes[0]);
rb_update_max_fd(pipes[1]);
}
return ret;
}
@ -6540,7 +6536,7 @@ rb_io_initialize(int argc, VALUE *argv, VALUE io)
#else
if (fstat(fd, &st) == -1) rb_sys_fail(0);
#endif
UPDATE_MAXFD(fd);
rb_update_max_fd(fd);
#if defined(HAVE_FCNTL) && defined(F_GETFL)
ofmode = rb_io_oflags_fmode(oflags);
if (NIL_P(vmode)) {
@ -7695,7 +7691,7 @@ io_cntl(int fd, int cmd, long narg, int io_p)
retval = (int)rb_thread_io_blocking_region(nogvl_io_cntl, &arg, fd);
#if defined(F_DUPFD)
if (!io_p && retval != -1 && cmd == F_DUPFD) {
UPDATE_MAXFD(retval);
rb_update_max_fd(retval);
}
#endif