# memberdef

refid: a3e9d9e45d908e92377921bdc20e74479
name: stdin_fd
definition: int lxc_attach_options_t::stdin_fd
type: int
scope: lxc_attach_options_t
detaileddescription:
 File descriptors for stdin, stdout and stderr,
\c dup2() will be used before calling exec_function,
(assuming not \c 0, \c 1 and \c 2 are specified) and the
original fds are closed before passing control
over. Any \c O_CLOEXEC flag will be removed after
that.stdin file descriptor  


refid: a22232139102062bcf18e1f7ae6aea17d
name: personality
definition: long lxc_attach_options_t::personality
type: long
scope: lxc_attach_options_t
detaileddescription:
 Initial personality (\c -1 to autodetect).
\warning This may be ignored if lxc is compiled without personality
support)


refid: ab6a000a4ac27f2ec3d861c55499eaff2
name: initial_cwd
definition: char* lxc_attach_options_t::initial_cwd
type: char *
scope: lxc_attach_options_t
detaileddescription:
 Initial current directory, use \c NULL to use cwd.
If the current directory does not exist in the container, the root
directory will be used instead because of kernel defaults.


refid: a8a62e9318622bc396fdd24ab1a89bf60
name: uid
definition: uid_t lxc_attach_options_t::uid
type: uid_t
scope: lxc_attach_options_t
detaileddescription:
 The user-id to run as.

\note Set to \c -1 for default behaviour (init uid for userns
containers or \c 0 (super-user) if detection fails).


refid: a7e54d34f03a8a366ff3a64306fd61dfe
name: gid
definition: gid_t lxc_attach_options_t::gid
type: gid_t
scope: lxc_attach_options_t
detaileddescription:
 The group-id to run as.

\note Set to \c -1 for default behaviour (init gid for userns
containers or \c 0 (super-user) if detection fails).


refid: a4a1110eb2780d6d4b67e591002f4c093
name: state
definition: const char*(* lxc_container::state)(struct lxc_container *c)
type: const char *(*
argsstring: )(struct lxc_container *c)
scope: lxc_container
briefdescription: Determine state of container.
detaileddescription:
\param c Container.

\return Static upper-case string representing state of container.

\note Returned string must not be freed.


refid: a55798d1efdb0896b6e229f6b333da363
name: load_config
definition: bool(* lxc_container::load_config)(struct lxc_container *c, const char *alt_file)
type: bool(*
argsstring: )(struct lxc_container *c, const char *alt_file)
scope: lxc_container
briefdescription: Load the specified configuration for the container.
detaileddescription:
\param c Container.
\param alt_file Full path to alternate configuration file, or
 \c NULL to use the default configuration file.

\return \c true on success, else \c false.


refid: a8098153d082a8c30037920b36b27edc9
name: start
definition: bool(* lxc_container::start)(struct lxc_container *c, int useinit, char *const argv[])
type: bool(*
argsstring: )(struct lxc_container *c, int useinit, char *const argv[])
scope: lxc_container
briefdescription: Start the container.
detaileddescription:
\param c Container.
\param useinit Use lxcinit rather than \c /sbin/init.
\param argv Array of arguments to pass to init.

\return \c true on success, else \c false.


refid: a586a3bc48b5ece3e44ccf9bb418453e0
name: startl
definition: bool(* lxc_container::startl)(struct lxc_container *c, int useinit,...)
type: bool(*
argsstring: )(struct lxc_container *c, int useinit,...)
scope: lxc_container
briefdescription: Start the container (list variant).
detaileddescription:
\param c Container.
\param useinit Use lxcinit rather than \c /sbin/init.
\param ... Command-line to pass to init (must end in \c NULL).

\return \c true on success, else \c false.

\note Identical to \ref start except that that the init
 arguments are specified via a list rather than an array of
 pointers.


refid: a8ce6b7f2a69200c66153bd05046d7749
name: want_daemonize
definition: bool(* lxc_container::want_daemonize)(struct lxc_container *c, bool state)
type: bool(*
argsstring: )(struct lxc_container *c, bool state)
scope: lxc_container
briefdescription: Change whether the container wants to run disconnected from the terminal.
detaileddescription:
\param c Container.
\param state Value for the daemonize bit (0 or 1).

\return \c true on success, else \c false.


refid: ae0432298d2546b72f1dd8f0ab93e148d
name: want_close_all_fds
definition: bool(* lxc_container::want_close_all_fds)(struct lxc_container *c, bool state)
type: bool(*
argsstring: )(struct lxc_container *c, bool state)
scope: lxc_container
briefdescription: Change whether the container wishes all file descriptors to be closed on startup.
detaileddescription:
\param c Container.
\param state Value for the close_all_fds bit (0 or 1).

