docs/example.rb
author Michael Granger <ged@FaerieMUD.org>
Thu, 20 Nov 2008 16:59:00 +0000
changeset 4 9e4a97b20fcb
parent 0 92d00ff32c56
permissions -rw-r--r--
Adding ignore for mkmf.log.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
92d00ff32c56 Initial checkin
Michael Granger <ged@FaerieMUD.org>
parents:
diff changeset
     1
#!/usr/bin/ruby
92d00ff32c56 Initial checkin
Michael Granger <ged@FaerieMUD.org>
parents:
diff changeset
     2
# 
92d00ff32c56 Initial checkin
Michael Granger <ged@FaerieMUD.org>
parents:
diff changeset
     3
# Example jail_attach usage
92d00ff32c56 Initial checkin
Michael Granger <ged@FaerieMUD.org>
parents:
diff changeset
     4
# 
92d00ff32c56 Initial checkin
Michael Granger <ged@FaerieMUD.org>
parents:
diff changeset
     5
# == Synopsis
92d00ff32c56 Initial checkin
Michael Granger <ged@FaerieMUD.org>
parents:
diff changeset
     6
# 
92d00ff32c56 Initial checkin
Michael Granger <ged@FaerieMUD.org>
parents:
diff changeset
     7
#   
92d00ff32c56 Initial checkin
Michael Granger <ged@FaerieMUD.org>
parents:
diff changeset
     8
# 
92d00ff32c56 Initial checkin
Michael Granger <ged@FaerieMUD.org>
parents:
diff changeset
     9
# == Authors
92d00ff32c56 Initial checkin
Michael Granger <ged@FaerieMUD.org>
parents:
diff changeset
    10
# 
92d00ff32c56 Initial checkin
Michael Granger <ged@FaerieMUD.org>
parents:
diff changeset
    11
# * Michael Granger <ged@FaerieMUD.org>
92d00ff32c56 Initial checkin
Michael Granger <ged@FaerieMUD.org>
parents:
diff changeset
    12
# 
92d00ff32c56 Initial checkin
Michael Granger <ged@FaerieMUD.org>
parents:
diff changeset
    13
# == Copyright
92d00ff32c56 Initial checkin
Michael Granger <ged@FaerieMUD.org>
parents:
diff changeset
    14
#
92d00ff32c56 Initial checkin
Michael Granger <ged@FaerieMUD.org>
parents:
diff changeset
    15
# Copyright (c) 2006 The FaerieMUD Consortium. Some rights reserved.
92d00ff32c56 Initial checkin
Michael Granger <ged@FaerieMUD.org>
parents:
diff changeset
    16
# 
92d00ff32c56 Initial checkin
Michael Granger <ged@FaerieMUD.org>
parents:
diff changeset
    17
# This work is licensed under the Creative Commons Attribution License. To view
92d00ff32c56 Initial checkin
Michael Granger <ged@FaerieMUD.org>
parents:
diff changeset
    18
# a copy of this license, visit http://creativecommons.org/licenses/by/1.0/ or
92d00ff32c56 Initial checkin
Michael Granger <ged@FaerieMUD.org>
parents:
diff changeset
    19
# send a letter to Creative Commons, 559 Nathan Abbott Way, Stanford, California
92d00ff32c56 Initial checkin
Michael Granger <ged@FaerieMUD.org>
parents:
diff changeset
    20
# 94305, USA.
92d00ff32c56 Initial checkin
Michael Granger <ged@FaerieMUD.org>
parents:
diff changeset
    21
# 
92d00ff32c56 Initial checkin
Michael Granger <ged@FaerieMUD.org>
parents:
diff changeset
    22
# == Version
92d00ff32c56 Initial checkin
Michael Granger <ged@FaerieMUD.org>
parents:
diff changeset
    23
#
92d00ff32c56 Initial checkin
Michael Granger <ged@FaerieMUD.org>
parents:
diff changeset
    24
#  $Id$
92d00ff32c56 Initial checkin
Michael Granger <ged@FaerieMUD.org>
parents:
diff changeset
    25
# 
92d00ff32c56 Initial checkin
Michael Granger <ged@FaerieMUD.org>
parents:
diff changeset
    26
92d00ff32c56 Initial checkin
Michael Granger <ged@FaerieMUD.org>
parents:
diff changeset
    27
require 'bsdjail'
92d00ff32c56 Initial checkin
Michael Granger <ged@FaerieMUD.org>
parents:
diff changeset
    28
92d00ff32c56 Initial checkin
Michael Granger <ged@FaerieMUD.org>
parents:
diff changeset
    29
# With a block, does a fork() then a jail_attach() from the child
92d00ff32c56 Initial checkin
Michael Granger <ged@FaerieMUD.org>
parents:
diff changeset
    30
pid = BSDJail.attach( jid ) do
92d00ff32c56 Initial checkin
Michael Granger <ged@FaerieMUD.org>
parents:
diff changeset
    31
	puts "I'm a child process in jail!"
92d00ff32c56 Initial checkin
Michael Granger <ged@FaerieMUD.org>
parents:
diff changeset
    32
	
92d00ff32c56 Initial checkin
Michael Granger <ged@FaerieMUD.org>
parents:
diff changeset
    33
	
92d00ff32c56 Initial checkin
Michael Granger <ged@FaerieMUD.org>
parents:
diff changeset
    34
end
92d00ff32c56 Initial checkin
Michael Granger <ged@FaerieMUD.org>
parents:
diff changeset
    35
92d00ff32c56 Initial checkin
Michael Granger <ged@FaerieMUD.org>
parents:
diff changeset
    36