mirror of
git://github.com/lxc/lxc
synced 2025-09-01 10:39:54 +00:00
Change nscgroup interface
Prepare the nscgroup to be converted to the clone_children changes. Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
This commit is contained in:
committed by
Daniel Lezcano
parent
7c282e3cf4
commit
b234e44fdf
@@ -85,7 +85,7 @@ out:
|
|||||||
return err;
|
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 oldname[MAXPATHLEN];
|
||||||
char newname[MAXPATHLEN];
|
char newname[MAXPATHLEN];
|
||||||
@@ -97,7 +97,7 @@ int lxc_rename_nsgroup(const char *name, struct lxc_handler *handler)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
snprintf(oldname, MAXPATHLEN, "%s/%d", cgroup, handler->pid);
|
snprintf(oldname, MAXPATHLEN, "%s/%d", cgroup, pid);
|
||||||
snprintf(newname, MAXPATHLEN, "%s/%s", cgroup, name);
|
snprintf(newname, MAXPATHLEN, "%s/%s", cgroup, name);
|
||||||
|
|
||||||
/* there is a previous cgroup, assume it is empty, otherwise
|
/* there is a previous cgroup, assume it is empty, otherwise
|
||||||
|
@@ -26,7 +26,7 @@
|
|||||||
#define MAXPRIOLEN 24
|
#define MAXPRIOLEN 24
|
||||||
|
|
||||||
struct lxc_handler;
|
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_unlink_nsgroup(const char *name);
|
||||||
int lxc_cgroup_path_get(char **path, const char *name);
|
int lxc_cgroup_path_get(char **path, const char *name);
|
||||||
int lxc_cgroup_nrtasks(const char *name);
|
int lxc_cgroup_nrtasks(const char *name);
|
||||||
|
@@ -506,7 +506,7 @@ int lxc_spawn(struct lxc_handler *handler)
|
|||||||
if (lxc_sync_wait_child(handler, LXC_SYNC_CONFIGURE))
|
if (lxc_sync_wait_child(handler, LXC_SYNC_CONFIGURE))
|
||||||
failed_before_rename = 1;
|
failed_before_rename = 1;
|
||||||
|
|
||||||
if (lxc_rename_nsgroup(name, handler))
|
if (lxc_rename_nsgroup(name, handler->pid))
|
||||||
goto out_delete_net;
|
goto out_delete_net;
|
||||||
|
|
||||||
if (failed_before_rename)
|
if (failed_before_rename)
|
||||||
|
Reference in New Issue
Block a user