Date | Commit message (Collapse) |
|
IO::Splice.copy_stream no longer modifies the actual file offset
of the given source file (if it's a regular file). This follows
IO.copy_stream and IO#sendfile semantics, allowing multiple
threads/processes to simultaneously stream a single regular file
descriptor to multiple sockets/pipes.
|
|
IO::Splice.copy_stream is more useful, now
|
|
This is for compatibility with IO.copy_stream and IO#sendfile,
both of which use pread()-semantics when given a source file
offset. This allows multiple threads/processes to copy from
the same file handle.
|
|
I didn't know mkmf at the time :<
|
|
This release adds the IO.trysplice and IO.trytee interfaces
to avoid expensive EAGAIN exceptions for non-blocking I/O.
There is no IO.tryvmsplice method as we still haven't figured
out a good use for IO.vmsplice in Ruby, and non-blocking I/O
with iovecs is just painful! If you want more zero-copy fun
without needing mmap(2), check out the "sendfile" RubyGem and
IO.copy_stream (1.9). As of Linux 2.6.33+, sendfile(2) can copy
mmap-able files to +any+ descriptor, not just sockets.
Please email us at ruby.io.splice@librelist.com if you can think
of a good use for IO.vmsplice or IO.trysplice in Ruby.
|
|
HALP!
|
|
Needless cruft and maintenance overhead.
|
|
And yes, encourage them for non-blocking I/O users.
|
|
For consistency with all of our other methods.
|
|
This allows more-efficient use of non-blocking I/O with
tee(2) and will return :EAGAIN instead of generating an
expensive Errno::EAGAIN exception.
|
|
It makes more sense this way if non-blocking I/O is expected.
|
|
No point in requiring the flags argument if it's going to be
zero, so default them to zero if they're unset.
|
|
Long lines bother me
|
|
Caught when compiling with the CFLAGS of Ruby 1.9.3dev
|
|
No need to open in binary mode since no file data
goes through luserspace!
|
|
Oops :x
|
|
Things should be slightly faster this way.
|
|
It's wholly unnecessary when we don't do exec() for other
processes.
|
|
This reduces the cost of EAGAIN and EOF since they
are not considered exceptional conditions.
|
|
This seems to fix the issue we had with older RDoc, too
|
|
Duh!
|
|
|
|
No more JavaScript!
|
|
The examples on our site were out-of-date.
|
|
|
|
This release adds IO#pipe_size and IO#pipe_size= accessors for
resizing the kernel pipe buffer under Linux 2.6.35+. This
functionality may be used to either reduce memory footprint or
make large copies with fewer method dispatches and system calls.
These methods are only available when run under Linux 2.6.35 or
later (but always built, so there's no need to recompile this
library after upgrading your kernel).
http://bogomips.org/ruby_io_splice/doc/IO.html#method-i-pipe_size
http://bogomips.org/ruby_io_splice/doc/IO.html#method-i-pipe_size%3D
|
|
These are friendly wrappers around F_GETPIPE_SZ
and F_SETPIPE_SZ fcntl()s in Linux 2.6.35.
|
|
Apparently timing variations were allowing it to succeed under
Ruby 1.8/1.9, but Rubinius tripped and exposed the bug.
|
|
This fixes the issue with our copy_stream where non-pipe
descriptors with the O_NONBLOCK flag set were not handled
correctly. Like IO.copy_stream in Ruby 1.9, our
IO::Splice.copy_stream will _always_ block until IO is available
(or raise if there are errors).
IO::Splice.copy_stream now closes all file descriptors that were
opened within the method, reducing pressure on the garbage
collector.
There are also new singleton convenience methods:
* IO::Splice.full - blocks and splices the full amount
* IO::Splice.partial - blocks until something is spliceable
They are used internally to implement IO::Splice.copy_stream,
but may also be useful to end users.
Rcov shows 100% test coverage \o/
|
|
|
|
Unlike IO::Splice.copy_stream, these require at least
one of the source or destination parameters to be a
pipe.
|
|
|
|
splice(2) (called without SPLICE_F_NONBLOCK) only blocks on the
pipe descriptor, but may trigger EAGAIN from the non-pipe
descriptor. So use IO.select to deal with the case where the
non-pipe descriptor is non-blocking and wait on it.
While we're at it, add the IO::Splice.partial and
IO::Splice.full singleton methods to make our life easier
to implement copy_stream with. These methods may also
be used directly by users who may find them useful.
|
|
|
|
It's a good idea to clean up any file descriptors
opened within our method to avoid unnecessary GC
invocations.
|
|
The choice of version is up to the user, but bundle the one
more likely to be invoked.
|
|
There is a new IO::Splice.copy_stream method which is similar to
the IO.copy_stream method in 1.9 core, but uses splice()
internally to avoid copies to userspace in situations where
sendfile() is not possible.
With Linux 2.6.35 (and header files to match), we will also
export the F_GETPIPE_SZ and and F_SETPIPE_SZ constants so
they can be used with fcntl() to resize pipe buffers.
The documentation is also updated to reflect the returned
usefulness of the IO::Splice::F_MOVE constant for FUSE
filesystems under Linux 2.6.35.
I've also relicensed to LGPLv2.1+ (from LGPLv3-only) to allow
bundling with GPLv2-only applications (I'm currently the sole
copyright holder).
Signed-off-by: Eric Wong <normalperson@yhbt.net>
|
|
|
|
This allows GPLv2-only programs to bundle us.
Signed-off-by: Eric Wong <normalperson@yhbt.net>
|
|
|
|
|
|
It seems needed for Rubinius
|
|
This should make it a drop-in replacement for IO.copy_stream,
except it won't deal with things like StringIO.
|
|
This could be useful if a Ruby implementation eventually gives
us page-aligned strings that we can IO::Splice::F_GIFT
|
|
For most case in the forseeable future it's a no-op, but
since FUSE will support it in 2.6.35, some folks will be
able to use it again.
|
|
One day soon (2.6.35), we'll be able to resize pipes. We may
support this independently of the C library since that can take
a few months/years to catch up, taking distro release cycles
into account, too.
|
|
FUSE devices will finally gain splice() support and also
support SPLICE_F_MOVE in 2.6.35. SPLICE_F_MOVE is still
ignored for non-FUSE devices.
|
|
|
|
This is like IO.copy_stream in Ruby 1.9, but uses
the splice() system call internally.
|
|
|