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: Daniel Lezcano <dlezcano@fr.ibm.com>
This commit is contained in:
dlezcano 2009-01-05 18:36:23 +00:00
parent 952be76a13
commit 84701151f0

View File

@ -36,7 +36,7 @@
static int freeze_unfreeze(const char *name, int freeze)
{
char freezer[MAXPATHLEN], *f = freeze?"FROZEN":"THAWED";
char freezer[MAXPATHLEN], *f;
int fd, ret = -1;
snprintf(freezer, MAXPATHLEN,
@ -48,7 +48,20 @@ static int freeze_unfreeze(const char *name, int freeze)
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);
if (ret)
lxc_log_syserror("failed to write to '%s'", freezer);