1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

io.c: define EWOULDBLOCK

* io.c (Init_IO): define EWOULDBLOCK alway as it is needed always.
  and turn runtime branch into preprocessor condition.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40203 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2013-04-09 00:42:33 +00:00
parent e0b523d1a9
commit 74ba9c2488

13
io.c
View file

@ -110,6 +110,10 @@
# endif # endif
#endif #endif
#ifndef EWOULDBLOCK
# define EWOULDBLOCK EAGAIN
#endif
#if defined(HAVE___SYSCALL) && (defined(__APPLE__) || defined(__OpenBSD__)) #if defined(HAVE___SYSCALL) && (defined(__APPLE__) || defined(__OpenBSD__))
/* Mac OS X and OpenBSD have __syscall but don't define it in headers */ /* Mac OS X and OpenBSD have __syscall but don't define it in headers */
off_t __syscall(quad_t number, ...); off_t __syscall(quad_t number, ...);
@ -11502,7 +11506,8 @@ rb_readwrite_sys_fail(int writable, const char *mesg)
default: default:
rb_mod_sys_fail_str(rb_mWaitReadable, arg); rb_mod_sys_fail_str(rb_mWaitReadable, arg);
} }
} else { }
else {
rb_bug("invalid read/write type passed to rb_readwrite_sys_fail: %d", writable); rb_bug("invalid read/write type passed to rb_readwrite_sys_fail: %d", writable);
} }
} }
@ -11719,17 +11724,17 @@ Init_IO(void)
rb_include_module(rb_eEAGAINWaitReadable, rb_mWaitReadable); rb_include_module(rb_eEAGAINWaitReadable, rb_mWaitReadable);
rb_eEAGAINWaitWritable = rb_define_class_under(rb_cIO, "EAGAINWaitWritable", rb_eEAGAIN); rb_eEAGAINWaitWritable = rb_define_class_under(rb_cIO, "EAGAINWaitWritable", rb_eEAGAIN);
rb_include_module(rb_eEAGAINWaitWritable, rb_mWaitWritable); rb_include_module(rb_eEAGAINWaitWritable, rb_mWaitWritable);
if (EAGAIN == EWOULDBLOCK) { #if EAGAIN == EWOULDBLOCK
rb_eEWOULDBLOCKWaitReadable = rb_eEAGAINWaitReadable; rb_eEWOULDBLOCKWaitReadable = rb_eEAGAINWaitReadable;
rb_define_const(rb_cIO, "EWOULDBLOCKWaitReadable", rb_eEAGAINWaitReadable); rb_define_const(rb_cIO, "EWOULDBLOCKWaitReadable", rb_eEAGAINWaitReadable);
rb_eEWOULDBLOCKWaitWritable = rb_eEAGAINWaitWritable; rb_eEWOULDBLOCKWaitWritable = rb_eEAGAINWaitWritable;
rb_define_const(rb_cIO, "EWOULDBLOCKWaitWritable", rb_eEAGAINWaitWritable); rb_define_const(rb_cIO, "EWOULDBLOCKWaitWritable", rb_eEAGAINWaitWritable);
} else { #else
rb_eEWOULDBLOCKWaitReadable = rb_define_class_under(rb_cIO, "EWOULDBLOCKRWaiteadable", rb_eEWOULDBLOCK); rb_eEWOULDBLOCKWaitReadable = rb_define_class_under(rb_cIO, "EWOULDBLOCKRWaiteadable", rb_eEWOULDBLOCK);
rb_include_module(rb_eEWOULDBLOCKWaitReadable, rb_mWaitReadable); rb_include_module(rb_eEWOULDBLOCKWaitReadable, rb_mWaitReadable);
rb_eEWOULDBLOCKWaitWritable = rb_define_class_under(rb_cIO, "EWOULDBLOCKWaitWritable", rb_eEWOULDBLOCK); rb_eEWOULDBLOCKWaitWritable = rb_define_class_under(rb_cIO, "EWOULDBLOCKWaitWritable", rb_eEWOULDBLOCK);
rb_include_module(rb_eEWOULDBLOCKWaitWritable, rb_mWaitWritable); rb_include_module(rb_eEWOULDBLOCKWaitWritable, rb_mWaitWritable);
} #endif
rb_eEINPROGRESSWaitReadable = rb_define_class_under(rb_cIO, "EINPROGRESSWaitReadable", rb_eEINPROGRESS); rb_eEINPROGRESSWaitReadable = rb_define_class_under(rb_cIO, "EINPROGRESSWaitReadable", rb_eEINPROGRESS);
rb_include_module(rb_eEINPROGRESSWaitReadable, rb_mWaitReadable); rb_include_module(rb_eEINPROGRESSWaitReadable, rb_mWaitReadable);
rb_eEINPROGRESSWaitWritable = rb_define_class_under(rb_cIO, "EINPROGRESSWaitWritable", rb_eEINPROGRESS); rb_eEINPROGRESSWaitWritable = rb_define_class_under(rb_cIO, "EINPROGRESSWaitWritable", rb_eEINPROGRESS);