2 .\" SPDX-License-Identifier: BSD-2-Clause-FreeBSD
4 .\" Copyright (c) 2020, Ryan Moeller <freqlabs@FreeBSD.org>
6 .\" Redistribution and use in source and binary forms, with or without
7 .\" modification, are permitted provided that the following conditions
9 .\" 1. Redistributions of source code must retain the above copyright
10 .\" notice, this list of conditions and the following disclaimer.
11 .\" 2. Redistributions in binary form must reproduce the above copyright
12 .\" notice, this list of conditions and the following disclaimer in the
13 .\" documentation and/or other materials provided with the distribution.
15 .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
46 local jail = require('jail')
49 .Bl -tag -width XXXX -compact
50 .It Dv jid, err = jail.getid(name)
51 .It Dv name, err = jail.getname(jid)
52 .It Dv params, err = jail.allparams()
53 .It Dv jid, res = jail.getparams(jid|name, params [, flags ] )
54 .It Dv jid, err = jail.setparams(jid|name, params, flags )
63 module is a binding to the
66 It provides a string-oriented interface for the
72 .It Dv jid, err = jail.getid(name)
73 Get the jail identifier
77 is the name of a jail or a jid in the form of a string.
78 .It Dv name, err = jail.getname(jid)
79 Get the name of a jail as a string for the given
82 .It Dv params, err = jail.allparams()
83 Get a list of all supported parameter names
87 for descriptions of the core jail parameters.
88 .It Dv jid, res = jail.getparams(jid|name, params [, flags ] )
89 Get a table of the requested parameters for the given jail.
91 can either be the jid as an integer or the jid or name as a string.
93 is a list of parameter names.
95 is an optional integer representing the flag bits to apply for the operation.
96 See the list of flags below.
100 .It Dv jid, err = jail.setparams(jid|name, params [, flags ] )
101 Set parameters for a given jail.
102 This is used to create, update, attach to, or destroy a jail.
104 can either be the jid as an integer or the jid or name as a string.
106 is a table of parameters to apply to the jail, where each key in the table
107 is a parameter name as a string and each value is a string that will be
108 converted to the internal value type by
109 .Xr jailparam_import 3 .
111 is an optional integer representing the flag bits to apply for the operation.
112 See the list of flags below.
117 arguments are an integer bitwise-or combination of one or more of the following
123 to create a new jail.
124 The jail must not already exist, unless combined with
129 to modify an existing jail.
130 The jail must already exist, unless combined with
139 to attach the current process to a jail.
141 Allow operating on a jail that is in the process of being removed.
148 functions return a jail identifier integer on success, or
150 and an error message string if an error occurred.
154 function returns a jail name string on success, or
156 and an error message string if an error occurred.
160 function returns a list of parameter name strings on success, or
162 and an error message string if an error occurred.
166 function returns a jail identifier integer and a table of jail parameters
167 with parameter name strings as keys and strings for values on success, or
169 and an error message string if an error occurred.
171 Set the hostname of jail
175 .Bd -literal -offset indent
176 local jail = require('jail')
178 jid, err = jail.setparams("foo", {["host.hostname"]="foo.bar"},
185 Retrieve the hostname of jail
187 .Bd -literal -offset indent
188 local jail = require('jail')
190 jid, res = jail.getparams("foo", {"host.hostname"})
194 print(res["host.hostname"])
203 Lua module for flua first appeared in
207 with inspiration from