diff options
author | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2004-12-06 08:40:30 +0000 |
---|---|---|
committer | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2004-12-06 08:40:30 +0000 |
commit | 04f36c2bba797225f0ab8f2bd83de86e1203ac47 (patch) | |
tree | 92055143e8d1ef22277637802fff499dd1e06d09 /ext/io/wait | |
parent | 35091fdda5bb3aa55d49c1c6bf20964a7a920bee (diff) |
* rubyio.h, intern.h, io.c, file.c, process.c, ext/socket/socket.c,
ext/pty/pty.c, ext/io/wait/wait.c, ext/openssl/ossl_ssl.c:
Use own buffering mechanism instead of stdio.
* io.c, ext/stringio/stringio.c, test/ruby/ut_eof.rb:
EOF flag removed.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@7473 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/io/wait')
-rw-r--r-- | ext/io/wait/wait.c | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/ext/io/wait/wait.c b/ext/io/wait/wait.c index 53d5bd7d18..df8d24c29b 100644 --- a/ext/io/wait/wait.c +++ b/ext/io/wait/wait.c @@ -40,15 +40,12 @@ io_ready_p(io) VALUE io; { OpenFile *fptr; - FILE *fp; int n; GetOpenFile(io, fptr); rb_io_check_readable(fptr); - fp = fptr->f; - if (feof(fp)) return Qfalse; - if (rb_read_pending(fp)) return Qtrue; - if (ioctl(fileno(fp), FIONREAD, &n)) rb_sys_fail(0); + if (rb_io_read_pending(fptr)) return Qtrue; + if (ioctl(fptr->fd, FIONREAD, &n)) rb_sys_fail(0); if (n > 0) return INT2NUM(n); return Qnil; } @@ -68,7 +65,6 @@ io_wait(argc, argv, io) { OpenFile *fptr; fd_set rd; - FILE *fp; int fd, n; VALUE timeout; struct timeval *tp, timerec; @@ -84,16 +80,14 @@ io_wait(argc, argv, io) tp = &timerec; } - fp = fptr->f; - if (feof(fp)) return Qfalse; - if (rb_read_pending(fp)) return Qtrue; - fd = fileno(fp); + if (rb_io_read_pending(fptr)) return Qtrue; + fd = fptr->fd; FD_ZERO(&rd); FD_SET(fd, &rd); if (rb_thread_select(fd + 1, &rd, NULL, NULL, tp) < 0) rb_sys_fail(0); rb_io_check_closed(fptr); - if (ioctl(fileno(fp), FIONREAD, &n)) rb_sys_fail(0); + if (ioctl(fptr->fd, FIONREAD, &n)) rb_sys_fail(0); if (n > 0) return io; return Qnil; } |