Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Bringing common kernel APIs into Ruby using FFI
Ruby C
tree: 96e2a9fa32

Now returns multiple events per #poll call, as it should. Requires ed…

…ge ruby-ffi from mercurial until a new gem is released.
latest commit 96e2a9fa32
@jakedouglas authored
Failed to load latest commit information.
ext switched Kqueue over to using select(), got rid of rb_thread_blocking…
lib
tests
README.rdoc
Rakefile
ktools.gemspec

README.rdoc

ktools

Bringing common kernel APIs into Ruby using FFI.

www.github.com/yakischloba/ktools

Synopsis

irb(main):001:0> require 'ktools'
=> true
irb(main):002:0> r, w = IO.pipe
=> [#<IO:0x4fa90c>, #<IO:0x4fa880>]
irb(main):003:0> kq = Kqueue.new
=> #<Kernel::Kqueue:0x4f43a4 @kqfd=6, @fds={}>
irb(main):004:0> kq.add(:socket, r, :events => [:read, :write])
=> true
irb(main):005:0> kq.poll
=> []
irb(main):006:0> w.write "foo"
=> 3
irb(main):007:0> kq.poll
=> [{:type=>:socket, :target=>#<IO:0x4fa90c>, :events=>[:read]}]
irb(main):008:0> [r, w, kq].each {|i| i.close}

Features

I plan to support the following kernel APIs:

  • kqueue (works - see tests/test_kqueue.rb)

  • epoll (works - see tests/test_epoll.rb)

  • inotify

  • netlink

and maybe some others! I will at first hook up the C interfaces as directly as possible, and then write Rubyist-friendly wrappers around them.

Currently kqueue and epoll have Ruby wrapper APIs.

Install

  1. git clone git://github.com/yakischloba/ktools.git

  2. cd ktools

  3. gem build ktools.gemspec

  4. sudo gem install ktools-x.x.x.gem

Also gems are on Rubyforge, so you can simply 'sudo gem install ktools', but commits will be frequent for some time, so you'll probably want to be pulling the latest from Github.

Documentation

  • Documentation is located at ktools.rubyforge.org

  • Familiarity with the actual kernel subsystems is helpful for nitty-gritty usage or debugging issues.

Help

Please file all issues on the Github issue tracker. Patches (with tests) are welcome and encouraged, as are suggestions about API design, etc. It's all up in the air right now.

  • yakischloba on freenode

  • jakecdouglas at gmail

Something went wrong with that request. Please try again.