ruby_io_splice.git
4 years agoRuby io_splice 4.4.2 - URL + doc updatesmasterv4.4.2
Eric Wong [Sat, 22 Feb 2020 01:02:38 +0000 (22 01:02 +0000)]
Ruby io_splice 4.4.2 - URL + doc updates

doc: update URLs to point to YHBT.net

bogomips.org is going away since .org isn't going to
be affordable, anymore.  While we're at it, stop requiring
olddoc to just build the gem.

4 years agodoc: update URLs to point to YHBT.net
Eric Wong [Sat, 22 Feb 2020 01:00:34 +0000 (22 01:00 +0000)]
doc: update URLs to point to YHBT.net

bogomips.org is going away since .org isn't going to
be affordable, anymore.  While we're at it, stop requiring
olddoc to just build the gem.

5 years agoRuby io_splice 4.4.1 - minor updatesv4.4.1
Eric Wong [Wed, 2 Jan 2019 20:57:59 +0000 (2 20:57 +0000)]
Ruby io_splice 4.4.1 - minor updates

This release fixes mismatched indentation warnings in
Ruby 2.6+.  There are also some minor doc updates.

Of course, all the relevant functionality is also in the
"sleepy_penguin" RubyGem.  So chances are you won't need
this package and increase overhead from DSOs(*)

4 changes since v4.4.0

      io/splice: fix mismatched indentation warnings
      pkg.mk: build system updates
      doc: update URLs to HTTPS and remove refs to mail software
      README: add a note on sleepy_penguin providing splice + tee

(*) https://udrepper.livejournal.com/8790.html

5 years agoREADME: add a note on sleepy_penguin providing splice + tee
Eric Wong [Wed, 2 Jan 2019 19:54:00 +0000 (2 19:54 +0000)]
README: add a note on sleepy_penguin providing splice + tee

5 years agodoc: update URLs to HTTPS and remove refs to mail software
Eric Wong [Wed, 2 Jan 2019 10:36:32 +0000 (2 10:36 +0000)]
doc: update URLs to HTTPS and remove refs to mail software

No need to market or promote anything, here.

5 years agopkg.mk: build system updates
Eric Wong [Wed, 2 Jan 2019 10:26:28 +0000 (2 10:26 +0000)]
pkg.mk: build system updates

Mainly, pass --local to "'gem install"

5 years agoio/splice: fix mismatched indentation warnings
Eric Wong [Fri, 18 May 2018 03:03:45 +0000 (18 03:03 +0000)]
io/splice: fix mismatched indentation warnings

Ruby 2.6.0dev warns about these

9 years agoRuby io_splice 4.4.0 - minor updatesv4.4.0
Eric Wong [Sun, 11 Jan 2015 08:24:28 +0000 (11 08:24 +0000)]
Ruby io_splice 4.4.0 - minor updates

Most notably the mailing list is now subscription-optional
on the bogomips.org server:

    ruby-io-splice@bogomips.org

If you want to keep receiving email updates, you'll need to
resubscribe by sending a message to:

    ruby-io-splice+subscribe@bogomips.org

Migrating subscribers can't be done automatically as librelist
(our old host) doesn't publish subscriber lists.  But you don't
have to subscribe, either, HTTP archives are available at:

    http://bogomips.org/ruby-io-splice/

There you'll also find links to ssoma/public-inbox for
extracting the mail archives to git.

shortlog:
      move mailing list to ruby-io-splice@bogomips.org
      switch documentation to olddoc
      pack internal structs for 64-bit systems
      favor comparisons against zero instead of -1
      doc updates

Again, the io_splice 5.x will remove the mistake of the
IO::Splice.copy_stream method.  Users are encouraged to use
IO.copy_stream in Ruby (1.9+) itself instead.

9 years agogemspec: remove dead wrongdoc stuff
Eric Wong [Sun, 11 Jan 2015 08:28:17 +0000 (11 08:28 +0000)]
gemspec: remove dead wrongdoc stuff

Old wrongdoc cruft, update for olddoc.

