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 * ----------------------------------------------------------------------------
9 * $FreeBSD: src/sys/sys/jail.h,v 1.8.2.2 2000/11/01 17:58:06 rwatson Exp $
10 * $DragonFly: src/sys/sys/jail.h,v 1.8 2006/10/27 04:56:33 dillon Exp $
18 #include <sys/types.h>
21 #include <sys/param.h>
24 #include <sys/ucred.h>
36 int jail(struct jail *);
41 #ifndef _SYS_NAMECACHE_H_
42 #include <sys/namecache.h>
44 #ifndef _SYS_VARSYM_H_
45 #include <sys/varsym.h>
49 MALLOC_DECLARE(M_PRISON);
52 #define JAIL_MAX 999999
55 * This structure describes a prison. It is pointed to by all struct
56 * proc's of the inmates. pr_ref keeps track of them and is used to
57 * delete the struture when the last inmate is dead.
61 LIST_ENTRY(prison) pr_list; /* all prisons */
62 int pr_id; /* prison id */
63 int pr_ref; /* reference count */
64 struct nchandle pr_root; /* namecache entry of root */
65 char pr_host[MAXHOSTNAMELEN]; /* host name */
66 uint32_t pr_ip; /* IP address */
67 void *pr_linux; /* Linux ABI emulation */
68 int pr_securelevel; /* jail securelevel */
69 struct varsymset pr_varsymset; /* jail varsyms */
73 * Sysctl-set variables that determine global jail policy
75 extern int jail_set_hostname_allowed;
76 extern int jail_socket_unixiproute_only;
77 extern int jail_sysvipc_allowed;
78 extern int jail_chflags_allowed;
80 void prison_hold(struct prison *);
81 void prison_free(struct prison *);
84 * Return 1 if the passed credential is in a jail, otherwise 0.
87 jailed(struct ucred *cred)
89 return(cred->cr_prison != NULL);
93 #endif /* !_SYS_JAIL_H_ */