зеркало из https://github.com/github/ruby.git
* ext/io/wait/wait.c: wrong backport from trunk, and compile error on
platforms fd_set is not a bit set. fixed: [ruby-dev:26562] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@8789 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
8c2e1ce91c
Коммит
5e69b52014
|
@ -1,3 +1,8 @@
|
|||
Mon Jul 18 12:23:27 2005 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp>
|
||||
|
||||
* ext/io/wait/wait.c: wrong backport from trunk, and compile error on
|
||||
platforms fd_set is not a bit set. fixed: [ruby-dev:26562]
|
||||
|
||||
Mon Jul 18 09:36:25 2005 Tanaka Akira <akr@m17n.org>
|
||||
|
||||
* rubyio.h (FMODE_WSPLIT, FMODE_WSPLIT_INITIALIZED): new constant.
|
||||
|
@ -9,8 +14,8 @@ Mon Jul 18 09:36:25 2005 Tanaka Akira <akr@m17n.org>
|
|||
|
||||
Mon Jul 18 05:00:00 2005 NARUSE, Yui <naruse@ruby-lang.org>
|
||||
|
||||
* ext/nkf/nkf-utf8/nkf.c: import nkf.c 1.73
|
||||
fix: TestKconv 1F
|
||||
* ext/nkf/nkf-utf8/nkf.c: import nkf.c 1.73
|
||||
fix: TestKconv 1F
|
||||
|
||||
Sun Jul 17 13:46:54 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
|
|
|
@ -17,14 +17,21 @@
|
|||
#include <sys/types.h>
|
||||
#if defined(FIONREAD_HEADER)
|
||||
#include FIONREAD_HEADER
|
||||
#elif defined(HAVE_RB_W32_IOCTLSOCKET)
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_RB_W32_IOCTLSOCKET
|
||||
#define ioctl ioctlsocket
|
||||
#define ioctl_arg u_long
|
||||
#define ioctl_arg2num(i) ULONG2NUM(i)
|
||||
#else
|
||||
#define ioctl_arg int
|
||||
#define ioctl_arg2num(i) INT2NUM(i)
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_RB_W32_IS_SOCKET
|
||||
#define FIONREAD_POSSIBLE_P(fd) rb_w32_is_socket(fptr->fd)
|
||||
#define FIONREAD_POSSIBLE_P(fd) rb_w32_is_socket(fd)
|
||||
#else
|
||||
#define FIONREAD_POSSIBLE_P(fd) Qtrue
|
||||
#define FIONREAD_POSSIBLE_P(fd) ((fd),Qtrue)
|
||||
#endif
|
||||
|
||||
static VALUE io_ready_p _((VALUE io));
|
||||
|
@ -50,14 +57,14 @@ io_ready_p(io)
|
|||
VALUE io;
|
||||
{
|
||||
OpenFile *fptr;
|
||||
int n;
|
||||
ioctl_arg n;
|
||||
|
||||
GetOpenFile(io, fptr);
|
||||
rb_io_check_readable(fptr);
|
||||
if (rb_io_read_pending(fptr)) return Qtrue;
|
||||
if (!FIONREAD_POSSIBLE_P(fptr->fd)) return Qfalse;
|
||||
if (ioctl(fptr->fd, FIONREAD, &n)) rb_sys_fail(0);
|
||||
if (n > 0) return INT2NUM(n);
|
||||
if (n > 0) return ioctl_arg2num(n);
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
|
@ -93,7 +100,8 @@ io_wait(argc, argv, io)
|
|||
{
|
||||
OpenFile *fptr;
|
||||
struct wait_readable_arg arg;
|
||||
int fd, n;
|
||||
int fd, i;
|
||||
ioctl_arg n;
|
||||
VALUE timeout;
|
||||
struct timeval timerec;
|
||||
|
||||
|
@ -114,12 +122,12 @@ io_wait(argc, argv, io)
|
|||
rb_fd_init(&arg.fds);
|
||||
rb_fd_set(fd, &arg.fds);
|
||||
#ifdef HAVE_RB_FD_INIT
|
||||
n = (int)rb_ensure(wait_readable, (VALUE)&arg,
|
||||
i = (int)rb_ensure(wait_readable, (VALUE)&arg,
|
||||
(VALUE (*)_((VALUE)))rb_fd_term, (VALUE)&arg.fds);
|
||||
#else
|
||||
n = rb_thread_select(fd + 1, rb_fd_ptr(&rd), NULL, NULL, tp)
|
||||
i = rb_thread_select(fd + 1, rb_fd_ptr(&arg.fds), NULL, NULL, arg.timeout);
|
||||
#endif
|
||||
if (n < 0)
|
||||
if (i < 0)
|
||||
rb_sys_fail(0);
|
||||
rb_io_check_closed(fptr);
|
||||
if (ioctl(fptr->fd, FIONREAD, &n)) rb_sys_fail(0);
|
||||
|
|
Загрузка…
Ссылка в новой задаче