Commit 84701151 by dlezcano

Add freezer compatibility for older interface

From: Daniel Lezcano <dlezcano@fr.ibm.com> Different interface exists for the freezer, "RUNNING" or "THAWED" should be written to the freezer file, so in case "THAWED", we fall back to "RUNNING". That allows to support older freezer kernel interface for 2.6.27. Signed-off-by: 's avatarDaniel Lezcano <dlezcano@fr.ibm.com>
parent 952be76a
...@@ -36,7 +36,7 @@ ...@@ -36,7 +36,7 @@
static int freeze_unfreeze(const char *name, int freeze) static int freeze_unfreeze(const char *name, int freeze)
{ {
char freezer[MAXPATHLEN], *f = freeze?"FROZEN":"THAWED"; char freezer[MAXPATHLEN], *f;
int fd, ret = -1; int fd, ret = -1;
snprintf(freezer, MAXPATHLEN, snprintf(freezer, MAXPATHLEN,
...@@ -48,7 +48,20 @@ static int freeze_unfreeze(const char *name, int freeze) ...@@ -48,7 +48,20 @@ static int freeze_unfreeze(const char *name, int freeze)
return -1; return -1;
} }
ret = write(fd, f, strlen(f) + 1) < 0; if (freeze) {
f = "FROZEN";
ret = write(fd, f, strlen(f) + 1) < 0;
} else {
f = "THAWED";
ret = write(fd, f, strlen(f) + 1) < 0;
/* compatibility code with old freezer interface */
if (ret) {
f = "RUNNING";
ret = write(fd, f, strlen(f) + 1) < 0;
}
}
close(fd); close(fd);
if (ret) if (ret)
lxc_log_syserror("failed to write to '%s'", freezer); lxc_log_syserror("failed to write to '%s'", freezer);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment