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