README

Last Update: Mon Jul 16 15:12:12 -0600 2007

Description

The io-extra package provides a few extra IO methods that you may find handy. They are IO.closefrom, IO.fdwalk, IO#directio? and IO#directio=.

Not supported on MS Windows or OS X.

Installation

Standard Installation

   rake test (optional)
   rake install

Gem Installation

   rake test (optional)
   rake install_gem

Developer‘s Notes

You might be wondering what the difference is between my implementation of IO.closefrom and a pure Ruby version that looks something like this:

   def IO.closefrom(n)
      0.upto n do |fd|
         IO.for_fd(fd).close
      end
   end

The primary difference is that this walks all file descriptors, rather than only open file descriptors. However, I should note that this only applies if your platform supports the closefrom() function. In that case, the only advantage is speed.

You might also be wondering what the difference is between my implementation of IO.fdwalk and a pure Ruby version that looks something like this:

   def IO.fdwalk(n)
      ObjectSpace.each_object(File){ |f|
         yield f if f.fileno >= n
      }
   end

The primary difference is that this only closes Ruby file objects, not necessarily every filehandle opened by the Ruby process. For example, handles opened via system() calls.

Note to OS X Users

The OS X platform does not support closefrom(), fdwalk() or directio(). The hand-crafted IO.closefrom function will not work because the getrlimit() function on OS X does not work. Patches welcome.

Documentation

For further documentation, see the io_extra.txt file or the inline documentation that was generated by RDoc (if you did a gem install).

Known Issues

None that I‘m aware of. Please file any bug reports on the project page at www.rubyforge.org/projects/shards.

Future Plans

I may add the File::O_DIRECT open constant on platforms that support it.

License

Ruby‘s

Copyright

(C) 2003-2007 Daniel J. Berger All Rights Reserved

Warranty

This package is provided "as is" and without any express or implied warranties, including, without limitation, the implied warranties of merchantability and fitness for a particular purpose.

Author

Daniel J. Berger djberg96 at nospam at gmail dot com imperator on IRC (irc.freenode.net)

[Validate]