From b234e44fdfb03ebb29f9bcb121d83e25b5a49800 Mon Sep 17 00:00:00 2001 From: Daniel Lezcano Date: Fri, 17 Dec 2010 11:43:37 +0100 Subject: [PATCH] Change nscgroup interface Prepare the nscgroup to be converted to the clone_children changes. Signed-off-by: Daniel Lezcano --- src/lxc/cgroup.c | 4 ++-- src/lxc/cgroup.h | 2 +- src/lxc/start.c | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/lxc/cgroup.c b/src/lxc/cgroup.c index 96a8ecdcc..350d43966 100644 --- a/src/lxc/cgroup.c +++ b/src/lxc/cgroup.c @@ -85,7 +85,7 @@ out: return err; } -int lxc_rename_nsgroup(const char *name, struct lxc_handler *handler) +int lxc_rename_nsgroup(const char *name, pid_t pid) { char oldname[MAXPATHLEN]; char newname[MAXPATHLEN]; @@ -97,7 +97,7 @@ int lxc_rename_nsgroup(const char *name, struct lxc_handler *handler) return -1; } - snprintf(oldname, MAXPATHLEN, "%s/%d", cgroup, handler->pid); + snprintf(oldname, MAXPATHLEN, "%s/%d", cgroup, pid); snprintf(newname, MAXPATHLEN, "%s/%s", cgroup, name); /* there is a previous cgroup, assume it is empty, otherwise diff --git a/src/lxc/cgroup.h b/src/lxc/cgroup.h index 640f1d245..905686e4c 100644 --- a/src/lxc/cgroup.h +++ b/src/lxc/cgroup.h @@ -26,7 +26,7 @@ #define MAXPRIOLEN 24 struct lxc_handler; -int lxc_rename_nsgroup(const char *name, struct lxc_handler *handler); +int lxc_rename_nsgroup(const char *name, pid_t pid); int lxc_unlink_nsgroup(const char *name); int lxc_cgroup_path_get(char **path, const char *name); int lxc_cgroup_nrtasks(const char *name); diff --git a/src/lxc/start.c b/src/lxc/start.c index 451d3559b..7e17cc557 100644 --- a/src/lxc/start.c +++ b/src/lxc/start.c @@ -506,7 +506,7 @@ int lxc_spawn(struct lxc_handler *handler) if (lxc_sync_wait_child(handler, LXC_SYNC_CONFIGURE)) failed_before_rename = 1; - if (lxc_rename_nsgroup(name, handler)) + if (lxc_rename_nsgroup(name, handler->pid)) goto out_delete_net; if (failed_before_rename) -- 2.47.2