* Added jail header dependencies for mkmf Makefile.
* Renamed header file (bsdjail -> jail)
* Fixed copyright
* Initial commit of primary functionality
* Attach to a running jail
* Create a new jail
* List and instantiate existing jails
* Fetch information about existing jails
* Still needs...
* Attach "in a block" fleshed out
* Documentation and better comments
* Tests (of some kind, this will be tough)
* Update for not-yet-MFC'ed multiple IP jail patch in FBSD 7.2-STABLE
#!/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 ]