* 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:
parent
bd793165ae
commit
b1c03685bc
@ -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>
|
Tue Jul 19 16:07:45 2011 Tanaka Akira <akr@fsij.org>
|
||||||
|
|
||||||
* io.c (rb_update_max_fd): new function.
|
* io.c (rb_update_max_fd): new function.
|
||||||
|
18
io.c
18
io.c
@ -151,14 +151,10 @@ struct argf {
|
|||||||
};
|
};
|
||||||
|
|
||||||
static int max_file_descriptor = NOFILE;
|
static int max_file_descriptor = NOFILE;
|
||||||
#define UPDATE_MAXFD(fd) \
|
|
||||||
do { \
|
|
||||||
if (max_file_descriptor < (fd)) max_file_descriptor = (fd); \
|
|
||||||
} while (0)
|
|
||||||
void
|
void
|
||||||
rb_update_max_fd(int fd)
|
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))
|
#define argf_of(obj) (*(struct argf *)DATA_PTR(obj))
|
||||||
@ -531,7 +527,7 @@ ruby_dup(int orig)
|
|||||||
rb_sys_fail(0);
|
rb_sys_fail(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
UPDATE_MAXFD(fd);
|
rb_update_max_fd(fd);
|
||||||
return fd;
|
return fd;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4622,7 +4618,7 @@ rb_sysopen(VALUE fname, int oflags, mode_t perm)
|
|||||||
rb_sys_fail(RSTRING_PTR(fname));
|
rb_sys_fail(RSTRING_PTR(fname));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
UPDATE_MAXFD(fd);
|
rb_update_max_fd(fd);
|
||||||
return fd;
|
return fd;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4915,8 +4911,8 @@ rb_pipe(int *pipes)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (ret == 0) {
|
if (ret == 0) {
|
||||||
UPDATE_MAXFD(pipes[0]);
|
rb_update_max_fd(pipes[0]);
|
||||||
UPDATE_MAXFD(pipes[1]);
|
rb_update_max_fd(pipes[1]);
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@ -6540,7 +6536,7 @@ rb_io_initialize(int argc, VALUE *argv, VALUE io)
|
|||||||
#else
|
#else
|
||||||
if (fstat(fd, &st) == -1) rb_sys_fail(0);
|
if (fstat(fd, &st) == -1) rb_sys_fail(0);
|
||||||
#endif
|
#endif
|
||||||
UPDATE_MAXFD(fd);
|
rb_update_max_fd(fd);
|
||||||
#if defined(HAVE_FCNTL) && defined(F_GETFL)
|
#if defined(HAVE_FCNTL) && defined(F_GETFL)
|
||||||
ofmode = rb_io_oflags_fmode(oflags);
|
ofmode = rb_io_oflags_fmode(oflags);
|
||||||
if (NIL_P(vmode)) {
|
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);
|
retval = (int)rb_thread_io_blocking_region(nogvl_io_cntl, &arg, fd);
|
||||||
#if defined(F_DUPFD)
|
#if defined(F_DUPFD)
|
||||||
if (!io_p && retval != -1 && cmd == F_DUPFD) {
|
if (!io_p && retval != -1 && cmd == F_DUPFD) {
|
||||||
UPDATE_MAXFD(retval);
|
rb_update_max_fd(retval);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user