|
Lines 20-25
Link Here
|
| 20 |
***/ |
20 |
***/ |
| 21 |
|
21 |
|
| 22 |
#include <stdio.h> |
22 |
#include <stdio.h> |
|
|
23 |
#include <string.h> |
| 23 |
|
24 |
|
| 24 |
#include "conf-parser.h" |
25 |
#include "conf-parser.h" |
| 25 |
#include "sleep-config.h" |
26 |
#include "sleep-config.h" |
|
Lines 138-143
int can_sleep_disk(char **types) {
Link Here
|
| 138 |
|
139 |
|
| 139 |
if (strv_isempty(types)) |
140 |
if (strv_isempty(types)) |
| 140 |
return true; |
141 |
return true; |
|
|
142 |
/* kernel commandline must have a resume parameter: */ |
| 143 |
FILE * cmdline_fp = fopen("/proc/cmdline", "r"); |
| 144 |
char * cmdline = malloc(255); |
| 145 |
fgets(cmdline, 255, cmdline_fp); |
| 146 |
if (strstr(cmdline, "resume") == NULL) return false; |
| 147 |
fclose(cmdline_fp); |
| 141 |
|
148 |
|
| 142 |
/* If /sys is read-only we cannot sleep */ |
149 |
/* If /sys is read-only we cannot sleep */ |
| 143 |
if (access("/sys/power/disk", W_OK) < 0) |
150 |
if (access("/sys/power/disk", W_OK) < 0) |