]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
commands: simplify lxc_cmd_get_cgroup_ctx()
authorChristian Brauner <christian.brauner@ubuntu.com>
Wed, 24 Feb 2021 08:47:40 +0000 (09:47 +0100)
committerChristian Brauner <christian.brauner@ubuntu.com>
Wed, 24 Feb 2021 08:47:40 +0000 (09:47 +0100)
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>
src/lxc/cgroups/cgfsng.c
src/lxc/commands.c
src/lxc/commands.h

index 59f0242905e2d3ea430c65e26beed75b4d26c289..233367fa7b01ec30707bf6b05752d1585cfbf0c7 100644 (file)
@@ -3382,8 +3382,7 @@ static int __cgroup_attach_many(const struct lxc_conf *conf, const char *name,
        ssize_t pidstr_len;
        char pidstr[INTTYPE_TO_STRLEN(pid_t)];
 
-       ret = lxc_cmd_get_cgroup_ctx(name, lxcpath, NULL, true,
-                                    sizeof(struct cgroup_ctx), ctx);
+       ret = lxc_cmd_get_cgroup_ctx(name, lxcpath, sizeof(struct cgroup_ctx), ctx);
        if (ret < 0)
                return ret_errno(ENOSYS);
 
index 4f0ea327f4d2c62e95d0d7ef8d81a8fc93b8c648..c2ec510c6fd9bb9ade16e0b87b4b3c3f5b62f9fe 100644 (file)
@@ -629,7 +629,6 @@ static int lxc_cmd_get_seccomp_notify_fd_callback(int fd, struct lxc_cmd_req *re
 }
 
 int lxc_cmd_get_cgroup_ctx(const char *name, const char *lxcpath,
-                          const char *controller, bool batch,
                           size_t size_ret_ctx, struct cgroup_ctx *ret_ctx)
 {
        struct lxc_cmd_rr cmd = {
@@ -644,9 +643,6 @@ int lxc_cmd_get_cgroup_ctx(const char *name, const char *lxcpath,
        };
        int ret, stopped;
 
-       if (batch && !is_empty_string(controller))
-               return ret_errno(EINVAL);
-
        ret = lxc_cmd(name, &cmd, &stopped, lxcpath, NULL);
        if (ret < 0)
                return log_debug_errno(-1, errno, "Failed to process cgroup context command");
index 42e917e5a4a13370b23e13f74b0685107650cd30..83eda38a56a82dbaffad6f8ee1137333975595e4 100644 (file)
@@ -125,7 +125,6 @@ __hidden extern int lxc_cmd_console_log(const char *name, const char *lxcpath,
                                        struct lxc_console_log *log);
 __hidden extern int lxc_cmd_get_seccomp_notify_fd(const char *name, const char *lxcpath);
 __hidden extern int lxc_cmd_get_cgroup_ctx(const char *name, const char *lxcpath,
-                                          const char *controller, bool batch,
                                           size_t size_ret_ctx,
                                           struct cgroup_ctx *ret_ctx);
 __hidden extern int lxc_cmd_seccomp_notify_add_listener(const char *name, const char *lxcpath, int fd,