\return \c true on success, else \c false.


refid: aaaf338836d323c7f97ff53e9c03e2dfe
name: config_file_name
definition: char*(* lxc_container::config_file_name)(struct lxc_container *c)
type: char *(*
argsstring: )(struct lxc_container *c)
scope: lxc_container
briefdescription: Return current config file name.
detaileddescription:
\param c Container.

\return config file name, or \c NULL on error.

\note The result is allocated, so the caller must free the result.


refid: a11f4bad9bf0d9f581f372069add3d48b
name: wait
definition: bool(* lxc_container::wait)(struct lxc_container *c, const char *state, int timeout)
type: bool(*
argsstring: )(struct lxc_container *c, const char *state, int timeout)
scope: lxc_container
briefdescription: Wait for container to reach a particular state.
detaileddescription:
\param c Container.
\param state State to wait for.
\param timeout Timeout in seconds.

\return \c true if state reached within \p timeout, else \c false.

\note A \p timeout of \c -1 means wait forever. A \p timeout
 of \c 0 means do not wait.


refid: a669fffdfb011f7dde346c2d637b472df
name: set_config_item
definition: bool(* lxc_container::set_config_item)(struct lxc_container *c, const char *key, const char *value)
type: bool(*
argsstring: )(struct lxc_container *c, const char *key, const char *value)
scope: lxc_container
briefdescription: Set a key/value configuration option.
detaileddescription:
\param c Container.
\param key Name of option to set.
\param value Value of \p name to set.

\return \c true on success, else \c false.


refid: a1441b3a58810bf50d23dc57c0663a336
name: destroy
definition: bool(* lxc_container::destroy)(struct lxc_container *c)
type: bool(*
argsstring: )(struct lxc_container *c)
scope: lxc_container
briefdescription: Delete the container.
detaileddescription:
\param c Container.

\return \c true on success, else \c false.

\note Container must be stopped and have no dependent snapshots.


refid: ab0ead26c628469a6cc35439b93264ebe
name: save_config
definition: bool(* lxc_container::save_config)(struct lxc_container *c, const char *alt_file)
type: bool(*
argsstring: )(struct lxc_container *c, const char *alt_file)
scope: lxc_container
briefdescription: Save configuaration to a file.
detaileddescription:
\param c Container.
\param alt_file Full path to file to save configuration in.

\return \c true on success, else \c false.


refid: aa7ed864c0494df67fe7cce42bb79fc7d
name: create
type: bool(*
scope: lxc_container
briefdescription: Create a container.
definition:
bool(* lxc_container::create)(struct lxc_container *c, const char *t, const char *bdevtype, struct bdev_specs *specs, int flags, char *const argv[])

argsstring:
)(struct lxc_container *c, const char *t, const char *bdevtype, struct bdev_specs *specs, int flags, char *const argv[])

detaileddescription:
\param c Container (with lxcpath, name and a starting
 configuration set).
\param t Template to execute to instantiate the root
 filesystem and adjust the configuration.
\param bdevtype Backing store type to use (if \c NULL, \c dir will be used).
\param specs Additional parameters for the backing store (for
 example LVM volume group to use).
\param flags \c LXC_CREATE_* options (currently only \ref
 LXC_CREATE_QUIET is supported).
\param argv Arguments to pass to the template, terminated by \c NULL (if no
 arguments are required, just pass \c NULL).

\return \c true on success, else \c false.


refid: a3c8b4609067b7d4fc770688b9c069ace
name: createl
type: bool(*
scope: lxc_container
briefdescription: Create a container (list variant).
definition:
bool(* lxc_container::createl)(struct lxc_container *c, const char *t, const char *bdevtype, struct bdev_specs *specs, int flags,...)

argsstring:
)(struct lxc_container *c, const char *t, const char *bdevtype, struct bdev_specs *specs, int flags,...)

detaileddescription:
\param c Container (with lxcpath, name and a starting
 configuration set).
\param t Template to execute to instantiate the root
 filesystem and adjust the configuration.
\param bdevtype Backing store type to use (if \c NULL, \c dir will be used).
\param specs Additional parameters for the backing store (for
 example LVM volume group to use).
\param flags \c LXC_CREATE_* options (currently only \ref
 LXC_CREATE_QUIET is supported).
\param ... Command-line to pass to init (must end in \c NULL).

\return \c true on success, else \c false.