9 years agodoc updates
Eric Wong [Sun, 11 Jan 2015 08:22:39 +0000 (11 08:22 +0000)]
doc updates

Remove LATEST from being rdoc-ed at all, and update the
(mostly useless) private email address.

9 years agofavor comparisons against zero instead of -1
Eric Wong [Sat, 10 Jan 2015 03:31:46 +0000 (10 03:31 +0000)]
favor comparisons against zero instead of -1

This should allow faster instructions to be used in some cases.
Technically this may be less pedantically correct, but there is
enough existing code out there which does the same thing to
discourage kernel/libc developers from overloading negative
return values.

...And glibc even favors comparison against zero, too.

9 years agopack internal structs for 64-bit systems
Eric Wong [Sat, 10 Jan 2015 03:24:42 +0000 (10 03:24 +0000)]
pack internal structs for 64-bit systems

This reduces stack usage in some places, perhaps providing a
miniscule improvement in GC performance.

struct          before  after   difference
splice_args 48 40 8
vmsplice_args 32 24 8

9 years agoswitch documentation to olddoc
Eric Wong [Sat, 10 Jan 2015 03:00:24 +0000 (10 03:00 +0000)]
switch documentation to olddoc

wrongdoc was difficult to maintain because of the tidy-ffi
dependency and the HTML5 changes in Darkfish could not be
handled well by Tidy.

olddoc is superior as it generates leaner HTML which loads faster,
requires less scrolling and less processing power to render.
Aesthetic comparisons are subjective of course but completely
unimportant compared to speed and accessibility.

ref: http://80x24.org/olddoc/

9 years agomove mailing list to ruby-io-splice@bogomips.org
Eric Wong [Sat, 10 Jan 2015 02:43:37 +0000 (10 02:43 +0000)]
move mailing list to ruby-io-splice@bogomips.org

The public-inbox + mlmmj setup on bogomips.org allows posting
without subscription and offers downloadable archives via git.
The lack of rsyncable archives on librelist nowadays and
subscription-required nature of librelist are points against it.

Repliers are now encouraged to Cc: all recipients (using the
reply-all function of their mail client) since many readers are
not subscribed.

This project has never accepted or encouraged HTML email, but
librelist accepted it.  The bogomips.org mail server is
configured to treat HTML mail as spam, so do not send HTML mail
if you expect a response.

Users who wish to subscribe may send a message to:

ruby-io-splice+subscribe@bogomips.org

Similarly, they may unsubscribe via:

ruby-io-splice+unsubscribe@bogomips.org

HTTP archives are available via:

http://bogomips.org/ruby-io-splice/

ssoma users may also use: git://bogomips.org/ruby-io-splice
(see README change)

Old messages to the librelist addresses will continue to
get routed to the new mailing list.

ref: http://public-inbox.org/

10 years agoio_splice 4.3.0 - cleanups and compatibility fixesv4.3.0
Eric Wong [Sat, 15 Feb 2014 10:17:52 +0000 (15 10:17 +0000)]
io_splice 4.3.0 - cleanups and compatibility fixes

This release fixes compatibility with Ruby trunk r44955 and onwards.
There are also numerous cleanups.
Note: usage of IO::Splice::WAITALL is deprecated and will be removed
in 5.x along with IO::Splice.copy_stream.

10 years agoavoid deprecated rb_thread_blocking_region on 2.0+
Eric Wong [Sat, 15 Feb 2014 09:53:47 +0000 (15 09:53 +0000)]
avoid deprecated rb_thread_blocking_region on 2.0+

rb_thread_blocking_region is not in ruby trunk as of r44955

10 years agodeprecate and remove docs for IO::Splice::WAITALL
Eric Wong [Sun, 9 Feb 2014 07:42:15 +0000 (9 07:42 +0000)]
deprecate and remove docs for IO::Splice::WAITALL

This functionality should not be implemented in Ruby, at least.
This flag could also conflict with future flags used by the
underlying syscalls.

10 years agoremove copy_stream tests and references
Eric Wong [Sun, 9 Feb 2014 07:26:52 +0000 (9 07:26 +0000)]
remove copy_stream tests and references

