ruby-changes:15501
From: nobu <ko1@a...>
Date: Tue, 20 Apr 2010 00:41:43 +0900 (JST)
Subject: [ruby-changes:15501] Ruby:r27403 (trunk): * io.c (internal_{read,write}_func, rb_{read,write}_internal):
nobu 2010-04-20 00:41:27 +0900 (Tue, 20 Apr 2010) New Revision: 27403 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=27403 Log: * io.c (internal_{read,write}_func, rb_{read,write}_internal): reverted r27265, since now rb_thread_blocking_region() preserves errno. Modified files: trunk/ChangeLog trunk/io.c Index: ChangeLog =================================================================== --- ChangeLog (revision 27402) +++ ChangeLog (revision 27403) @@ -1,3 +1,9 @@ +Tue Apr 20 00:41:25 2010 Nobuyoshi Nakada <nobu@r...> + + * io.c (internal_{read,write}_func, rb_{read,write}_internal): + reverted r27265, since now rb_thread_blocking_region() preserves + errno. + Mon Apr 19 23:14:45 2010 Yusuke Endoh <mame@t...> * thread.c (rb_thread_blocking_region, rb_thread_blocking_region_end): Index: io.c =================================================================== --- io.c (revision 27402) +++ io.c (revision 27403) @@ -530,7 +530,6 @@ struct io_internal_struct { int fd; - int saved_errno; void *buf; size_t capa; }; @@ -539,48 +538,36 @@ internal_read_func(void *ptr) { struct io_internal_struct *iis = (struct io_internal_struct*)ptr; - ssize_t ret = read(iis->fd, iis->buf, iis->capa); - iis->saved_errno = errno; - return (VALUE)ret; + return read(iis->fd, iis->buf, iis->capa); } static VALUE internal_write_func(void *ptr) { struct io_internal_struct *iis = (struct io_internal_struct*)ptr; - ssize_t ret = write(iis->fd, iis->buf, iis->capa); - iis->saved_errno = errno; - return (VALUE)ret; + return write(iis->fd, iis->buf, iis->capa); } static ssize_t rb_read_internal(int fd, void *buf, size_t count) { struct io_internal_struct iis; - ssize_t ret; - iis.fd = fd; iis.buf = buf; iis.capa = count; - ret = (ssize_t)rb_thread_blocking_region(internal_read_func, &iis, RUBY_UBF_IO, 0); - errno = iis.saved_errno; - return ret; + return (ssize_t)rb_thread_blocking_region(internal_read_func, &iis, RUBY_UBF_IO, 0); } static ssize_t rb_write_internal(int fd, void *buf, size_t count) { struct io_internal_struct iis; - ssize_t ret; - iis.fd = fd; iis.buf = buf; iis.capa = count; - ret = (ssize_t)rb_thread_blocking_region(internal_write_func, &iis, RUBY_UBF_IO, 0); - errno = iis.saved_errno; - return ret; + return (ssize_t)rb_thread_blocking_region(internal_write_func, &iis, RUBY_UBF_IO, 0); } static long -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/