\note Identical to \ref create except that the template
 arguments are specified as a list rather than an array of
 pointers.


refid: aef3055dc532eb49a48ab60e4b3097361
name: rename
definition: bool(* lxc_container::rename)(struct lxc_container *c, const char *newname)
type: bool(*
argsstring: )(struct lxc_container *c, const char *newname)
scope: lxc_container
briefdescription: Rename a container.
detaileddescription:
\param c Container.
\param newname New name to be used for the container.

\return \c true on success, else \c false.


refid: ae0e1a3b0d560e621cba07d255c6784e7
name: shutdown
definition: bool(* lxc_container::shutdown)(struct lxc_container *c, int timeout)
type: bool(*
argsstring: )(struct lxc_container *c, int timeout)
scope: lxc_container
briefdescription: Request the container shutdown by sending it \c SIGPWR.
detaileddescription:
\param c Container.
\param timeout Seconds to wait before returning false.
 (-1 to wait forever, 0 to avoid waiting).

\return \c true if the container was shutdown successfully, else \c false.


refid: a78d86ced72bfb276b9fa1634b5eedd16
name: clear_config_item
definition: bool(* lxc_container::clear_config_item)(struct lxc_container *c, const char *key)
type: bool(*
argsstring: )(struct lxc_container *c, const char *key)
scope: lxc_container
briefdescription: Clear a configuration item.
detaileddescription:
\param c Container.
\param key Name of option to clear.

\return \c true on success, else \c false.

\note Analog of \ref set_config_item.


refid: ad400f7bf1a0ae8181df01591d80c23ce
name: get_config_item
type: int(*
argsstring: )(struct lxc_container *c, const char *key, char *retv, int inlen)
scope: lxc_container
briefdescription: Retrieve the value of a config item.
definition:
int(* lxc_container::get_config_item)(struct lxc_container *c, const char *key, char *retv, int inlen)

detaileddescription:
\param c Container.
\param key Name of option to get.
\param[out] retv Caller-allocated buffer to write value of \p key
into (or \c NULL to determine length of value).
\param inlen Length of \p retv (may be zero).

\return Length of config items value, or < 0 on error.

\note The caller can (and should) determine how large a buffer to allocate for
 \p retv by initially passing its value as \c NULL and considering the return value.
 This function can then be called again passing a newly-allocated suitably-sized buffer.
\note If \p retv is NULL, \p inlen is ignored.
\note If \p inlen is smaller than required, nothing will be written to \p retv and still return
 the length of config item value.


refid: a4d7bc7e620ec747d168a9bb4071f529c
name: get_running_config_item
definition: char*(* lxc_container::get_running_config_item)(struct lxc_container *c, const char *key)
type: char *(*
argsstring: )(struct lxc_container *c, const char *key)
scope: lxc_container
briefdescription: Retrieve the value of a config item from running container.
detaileddescription:
\param c Container.
\param key Name of option to get.

\return the item or NULL on error.

\note Returned string must be freed by the caller.


refid: a58762922ffcf9c852d2472b8e24a3cc9
name: get_keys
definition: int(* lxc_container::get_keys)(struct lxc_container *c, const char *key, char *retv, int inlen)
type: int(*
argsstring: )(struct lxc_container *c, const char *key, char *retv, int inlen)
scope: lxc_container
briefdescription: Retrieve a list of config item keys given a key prefix.
detaileddescription:
\param c Container.
\param key Name of option to get.
\param[out] retv Caller-allocated buffer to write list of keys to
 (or \c NULL to determine overall length of keys list).
\param inlen Length of \p retv (may be zero).

\return Length of keys list, or < 0 on error.

\note The list values written to \p retv are separated by
 a newline character ('\\n').
\note The caller can (and should) determine how large a buffer to allocate for
 \p retv by initially passing its value as \c NULL and considering the return value.
 This function can then be called again passing a newly-allocated suitably-sized buffer.
\note If \p retv is NULL, \p inlen is ignored.
\note If \p inlen is smaller than required, the value written
 to \p retv will be truncated.


refid: aa8e744bd9026d996bbaa936122413974
name: get_interfaces
definition: char**(* lxc_container::get_interfaces)(struct lxc_container *c)
type: char **(*
argsstring: )(struct lxc_container *c)
scope: lxc_container
briefdescription: Obtain a list of network interfaces.
detaileddescription:
\param c Container.

\return Newly-allocated array of network interfaces, or \c
 NULL on error.

\note The returned array is allocated, so the caller must free it.
\note The returned array is terminated with a \c NULL entry.