It is deprecated, so stop testing and advertising it.

10 years agoprepare for rb_thread_blocking_region removal
Eric Wong [Sun, 9 Feb 2014 00:50:03 +0000 (9 00:50 +0000)]
prepare for rb_thread_blocking_region removal

It'll be OK to use rb_thread_call_without_gvl when
rb_thread_blocking_region is not detectable at all.
We still use rb_thread_blocking_region for Ruby 2.0-2.1 because
rb_thread_call_without_gvl was detectable in 1.9.3, but not
usable as an internal symbol.

ref: https://bugs.ruby-lang.org/issues/9502

10 years agoRakefile: kill raa_update task
Eric Wong [Mon, 30 Sep 2013 18:22:15 +0000 (30 18:22 +0000)]
Rakefile: kill raa_update task

RAA is dead

10 years agoavoid RARRAY_PTR usage for vmsplice
Eric Wong [Thu, 26 Sep 2013 18:54:33 +0000 (26 18:54 +0000)]
avoid RARRAY_PTR usage for vmsplice

In case somebody finds vmsplice useful in Ruby, we avoid incurring
the performance loss from RARRAY_PTR under Ruby 2.1.0 and Rubinius.
However, I still haven't found a useful use of vmsplice under
Ruby (or any high-level languages).

10 years ago.gitignore: add .rbx
Eric Wong [Sun, 12 May 2013 20:01:00 +0000 (12 20:01 +0000)]
.gitignore: add .rbx

Newer versions of Rubinius generate files in .rbx.

10 years agoio/splice: deprecated potentially unsafe methods
Eric Wong [Sun, 12 May 2013 19:59:45 +0000 (12 19:59 +0000)]
io/splice: deprecated potentially unsafe methods

In retrospect, these methods are too infrequently useful and
causes problems too easily to be worth supporting.

11 years agoset close-on-exec in pipe size modification check
Eric Wong [Sun, 21 Apr 2013 03:22:26 +0000 (21 03:22 +0000)]
set close-on-exec in pipe size modification check

This prevents a file descriptor leak in case another thread
forks and execs while we are in the middle of loading.  This
places a hard dependency on pipe2, but pipe2 appeared in Linux
before pipe size modification.

11 years agoio_splice 4.2.0 - several bugfixes and workaroundsv4.2.0
Eric Wong [Sat, 19 Jan 2013 08:12:06 +0000 (19 08:12 +0000)]
io_splice 4.2.0 - several bugfixes and workarounds

We now limit maximum splice length to (1<<30) to avoid EINVAL
errors on 64-bit hosts.

vmsplice no longer raises Errno::EFAULT optimizations in newer
GCC (not that I've found a good use for vmsplice at all with
Ruby...)

There are several other small cleanups.

Eric Wong (6):
      copy_stream: small cleanup for pipe splicing
      limit maximum splice length to 1 << 30
      avoid uname() for pipe size modification checks
      doc: s/librelist.com/librelist.org/
      vmsplice: avoid referencing invalid stack address for strings
      vmsplice: more consistent fileno retry handling

11 years agovmsplice: more consistent fileno retry handling
Eric Wong [Sat, 19 Jan 2013 08:10:23 +0000 (19 08:10 +0000)]
vmsplice: more consistent fileno retry handling

While vmsplice is hardly useful, its FD-closed-while-GVL-less
handling should be as good as our splice and tee wrappers.

11 years agovmsplice: avoid referencing invalid stack address for strings
Eric Wong [Sat, 19 Jan 2013 03:08:06 +0000 (19 03:08 +0000)]
vmsplice: avoid referencing invalid stack address for strings

Newer GCC more aggressively optimizes stack allocations away,
so we need to avoid passing out-of-scope addresses to vmsplice.
Not that vmsplice is useful in Ruby...

12 years agodoc: s/librelist.com/librelist.org/
Eric Wong [Thu, 8 Mar 2012 05:20:15 +0000 (8 05:20 +0000)]
doc: s/librelist.com/librelist.org/

.org makes us look less commercial, which may be
important to some folks.  Yes, this project is
run by a dirty hippie.

