#include <stdbool.h>
#include "list.h"
+#include "ringbuf.h"
#include "start.h" /* for lxc_handler */
#if HAVE_SCMP_FILTER_CTX
ID_TYPE_GID
};
+/*
+ * Defines a structure to configure kernel parameters at runtime.
+ * @key : the kernel parameters will be configured without the "lxc.sysctl" prefix
+ * @value : the value to set
+ */
+struct lxc_sysctl {
+ char *key;
+ char *value;
+};
+
+/*
+ * Defines a structure to configure proc filesystem at runtime.
+ * @filename : the proc filesystem will be configured without the "lxc.proc" prefix
+ * @value : the value to set
+ */
+struct lxc_proc {
+ char *filename;
+ char *value;
+};
+
/*
* id_map is an id map entry. Form in confile is:
* lxc.idmap = u 0 9800 100
char *path;
char *log_path;
int log_fd;
+ unsigned int log_rotate;
char name[MAXPATHLEN];
struct termios *tios;
struct lxc_tty_state *tty_state;
- uint64_t log_size;
+
+ /* size of the ringbuffer */
+ uint64_t buffer_size;
+
+ /* path to the log file for the ringbuffer */
+ char *buffer_log_file;
+
+ /* fd to the log file for the ringbuffer */
+ int buffer_log_file_fd;
+
+ /* the in-memory ringbuffer */
+ struct lxc_ringbuf ringbuf;
};
/*
extern char *lxchook_names[NUM_LXC_HOOKS];
+struct lxc_state_client {
+ int clientfd;
+ lxc_state_t states[MAX_STATE];
+};
+
struct lxc_conf {
int is_execute;
char *fstab;
signed long personality;
struct utsname *utsname;
struct lxc_list cgroup;
- struct lxc_list id_map;
+ struct {
+ struct lxc_list id_map;
+
+ /* Pointer to the idmap entry for the container's root uid in
+ * the id_map list. Do not free! */
+ struct id_map *root_nsuid_map;
+
+ /* Pointer to the idmap entry for the container's root gid in
+ * the id_map list. Do not free! */
+ struct id_map *root_nsgid_map;
+ };
struct lxc_list network;
int auto_mounts;
struct lxc_list mount_list;
struct lxc_rootfs rootfs;
char *ttydir;
int close_all_fds;
- struct lxc_list hooks[NUM_LXC_HOOKS];
+
+ struct {
+ unsigned int hooks_version;
+ struct lxc_list hooks[NUM_LXC_HOOKS];
+ };
char *lsm_aa_profile;
unsigned int lsm_aa_allow_incomplete;
int loglevel; /* loglevel as specifed in config (if any) */
int logfd;
- int inherit_ns_fd[LXC_NS_MAX];
-
unsigned int start_auto;
unsigned int start_delay;
int start_order;
* that union.
*/
struct lxc_cgroup cgroup_meta;
+
+ char *inherit_ns[LXC_NS_MAX];
+
+ /* init working directory */
+ char *init_cwd;
+
+ /* A list of clients registered to be informed about a container state. */
+ struct lxc_list state_clients;
+
+ /* sysctls */
+ struct lxc_list sysctls;
+
+ /* procs */
+ struct lxc_list procs;
};
+extern int write_id_mapping(enum idtype idtype, pid_t pid, const char *buf,
+ size_t buf_size);
+
#ifdef HAVE_TLS
extern __thread struct lxc_conf *current_config;
#else
#endif
extern int run_lxc_hooks(const char *name, char *hook, struct lxc_conf *conf,
- const char *lxcpath, char *argv[]);
+ char *argv[]);
extern int detect_shared_rootfs(void);
extern struct lxc_conf *lxc_conf_init(void);
extern void lxc_conf_free(struct lxc_conf *conf);
extern int do_rootfs_setup(struct lxc_conf *conf, const char *name,
const char *lxcpath);
extern int lxc_setup(struct lxc_handler *handler);
+extern int lxc_setup_parent(struct lxc_handler *handler);
extern int setup_resource_limits(struct lxc_list *limits, pid_t pid);
extern int find_unmapped_nsid(struct lxc_conf *conf, enum idtype idtype);
extern int mapped_hostid(unsigned id, struct lxc_conf *conf,
enum idtype idtype);
-extern int chown_mapped_root(char *path, struct lxc_conf *conf);
+extern int chown_mapped_root(const char *path, struct lxc_conf *conf);
extern int lxc_ttys_shift_ids(struct lxc_conf *c);
extern int userns_exec_1(struct lxc_conf *conf, int (*fn)(void *), void *data,
const char *fn_name);
unsigned long flags);
extern int run_script(const char *name, const char *section, const char *script,
...);
+extern int run_script_argv(const char *name, unsigned int hook_version,
+ const char *section, const char *script,
+ const char *hookname, char **argsin);
+extern int in_caplist(int cap, struct lxc_list *caps);
+extern int setup_sysctl_parameters(struct lxc_list *sysctls);
+extern int lxc_clear_sysctls(struct lxc_conf *c, const char *key);
+extern int setup_proc_filesystem(struct lxc_list *procs, pid_t pid);
+extern int lxc_clear_procs(struct lxc_conf *c, const char *key);
#endif /* __LXC_CONF_H */