* io.c (internal_{read,write}_func, rb_{read,write}_internal):

reverted r27265, since now rb_thread_blocking_region() preserves
  errno.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27403 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2010-04-19 15:41:27 +00:00
Родитель aef15affc7
Коммит a91d8b8c33
2 изменённых файлов: 10 добавлений и 17 удалений

Просмотреть файл

@ -1,3 +1,9 @@
Tue Apr 20 00:41:25 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
* 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@tsg.ne.jp>
* thread.c (rb_thread_blocking_region, rb_thread_blocking_region_end):

21
io.c
Просмотреть файл

@ -530,7 +530,6 @@ wsplit_p(rb_io_t *fptr)
struct io_internal_struct {
int fd;
int saved_errno;
void *buf;
size_t capa;
};
@ -539,48 +538,36 @@ static VALUE
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