12 years agoavoid uname() for pipe size modification checks
Eric Wong [Wed, 7 Mar 2012 10:27:46 +0000 (7 10:27 +0000)]
avoid uname() for pipe size modification checks

The uname comparison is fragile and we can better
detect this during the Init_* function by just using
a pipe.

12 years agolimit maximum splice length to 1 << 30
Eric Wong [Wed, 18 May 2011 22:36:52 +0000 (18 15:36 -0700)]
limit maximum splice length to 1 << 30

This is the same value haproxy has to work around the same
issue on 64-bit platforms.

ref: a9de333aa58e6cb76f08a50e8ba2c5931184068f in
     http://git.1wt.eu/git/haproxy.git

12 years agocopy_stream: small cleanup for pipe splicing
Eric Wong [Wed, 18 May 2011 20:47:54 +0000 (18 13:47 -0700)]
copy_stream: small cleanup for pipe splicing

No need to loop on IO::Splice.full, it already loops
internally whenever it makes sense.

12 years agoio_splice 4.1.1 - workaround socket -> pipe issuesv4.1.1
Eric Wong [Wed, 18 May 2011 00:15:49 +0000 (17 17:15 -0700)]
io_splice 4.1.1 - workaround socket -> pipe issues

IO::Splice.copy_stream now uses SPLICE_F_NONBLOCK whenever the
destination is a pipe.  Our documentation is also updated to
reflect the issue of splicing from sockets into pipes.

ref: http://lkml.org/lkml/2009/1/13/478

12 years agoexpand doc for non-blocking splice into a pipe
Eric Wong [Wed, 18 May 2011 00:12:48 +0000 (17 17:12 -0700)]
expand doc for non-blocking splice into a pipe

We should warn our users to avoid a blocking splice() from a
socket into a pipe if the socket buffers are full unless there's
a blocking read/splice on the other end of the pipe.

12 years agocopy_stream: always use SPLICE_F_NONBLOCK for partial copy
Eric Wong [Tue, 17 May 2011 03:18:12 +0000 (16 20:18 -0700)]
copy_stream: always use SPLICE_F_NONBLOCK for partial copy

The pipe may be full from small buffers due to how TCP
works, so we need to use non-blocking I/O on the pipe.

ref: http://lkml.org/lkml/2009/1/13/478

12 years agoio_splice 4.1.0 - copy_stream enhancement for 1.9v4.1.0
Eric Wong [Mon, 16 May 2011 16:28:48 +0000 (16 09:28 -0700)]
io_splice 4.1.0 - copy_stream enhancement for 1.9

IO::Splice.copy_stream coerces based on the availability of
the #to_path method in source and destination arguments.

This is to be compatible with IO.copy_stream and also
Rack::File since this may be used in web servers.

This is NOT visible with Ruby 1.8 since File.open
doesn't coerce with #to_path on the given object.

12 years agocopy_stream coerces based on #to_path
Eric Wong [Fri, 13 May 2011 19:59:13 +0000 (13 12:59 -0700)]
copy_stream coerces based on #to_path

This is to be compatible with IO.copy_stream and also
Rack::File since this may be used in web servers.

This is NOT compatible with Ruby 1.8 since File.open
doesn't coerce with #to_path on the given object.

12 years agoio_splice 4.0.0 - easier to use!v4.0.0
Eric Wong [Fri, 13 May 2011 02:39:12 +0000 (12 19:39 -0700)]
io_splice 4.0.0 - easier to use!

Methods now automatically retry on EINTR after checking
IO#closed? and executing interrupts.

There is a new IO::Splice::WAITALL flag (implemented in
userspace) which may be used to cause IO.splice and IO.tee
to retry (while the GVL is released) until the operation
is complete.

IO::Splice.copy_stream now works correctly for large copies
if source offset is specified.

MRI 1.8 is only weakly supported now, MRI 1.9 is the
preferred platform though Rubinius appears to work, too.

12 years agofix up documentation for fd vs IO objects
Eric Wong [Fri, 13 May 2011 02:28:41 +0000 (12 19:28 -0700)]
fix up documentation for fd vs IO objects

