]>
git.proxmox.com Git - mirror_lxc.git/blob - src/lxc/lxc.h
1 /* SPDX-License-Identifier: LGPL-2.1+ */
12 #include <sys/select.h>
13 #include <sys/types.h>
16 #include "memory_utils.h"
25 Following code is for liblxc.
27 lxc/lxc.h will contain exports of liblxc
31 * Start the specified command inside a system container
32 * @argv : an array of char * corresponding to the command line
33 * @conf : configuration
34 * @daemonize : whether or not the container is daemonized
35 * Returns 0 on success, < 0 otherwise
37 __hidden
extern int lxc_start(char *const argv
[], struct lxc_handler
*handler
, const char *lxcpath
,
38 bool daemonize
, int *error_num
);
41 * Start the specified command inside an application container
42 * @name : the name of the container
43 * @argv : an array of char * corresponding to the command line
44 * @quiet : if != 0 then lxc-init won't produce any output
45 * @conf : configuration
46 * @daemonize : whether or not the container is daemonized
47 * Returns 0 on success, < 0 otherwise
49 __hidden
extern int lxc_execute(const char *name
, char *const argv
[], int quiet
,
50 struct lxc_handler
*handler
, const char *lxcpath
, bool daemonize
,
54 * Close the fd associated with the monitoring
55 * @fd : the file descriptor provided by lxc_monitor_open
56 * Returns 0 on success, < 0 otherwise
58 __hidden
extern int lxc_monitor_close(int fd
);
61 * Freeze all the tasks running inside the container <name>
62 * @name : the container name
63 * Returns 0 on success, < 0 otherwise
65 __hidden
extern int lxc_freeze(struct lxc_conf
*conf
, const char *name
, const char *lxcpath
);
68 * Unfreeze all previously frozen tasks.
69 * @name : the name of the container
70 * Return 0 on success, < 0 otherwise
72 __hidden
extern int lxc_unfreeze(struct lxc_conf
*conf
, const char *name
, const char *lxcpath
);
75 * Retrieve the container state
76 * @name : the name of the container
77 * Returns the state of the container on success, < 0 otherwise
79 __hidden
extern lxc_state_t
lxc_state(const char *name
, const char *lxcpath
);
82 * Create and return a new lxccontainer struct.
84 extern struct lxc_container
*lxc_container_new(const char *name
, const char *configpath
);
87 * Returns 1 on success, 0 on failure.
89 extern int lxc_container_get(struct lxc_container
*c
);
92 * Put a lxccontainer struct reference.
94 * Return 0 if this was not the last reference.
95 * If it is the last reference, free the lxccontainer and return 1.
97 extern int lxc_container_put(struct lxc_container
*c
);
98 static inline void put_lxc_container(struct lxc_container
*c
)
101 lxc_container_put(c
);
103 define_cleanup_function(struct lxc_container
*, put_lxc_container
);
104 #define __put_lxc_container call_cleaner(put_lxc_container)
107 * Get a list of valid wait states.
108 * If states is NULL, simply return the number of states
110 extern int lxc_get_wait_states(const char **states
);
113 * Add a dependency to a container
115 __hidden
extern int add_rdepend(struct lxc_conf
*lxc_conf
, char *rdepend
);
118 * Set a key/value configuration option. Requires that to take a lock on the
119 * in-memory config of the container.
121 __hidden
extern int lxc_set_config_item_locked(struct lxc_conf
*conf
, const char *key
, const char *v
);
127 #endif /* __LXC_LXC_H */