about summary refs log tree commit homepage
path: root/ext/kgio/kgio.h
diff options
context:
space:
mode:
Diffstat (limited to 'ext/kgio/kgio.h')
-rw-r--r--ext/kgio/kgio.h30
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 */