We support both, but IO objects are easier to use so
refer to those in the documentation.

12 years agocopy_stream: enough to get this working under MRI 1.8
Eric Wong [Fri, 13 May 2011 02:13:57 +0000 (12 19:13 -0700)]
copy_stream: enough to get this working under MRI 1.8

This way at least 1.8 users can have something akin to
IO.copy_stream.

12 years agotest_copy_stream: fix userspace buffering assumption
Eric Wong [Fri, 13 May 2011 01:59:44 +0000 (12 18:59 -0700)]
test_copy_stream: fix userspace buffering assumption

And enable UNIX socket tests for this

12 years agoadd copy_stream test from MRI
Eric Wong [Fri, 13 May 2011 00:25:08 +0000 (12 17:25 -0700)]
add copy_stream test from MRI

This helps flesh out some inconsistencies between our
implementation and IO.copy_stream in MRI.  Some things
we won't care about though, like userspace buffering.

12 years agocopy_stream: update src_offset on retries
Eric Wong [Fri, 13 May 2011 00:22:57 +0000 (12 17:22 -0700)]
copy_stream: update src_offset on retries

Oops :x

12 years agocopy_stream attempts to use IO::Splice::WAITALL
Eric Wong [Tue, 10 May 2011 19:42:38 +0000 (10 12:42 -0700)]
copy_stream attempts to use IO::Splice::WAITALL

This reduces Ruby method dispatches

12 years agotest_io_splice: disable timeout-related tests in non-MRI
Eric Wong [Tue, 10 May 2011 19:36:59 +0000 (10 12:36 -0700)]
test_io_splice: disable timeout-related tests in non-MRI

timeout doesn't seem to interrupt C extensions reliably
in some cases...

12 years agoadd IO::Splice::WAITALL flag support
Eric Wong [Tue, 10 May 2011 00:57:10 +0000 (9 17:57 -0700)]
add IO::Splice::WAITALL flag support

This allows splice-in-full and tee-in-full behavior
to simplify user code.

12 years agotest_io_splice_eintr: beef up test
Eric Wong [Mon, 9 May 2011 20:54:54 +0000 (9 13:54 -0700)]
test_io_splice_eintr: beef up test

Also works under Rubinius

12 years agouse ssize_t/size_t instead of long/unsigned long
Eric Wong [Mon, 9 May 2011 20:45:28 +0000 (9 13:45 -0700)]
use ssize_t/size_t instead of long/unsigned long

Easier to read this way since it matches upstream
functions.

12 years agoEINTR test only works under 1.9
Eric Wong [Mon, 9 May 2011 20:43:39 +0000 (9 13:43 -0700)]
EINTR test only works under 1.9

Not that we feel like supporting 1.8 any longer..

12 years agodetect closed descriptors on EINTR
Eric Wong [Mon, 9 May 2011 20:28:19 +0000 (9 13:28 -0700)]
detect closed descriptors on EINTR

We don't want to retry with the same FD if it somehow
got closed and reopened in a different thread.  We
could possibly have Errno::EBADF, too, but
rb_thread_io_blocking_region doesn't allow multiple
file descriptors...

12 years agomy_fileno: use FIX2INT instead of NUM2INT
Eric Wong [Mon, 9 May 2011 20:18:42 +0000 (9 13:18 -0700)]
my_fileno: use FIX2INT instead of NUM2INT

No chance in hell a file descriptor can be a Bignum...

12 years agoretry on EINTR
Eric Wong [Mon, 9 May 2011 20:12:25 +0000 (9 13:12 -0700)]
retry on EINTR

This makes things consistent with Ruby core IO methods

12 years agoio_splice 3.1.0 - IO::Splice.copy_stream improvementv3.1.0
Eric Wong [Sun, 1 May 2011 21:11:11 +0000 (1 14:11 -0700)]
io_splice 3.1.0 - IO::Splice.copy_stream improvement

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.

12 years agominor documentation updates
Eric Wong [Sun, 1 May 2011 20:58:23 +0000 (1 13:58 -0700)]
minor documentation updates