refid: a731bf677a8f153ecf027b0c084ccfdaf
name: get_ips
type: char **(*
argsstring: )(struct lxc_container *c, const char *interface, const char *family, int scope)
scope: lxc_container
briefdescription: Determine the list of container IP addresses.
definition:
char**(* lxc_container::get_ips)(struct lxc_container *c, const char *interface, const char *family, int scope)

detaileddescription:
\param c Container.
\param interface Network interface name to consider.
\param family Network family (for example "inet", "inet6").
\param scope IPv6 scope id (ignored if \p family is not "inet6").

\return Newly-allocated array of network interfaces, or \c
 NULL on error.

\note The returned array is allocated, so the caller must free it.
\note The returned array is terminated with a \c NULL entry.


refid: abaa2bc1bea01623c769440c9911833ae
name: get_cgroup_item
type: int(*
argsstring: )(struct lxc_container *c, const char *subsys, char *retv, int inlen)
scope: lxc_container
briefdescription: Retrieve the specified cgroup subsystem value for the container.
definition:
int(* lxc_container::get_cgroup_item)(struct lxc_container *c, const char *subsys, char *retv, int inlen)

detaileddescription:
\param c Container.
\param subsys cgroup subsystem to retrieve.
\param[out] retv Caller-allocated buffer to write value of \p
 subsys into (or \c NULL to determine length of value).
\param inlen length of \p retv (may be zero).

\return Length of \p subsys value, or < 0 on error.

\note If \p retv is \c NULL, \p inlen is ignored.
\note If \p inlen is smaller than required, the value written
 to \p retv will be truncated.


refid: a0495704d4866ce82708c99e35f294eaa
name: set_cgroup_item
type: bool(*
argsstring: )(struct lxc_container *c, const char *subsys, const char *value)
scope: lxc_container
briefdescription: Set the specified cgroup subsystem value for the container.
definition:
bool(* lxc_container::set_cgroup_item)(struct lxc_container *c, const char *subsys, const char *value)

detaileddescription:
\param c Container.
\param subsys cgroup subsystem to consider.
\param value Value to set for \p subsys.

\return \c true on success, else \c false.


refid: afccd612db819ecea8481d98d7aace724
name: get_config_path
definition: const char*(* lxc_container::get_config_path)(struct lxc_container *c)
type: const char *(*
argsstring: )(struct lxc_container *c)
scope: lxc_container
detaileddescription:
\param c Container.

\return Static string representing full path to configuration
file.

\note Returned string must not be freed.

briefdescription:
Determine full path to the containers configuration file.
Each container can have a custom configuration path. However
by default it will be set to either the \c LXCPATH configure
variable, or the lxcpath value in the \c LXC_GLOBAL_CONF configuration
file (i.e. \c /etc/lxc/lxc.conf).
The value for a specific container can be changed using
\ref set_config_path. There is no other way to specify this in general at the moment.


refid: a4ccbccc881605ec3e7a261b3a4d44629
name: set_config_path
definition: bool(* lxc_container::set_config_path)(struct lxc_container *c, const char *path)
type: bool(*
argsstring: )(struct lxc_container *c, const char *path)
scope: lxc_container
briefdescription: Set the full path to the containers configuration file.
detaileddescription:
\param c Container.
\param path Full path to configuration file.

\return \c true on success, else \c false.


refid: a9da41d5919319b80ea1744b444f01677
name: clone
type: struct lxc_container *(*
scope: lxc_container
briefdescription: Copy a stopped container.
definition:
struct lxc_container*(* lxc_container::clone)(struct lxc_container *c, const char *newname, const char *lxcpath, int flags, const char *bdevtype, const char *bdevdata, uint64_t newsize, char **hookargs)

argsstring:
)(struct lxc_container *c, const char *newname, const char *lxcpath, int flags, const char *bdevtype, const char *bdevdata, uint64_t newsize, char **hookargs)

detaileddescription:
\param c Original container.
\param newname New name for the container. If \c NULL, the same
 name is used and a new lxcpath MUST be specified.
\param lxcpath lxcpath in which to create the new container. If
 \c NULL, the original container's lxcpath will be used.
 (XXX: should we use the default instead?)
\param flags Additional \c LXC_CLONE* flags to change the cloning behaviour:
 - \ref LXC_CLONE_KEEPNAME
 - \ref LXC_CLONE_KEEPMACADDR
 - \ref LXC_CLONE_SNAPSHOT
\param bdevtype Optionally force the cloned bdevtype to a specified plugin.
 By default the original is used (subject to snapshot requirements).
