diff -r 2d52adc4adcc -r 4460fc10c6a3 examples/jail.rb --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/examples/jail.rb Tue Mar 03 22:23:45 2009 +0000 @@ -0,0 +1,21 @@ +#!/usr/bin/env ruby +# +# An example 'jail' utility in ruby. +# + +BEGIN { + require 'pathname' + basedir = Pathname.new( __FILE__ ).dirname.parent + + $LOAD_PATH.unshift basedir + "ext" unless + $LOAD_PATH.include? basedir + "ext" +} + +require 'jail' + +jid = BSD::Jail.create( '127.0.0.1', '/tmp', 'testjail' ) +puts "New jail created with id: %d" % [ jid ] + +# We're in the jail, now. +Dir.foreach('.') { |i| puts i } +