IO::Splice.copy_stream is more useful, now

12 years agoIO::Splice.copy_stream doesn't change offset of source file
Eric Wong [Sun, 1 May 2011 20:29:51 +0000 (1 13:29 -0700)]
IO::Splice.copy_stream doesn't change offset of source file

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.

13 years agoextconf: remove unnecessary dir_config statement
Eric Wong [Wed, 27 Apr 2011 18:36:33 +0000 (27 11:36 -0700)]
extconf: remove unnecessary dir_config statement

I didn't know mkmf at the time :<

13 years agoio_splice 3.0.0 - kinder, gentler Linux zero-copyv3.0.0
Eric Wong [Tue, 1 Mar 2011 09:29:57 +0000 (1 09:29 +0000)]
io_splice 3.0.0 - kinder, gentler Linux zero-copy

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.

13 years agodoc: more notes for IO.vmsplice
Eric Wong [Mon, 28 Feb 2011 01:24:01 +0000 (28 01:24 +0000)]
doc: more notes for IO.vmsplice

HALP!

13 years agoremove VERSION constant
Eric Wong [Mon, 28 Feb 2011 01:08:44 +0000 (28 01:08 +0000)]
remove VERSION constant

Needless cruft and maintenance overhead.

13 years agodoc: RDoc for new interfaces and changes
Eric Wong [Mon, 28 Feb 2011 01:05:15 +0000 (28 01:05 +0000)]
doc: RDoc for new interfaces and changes

And yes, encourage them for non-blocking I/O users.

13 years agoIO.vmsplice flags argument defaults to zero
Eric Wong [Mon, 28 Feb 2011 00:21:28 +0000 (28 00:21 +0000)]
IO.vmsplice flags argument defaults to zero

For consistency with all of our other methods.

13 years agoadd IO.trytee interface
Eric Wong [Sun, 27 Feb 2011 23:40:44 +0000 (27 23:40 +0000)]
add IO.trytee interface

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.

13 years agotrysplice implies SPLICE_F_NONBLOCK for flags
Eric Wong [Sun, 27 Feb 2011 00:47:40 +0000 (26 16:47 -0800)]
trysplice implies SPLICE_F_NONBLOCK for flags

It makes more sense this way if non-blocking I/O is expected.

13 years agoflags are optional for splice and trysplice
Eric Wong [Sun, 27 Feb 2011 00:44:17 +0000 (26 16:44 -0800)]
flags are optional for splice and trysplice

No point in requiring the flags argument if it's going to be
zero, so default them to zero if they're unset.

13 years agoshorten calls to rb_thread_blocking_region
Eric Wong [Sun, 27 Feb 2011 00:35:56 +0000 (26 16:35 -0800)]
shorten calls to rb_thread_blocking_region

Long lines bother me

13 years agoavoid signed vs unsigned comparison
Eric Wong [Sat, 26 Feb 2011 22:45:04 +0000 (26 14:45 -0800)]
avoid signed vs unsigned comparison

Caught when compiling with the CFLAGS of Ruby 1.9.3dev

13 years agocopy_stream: File.open encoding doesn't matter
Eric Wong [Sat, 26 Feb 2011 22:43:08 +0000 (26 14:43 -0800)]
copy_stream: File.open encoding doesn't matter

No need to open in binary mode since no file data
goes through luserspace!

13 years agotest: fix broken assertions on Ruby 1.9.3dev
Eric Wong [Sat, 26 Feb 2011 22:41:19 +0000 (26 14:41 -0800)]
test: fix broken assertions on Ruby 1.9.3dev

Oops :x

13 years agocopy_stream uses IO.trysplice instead of IO.splice
Eric Wong [Sat, 26 Feb 2011 22:40:48 +0000 (26 14:40 -0800)]
copy_stream uses IO.trysplice instead of IO.splice

Things should be slightly faster this way.

13 years agotest: remove unused_port function
Eric Wong [Sat, 26 Feb 2011 22:20:37 +0000 (26 14:20 -0800)]
test: remove unused_port function