\param bdevdata Information about how to create the new storage
 (i.e. fstype and fsdata).
\param newsize In case of a block device backing store, an
 optional size. If \c 0, the original backing store's size will
 be used if possible. Note this only applies to the rootfs. For
 any other filesystems, the original size will be duplicated.
\param hookargs Additional arguments to pass to the clone hook script.

\return Newly-allocated copy of container \p c, or \p NULL on
error.

\note If devtype was not specified, and \p flags contains \ref
LXC_CLONE_SNAPSHOT then use the native \p bdevtype if possible,
else use an overlayfs.


refid: acf237c8d2e6dbe335c5670d56c30c8d7
name: console_getfd
definition: int(* lxc_container::console_getfd)(struct lxc_container *c, int *ttynum, int *masterfd)
type: int(*
argsstring: )(struct lxc_container *c, int *ttynum, int *masterfd)
scope: lxc_container
briefdescription: Allocate a console tty for the container.
detaileddescription:
\param c Container.
\param[in,out] ttynum Terminal number to attempt to allocate,
 or \c -1 to allocate the first available tty.
\param[out] masterfd File descriptor referring to the master side of the pty.

\return tty file descriptor number on success, or \c -1 on
 failure.

\note On successful return, \p ttynum will contain the tty number
 that was allocated.
\note The returned file descriptor is used to keep the tty
 allocated. The caller should call close(2) on the returned file
 descriptor when no longer required so that it may be allocated
 by another caller.


refid: a222a64610d5db88f36c8b054e3d45a33
name: console
type: int(*
argsstring: )(struct lxc_container *c, int ttynum, int stdinfd, int stdoutfd, int stderrfd, int escape)
scope: lxc_container
briefdescription: Allocate and run a console tty.
definition:
int(* lxc_container::console)(struct lxc_container *c, int ttynum, int stdinfd, int stdoutfd, int stderrfd, int escape)

detaileddescription:
\param c Container.
\param ttynum Terminal number to attempt to allocate, \c -1 to
 allocate the first available tty or \c 0 to allocate the
 console.
\param stdinfd File descriptor to read input from.
\param stdoutfd File descriptor to write output to.
\param stderrfd File descriptor to write error output to.
\param escape The escape character (1 == 'a', 2 == 'b', ...).

\return \c 0 on success, \c -1 on failure.

\note This function will not return until the console has been
 exited by the user.


refid: a40d668f52cf41f2bfb90bc98521561c7
name: attach
type: int(*
scope: lxc_container
briefdescription: Create a sub-process attached to a container and run a function inside it.
definition:
int(* lxc_container::attach)(struct lxc_container *c, lxc_attach_exec_t exec_function, void *exec_payload, lxc_attach_options_t *options, pid_t *attached_process)

argsstring:
)(struct lxc_container *c, lxc_attach_exec_t exec_function, void *exec_payload, lxc_attach_options_t *options, pid_t *attached_process)

detaileddescription:
\param c Container.
\param exec_function Function to run.
\param exec_payload Data to pass to \p exec_function.
\param options \ref lxc_attach_options_t.
\param[out] attached_process Process ID of process running inside
 container \p c that is running \p exec_function.

\return \c 0 on success, \c -1 on error.


refid: a051dce4ded912629659119d96e24f23b
name: attach_run_wait
type: int(*
scope: lxc_container
briefdescription: Run a program inside a container and wait for it to exit.
definition:
int(* lxc_container::attach_run_wait)(struct lxc_container *c, lxc_attach_options_t *options, const char *program, const char *const argv[])

argsstring:
)(struct lxc_container *c, lxc_attach_options_t *options, const char *program, const char *const argv[])

detaileddescription:
\param c Container.
\param options See \ref attach options.
\param program Full path inside container of program to run.
\param argv Array of arguments to pass to \p program.

\return \c waitpid(2) status of exited process that ran \p
program, or \c -1 on error.


refid: a2ecae62abda52d869d0d5faa34429b93
name: attach_run_waitl
type: int(*
argsstring: )(struct lxc_container *c, lxc_attach_options_t *options, const char *program, const char *arg,...)
scope: lxc_container
briefdescription: Run a program inside a container and wait for it to exit (list variant).
definition:
int(* lxc_container::attach_run_waitl)(struct lxc_container *c, lxc_attach_options_t *options, const char *program, const char *arg,...)

detaileddescription:
\param c Container.
\param options See \ref attach options.
\param program Full path inside container of program to run.
\param ... Command-line to pass to \p program (must end in \c NULL).

