ext/jail.h
author Mahlon E. Smith <mahlon@martini.nu>
Sat, 28 Feb 2009 06:52:48 +0000
changeset 6 2d52adc4adcc
child 7 4460fc10c6a3
permissions -rw-r--r--
* Merge of the mahlon experimental branch.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
6
2d52adc4adcc * Merge of the mahlon experimental branch.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
     1
/*
2d52adc4adcc * Merge of the mahlon experimental branch.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
     2
 *  jail.h - Header for the ruby jail extension
2d52adc4adcc * Merge of the mahlon experimental branch.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
     3
 *
2d52adc4adcc * Merge of the mahlon experimental branch.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
     4
 *  vim: set nosta noet ts=4 sw=4:
2d52adc4adcc * Merge of the mahlon experimental branch.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
     5
 *
2d52adc4adcc * Merge of the mahlon experimental branch.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
     6
 *  $Id$
2d52adc4adcc * Merge of the mahlon experimental branch.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
     7
 *  
2d52adc4adcc * Merge of the mahlon experimental branch.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
     8
 *  Authors:
2d52adc4adcc * Merge of the mahlon experimental branch.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
     9
 *    * Michael Granger <ged@FaerieMUD.org>
2d52adc4adcc * Merge of the mahlon experimental branch.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    10
 *    * Mahlon E. Smith <mahlon@martini.nu>
2d52adc4adcc * Merge of the mahlon experimental branch.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    11
 *  
2d52adc4adcc * Merge of the mahlon experimental branch.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    12
 *  Copyright (c) 2008, Michael Granger and Mahlon Smith
2d52adc4adcc * Merge of the mahlon experimental branch.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    13
 *  All rights reserved.
2d52adc4adcc * Merge of the mahlon experimental branch.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    14
 *  
2d52adc4adcc * Merge of the mahlon experimental branch.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    15
 *  Redistribution and use in source and binary forms, with or without
2d52adc4adcc * Merge of the mahlon experimental branch.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    16
 *  modification, are permitted provided that the following conditions are met:
2d52adc4adcc * Merge of the mahlon experimental branch.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    17
 *  
2d52adc4adcc * Merge of the mahlon experimental branch.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    18
 *    * Redistributions of source code must retain the above copyright notice,
2d52adc4adcc * Merge of the mahlon experimental branch.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    19
 *      this list of conditions and the following disclaimer.
2d52adc4adcc * Merge of the mahlon experimental branch.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    20
 *  
2d52adc4adcc * Merge of the mahlon experimental branch.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    21
 *    * Redistributions in binary form must reproduce the above copyright notice,
2d52adc4adcc * Merge of the mahlon experimental branch.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    22
 *      this list of conditions and the following disclaimer in the documentation
2d52adc4adcc * Merge of the mahlon experimental branch.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    23
 *      and/or other materials provided with the distribution.
2d52adc4adcc * Merge of the mahlon experimental branch.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    24
 *  
2d52adc4adcc * Merge of the mahlon experimental branch.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    25
 *    * Neither the name of the author/s, nor the names of the project's
2d52adc4adcc * Merge of the mahlon experimental branch.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    26
 *      contributors may be used to endorse or promote products derived from this
2d52adc4adcc * Merge of the mahlon experimental branch.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    27
 *      software without specific prior written permission.
2d52adc4adcc * Merge of the mahlon experimental branch.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    28
 *  
2d52adc4adcc * Merge of the mahlon experimental branch.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    29
 *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
2d52adc4adcc * Merge of the mahlon experimental branch.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    30
 *  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2d52adc4adcc * Merge of the mahlon experimental branch.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    31
 *  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
2d52adc4adcc * Merge of the mahlon experimental branch.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    32
 *  DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
2d52adc4adcc * Merge of the mahlon experimental branch.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    33
 *  FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2d52adc4adcc * Merge of the mahlon experimental branch.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    34
 *  DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
2d52adc4adcc * Merge of the mahlon experimental branch.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    35
 *  SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
2d52adc4adcc * Merge of the mahlon experimental branch.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    36
 *  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
2d52adc4adcc * Merge of the mahlon experimental branch.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    37
 *  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
2d52adc4adcc * Merge of the mahlon experimental branch.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    38
 *  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2d52adc4adcc * Merge of the mahlon experimental branch.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    39
 *  
2d52adc4adcc * Merge of the mahlon experimental branch.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    40
 */