It's wholly unnecessary when we don't do exec() for other
processes.

13 years agoadd IO.trysplice interface
Eric Wong [Sat, 26 Feb 2011 22:17:25 +0000 (26 14:17 -0800)]
add IO.trysplice interface

This reduces the cost of EAGAIN and EOF since they
are not considered exceptional conditions.

13 years agoio/splice: unindent
Eric Wong [Wed, 22 Dec 2010 18:57:58 +0000 (22 10:57 -0800)]
io/splice: unindent

This seems to fix the issue we had with older RDoc, too

13 years agotest: cleanup unused_port function
Eric Wong [Sat, 5 Feb 2011 11:27:54 +0000 (5 03:27 -0800)]
test: cleanup unused_port function

Duh!

13 years agoclean up packaging and use pkg.mk
Eric Wong [Sat, 5 Feb 2011 11:25:47 +0000 (5 03:25 -0800)]
clean up packaging and use pkg.mk

13 years agodoc: switch to wrongdoc
Eric Wong [Mon, 27 Dec 2010 16:55:28 +0000 (27 16:55 +0000)]
doc: switch to wrongdoc

No more JavaScript!

13 years agoGNUmakefile: sync examples for documentation publishing
Eric Wong [Mon, 27 Dec 2010 16:19:30 +0000 (27 16:19 +0000)]
GNUmakefile: sync examples for documentation publishing

The examples on our site were out-of-date.

13 years agoGNUmakefile: update RAA on new releases
Eric Wong [Mon, 2 Aug 2010 08:14:08 +0000 (2 08:14 +0000)]
GNUmakefile: update RAA on new releases

13 years agoRuby io_splice 2.2.0 - updates for Linux 2.6.35v2.2.0
Eric Wong [Mon, 2 Aug 2010 07:55:57 +0000 (2 07:55 +0000)]
Ruby io_splice 2.2.0 - updates for Linux 2.6.35

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

13 years agoadd IO#pipe_size and IO#pipe_size= accessors
Eric Wong [Mon, 2 Aug 2010 07:40:48 +0000 (2 07:40 +0000)]
add IO#pipe_size and IO#pipe_size= accessors

These are friendly wrappers around F_GETPIPE_SZ
and F_SETPIPE_SZ fcntl()s in Linux 2.6.35.

13 years agotest_io_splice: fix broken test
Eric Wong [Thu, 24 Jun 2010 18:46:14 +0000 (24 18:46 +0000)]
test_io_splice: fix broken test

Apparently timing variations were allowing it to succeed under
Ruby 1.8/1.9, but Rubinius tripped and exposed the bug.

13 years agoRuby io_splice 2.1.0 - IO::Splice.copy_stream fixesv2.1.0
Eric Wong [Sun, 6 Jun 2010 20:27:36 +0000 (6 20:27 +0000)]
Ruby io_splice 2.1.0 - IO::Splice.copy_stream fixes

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/

13 years agodoc: help RDoc read IO::Splice singleton methods
Eric Wong [Sun, 6 Jun 2010 20:26:37 +0000 (6 20:26 +0000)]
doc: help RDoc read IO::Splice singleton methods

13 years agodocument +src+ and +dst+ for IO::Splice.{full,partial}
Eric Wong [Sun, 6 Jun 2010 19:49:12 +0000 (6 19:49 +0000)]
document +src+ and +dst+ for IO::Splice.{full,partial}

Unlike IO::Splice.copy_stream, these require at least
one of the source or destination parameters to be a
pipe.

13 years agoGNUmakefile: add rcov target
Eric Wong [Sun, 6 Jun 2010 19:46:05 +0000 (6 19:46 +0000)]
GNUmakefile: add rcov target

13 years agocopy_stream: handle and block on EAGAIN from the non-pipe IO
Eric Wong [Sun, 6 Jun 2010 19:21:42 +0000 (6 19:21 +0000)]
copy_stream: handle and block on EAGAIN from the non-pipe IO

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.

13 years agoGNUmakefile: allow passing options to test/unit
Eric Wong [Sun, 6 Jun 2010 19:21:17 +0000 (6 19:21 +0000)]
GNUmakefile: allow passing options to test/unit

