mirror of
https://git.proxmox.com/git/mirror_lxc
synced 2025-08-15 10:12:24 +00:00
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:
parent
952be76a13
commit
84701151f0
@ -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;
|
||||
}
|
||||
|
||||
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);
|
||||
|
Loading…
Reference in New Issue
Block a user