\return \c waitpid(2) status of exited process that ran \p
program, or \c -1 on error.


refid: ae3a25bab4fdc4e221a06c064e9a79391
name: snapshot
definition: int(* lxc_container::snapshot)(struct lxc_container *c, const char *commentfile)
type: int(*
argsstring: )(struct lxc_container *c, const char *commentfile)
scope: lxc_container
briefdescription: Create a container snapshot.
detaileddescription:
Assuming default paths, snapshots will be created as
\c /var/lib/lxc/\<c\>/snaps/snap\<n\>
where \c \<c\> represents the container name and \c \<n\>
represents the zero-based snapshot number.

\param c Container.
\param commentfile Full path to file containing a description
 of the snapshot.

\return -1 on error, or zero-based snapshot number.

\note \p commentfile may be \c NULL but this is discouraged.


refid: ac0f8ea3352c9c30eeb0957d7f82e6d35
name: snapshot_list
definition: int(* lxc_container::snapshot_list)(struct lxc_container *c, struct lxc_snapshot **snapshots)
type: int(*
argsstring: )(struct lxc_container *c, struct lxc_snapshot **snapshots)
scope: lxc_container
briefdescription: Obtain a list of container snapshots.
detaileddescription:
\param c Container.
\param[out] snapshots Dynamically-allocated Array of lxc_snapshot's.

\return Number of snapshots.

\note The array returned in \p snapshots is allocated, so the caller must free it.
\note To free an individual snapshot as returned in \p
snapshots, call the snapshots \c free function (see \c src/tests/snapshot.c for an example).


refid: a572a8de0a4af2e59eddc26fc6d738f32
name: snapshot_restore
type: bool(*
argsstring: )(struct lxc_container *c, const char *snapname, const char *newname)
scope: lxc_container
briefdescription: Create a new container based on a snapshot.
definition:
bool(* lxc_container::snapshot_restore)(struct lxc_container *c, const char *snapname, const char *newname)

detaileddescription:
 The restored container will be a copy (not snapshot) of the snapshot,
 and restored in the lxcpath of the original container.
\param c Container.
\param snapname Name of snapshot.
\param newname Name to be used for the restored snapshot.
\return \c true on success, else \c false.
\warning If \p newname is the same as the current container
 name, the container will be destroyed. However, this will
 fail if the  snapshot is overlay-based, since the snapshots
 will pin the original container.
\note As an example, if the container exists as \c /var/lib/lxc/c1, snapname might be \c 'snap0'
 (representing \c /var/lib/lxc/c1/snaps/snap0). If \p newname is \p c2,
 then \c snap0 will be copied to \c /var/lib/lxc/c2.


refid: acdae241f1e3aca34fc8e977a0988c164
name: may_control
definition: bool(* lxc_container::may_control)(struct lxc_container *c)
type: bool(*
argsstring: )(struct lxc_container *c)
scope: lxc_container
briefdescription: Determine if the caller may control the container.
detaileddescription:
\param c Container.

\return \c false if there is a control socket for the
 container monitor and the caller may not access it, otherwise
returns \c true.


refid: a5e20c6f2c5232fe7b321986c2c16f499
name: add_device_node
type: bool(*
argsstring: )(struct lxc_container *c, const char *src_path, const char *dest_path)
scope: lxc_container
briefdescription: Add specified device to the container.
definition:
bool(* lxc_container::add_device_node)(struct lxc_container *c, const char *src_path, const char *dest_path)

detaileddescription:
\param c Container.
\param src_path Full path of the device.
\param dest_path Alternate path in the container (or \p NULL
 to use \p src_path).

\return \c true on success, else \c false.


refid: aa794f6d65734715bc7218b80df575f9c
name: remove_device_node
type: bool(*
argsstring: )(struct lxc_container *c, const char *src_path, const char *dest_path)
scope: lxc_container
briefdescription: Remove specified device from the container.
definition:
bool(* lxc_container::remove_device_node)(struct lxc_container *c, const char *src_path, const char *dest_path)

detaileddescription:
\param c Container.
\param src_path Full path of the device.
\param dest_path Alternate path in the container (or \p NULL
 to use \p src_path).

\return \c true on success, else \c false.


refid: a24572272e073c556ec0720c20b2926ef
name: attach_interface
type: bool(*
argsstring: )(struct lxc_container *c, const char *dev, const char *dst_dev)
scope: lxc_container
detaileddescription: \param c Container. \param dev name of net device. \return \c true on success, else \c false.
briefdescription: Add specified netdev to the container.
definition:
bool(* lxc_container::attach_interface)(struct lxc_container *c, const char *dev, const char *dst_dev)


