* It compiles!
* Removed additional leftover link parser stuff.
* Removed unused memory allocate/free stuff until I discuss with my
cohort. It may be back... it may be left over from linkparser too. ;)
* list() works, but cores. Not sure why yet. Really, list() should be
renamed to something sensible, and return instantiated BSD::Jail
objects to attach() to or get additional info on.
* Ruby C bindings are way, way fun. Reminds me how little C I can
remember with one project a year :)
#!/usr/bin/ruby
BEGIN {
require 'pathname'
basedir = Pathname.new( __FILE__ ).dirname.parent
$LOAD_PATH.unshift basedir + "ext" unless
$LOAD_PATH.include? basedir + "ext"
}
require 'bsdjail'
jid = Integer( ARGV.shift )
args = ARGV
$deferr.puts "In process #{Process.pid}, about to jail_attach() with a block"
childpid = BSD::Jail.attach( jid ) do
Dir.chdir( "/" )
$deferr.puts "Child #{Process.pid} exec()ing:", " " + args.join(" ")
exec( *args )
end
$deferr.puts "Parent: waiting on imprisoned child #{childpid}"
Process.waitpid( childpid )
$deferr.puts "Child exited with exit code: %d" % [ $?.exitstatus ]