diff options
author | headius <headius@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-04-08 19:58:55 +0000 |
---|---|---|
committer | headius <headius@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-04-08 19:58:55 +0000 |
commit | 0626d9b91c8e64dbbe90fd966ea95d2c80f9632e (patch) | |
tree | 628cf13afa093ab594e5a1b0e033f9015034c292 /include/ruby | |
parent | 46eddae1b486ae73480d00ebd99adb94ea04eb57 (diff) | |
download | ruby-0626d9b91c8e64dbbe90fd966ea95d2c80f9632e.tar.gz |
Fix #6154 by introducing new EAGAIN/EWOULDBLOCK/EINPROGRESS
subclasses that include WaitReadable or WaitWritable rather than
extending them into the exception object each time.
* error.c: Capture EGAIN, EWOULDBLOCK, EINPROGRESS exceptions and
export them for use in WaitReadable/Writable exceptions.
* io.c: Create versions of EAGAIN, EWOULDBLOCK, EINPROGRESS that
include WaitReadable and WaitWritable. Add rb_readwrite_sys_fail
for nonblocking failures using those exceptions. Use that
function in io_getpartial and io_write_nonblock instead of
rb_mod_sys_fail
* ext/openssl/ossl_ssl.c: Add new SSLError subclasses that include
WaitReadable and WaitWritable. Use those classes for
write_would_block and read_would_block instead of rb_mod_sys_fail.
* ext/socket/ancdata.c: Use rb_readwrite_sys_fail instead of
rb_mod_sys_fail in bsock_sendmsg_internal and
bsock_recvmsg_internal.
* ext/socket/init.c: Use rb_readwrite_sys_fail instead of
rb_mod_sys_fail in rsock_s_recvfrom_nonblock and
rsock_s_connect_nonblock.
* ext/socket/socket.c: Use rb_readwrite_sys_fail instead of
rb_mod_sys_fail in sock_connect_nonblock.
* include/ruby/ruby.h: Export rb_readwrite_sys_fail for use instead
of rb_mod_sys_fail. Introduce new constants RB_IO_WAIT_READABLE and
RB_IO_WAIT_WRITABLE for first arg to rb_readwrite_sys_fail.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40195 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'include/ruby')
-rw-r--r-- | include/ruby/ruby.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/include/ruby/ruby.h b/include/ruby/ruby.h index 5bd71121f6..43c5de6057 100644 --- a/include/ruby/ruby.h +++ b/include/ruby/ruby.h @@ -1354,6 +1354,7 @@ NORETURN(void rb_sys_fail(const char*)); NORETURN(void rb_sys_fail_str(VALUE)); NORETURN(void rb_mod_sys_fail(VALUE, const char*)); NORETURN(void rb_mod_sys_fail_str(VALUE, VALUE)); +NORETURN(void rb_readwrite_sys_fail(int, const char*)); NORETURN(void rb_iter_break(void)); NORETURN(void rb_iter_break_value(VALUE)); NORETURN(void rb_exit(int)); @@ -1373,6 +1374,10 @@ PRINTF_ARGS(void rb_sys_warning(const char*, ...), 1, 2); PRINTF_ARGS(void rb_warn(const char*, ...), 1, 2); PRINTF_ARGS(void rb_compile_warn(const char *, int, const char*, ...), 3, 4); +/* for rb_readwrite_sys_fail first argument */ +#define RB_IO_WAIT_READABLE 0 +#define RB_IO_WAIT_WRITABLE 1 + typedef VALUE rb_block_call_func(VALUE, VALUE, int, VALUE*); VALUE rb_each(VALUE); |