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 .\" ----------------------------------------------------------------------------
15 .Nm jail , jail_attach
16 .Nd imprison current process and future descendants
23 .Fn jail "struct jail *jail"
25 .Fn jail_attach "int jid"
29 system call sets up a jail and locks the current process in it.
31 The argument is a pointer to a structure describing the prison:
32 .Bd -literal -offset indent
42 defines the version of the API in use.
43 It should be set to zero at this time.
47 pointer should be set to the directory which is to be the root of the
52 pointer can be set to the hostname of the prison.
54 from the inside of the prison.
58 can be set to the IP number assigned to the prison.
62 system call attaches the current process to an existing jail,
68 returns a non-negative integer, termed the jail identifier (JID).
69 It returns \-1 on failure, and sets
71 to indicate the error.
75 Once a process has been put in a prison, it and its descendants cannot escape
78 Inside the prison, the concept of
82 it can be assumed that nothing can be mangled from inside a prison which
83 does not exist entirely inside that prison.
84 For instance the directory
87 can be manipulated all the ways a root can normally do it, including
89 but new device special nodes cannot be created because they reference
90 shared resources (the device drivers in the kernel).
93 for a process is the greater of the global
95 or, if present, the per-jail
98 All IP activity will be forced to happen to/from the IP number specified,
99 which should be an alias on one of the network interfaces.
101 It is possible to identify a process as jailed by examining
102 .Dq Li /proc/<pid>/status :
103 it will show a field near the end of the line, either as
104 a single hyphen for a process at large, or the hostname currently
105 set for the prison for jailed processes.
113 The version number of the argument is not correct.
115 No free JID could be found.
122 internally, so it can fail for all the same reasons.
125 manual page for details.
132 system call appeared in
136 system call appeared in
139 The jail feature was written by
140 .An Poul-Henning Kamp
142 .Dq Li http://www.rndassociates.com/
143 who contributed it to