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
Christian Brauner
f740bc6343
cgroups: make use of ERRNO_IS_NOT_SUPPORTED()
...
This will hopefully prevent backwards compatibility fallback errors.
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2021-02-24 09:37:13 +01:00
Christian Brauner
7924f36a15
error_utils: copy over Lennart's IN_SET()
...
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2021-02-24 09:37:01 +01:00
Christian Brauner
5dc24a8c28
commands: tweak return values
...
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2021-02-24 09:37:01 +01:00
Christian Brauner
38fa7e479c
error_utils: move error helper to separate header
...
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2021-02-24 09:37:00 +01:00
Christian Brauner
9d3480dab4
cgroups: simple variable reordering
...
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2021-02-24 08:58:56 +01:00
Stéphane Graber
5dc90afd49
Merge pull request #3692 from brauner/2021-02-23/fixes
...
build fix & cgroup braino
2021-02-23 20:17:52 -05:00
Christian Brauner
6ee13f5be7
attach: be paranoid about file descriptors
...
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2021-02-24 01:53:05 +01:00
Christian Brauner
327baffea3
cgroups: fix braino during controller list creation
...
Co-mounted controllers are conventionally separated by ",".
Fixes: https://jenkins.linuxcontainers.org/job/lxd-github-commit/1905/arch=amd64,backend=dir,compiler=golang-1.15/consoleFull
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2021-02-24 01:37:54 +01:00
Christian Brauner
70ba94fb0a
commands: remove faulty use of access attribute
...
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2021-02-24 01:01:17 +01:00
Stéphane Graber
162402ccc1
Merge pull request #3691 from brauner/2021-02-23/fixes
...
Fix issues reported by Coverity
2021-02-23 16:53:23 -05:00
Christian Brauner
2d8b9ab865
cgroups: fix error checking
...
Fixes: Coverity 1473310
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2021-02-23 22:11:22 +01:00
Christian Brauner
92fea74bfe
af_unix: prevent oob writes
...
Fixes: Coverity 1473309
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2021-02-23 22:08:48 +01:00
Christian Brauner
1454e5d9a0
commands: only deref once
...
Fixes: Coverity 1473308
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2021-02-23 22:07:11 +01:00
Stéphane Graber
be7715476f
Merge pull request #3690 from brauner/2021-02-21/fixes
...
attach: improve attaching of new clients to old servers
2021-02-23 15:49:38 -05:00
Christian Brauner
7ec5eee4f0
commands: handle old clients for LXC_CMD_GET_CGROUP_CTX
...
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2021-02-23 21:11:10 +01:00
Christian Brauner
bef8f78473
attach: handle new and old clients
...
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2021-02-23 21:11:09 +01:00
Christian Brauner
8723f88e9a
attach: make fd sending more uniform
...
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2021-02-23 21:11:09 +01:00
Christian Brauner
550ede0a94
terminal: dumb logging down
...
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2021-02-23 21:11:07 +01:00
Stéphane Graber
b6f4863739
Merge pull request #3689 from brauner/2021-02-21/fixes
...
cgroups: introduce fd-only cgroup attach via LXC_CMD_GET_CGROUP_CTX
2021-02-23 15:08:04 -05:00
Christian Brauner
3a6678c7fb
attach: fix namespace preservation
...
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2021-02-23 20:36:29 +01:00
Christian Brauner
00df53300b
commands: verify expected file descriptors were sent
...
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2021-02-23 19:39:36 +01:00