The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/sys/jail.h

Version: -  FREEBSD  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-2  -  FREEBSD-11-1  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-4  -  FREEBSD-10-3  -  FREEBSD-10-2  -  FREEBSD-10-1  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-3  -  FREEBSD-9-2  -  FREEBSD-9-1  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-4  -  FREEBSD-8-3  -  FREEBSD-8-2  -  FREEBSD-8-1  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-4  -  FREEBSD-7-3  -  FREEBSD-7-2  -  FREEBSD-7-1  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-4  -  FREEBSD-6-3  -  FREEBSD-6-2  -  FREEBSD-6-1  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-5  -  FREEBSD-5-4  -  FREEBSD-5-3  -  FREEBSD-5-2  -  FREEBSD-5-1  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  linux-2.6  -  linux-2.4.22  -  MK83  -  MK84  -  PLAN9  -  DFBSD  -  NETBSD  -  NETBSD5  -  NETBSD4  -  NETBSD3  -  NETBSD20  -  OPENBSD  -  xnu-517  -  xnu-792  -  xnu-792.6.70  -  xnu-1228  -  xnu-1456.1.26  -  xnu-1699.24.8  -  xnu-2050.18.24  -  OPENSOLARIS  -  minix-3-1-1 
SearchContext: -  none  -  3  -  10 

    1 /*
    2  * ----------------------------------------------------------------------------
    3  * "THE BEER-WARE LICENSE" (Revision 42):
    4  * <phk@FreeBSD.org> wrote this file.  As long as you retain this notice you
    5  * can do whatever you want with this stuff. If we meet some day, and you think
    6  * this stuff is worth it, you can buy me a beer in return.   Poul-Henning Kamp
    7  * ----------------------------------------------------------------------------
    8  *
    9  * $FreeBSD: releng/5.2/sys/sys/jail.h 113275 2003-04-09 02:55:18Z mike $
   10  *
   11  */
   12 
   13 #ifndef _SYS_JAIL_H_
   14 #define _SYS_JAIL_H_
   15 
   16 struct jail {
   17         u_int32_t       version;
   18         char            *path;
   19         char            *hostname;
   20         u_int32_t       ip_number;
   21 };
   22 
   23 struct xprison {
   24         int              pr_version;
   25         int              pr_id;
   26         char             pr_path[MAXPATHLEN];
   27         char             pr_host[MAXHOSTNAMELEN];
   28         u_int32_t        pr_ip;
   29 };
   30 #define XPRISON_VERSION 1
   31 
   32 #ifndef _KERNEL
   33 
   34 int jail(struct jail *);
   35 int jail_attach(int);
   36 
   37 #else /* _KERNEL */
   38 
   39 #include <sys/queue.h>
   40 #include <sys/_lock.h>
   41 #include <sys/_mutex.h>
   42 
   43 #define JAIL_MAX        999999
   44 
   45 #ifdef MALLOC_DECLARE
   46 MALLOC_DECLARE(M_PRISON);
   47 #endif
   48 
   49 /*
   50  * This structure describes a prison.  It is pointed to by all struct
   51  * ucreds's of the inmates.  pr_ref keeps track of them and is used to
   52  * delete the struture when the last inmate is dead.
   53  *
   54  * Lock key:
   55  *   (a) allprison_mutex
   56  *   (p) locked by pr_mutex
   57  *   (c) set only during creation before the structure is shared, no mutex
   58  *       required to read
   59  */
   60 struct mtx;
   61 struct prison {
   62         LIST_ENTRY(prison) pr_list;                     /* (a) all prisons */
   63         int              pr_id;                         /* (c) prison id */
   64         int              pr_ref;                        /* (p) refcount */
   65         char             pr_path[MAXPATHLEN];           /* (c) chroot path */
   66         struct vnode    *pr_root;                       /* (c) vnode to rdir */
   67         char             pr_host[MAXHOSTNAMELEN];       /* (p) jail hostname */
   68         u_int32_t        pr_ip;                         /* (c) ip addr host */
   69         void            *pr_linux;                      /* (p) linux abi */
   70         int              pr_securelevel;                /* (p) securelevel */
   71         struct mtx       pr_mtx;
   72 };
   73 
   74 /*
   75  * Sysctl-set variables that determine global jail policy
   76  *
   77  * XXX MIB entries will need to be protected by a mutex.
   78  */
   79 extern int      jail_set_hostname_allowed;
   80 extern int      jail_socket_unixiproute_only;
   81 extern int      jail_sysvipc_allowed;
   82 
   83 LIST_HEAD(prisonlist, prison);
   84 extern struct   prisonlist allprison;
   85 
   86 /*
   87  * Kernel support functions for jail().
   88  */
   89 struct ucred;
   90 struct sockaddr;
   91 int jailed(struct ucred *cred);
   92 void getcredhostname(struct ucred *cred, char *, size_t);
   93 int prison_check(struct ucred *cred1, struct ucred *cred2);
   94 void prison_free(struct prison *pr);
   95 u_int32_t prison_getip(struct ucred *cred);
   96 void prison_hold(struct prison *pr);
   97 int prison_if(struct ucred *cred, struct sockaddr *sa);
   98 int prison_ip(struct ucred *cred, int flag, u_int32_t *ip);
   99 void prison_remote_ip(struct ucred *cred, int flags, u_int32_t *ip);
  100 
  101 #endif /* !_KERNEL */
  102 #endif /* !_SYS_JAIL_H_ */

Cache object: 950bbc35d6a0e813126cfd59d0f699b5


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.