summaryrefslogtreecommitdiff
path: root/src/shared/sleep-config.c
diff options
context:
space:
mode:
authorVittorio G (VittGam) <github@vittgam.net>2016-04-19 11:18:18 +0200
committerLennart Poettering <lennart@poettering.net>2016-04-19 11:18:18 +0200
commit490d20e65dd85628f910299a3925bbff466b2e74 (patch)
treec4139eacf8121a95a4b4b3748ac248818e0757fe /src/shared/sleep-config.c
parent673fca32be277e6b73ed5c114768e4c64370e16e (diff)
sleep: Add debug feature to bypass hibernation memory checks. (#3064)
This new feature bypasses checking if a swap partition is mounted or if there is enough swap space available for hibernation to succeed. This can be useful when a system with a Solid State Disk (SSD) has no normal swap partition or file configured, and a custom systemd unit is used to mount a swap file just before hibernating and unmount it just after resuming. Signed-off-by: Vittorio Gambaletta <git-systemd@vittgam.net>
Diffstat (limited to 'src/shared/sleep-config.c')
-rw-r--r--src/shared/sleep-config.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/shared/sleep-config.c b/src/shared/sleep-config.c
index 35aa60101f..f00624d0f2 100644
--- a/src/shared/sleep-config.c
+++ b/src/shared/sleep-config.c
@@ -28,6 +28,7 @@
#include "alloc-util.h"
#include "conf-parser.h"
#include "def.h"
+#include "env-util.h"
#include "fd-util.h"
#include "fileio.h"
#include "log.h"
@@ -231,6 +232,9 @@ static bool enough_memory_for_hibernation(void) {
size_t size = 0, used = 0;
int r;
+ if (getenv_bool("SYSTEMD_BYPASS_HIBERNATION_MEMORY_CHECK") > 0)
+ return true;
+
r = hibernation_partition_size(&size, &used);
if (r < 0)
return false;