]>
git.proxmox.com Git - mirror_lxc.git/blob - src/lxc/lxc.h
2 * lxc: linux Container library
4 * (C) Copyright IBM Corp. 2007, 2008
7 * Daniel Lezcano <daniel.lezcano at free.fr>
9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public
11 * License as published by the Free Software Foundation; either
12 * version 2.1 of the License, or (at your option) any later version.
14 * This library is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Lesser General Public License for more details.
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with this library; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
32 #include <sys/select.h>
33 #include <sys/types.h>
43 Following code is for liblxc.
45 lxc/lxc.h will contain exports of liblxc
49 * Start the specified command inside a system container
50 * @name : the name of the container
51 * @argv : an array of char * corresponding to the commande line
52 * @conf : configuration
53 * @daemonize : whether or not the container is daemonized
54 * Returns 0 on success, < 0 otherwise
56 extern int lxc_start(const char *name
, char *const argv
[],
57 struct lxc_handler
*handler
, const char *lxcpath
,
58 bool daemonize
, int *error_num
);
61 * Start the specified command inside an application container
62 * @name : the name of the container
63 * @argv : an array of char * corresponding to the commande line
64 * @quiet : if != 0 then lxc-init won't produce any output
65 * @conf : configuration
66 * @daemonize : whether or not the container is daemonized
67 * Returns 0 on success, < 0 otherwise
69 extern int lxc_execute(const char *name
, char *const argv
[], int quiet
,
70 struct lxc_handler
*handler
, const char *lxcpath
,
71 bool daemonize
, int *error_num
);
74 * Close the fd associated with the monitoring
75 * @fd : the file descriptor provided by lxc_monitor_open
76 * Returns 0 on success, < 0 otherwise
78 extern int lxc_monitor_close(int fd
);
81 * Freeze all the tasks running inside the container <name>
82 * @name : the container name
83 * Returns 0 on success, < 0 otherwise
85 extern int lxc_freeze(struct lxc_conf
*conf
, const char *name
,
89 * Unfreeze all previously frozen tasks.
90 * @name : the name of the container
91 * Return 0 on success, < 0 otherwise
93 extern int lxc_unfreeze(struct lxc_conf
*conf
, const char *name
,
97 * Retrieve the container state
98 * @name : the name of the container
99 * Returns the state of the container on success, < 0 otherwise
101 extern lxc_state_t
lxc_state(const char *name
, const char *lxcpath
);
104 * Create and return a new lxccontainer struct.
106 extern struct lxc_container
*lxc_container_new(const char *name
, const char *configpath
);
109 * Returns 1 on success, 0 on failure.
111 extern int lxc_container_get(struct lxc_container
*c
);
114 * Put a lxccontainer struct reference.
115 * Return -1 on error.
116 * Return 0 if this was not the last reference.
117 * If it is the last reference, free the lxccontainer and return 1.
119 extern int lxc_container_put(struct lxc_container
*c
);
122 * Get a list of valid wait states.
123 * If states is NULL, simply return the number of states
125 extern int lxc_get_wait_states(const char **states
);
128 * Add a dependency to a container
130 extern int add_rdepend(struct lxc_conf
*lxc_conf
, char *rdepend
);
133 * Set a key/value configuration option. Requires that to take a lock on the
134 * in-memory config of the container.
136 extern int lxc_set_config_item_locked(struct lxc_conf
*conf
, const char *key
,