aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichel Normand <normand@fr.ibm.com>2009-10-09 11:38:39 +0200
committerDaniel Lezcano <dlezcano@fr.ibm.com>2009-10-09 11:38:39 +0200
commit14ad6bfdf0b3c994ab76687709dea6dd2274ad02 (patch)
tree24628eb847fe912a275496dcce19917fde7e9ba3
parentnew lxc_cgroup_path_get function (diff)
downloadlxc-14ad6bfdf0b3c994ab76687709dea6dd2274ad02.tar.gz
lxc-14ad6bfdf0b3c994ab76687709dea6dd2274ad02.tar.bz2
lxc-14ad6bfdf0b3c994ab76687709dea6dd2274ad02.zip
use the new nsgroup_path_get function in freezer.c
to avoid to use the LXCPATH/<name>/nsgroup Signed-off-by: Michel Normand <normand@fr.ibm.com> Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
-rw-r--r--src/lxc/cgroup.c2
-rw-r--r--src/lxc/cgroup.h1
-rw-r--r--src/lxc/freezer.c12
3 files changed, 10 insertions, 5 deletions
diff --git a/src/lxc/cgroup.c b/src/lxc/cgroup.c
index 072292a..fc13d99 100644
--- a/src/lxc/cgroup.c
+++ b/src/lxc/cgroup.c
@@ -155,7 +155,7 @@ int lxc_unlink_nsgroup(const char *name)
return unlink(nsgroup);
}
-static int lxc_cgroup_path_get(char **path, const char *name)
+int lxc_cgroup_path_get(char **path, const char *name)
{
char cgroup[MAXPATHLEN];
diff --git a/src/lxc/cgroup.h b/src/lxc/cgroup.h
index 6863247..cc125b2 100644
--- a/src/lxc/cgroup.h
+++ b/src/lxc/cgroup.h
@@ -30,5 +30,6 @@ int lxc_get_cgroup_mount(const char *mtab, char *mnt);
int lxc_rename_nsgroup(const char *name, struct lxc_handler *handler);
int lxc_link_nsgroup(const char *name, const char *nsgroup);
int lxc_unlink_nsgroup(const char *name);
+int lxc_cgroup_path_get(char **path, const char *name);
#endif
diff --git a/src/lxc/freezer.c b/src/lxc/freezer.c
index 0c0f405..f4b4018 100644
--- a/src/lxc/freezer.c
+++ b/src/lxc/freezer.c
@@ -39,11 +39,15 @@ lxc_log_define(lxc_freezer, lxc);
static int freeze_unfreeze(const char *name, int freeze)
{
+ char *nsgroup;
char freezer[MAXPATHLEN], *f;
- int fd, ret = -1;
+ int fd, ret;
- snprintf(freezer, MAXPATHLEN,
- LXCPATH "/%s/nsgroup/freezer.state", name);
+ ret = lxc_cgroup_path_get(&nsgroup, name);
+ if (ret)
+ return -1;
+
+ snprintf(freezer, MAXPATHLEN, "%s/freezer.state", nsgroup);
fd = open(freezer, O_WRONLY);
if (fd < 0) {
@@ -69,7 +73,7 @@ static int freeze_unfreeze(const char *name, int freeze)
if (ret)
SYSERROR("failed to write to '%s'", freezer);
- return 0;
+ return ret;
}
int lxc_freeze(const char *name)