]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - sys/sys/jail.h
This commit was generated by cvs2svn to compensate for changes in r76589,
[FreeBSD/FreeBSD.git] / sys / sys / jail.h
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$
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 #ifndef _KERNEL
24
25 int jail __P((struct jail *));
26
27 #else /* _KERNEL */
28
29 #ifdef MALLOC_DECLARE
30 MALLOC_DECLARE(M_PRISON);
31 #endif
32
33 /*
34  * This structure describes a prison.  It is pointed to by all struct
35  * ucreds's of the inmates.  pr_ref keeps track of them and is used to
36  * delete the struture when the last inmate is dead.
37  *
38  * XXX: Note: this structure needs a mutex to protect the reference count
39  * and other mutable fields (pr_host, pr_linux).
40  */
41
42 struct prison {
43         int             pr_ref;
44         char            pr_host[MAXHOSTNAMELEN];
45         u_int32_t       pr_ip;
46         void            *pr_linux;
47 };
48
49 /*
50  * Sysctl-set variables that determine global jail policy
51  */
52 extern int      jail_set_hostname_allowed;
53 extern int      jail_socket_unixiproute_only;
54 extern int      jail_sysvipc_allowed;
55
56 /*
57  * Kernel support functions for jail().
58  */
59 struct ucred;
60 struct sockaddr;
61 int jailed __P((struct ucred *cred));
62 int prison_check __P((struct ucred *cred1, struct ucred *cred2));
63 void prison_free __P((struct prison *pr));
64 void prison_hold __P((struct prison *pr));
65 int prison_if __P((struct ucred *cred, struct sockaddr *sa));
66 int prison_ip __P((struct ucred *cred, int flag, u_int32_t *ip));
67 void prison_remote_ip __P((struct ucred *cred, int flags, u_int32_t *ip));
68
69 #endif /* !_KERNEL */
70 #endif /* !_SYS_JAIL_H_ */