examples/jail.rb
changeset 7 4460fc10c6a3
--- /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 }
+