Skip to content

Commit

Permalink
Merge pull request #2337 from brauner/2018-05-18/cgroup_rework
Browse files Browse the repository at this point in the history
cgroups: refactor cgroup handling
  • Loading branch information
hallyn committed May 22, 2018
2 parents f49098e + 395b1a3 commit 394769b
Show file tree
Hide file tree
Showing 15 changed files with 767 additions and 1,016 deletions.
13 changes: 10 additions & 3 deletions src/lxc/attach.c
Expand Up @@ -1272,10 +1272,17 @@ int lxc_attach(const char *name, const char *lxcpath,

/* Attach to cgroup, if requested. */
if (options->attach_flags & LXC_ATTACH_MOVE_TO_CGROUP) {
if (!cgroup_attach(name, lxcpath, pid))
struct cgroup_ops *cgroup_ops;

cgroup_ops = cgroup_init(NULL);
if (!cgroup_ops)
goto on_error;

if (!cgroup_ops->attach(cgroup_ops, name, lxcpath, pid))
goto on_error;
TRACE("Moved intermediate process %d into container's "
"cgroups", pid);

cgroup_exit(cgroup_ops);
TRACE("Moved intermediate process %d into container's cgroups", pid);
}

/* Setup /proc limits */
Expand Down

0 comments on commit 394769b

Please sign in to comment.