lxccontainer.h File Reference
#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.
Detailed Description
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 Documentation
| #define LXC_CLONE_KEEPBDEVTYPE (1 << 3) |
| #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
Function Documentation
| int list_active_containers |
( |
const char * |
lxcpath, |
|
|
char *** |
names, |
|
|
struct lxc_container *** |
cret | |
|
) |
| | |
Get a list of active containers for a given lxcpath.
- Parameters:
-
| lxcpath | Full LXCPATH path to consider. |
| [out] | names | Dynamically-allocated array of container names. |
| [out] | cret | Dynamically-allocated list of containers. |
- Returns:
- Number of containers found, or -1 on error.
- Note:
- Some of the containers may not be "defined".
-
Values returned in
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.
- Parameters:
-
| lxcpath | Full LXCPATH path to consider. |
| [out] | names | Dynamically-allocated array of container name. |
| [out] | cret | Dynamically-allocated list of containers. |
- Returns:
- Number of containers, or -1 on error.
- Note:
- Some of the containers may not be "defined".
-
Values returned in
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.
- Parameters:
-
| 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. |
- Returns:
- Number of containers found, or
-1 on error.
- Note:
- Values returned in
cret are sorted by container name.
Add a reference to the specified container.
- Parameters:
-
- Returns:
true on success, false on error.
| struct lxc_container* lxc_container_new |
( |
const char * |
name, |
|
|
const char * |
configpath | |
|
) |
| | [read] |
Create a new container.
- Parameters:
-
| name | Name to use for container. |
| configpath | Full path to configuration file to use. |
- Returns:
- Newly-allocated container, or
NULL on error.
Drop a reference to the specified container.
- Parameters:
-
- Returns:
0 on success, 1 if reference was successfully dropped and container has been freed, and -1 on error.
- Warning:
- If
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.
- Parameters:
-
| key | The name of the config key |
- Returns:
- String representing the current value for the key.
| const char* lxc_get_version |
( |
void |
|
) |
|
Determine version of LXC.
- Returns:
- Static string representing version of LXC in use.
- Note:
- Returned string must not be freed.
| int lxc_get_wait_states |
( |
const char ** |
states |
) |
|
Obtain a list of all container states.
- Parameters:
-
| [out] | states | Caller-allocated array to hold all states (may be NULL). |
- Returns:
- Number of container states.
- Note:
- Passing
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.
-
The
states array should be freed by the caller, but not the strings the elements point to.