Debian Codegraph @

lxc-binding.h

raw symbols SCIP
1 // Copyright © 2013, 2014, The Go-LXC Authors. All rights reserved.
2 // Use of this source code is governed by a LGPLv2.1
3 // license that can be found in the LICENSE file.
4
5 #include <lxc/attach_options.h>
6
7 #define VERSION_AT_LEAST(major, minor, micro) \
8 ((LXC_DEVEL == 1) || (!(major > LXC_VERSION_MAJOR || \
9 major == LXC_VERSION_MAJOR && minor > LXC_VERSION_MINOR || \
10 major == LXC_VERSION_MAJOR && minor == LXC_VERSION_MINOR && micro > LXC_VERSION_MICRO)))
11
12 extern bool go_lxc_add_device_node(struct lxc_container *c, const char *src_path, const char *dest_path);
13 extern void go_lxc_clear_config(struct lxc_container *c);
14 extern bool go_lxc_clear_config_item(struct lxc_container *c, const char *key);
15 extern bool go_lxc_clone(struct lxc_container *c, const char *newname, const char *lxcpath, int flags, const char *bdevtype);
16 extern bool go_lxc_console(struct lxc_container *c, int ttynum, int stdinfd, int stdoutfd, int stderrfd, int escape);
17 extern bool go_lxc_create(struct lxc_container *c, const char *t, const char *bdevtype, struct bdev_specs *specs, int flags, char * const argv[]);
18 extern bool go_lxc_defined(struct lxc_container *c);
19 extern bool go_lxc_destroy(struct lxc_container *c);
20 extern bool go_lxc_destroy_with_snapshots(struct lxc_container *c);
21 extern bool go_lxc_freeze(struct lxc_container *c);
22 extern bool go_lxc_load_config(struct lxc_container *c, const char *alt_file);
23 extern bool go_lxc_may_control(struct lxc_container *c);
24 extern bool go_lxc_reboot(struct lxc_container *c);
25 extern bool go_lxc_remove_device_node(struct lxc_container *c, const char *src_path, const char *dest_path);
26 extern bool go_lxc_rename(struct lxc_container *c, const char *newname);
27 extern bool go_lxc_running(struct lxc_container *c);
28 extern bool go_lxc_save_config(struct lxc_container *c, const char *alt_file);
29 extern bool go_lxc_set_cgroup_item(struct lxc_container *c, const char *key, const char *value);
30 extern bool go_lxc_set_config_item(struct lxc_container *c, const char *key, const char *value);
31 extern bool go_lxc_set_config_path(struct lxc_container *c, const char *path);
32 extern bool go_lxc_shutdown(struct lxc_container *c, int timeout);
33 extern bool go_lxc_snapshot_destroy(struct lxc_container *c, const char *snapname);
34 extern bool go_lxc_snapshot_destroy_all(struct lxc_container *c);
35 extern bool go_lxc_snapshot_restore(struct lxc_container *c, const char *snapname, const char *newname);
36 extern bool go_lxc_start(struct lxc_container *c, int useinit, char * const argv[]);
37 extern bool go_lxc_stop(struct lxc_container *c);
38 extern bool go_lxc_unfreeze(struct lxc_container *c);
39 extern bool go_lxc_wait(struct lxc_container *c, const char *state, int timeout);
40 extern bool go_lxc_want_close_all_fds(struct lxc_container *c, bool state);
41 extern bool go_lxc_want_daemonize(struct lxc_container *c, bool state);
42 extern char* go_lxc_config_file_name(struct lxc_container *c);
43 extern char* go_lxc_get_cgroup_item(struct lxc_container *c, const char *key);
44 extern char* go_lxc_get_config_item(struct lxc_container *c, const char *key);
45 extern char** go_lxc_get_interfaces(struct lxc_container *c);
46 extern char** go_lxc_get_ips(struct lxc_container *c, const char *interface, const char *family, int scope);
47 extern char* go_lxc_get_keys(struct lxc_container *c, const char *key);
48 extern char* go_lxc_get_running_config_item(struct lxc_container *c, const char *key);
49 extern const char* go_lxc_get_config_path(struct lxc_container *c);
50 extern const char* go_lxc_state(struct lxc_container *c);
51
52 #if !VERSION_AT_LEAST(4, 0, 9) && !defined(LXC_ATTACH_SETGROUPS)
53 typedef struct lxc_groups_t {
54 size_t size;
55 gid_t *list;
56 } lxc_groups_t;
57 # endif
58
59 extern int go_lxc_attach_run_wait(struct lxc_container *c,
60 bool clear_env,
61 int namespaces,
62 long personality,
63 uid_t uid, gid_t gid, lxc_groups_t groups,
64 int stdinfd, int stdoutfd, int stderrfd,
65 char *initial_cwd,
66 char **extra_env_vars,
67 char **extra_keep_env,
68 const char * const argv[],
69 int attach_flags);
70 extern int go_lxc_attach(struct lxc_container *c,
71 bool clear_env,
72 int namespaces,
73 long personality,
74 uid_t uid, gid_t gid, lxc_groups_t groups,
75 int stdinfd, int stdoutfd, int stderrfd,
76 char *initial_cwd,
77 char **extra_env_vars,
78 char **extra_keep_env,
79 int attach_flags);
80 extern int go_lxc_attach_no_wait(struct lxc_container *c,
81 bool clear_env,
82 int namespaces,
83 long personality,
84 uid_t uid, gid_t gid, lxc_groups_t groups,
85 int stdinfd, int stdoutfd, int stderrfd,
86 char *initial_cwd,
87 char **extra_env_vars,
88 char **extra_keep_env,
89 const char * const argv[],
90 pid_t *attached_pid,
91 int attach_flags);
92 extern int go_lxc_console_getfd(struct lxc_container *c, int ttynum);
93 extern int go_lxc_snapshot_list(struct lxc_container *c, struct lxc_snapshot **ret);
94 extern int go_lxc_snapshot(struct lxc_container *c);
95 extern pid_t go_lxc_init_pid(struct lxc_container *c);
96 extern int go_lxc_init_pidfd(struct lxc_container *c);
97 extern int go_lxc_devpts_fd(struct lxc_container *c);
98 extern int go_lxc_seccomp_notify_fd(struct lxc_container *c);
99 extern int go_lxc_seccomp_notify_fd_active(struct lxc_container *c);
100 extern int go_lxc_set_timeout(struct lxc_container *c, int timeout);
101 extern bool go_lxc_checkpoint(struct lxc_container *c, char *directory, bool stop, bool verbose);
102 extern bool go_lxc_restore(struct lxc_container *c, char *directory, bool verbose);
103 extern bool go_lxc_config_item_is_supported(const char *key);
104 extern bool go_lxc_has_api_extension(const char *extension);
105
106 /* n.b. that we're just adding the fields here to shorten the definition
107 * of go_lxc_migrate; in the case where we don't have the ->migrate API call,
108 * we don't want to have to pass all the arguments in to let conditional
109 * compilation handle things, but the call will still fail
110 */
111 #if !VERSION_AT_LEAST(2, 0, 0)
112 struct migrate_opts {
113 char *directory;
114 bool verbose;
115 bool stop;
116 char *predump_dir;
117 };
118 #endif
119
120 /* This is a struct that we can add "extra" (i.e. options added after 2.0.0)
121 * migrate options to, so that we don't have to have a massive function
122 * signature when the list of options grows.
123 */
124 struct extra_migrate_opts {
125 bool preserves_inodes;
126 char *action_script;
127 uint64_t ghost_limit;
128 uint64_t features_to_check;
129 };
130 int go_lxc_migrate(struct lxc_container *c, unsigned int cmd, struct migrate_opts *opts, struct extra_migrate_opts *extras);
131
132 extern bool go_lxc_attach_interface(struct lxc_container *c, const char *dev, const char *dst_dev);
133 extern bool go_lxc_detach_interface(struct lxc_container *c, const char *dev, const char *dst_dev);
134
135 #if !VERSION_AT_LEAST(3, 0, 0)
136 struct lxc_console_log {
137 bool clear;
138 bool read;
139 uint64_t *read_max;
140 char *data;
141 };
142 #endif
143
144 extern int go_lxc_console_log(struct lxc_container *c, struct lxc_console_log *log);
145 extern int go_lxc_error_num(struct lxc_container *c);