man.bsd.lv manual page server

Manual Page Search Parameters

JAIL(3lua) 3lua JAIL(3lua)

getid, getname, allparams, getparams, setparams, CREATE, UPDATE, ATTACH, DYINGLua binding to jail(3)

local jail = require('jail')

 
 
 
])
 
)
 
 
 
 
 

The jail module is a binding to the jail(3) library. It provides a string-oriented interface for the jail_get(2) and jail_set(2) system calls.
Get the jail identifier (jid) as an integer. name is the name of a jail or a jid in the form of a string.
Get the name of a jail as a string for the given jid (an integer).
Get a list of all supported parameter names (as strings). See jail(8) for descriptions of the core jail parameters.
])
Get a table of the requested parameters for the given jail. jid|name can either be the jid as an integer or the jid or name as a string. params is a list of parameter names. flags is an optional integer representing the flag bits to apply for the operation. See the list of flags below. Only the DYING flag is valid to set.
])
Set parameters for a given jail. This is used to create, update, attach to, or destroy a jail. jid|name can either be the jid as an integer or the jid or name as a string. params is a table of parameters to apply to the jail, where each key in the table is a parameter name as a string and each value is a string that will be converted to the internal value type by jailparam_import(3). flags is an optional integer representing the flag bits to apply for the operation. See the list of flags below.

The flags arguments are an integer bitwise-or combination of one or more of the following flags:

Used with () to create a new jail. The jail must not already exist, unless combined with UPDATE.
Used with setparams() to modify an existing jail. The jail must already exist, unless combined with CREATE.
Used with setparams() in combination with CREATE or UPDATE to attach the current process to a jail.
Allow operating on a jail that is in the process of being removed.

The getid() and setparams() functions return a jail identifier integer on success, or nil and an error message string if an error occurred.

The getname() function returns a jail name string on success, or nil and an error message string if an error occurred.

The allparams() function returns a list of parameter name strings on success, or nil and an error message string if an error occurred.

The getparams() function returns a jail identifier integer and a table of jail parameters with parameter name strings as keys and strings for values on success, or nil and an error message string if an error occurred.

Set the hostname of jail “foo” to “foo.bar”:

local jail = require('jail')

jid, err = jail.setparams("foo", {["host.hostname"]="foo.bar"},
    jail.UPDATE)
if not jid then
    error(err)
end

Retrieve the hostname of jail “foo”:

local jail = require('jail')

jid, res = jail.getparams("foo", {"host.hostname"})
if not jid then
    error(res)
end
print(res["host.hostname"])

jail(2), jail(3), jail(8)

The jail Lua module for flua first appeared in FreeBSD 13.0.

Ryan Moeller, with inspiration from NetBSD gpio(3lua), by
Mark Balmer.

October 24, 2020 FreeBSD-13.0