| Main index | Section 3 | Options |
#include <sys/param.h>
#include <sys/jail.h>
#include <jail.h>extern char jail_errmsg[];
The jail_getid() function returns the JID of the jail identified by name, or -1 if the jail does not exist.
The jail_getname() function returns the name of the jail identified by jid, or NULL if the jail does not exist.
The jail_setv() function takes a null-terminated list of name and value strings, and passes it to jail_set(2).
The jail_getv() function takes a null-terminated list of name and value strings, and passes it to jail_get(2). It is the caller's responsibility to ensure that the value strings point to buffers large enough to hold the string representation of the returned parameters.
The jailparam_all() function sets jpp to a list of all known jail parameters, and returns the number of parameters. The list should later be freed with jailparam_free() and free(3).
The jailparam_init() function clears a parameter record and copies the name to it. After use, it should be freed with jailparam_free().
The jailparam_import() function adds a value to a parameter record, converting it from a string to its native form. The jailparam_import_raw() function adds a value without performing any conversion.
The jailparam_set() function passes a list of parameters to jail_set(2). The parameters are assumed to have been created with jailparam_init() and jailparam_import().
The jailparam_get() function passes a list of parameters to jail_get(2). The parameters are assumed to have been created with jailparam_init() or jailparam_list(), with one parameter (the key) having been given a value with jailparam_import().
The jailparam_export() function returns the string equivalent of a parameter value. The returned string should be freed after use.
The jailparam_free() function frees the stored names and values in a parameter list. If the list itself came from jailparam_all(), it should be freed as well.
The jail_getname() and jailparam_export() functions return a dynamically allocated string on success, or NULL on error.
The jailparam_all() function returns the number of parameters on success, or -1 on error.
The jailparam_init(), jailparam_import() and jailparam_import_raw() functions return 0 on success, or -1 on error.
Whenever an error is returned, errno is set, and the global string jail_errmsg contains a description of the error, possibly from jail_set(2) or jail_get(2).
jail_setv(JAIL_UPDATE, "name", "foo", "host.hostname", "foo.bar",
NULL);
OR:
struct jailparam params[2]; jailparam_init(¶ms[0], "name"); jailparam_import(¶ms[0], "foo"); jailparam_init(¶ms[1], "host.hostname"); jailparam_import(¶ms[1], "foo.bar"); jailparam_set(params, 2, JAIL_UPDATE); jailparam_free(params, 2);
Retrieve the hostname of jail "foo":
char hostname[MAXHOSTNAMELEN]; jail_getv(0, "name", "foo", "host.hostname", hostname, NULL);
OR:
struct jailparam params[2]; jailparam_init(¶ms[0], "name"); jailparam_import(¶ms[0], "foo"); jailparam_init(¶ms[1], "host.hostname"); jailparam_get(params, 2, 0); hostname = jailparam_export(¶ms[1]); jailparam_free(params, 2); amp;... free(hostname);
| [EINVAL] | |
| A parameter value cannot be converted from the passed string to its internal form. | |
| [ENOENT] | |
| The named parameter does not exist. | |
| [ENOENT] | |
| A parameter is of an unknown type. | |
| JAIL (3) | August 31, 2010 |
| Main index | Section 3 | Options |
Please direct any comments about this manual page service to Ben Bullock. Privacy policy.
| “ | Ken Thompson has an automobile which he helped design. Unlike most automobiles, it has neither speedometer, nor gas gauge, nor any of the other numerous idiot lights which plague the modern driver. Rather, if the driver makes a mistake, a giant “?” lights up in the center of the dashboard. “The experienced driver,” says Thompson, “will usually know what's wrong.” | ” |