refid: ab3603ef542181194c53c14dd13b31a99
name: detach_interface
type: bool(*
argsstring: )(struct lxc_container *c, const char *dev, const char *dst_dev)
scope: lxc_container
detaileddescription: \param c Container. \param dev name of net device. \return \c true on success, else \c false.
briefdescription: Remove specified netdev from the container.
definition:
bool(* lxc_container::detach_interface)(struct lxc_container *c, const char *dev, const char *dst_dev)


refid: aaf472e60b4b91cb34b9691885f46bb63
name: checkpoint
type: bool(*
argsstring: )(struct lxc_container *c, char *directory, bool stop, bool verbose)
scope: lxc_container
briefdescription: Checkpoint a container.
definition:
bool(* lxc_container::checkpoint)(struct lxc_container *c, char *directory, bool stop, bool verbose)

detaileddescription:
\param c Container.
\param directory The directory to dump the container to.
\param stop Whether or not to stop the container after checkpointing.
\param verbose Enable criu's verbose logs.

\return \c true on success, else \c false.
present at compile time).


refid: a44dbd597526b95ad975f1b51849942de
name: restore
definition: bool(* lxc_container::restore)(struct lxc_container *c, char *directory, bool verbose)
type: bool(*
argsstring: )(struct lxc_container *c, char *directory, bool verbose)
scope: lxc_container
briefdescription: Restore a container from a checkpoint.
detaileddescription:
\param c Container.
\param directory The directory to restore the container from.
\param verbose Enable criu's verbose logs.

\return \c true on success, else \c false.


refid: ad21e8231c1ff033b09b32804d0cb74d1
name: migrate
type: int(*
argsstring: )(struct lxc_container *c, unsigned int cmd, struct migrate_opts *opts, unsigned int size)
scope: lxc_container
briefdescription: An API call to perform various migration operations.
definition:
int(* lxc_container::migrate)(struct lxc_container *c, unsigned int cmd, struct migrate_opts *opts, unsigned int size)

detaileddescription:
\param cmd One of the MIGRATE_ contstants.
\param opts A migrate_opts struct filled with relevant options.
\param size The size of the migrate_opts struct, i.e. sizeof(struct migrate_opts).

\return \c 0 on success, nonzero on failure.


refid: ac5bf0ac8ff84c53763ca6f38d797f5ef
name: LXC_ATTACH_OPTIONS_DEFAULT
detaileddescription: Default attach options to use
initializer:
{                                                                      \
		/* .attach_flags = */   LXC_ATTACH_DEFAULT,                    \
		/* .namespaces = */     -1,                                    \
		/* .personality = */    -1,                                    \
		/* .initial_cwd = */    NULL,                                  \
		/* .uid = */            (uid_t)-1,                             \
		/* .gid = */            (gid_t)-1,                             \
		/* .env_policy = */     LXC_ATTACH_KEEP_ENV,                   \
		/* .extra_env_vars = */ NULL,                                  \
		/* .extra_keep_env = */ NULL,                                  \
		/* .stdin_fd = */       0, 1, 2                                \
	}


refid: ae8258cc16fa05b8a27391525451f489d
name: lxc_attach_exec_t
definition: typedef int(* lxc_attach_exec_t)(void *payload)
type: int(*
argsstring: )(void *payload)
detaileddescription:
 LXC attach function type.

Function to run in container.

\param payload \ref lxc_attach_command_t to run.

\return Function should return \c 0 on success, and any other value to denote failure.


refid: ad8eb89ab82bcca8eb3cef1ca3c4ece8e
name: lxc_attach_run_command
definition: int lxc_attach_run_command
type: int
argsstring: (void *payload)
briefdescription: Run a command in the container.
detaileddescription:
\param payload \ref lxc_attach_command_t to run.

\return \c -1 on error, exit code of lxc_attach_command_t program on success.


refid: ae359fc2a229a77229a4be2a1ee83d85d
name: lxc_container_new
definition: struct lxc_container* lxc_container_new
type: struct lxc_container *
argsstring: (const char *name, const char *configpath)
briefdescription: Create a new container.
detaileddescription:
\param name Name to use for container.
\param configpath Full path to configuration file to use.

\return Newly-allocated container, or \c NULL on error.


refid: a51d3f4ee9eb7c42d730668796b080fa5
name: lxc_container_put
definition: int lxc_container_put
type: int
argsstring: (struct lxc_container *c)
briefdescription: Drop a reference to the specified container.
detaileddescription:
\param c Container.

