ext/bsdjail.h
author Mahlon E. Smith <mahlon@martini.nu>
Thu, 25 Dec 2008 08:35:46 +0000
branchmahlon-misc
changeset 11 e908d309e7ec
parent 10 b1426511fb64
permissions -rw-r--r--
* It compiles! * Removed additional leftover link parser stuff. * Removed unused memory allocate/free stuff until I discuss with my cohort. It may be back... it may be left over from linkparser too. ;) * list() works, but cores. Not sure why yet. Really, list() should be renamed to something sensible, and return instantiated BSD::Jail objects to attach() to or get additional info on. * Ruby C bindings are way, way fun. Reminds me how little C I can remember with one project a year :)
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
11
e908d309e7ec * It compiles!
Mahlon E. Smith <mahlon@martini.nu>
parents: 10
diff changeset
     3
 *
e908d309e7ec * It compiles!
Mahlon E. Smith <mahlon@martini.nu>
parents: 10
diff changeset
     4
 *  vim: set nosta noet ts=4 sw=4:
e908d309e7ec * It compiles!
Mahlon E. Smith <mahlon@martini.nu>
parents: 10
diff changeset
     5
 *
10
b1426511fb64 Merged changes from trunk@4:8.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
     6
 *  $Id$
b1426511fb64 Merged changes from trunk@4:8.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
     7
 *  
b1426511fb64 Merged changes from trunk@4:8.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
     8
 *  Authors:
b1426511fb64 Merged changes from trunk@4:8.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
     9
 *    * Michael Granger <ged@FaerieMUD.org>
b1426511fb64 Merged changes from trunk@4:8.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    10
 *    * Mahlon E. Smith <mahlon@martini.nu>
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
 *  Copyright (c) 2008, Michael Granger and Mahlon Smith
b1426511fb64 Merged changes from trunk@4:8.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    13
 *  All rights reserved.
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
 *  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
    16
 *  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
    17
 *  
b1426511fb64 Merged changes from trunk@4:8.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    18
 *    * 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
    19
 *      this list of conditions and the following disclaimer.
b1426511fb64 Merged changes from trunk@4:8.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    20
 *  
b1426511fb64 Merged changes from trunk@4:8.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    21
 *    * 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
    22
 *      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
    23
 *      and/or other materials provided with the distribution.
b1426511fb64 Merged changes from trunk@4:8.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    24
 *  
b1426511fb64 Merged changes from trunk@4:8.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    25
 *    * 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
    26
 *      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
    27
 *      software without specific prior written permission.
b1426511fb64 Merged changes from trunk@4:8.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    28
 *  
b1426511fb64 Merged changes from trunk@4:8.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    29
 *  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
    30
 *  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
    31
 *  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
    32
 *  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
    33
 *  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
    34
 *  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
    35
 *  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
    36
 *  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
    37
 *  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
    38
 *  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
    39
 *  
b1426511fb64 Merged changes from trunk@4:8.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    40
 */
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
#ifndef _BSDJAIL_H_
b1426511fb64 Merged changes from trunk@4:8.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    43
#define _BSDJAIL_H_
b1426511fb64 Merged changes from trunk@4:8.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    44
11
e908d309e7ec * It compiles!
Mahlon E. Smith <mahlon@martini.nu>
parents: 10
diff changeset
    45
#include <ruby.h>
e908d309e7ec * It compiles!
Mahlon E. Smith <mahlon@martini.nu>
parents: 10
diff changeset
    46
#include <intern.h>				/* For rb_dbl2big() */
10
b1426511fb64 Merged changes from trunk@4:8.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    47
b1426511fb64 Merged changes from trunk@4:8.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    48
#include <stdio.h>
b1426511fb64 Merged changes from trunk@4:8.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    49
#include <sys/param.h>
b1426511fb64 Merged changes from trunk@4:8.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    50
#include <sys/jail.h>
b1426511fb64 Merged changes from trunk@4:8.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    51
#include <sys/types.h>
b1426511fb64 Merged changes from trunk@4:8.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    52
#include <unistd.h>
11
e908d309e7ec * It compiles!
Mahlon E. Smith <mahlon@martini.nu>
parents: 10
diff changeset
    53
#include <arpa/inet.h>
e908d309e7ec * It compiles!
Mahlon E. Smith <mahlon@martini.nu>
parents: 10
diff changeset
    54
#include <errno.h>
e908d309e7ec * It compiles!
Mahlon E. Smith <mahlon@martini.nu>
parents: 10
diff changeset
    55
#include <limits.h>
10
b1426511fb64 Merged changes from trunk@4:8.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    56
b1426511fb64 Merged changes from trunk@4:8.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    57
b1426511fb64 Merged changes from trunk@4:8.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    58
/* Debugging functions/macros */
b1426511fb64 Merged changes from trunk@4:8.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    59
#ifdef HAVE_STDARG_PROTOTYPES
b1426511fb64 Merged changes from trunk@4:8.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    60
#include <stdarg.h>
b1426511fb64 Merged changes from trunk@4:8.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    61
#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
    62
extern void rbjail_debug(const char *fmt, ...);
b1426511fb64 Merged changes from trunk@4:8.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    63
#else
b1426511fb64 Merged changes from trunk@4:8.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    64
#include <varargs.h>
b1426511fb64 Merged changes from trunk@4:8.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    65
#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
    66
extern void rbjail_debug(fmt, va_alist);
b1426511fb64 Merged changes from trunk@4:8.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    67
#endif
b1426511fb64 Merged changes from trunk@4:8.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    68
b1426511fb64 Merged changes from trunk@4:8.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    69
b1426511fb64 Merged changes from trunk@4:8.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    70
/* Debugging macro */
b1426511fb64 Merged changes from trunk@4:8.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    71
#if DEBUG
b1426511fb64 Merged changes from trunk@4:8.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    72
#  define debugMsg(f)	rbjail_debug f
b1426511fb64 Merged changes from trunk@4:8.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    73
#else /* ! DEBUG */
b1426511fb64 Merged changes from trunk@4:8.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    74
#  define debugMsg(f) 
b1426511fb64 Merged changes from trunk@4:8.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    75
#endif /* DEBUG */
b1426511fb64 Merged changes from trunk@4:8.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    76
b1426511fb64 Merged changes from trunk@4:8.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    77
b1426511fb64 Merged changes from trunk@4:8.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    78
#endif /* _BSDJAIL_H_ */
b1426511fb64 Merged changes from trunk@4:8.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    79