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