\return \c 0 on success, \c 1 if reference was successfully dropped
and container has been freed, and \c -1 on error.

\warning If \c 1 is returned, \p c is no longer valid.


refid: a8621e95ba13ede5de571f6cf4e0758e6
name: lxc_get_wait_states
definition: int lxc_get_wait_states
type: int
argsstring: (const char **states)
briefdescription: Obtain a list of all container states.
detaileddescription:
\param[out] states Caller-allocated array to hold all states (may be \c NULL).

\return Number of container states.

\note Passing \c NULL for \p states allows the caller to first
 calculate how many states there are before calling the function again, the second time
 providing a suitably-sized array to store the static string pointers
 in.
\note The \p states array should be freed by the caller, but not the strings the elements point to.


refid: a0899aaef4a7ec1570b35c04037e75fed
name: list_defined_containers
definition: int list_defined_containers
type: int
argsstring: (const char *lxcpath, char ***names, struct lxc_container ***cret)
briefdescription: Get a list of defined containers in a lxcpath.
detaileddescription:
\param lxcpath lxcpath under which to look.
\param names If not \c NULL, then a list of container names will be returned here.
\param cret If not \c NULL, then a list of lxc_containers will be returned here.

\return Number of containers found, or \c -1 on error.

\note Values returned in \p cret are sorted by container name.


refid: a46f79d2f3c014be4c4e9327adb029602
name: list_active_containers
definition: int list_active_containers
type: int
argsstring: (const char *lxcpath, char ***names, struct lxc_container ***cret)
briefdescription: Get a list of active containers for a given lxcpath.
detaileddescription:
\param lxcpath Full \c LXCPATH path to consider.
\param[out] names Dynamically-allocated array of container names.
\param[out] cret Dynamically-allocated list of containers.

\return Number of containers found, or -1 on error.

\note Some of the containers may not be "defined".
\note Values returned in \p cret are sorted by container name.
\note \p names and \p cret may both (or either) be specified as \c NULL.
\note \p names and \p cret must be freed by the caller.


refid: a8630a77d709bbe8c07695e8ce0927079
name: list_all_containers
definition: int list_all_containers
type: int
argsstring: (const char *lxcpath, char ***names, struct lxc_container ***cret)
briefdescription: Get a complete list of all containers for a given lxcpath.
detaileddescription:
\param lxcpath Full \c LXCPATH path to consider.
\param[out] names Dynamically-allocated array of container name.
\param[out] cret Dynamically-allocated list of containers.

\return Number of containers, or -1 on error.

\note Some of the containers may not be "defined".
\note Values returned in \p cret are sorted by container name.
\note \p names and \p cret may both (or either) be specified as \c NULL.
\note \p names and \p cret must be freed by the caller.


refid: ae1366630c27893d7449ad9f140b8a75d
name: lxc_newlock
definition: struct lxc_lock* lxc_newlock
type: struct lxc_lock *
argsstring: (const char *lxcpath, const char *name)
briefdescription: Create a new (unlocked) lock.
detaileddescription:
\param lxcpath lxcpath lock should relate to.
\param name Name for lock.

\return Newly-allocated lxclock on success, \c NULL on failure.

\note If \p name is not given, create an unnamed semaphore
 (used to protect against racing threads).

\note Note that an unnamed sem was malloced by us and needs to be freed.


refid: a48b8bf4a48ba8b079b6ddf7d49541a7e
name: lxclock
definition: int lxclock
type: int
argsstring: (struct lxc_lock *lock, int timeout)
briefdescription: Take an existing lock.
detaileddescription:
\param lock Lock to operate on.
\param timeout Seconds to wait to take lock (\c 0 signifies an
indefinite wait).

\return \c 0 if lock obtained, \c -2 on failure to set timeout,
 or \c -1 on any other error (\c errno will be set by \c sem_wait(3)
or \c fcntl(2)).

\note \p timeout is (currently?) only supported for privlock, not
for slock.  Since currently there is not a single use of the timeout
(except in the test case) I may remove the support for it in sem as
well.


refid: a4ab54bd0ad62c5afaaa34e7a559411f7
name: lxcunlock
definition: int lxcunlock
type: int
argsstring: (struct lxc_lock *lock)
briefdescription: Unlock specified lock previously locked using \ref lxclock().
detaileddescription:
\param lock \ref lxc_lock.

\return \c 0 on success, \c -2 if provided lock was not already held,
otherwise \c -1 with \c errno saved from \c fcntl(2) or sem_post function.