2d52adc4adcc * Merge of the mahlon experimental branch.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    41
2d52adc4adcc * Merge of the mahlon experimental branch.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    42
#ifndef _BSDJAIL_H_
2d52adc4adcc * Merge of the mahlon experimental branch.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    43
#define _BSDJAIL_H_
2d52adc4adcc * Merge of the mahlon experimental branch.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    44
2d52adc4adcc * Merge of the mahlon experimental branch.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    45
#include "ruby.h"
2d52adc4adcc * Merge of the mahlon experimental branch.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    46
2d52adc4adcc * Merge of the mahlon experimental branch.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    47
#include <stdio.h>
2d52adc4adcc * Merge of the mahlon experimental branch.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    48
#include <sys/param.h>
2d52adc4adcc * Merge of the mahlon experimental branch.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    49
#include <sys/jail.h>
2d52adc4adcc * Merge of the mahlon experimental branch.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    50
#include <sys/types.h>
2d52adc4adcc * Merge of the mahlon experimental branch.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    51
#include <sys/sysctl.h>
2d52adc4adcc * Merge of the mahlon experimental branch.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    52
#include <unistd.h>
2d52adc4adcc * Merge of the mahlon experimental branch.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    53
#include <arpa/inet.h>
2d52adc4adcc * Merge of the mahlon experimental branch.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    54
#include <errno.h>
2d52adc4adcc * Merge of the mahlon experimental branch.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    55
2d52adc4adcc * Merge of the mahlon experimental branch.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    56
2d52adc4adcc * Merge of the mahlon experimental branch.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    57
/* Debugging functions/macros */
2d52adc4adcc * Merge of the mahlon experimental branch.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    58
#ifdef HAVE_STDARG_PROTOTYPES
2d52adc4adcc * Merge of the mahlon experimental branch.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    59
#include <stdarg.h>
2d52adc4adcc * Merge of the mahlon experimental branch.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    60
#define va_init_list(a,b) va_start(a,b)
2d52adc4adcc * Merge of the mahlon experimental branch.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    61
extern void rbjail_debug(const char *fmt, ...);
2d52adc4adcc * Merge of the mahlon experimental branch.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    62
#else
2d52adc4adcc * Merge of the mahlon experimental branch.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    63
#include <stdargs.h>
2d52adc4adcc * Merge of the mahlon experimental branch.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    64
#define va_init_list(a,b) va_start(a)
2d52adc4adcc * Merge of the mahlon experimental branch.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    65
extern void rbjail_debug(fmt, va_alist);
2d52adc4adcc * Merge of the mahlon experimental branch.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    66
#endif
2d52adc4adcc * Merge of the mahlon experimental branch.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    67
2d52adc4adcc * Merge of the mahlon experimental branch.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    68
2d52adc4adcc * Merge of the mahlon experimental branch.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    69
/* Debugging macro */
2d52adc4adcc * Merge of the mahlon experimental branch.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    70
#if DEBUG
2d52adc4adcc * Merge of the mahlon experimental branch.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    71
#  define debugMsg(f)	rbjail_debug f
2d52adc4adcc * Merge of the mahlon experimental branch.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    72
#else /* ! DEBUG */
2d52adc4adcc * Merge of the mahlon experimental branch.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    73
#  define debugMsg(f) 
2d52adc4adcc * Merge of the mahlon experimental branch.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    74
#endif /* DEBUG */
2d52adc4adcc * Merge of the mahlon experimental branch.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    75
2d52adc4adcc * Merge of the mahlon experimental branch.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    76
2d52adc4adcc * Merge of the mahlon experimental branch.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    77
#endif /* _BSDJAIL_H_ */
2d52adc4adcc * Merge of the mahlon experimental branch.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    78