diff options
author | Eric Wong <normalperson@yhbt.net> | 2013-11-21 21:18:45 +0000 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2013-11-21 21:18:45 +0000 |
commit | 806c366a28ba1557b3a8feea382e26086e9b194c (patch) | |
tree | 430109483bdbad49f39d2763a43a50083ec32874 /ext/kgio/kgio.h | |
parent | d4bc0043a88c8da29ef1820a07e336d27c670be0 (diff) | |
download | kgio-rbx-wip.tar.gz |
This helps make our code more manageable, as well as isolating RSTRING_MODIFIED usage to files which actually need it. writev.c can eventually be fixed to avoid modifying RSTRING pointers, but write.c can already benefit from const RSTRING_PTR values right away.
Diffstat (limited to 'ext/kgio/kgio.h')
-rw-r--r-- | ext/kgio/kgio.h | 30 |
1 files changed, 21 insertions, 9 deletions
diff --git a/ext/kgio/kgio.h b/ext/kgio/kgio.h index 983280d..3d55fd5 100644 --- a/ext/kgio/kgio.h +++ b/ext/kgio/kgio.h @@ -20,16 +20,10 @@ #include "ancient_ruby.h" -struct io_args { - VALUE io; - VALUE buf; - char *ptr; - long len; - int fd; -}; - void init_kgio_wait(void); -void init_kgio_read_write(void); +void init_kgio_read(void); +void init_kgio_write(void); +void init_kgio_writev(void); void init_kgio_accept(void); void init_kgio_connect(void); void init_kgio_autopush(void); @@ -71,5 +65,23 @@ VALUE kgio_call_wait_readable(VALUE io); #endif extern unsigned kgio_tfo; +NORETURN(void kgio_raise_empty_bt(VALUE, const char *)); +NORETURN(void kgio_wr_sys_fail(const char *)); +NORETURN(void kgio_rd_sys_fail(const char *)); +/* + * we know MSG_DONTWAIT works properly on all stream sockets under Linux + * we can define this macro for other platforms as people care and + * notice. + */ +# if defined(__linux__) +# define USE_MSG_DONTWAIT +# endif + +#ifdef USE_MSG_DONTWAIT +/* we don't need these variants, we call kgio_autopush_send/recv directly */ +static inline void kgio_autopush_write(VALUE io) { } +#else +static inline void kgio_autopush_write(VALUE io) { kgio_autopush_send(io); } +#endif #endif /* KGIO_H */ |