13 years agocopy_stream: cleanup after ourselves
Eric Wong [Sun, 6 Jun 2010 17:59:10 +0000 (6 17:59 +0000)]
copy_stream: cleanup after ourselves

It's a good idea to clean up any file descriptors
opened within our method to avoid unnecessary GC
invocations.

13 years agoCOPYING: bundle the LGPLv2.1 instead of LGPLv3
Eric Wong [Sun, 6 Jun 2010 06:50:10 +0000 (6 06:50 +0000)]
COPYING: bundle the LGPLv2.1 instead of LGPLv3

The choice of version is up to the user, but bundle the one
more likely to be invoked.

13 years agoRuby io_splice 2.0.0v2.0.0
Eric Wong [Sat, 5 Jun 2010 08:36:16 +0000 (5 08:36 +0000)]
Ruby io_splice 2.0.0

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>
13 years agoupdate PIPE_CAPA documentation for Linux 2.6.35
Eric Wong [Sat, 5 Jun 2010 08:34:17 +0000 (5 08:34 +0000)]
update PIPE_CAPA documentation for Linux 2.6.35

13 years agorelicense to LGPLv2.1+ (from LGPLv3 only)
Eric Wong [Sat, 5 Jun 2010 08:22:19 +0000 (5 08:22 +0000)]
relicense to LGPLv2.1+ (from LGPLv3 only)

This allows GPLv2-only programs to bundle us.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
13 years agoGNUmakefile: make our unit tests PHONY
Eric Wong [Sat, 5 Jun 2010 06:27:24 +0000 (5 06:27 +0000)]
GNUmakefile: make our unit tests PHONY

13 years agoexamples/splice-cp: simplify with IO::Splice.copy_stream
Eric Wong [Sat, 5 Jun 2010 06:19:17 +0000 (5 06:19 +0000)]
examples/splice-cp: simplify with IO::Splice.copy_stream

13 years agoio_splice_ext: require errno.h
Eric Wong [Sat, 5 Jun 2010 06:02:30 +0000 (5 06:02 +0000)]
io_splice_ext: require errno.h

It seems needed for Rubinius

13 years agocopy_stream takes source offset like the non-splice version
Eric Wong [Sat, 5 Jun 2010 05:42:54 +0000 (5 05:42 +0000)]
copy_stream takes source offset like the non-splice version

This should make it a drop-in replacement for IO.copy_stream,
except it won't deal with things like StringIO.

13 years agoallow IO.vmsplice to take a single string
Eric Wong [Thu, 3 Jun 2010 07:00:43 +0000 (3 07:00 +0000)]
allow IO.vmsplice to take a single string

This could be useful if a Ruby implementation eventually gives
us page-aligned strings that we can IO::Splice::F_GIFT

13 years agocopy_stream: always try to move pages instead of copying
Eric Wong [Tue, 1 Jun 2010 23:59:57 +0000 (1 16:59 -0700)]
copy_stream: always try to move pages instead of copying

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.

13 years agopreliminary support for F_GETPIPE_SZ and F_SETPIPE_SZ
Eric Wong [Tue, 1 Jun 2010 23:54:24 +0000 (1 16:54 -0700)]
preliminary support for F_GETPIPE_SZ and F_SETPIPE_SZ

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.

13 years agoupdate IO::Splice::F_MOVE documentation for 2.6.35
Eric Wong [Tue, 1 Jun 2010 23:46:18 +0000 (1 16:46 -0700)]
update IO::Splice::F_MOVE documentation for 2.6.35

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.

13 years agosimplify examples for 1.0.0 API
Eric Wong [Tue, 1 Jun 2010 23:08:46 +0000 (1 16:08 -0700)]
simplify examples for 1.0.0 API

13 years agoimplement IO::Splice.copy_stream
Eric Wong [Tue, 1 Jun 2010 23:01:58 +0000 (1 16:01 -0700)]
implement IO::Splice.copy_stream

This is like IO.copy_stream in Ruby 1.9, but uses
the splice() system call internally.