Commit Graph

10927 Commits

Author SHA1 Message Date
Christian Brauner
161e4bef90
tests: add logging to lxc-test-lxc-attach
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2021-02-25 21:28:45 +01:00
Christian Brauner
d2560c4e21
commands: improve lxc_cmd_get_tty_fd()
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2021-02-25 21:28:45 +01:00
Christian Brauner
3a9daa046c
commands: rework lxc_cmd_rsp_recv() to make it more obvious
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2021-02-25 21:28:44 +01:00
Christian Brauner
780215cf0d
af_unix: allow caller and callee to negotiate expectations and reality
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2021-02-25 16:05:06 +01:00
Christian Brauner
265dc73af6
macro: add hweight*() helpers
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2021-02-25 13:49:29 +01:00
Christian Brauner
57fc2dd7e6
commands: let lxc_cmd() return ssize_t to indicate that it returns not just 0 on success
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2021-02-25 12:03:28 +01:00
Christian Brauner
962c70c562
commands: port lxc_cmd_get_limit_cgroup2_fd() to new helpers
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2021-02-25 12:03:28 +01:00
Christian Brauner
dab4f69fe0
commands: port lxc_cmd_get_cgroup2_fd() to new helpers
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2021-02-25 12:03:28 +01:00
Christian Brauner
3d7661aa67
commands: port lxc_cmd_get_limit_cgroup_fd() to new helpers
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2021-02-25 12:03:28 +01:00
Christian Brauner
e83494bb56
commands: port lxc_cmd_get_cgroup_fd() to new helpers
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2021-02-25 12:03:28 +01:00
Christian Brauner
558cb2b58d
commands: port lxc_cmd_unfreeze() to new helpers
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2021-02-25 12:03:28 +01:00
Christian Brauner
ac91e5151b
commands: port lxc_cmd_freeze() to new helpers
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2021-02-25 12:03:27 +01:00
Christian Brauner
6e66211771
commands: port lxc_cmd_seccomp_notify_add_listener() to new helpers
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2021-02-25 12:03:27 +01:00
Christian Brauner
c58b63fe12
commands: port lxc_cmd_serve_state_clients() to new helpers
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2021-02-25 12:03:27 +01:00
Christian Brauner
dda7dc08f5
commands: port lxc_cmd_console_log() to new helpers
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2021-02-25 12:03:27 +01:00
Christian Brauner
9338a6f341
commands: port lxc_cmd_add_bpf_device_cgropu() to new helpers
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2021-02-25 12:03:27 +01:00
Christian Brauner
3de3c9e365
commands: port lxc_cmd_add_state_client() to new helpers
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2021-02-25 12:03:27 +01:00
Christian Brauner
9dca720777
commands: port lxc_cmd_get_lxcpath() to new helpers
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2021-02-25 12:03:27 +01:00
Christian Brauner
16fcb1fed0
commands: port lxc_cmd_get_name() to new helpers
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2021-02-25 12:03:27 +01:00
Christian Brauner
1a37ba9d55
commands: port lxc_get_tty_fd() to new helpers
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2021-02-25 12:03:26 +01:00
Christian Brauner
dbdd56c120
commands: port lxc_cmd_stop() to new helpers
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2021-02-25 12:03:26 +01:00
Christian Brauner
1b08494ee5
commands: port lxc_cmd_get_state() to new helpers
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2021-02-25 12:03:26 +01:00
Christian Brauner
187e46ab32
commands: port lxc_cmd_get_config_item() to new helpers
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2021-02-25 12:03:26 +01:00
Christian Brauner
f85d2385c0
commands: portlxc_cmd_get_cgroup_path_do() to new helpers
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2021-02-25 12:03:26 +01:00
Christian Brauner
b4e1a2e8e7
commands: port lxc_cmd_get_clone_flags() to new helpers
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2021-02-25 12:03:26 +01:00
Christian Brauner
19d141f686
commands: port lxc_cmd_get_cgroup_ctx() to new helpers
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2021-02-25 12:03:26 +01:00
Christian Brauner
f0af908257
commands: port lxc_cmd_get_seccomp_notify_fd() to new helpers
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2021-02-25 12:03:26 +01:00
Christian Brauner
f7a7b0955a
commands: port lxc_cmd_get_devpts_fd() to new helpers
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2021-02-25 12:03:26 +01:00
Christian Brauner
7208e700bb
commands: port lxc_cmd_get_init_pidfd() to new helpers
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2021-02-25 12:03:25 +01:00
Christian Brauner
22642823ac
commands: port lxc_cmd_get_init_pid() to new helpers
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2021-02-25 12:03:25 +01:00
Christian Brauner
38d14ebda6
commands: port lxc_try_cmd() to new helpers
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2021-02-25 12:03:25 +01:00
Christian Brauner
58a8d1f07d
commands: add lxc_cmd_init() and lxc_cmd_data()
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2021-02-25 12:03:25 +01:00
Christian Brauner
6834acfffb
commands: s/lxc_cmd_init()/lxc_server_init()/g
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2021-02-25 09:55:22 +01:00
Christian Brauner
8a598112dd
commands: switch to bool
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2021-02-25 09:32:19 +01:00
Christian Brauner
0437eac569
commands: use IN_SET() in lxc_cmd()
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2021-02-25 09:23:27 +01:00
Stéphane Graber
2be31fed40
Merge pull request #3695 from brauner/2021-02-24/fixes_3
commands: array hardening
2021-02-24 11:32:07 -05:00
Christian Brauner
3d97131917
commands: ensure that non-NULL and MAX_STATE is always passed
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2021-02-24 16:58:21 +01:00
Christian Brauner
e848413e2a
commands: annotate array argument
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2021-02-24 16:47:43 +01:00
Stéphane Graber
2ed90529b4
Merge pull request #3694 from brauner/2021-02-24/fixes_2
commands: rework and add LXC_CMD_GET_CGROUP_FD and LXC_CMD_GET_LIMIT_CGROUP_FD
2021-02-24 10:36:10 -05:00
Christian Brauner
7e85a2c423
commands: s/LXC_CMD_CONSOLE/LXC_CMD_GET_TTY_FD/g
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2021-02-24 16:07:23 +01:00
Christian Brauner
abb6f6572c
commands: add LXC_CMD_GET_CGROUP_FD and LXC_CMD_GET_LIMIT_CGROUP_FD
and port cgroup_get() and cgroup_set(). This means no more useless cgroup
driver initialization on ever get or set.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2021-02-24 15:59:13 +01:00
Christian Brauner
124b60ec3e
commands: extend rsp_one_fd() to also handle additional data
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2021-02-24 15:32:06 +01:00
Christian Brauner
53be29113c
file_utils: actually open the file for reading
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2021-02-24 15:32:05 +01:00
Christian Brauner
28c738ebe0
commands: set rsp.ret to 0 for lxc_cmd_get_cgroup_ctx_callback()
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2021-02-24 11:53:53 +01:00
Christian Brauner
61983e15d2
cgroups: s/cgroup_layout/layout/g
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2021-02-24 11:31:55 +01:00
Christian Brauner
c206ac24b3
commands: add LXC_CMD_GET_CGROUP_FD and LXC_CMD_GET_LIMIT_CGROUP_FD
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2021-02-24 11:11:08 +01:00
Christian Brauner
a9b642ee5c
commands: s/_LIMITING_/_LIMIT_/g and s/_limiting_/_limit_/g
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2021-02-24 11:06:06 +01:00
Christian Brauner
bce2970f80
commands: simplify lxc_cmd_get_cgroup_ctx()
Instead of allowing individual hierarchy fd retrieval through
lxc_cmd_get_cgroup_ctx() let's add a dedicated method instead.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2021-02-24 09:47:40 +01:00
Christian Brauner
ac5eacc62e
commands: fix alignment for lxc_cmd_get_cgroup_ctx()
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2021-02-24 09:46:07 +01:00
Christian Brauner
8dfcf0df6c
cgroups: handle fallback gracefully
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2021-02-24 09:41:32 +01:00