io_splice RubyGem user+dev discussion/patches/pulls/bugs/help
 help / color / mirror / code / Atom feed
* [RFC] try* interfaces in io_splice 2.2.0.18.g3025
@ 2011-02-28  1:19 Eric Wong
  2011-02-28  1:25 ` Eric Wong
  0 siblings, 1 reply; 2+ messages in thread
From: Eric Wong @ 2011-02-28  1:19 UTC (permalink / raw)
  To: ruby.io.splice

$ gem install --pre io_splice

It's also up at git://bogomips.org/ruby_io_splice.git in master.

This adds IO.trytee and IO.trysplice which behave like their
non-trying counterparts with the following exceptions:

1) IO::Splice::F_NONBLOCK is implied/forced.
   IO.trysplice may still block if the non-pipe descriptor blocks, so
   users should always set non-blocking on that descriptor.

2) Unlike the established Kgio, this returns :EAGAIN instead
   of :wait_readable or :wait_writable.  This is because only
   the user of the code can tell which descriptor is actually
   full/empty.

There is no IO.tryvmsplice, I haven't figured out if IO.vmsplice is
useful or not and non-blocking I/O with iovecs is so painful to deal
with it's not worth it.

The flags argument of all these interfaces is now optional and will
default to zero (and IO::Splice::F_NONBLOCK for IO.try{splice,tee}).

-- 
Eric Wong


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [RFC] try* interfaces in io_splice 2.2.0.18.g3025
  2011-02-28  1:19 [RFC] try* interfaces in io_splice 2.2.0.18.g3025 Eric Wong
@ 2011-02-28  1:25 ` Eric Wong
  0 siblings, 0 replies; 2+ messages in thread
From: Eric Wong @ 2011-02-28  1:25 UTC (permalink / raw)
  To: ruby.io.splice

Eric Wong <normalperson@yhbt.net> wrote:
> There is no IO.tryvmsplice, I haven't figured out if IO.vmsplice is
> useful or not and non-blocking I/O with iovecs is so painful to deal
> with it's not worth it.

Just pushed this out, too:

diff --git a/ext/io_splice/io_splice_ext.c b/ext/io_splice/io_splice_ext.c
index dc1e74d..a0ba381 100644
--- a/ext/io_splice/io_splice_ext.c
+++ b/ext/io_splice/io_splice_ext.c
@@ -394,7 +394,14 @@ static void advance_vmsplice_args(struct vmsplice_args *a, long n)
  * +fd+ must be the writable end of a pipe.
  *
  * This may allow the kernel to avoid data copies in some cases.
- * but is (probably) of limited usefulness in Ruby.
+ * but is (probably) of limited usefulness in Ruby.  If you have
+ * use cases or ideas for making this more useful for Ruby users,
+ * please tell us at ruby.io.splice@librelist.com!
+ *
+ * Also consider the "sendfile" RubyGem or IO.copy_stream in Ruby 1.9
+ * if you want to do zero-copy file transfers to pipes or sockets.  As
+ * of Linux 2.6.33, sendfile(2) can copy to any output descriptor,
+ * not just sockets.
  *
  * See manpage for full documentation:
  * http://kernel.org/doc/man-pages/online/pages/man2/vmsplice.2.html
-- 
Eric Wong


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-02-28  1:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-02-28  1:19 [RFC] try* interfaces in io_splice 2.2.0.18.g3025 Eric Wong
2011-02-28  1:25 ` Eric Wong

Code repositories for project(s) associated with this public inbox

	https://yhbt.net/ruby_io_splice.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).