#include <malloc.h>#include <semaphore.h>#include <stdbool.h>#include <stdlib.h>#include <stdint.h>#include <lxc/attach_options.h>
Go to the source code of this file.
Data Structures | |
| struct | lxc_container |
| struct | lxc_snapshot |
| An LXC container snapshot. More... | |
| struct | bdev_specs |
| Specifications for how to create a new backing store. More... | |
Macros | |
| #define | LXC_CLONE_KEEPNAME (1 << 0) |
| #define | LXC_CLONE_KEEPMACADDR (1 << 1) |
| #define | LXC_CLONE_SNAPSHOT (1 << 2) |
| #define | LXC_CLONE_KEEPBDEVTYPE (1 << 3) |
| #define | LXC_CLONE_MAYBE_SNAPSHOT (1 << 4) |
| #define | LXC_CLONE_MAXFLAGS (1 << 5) |
| #define | LXC_CREATE_QUIET (1 << 0) |
| #define | LXC_CREATE_MAXFLAGS (1 << 1) |
Functions | |
| struct lxc_container * | lxc_container_new (const char *name, const char *configpath) |
| Create a new container. More... | |
| int | lxc_container_get (struct lxc_container *c) |
| Add a reference to the specified container. More... | |
| int | lxc_container_put (struct lxc_container *c) |
| Drop a reference to the specified container. More... | |
| int | lxc_get_wait_states (const char **states) |
| Obtain a list of all container states. More... | |
| const char * | lxc_get_global_config_item (const char *key) |
| Get the value for a global config key. More... | |
| const char * | lxc_get_version (void) |
| Determine version of LXC. More... | |
| int | list_defined_containers (const char *lxcpath, char ***names, struct lxc_container ***cret) |
| Get a list of defined containers in a lxcpath. More... | |
| int | list_active_containers (const char *lxcpath, char ***names, struct lxc_container ***cret) |
| Get a list of active containers for a given lxcpath. More... | |
| int | list_all_containers (const char *lxcpath, char ***names, struct lxc_container ***cret) |
| Get a complete list of all containers for a given lxcpath. More... | |
| void | lxc_log_close (void) |
| Close log file. | |
liblxcapi
Copyright © 2012 Serge Hallyn serge.hallyn@ubuntu.com. Copyright © 2012 Canonical Ltd.
This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
| #define LXC_CLONE_KEEPBDEVTYPE (1 << 3) |
Use the same bdev type
| #define LXC_CLONE_KEEPMACADDR (1 << 1) |
Do not change the MAC address on network interfaces
| #define LXC_CLONE_KEEPNAME (1 << 0) |
Do not edit the rootfs to change the hostname
| #define LXC_CLONE_MAXFLAGS (1 << 5) |
Number of LXC_CLONE_* flags
| #define LXC_CLONE_MAYBE_SNAPSHOT (1 << 4) |
Snapshot only if bdev supports it, else copy
| #define LXC_CLONE_SNAPSHOT (1 << 2) |
Snapshot the original filesystem(s)
| #define LXC_CREATE_MAXFLAGS (1 << 1) |
Number of LXC_CREATE* flags
| #define LXC_CREATE_QUIET (1 << 0) |
Redirect stdin to /dev/zero and stdout and stderr to /dev/null
| int list_active_containers | ( | const char * | lxcpath, |
| char *** | names, | ||
| struct lxc_container *** | cret | ||
| ) |
Get a list of active containers for a given lxcpath.
| lxcpath | Full LXCPATH path to consider. | |
| [out] | names | Dynamically-allocated array of container names. |
| [out] | cret | Dynamically-allocated list of containers. |
cret are sorted by container name. names and cret may both (or either) be specified as NULL. names and cret must be freed by the caller. | int list_all_containers | ( | const char * | lxcpath, |
| char *** | names, | ||
| struct lxc_container *** | cret | ||
| ) |
Get a complete list of all containers for a given lxcpath.
| lxcpath | Full LXCPATH path to consider. | |
| [out] | names | Dynamically-allocated array of container name. |
| [out] | cret | Dynamically-allocated list of containers. |
cret are sorted by container name. names and cret may both (or either) be specified as NULL. names and cret must be freed by the caller. | int list_defined_containers | ( | const char * | lxcpath, |
| char *** | names, | ||
| struct lxc_container *** | cret | ||
| ) |
Get a list of defined containers in a lxcpath.
| lxcpath | lxcpath under which to look. |
| names | If not NULL, then a list of container names will be returned here. |
| cret | If not NULL, then a list of lxc_containers will be returned here. |
-1 on error.cret are sorted by container name. | int lxc_container_get | ( | struct lxc_container * | c | ) |
Add a reference to the specified container.
| c | Container. |
true on success, false on error. | struct lxc_container* lxc_container_new | ( | const char * | name, |
| const char * | configpath | ||
| ) |
Create a new container.
| name | Name to use for container. |
| configpath | Full path to configuration file to use. |
NULL on error. | int lxc_container_put | ( | struct lxc_container * | c | ) |
Drop a reference to the specified container.
| c | Container. |
0 on success, 1 if reference was successfully dropped and container has been freed, and -1 on error.1 is returned, c is no longer valid. | const char* lxc_get_global_config_item | ( | const char * | key | ) |
Get the value for a global config key.
| key | The name of the config key |
| const char* lxc_get_version | ( | void | ) |
Determine version of LXC.
| int lxc_get_wait_states | ( | const char ** | states | ) |
Obtain a list of all container states.
| [out] | states | Caller-allocated array to hold all states (may be NULL). |
NULL for 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. states array should be freed by the caller, but not the strings the elements point to.
1.8.8