Marcus Meissner
e118bb4a4a
+ systemd-nspawn creates etc/resolv.conf in container if needed. + systemd-nspawn will store metadata about container in container cgroup including its root directory. + cgroup hierarchy has been reworked, all objects are now suffxed (with .session for user sessions, .user for users, .nspawn for containers). All cgroup names are now escaped to preven collision of object names. + systemctl list-dependencies gained --plain, --reverse, --after and --before switches. + systemd-inhibit shows processes name taking inhibitor lock. + nss-myhostname will now resolve "localhost" implicitly. + .include is not allowed recursively anymore and only in unit files. Drop-in files should be favored in most cases. + systemd-analyze gained "critical-chain" command, to get slowest chain of units run during boot-up. + systemd-nspawn@.service has been added to easily run nspawn container for system services. Just start "systemd-nspawn@foobar.service" and container from /var/lib/container/foobar" will be booted. + systemd-cgls has new --machine parameter to list processes from one container. + ConditionSecurity= can now check for apparmor and SMACK. + /etc/systemd/sleep.conf has been introduced to configure which kernel operation will be execute when "suspend", "hibernate" or "hybrid-sleep" is requrested. It allow new kernel "freeze" state to be used too. (This setting won't have any effect if pm-utils is installed). + ENV{SYSTEMD_WANTS} in udev rules will now implicitly escape passed argument if applicable. OBS-URL: https://build.opensuse.org/package/show/Base:System/systemd?expand=0&rev=388
97 lines
2.8 KiB
Diff
97 lines
2.8 KiB
Diff
From: Frederic Crozat <fcrozat@suse.com>
|
|
Date: Tue, 19 Feb 2013 11:20:31 +0100
|
|
Subject: Forward suspend / hibernate calls to pm-utils
|
|
|
|
forward suspend/hibernation calls to pm-utils, if installed (bnc#790157)
|
|
---
|
|
src/sleep/sleep.c | 26 ++++++++++++++++++++++----
|
|
1 file changed, 22 insertions(+), 4 deletions(-)
|
|
|
|
diff --git a/src/sleep/sleep.c b/src/sleep/sleep.c
|
|
index a56ab89..232ab67 100644
|
|
--- a/src/sleep/sleep.c
|
|
+++ b/src/sleep/sleep.c
|
|
@@ -24,6 +24,7 @@
|
|
#include <errno.h>
|
|
#include <string.h>
|
|
#include <getopt.h>
|
|
+#include <stdlib.h>
|
|
|
|
#include "systemd/sd-id128.h"
|
|
#include "systemd/sd-messages.h"
|
|
@@ -35,6 +36,8 @@
|
|
#include "sleep-config.h"
|
|
|
|
static char* arg_verb = NULL;
|
|
+static bool delegate_to_pmutils = false;
|
|
+static const char *pmtools;
|
|
|
|
static int write_mode(char **modes) {
|
|
int r = 0;
|
|
@@ -50,9 +53,6 @@ static int write_mode(char **modes) {
|
|
r = k;
|
|
}
|
|
|
|
- if (r < 0)
|
|
- log_error("Failed to write mode to /sys/power/disk: %s",
|
|
- strerror(-r));
|
|
|
|
return r;
|
|
}
|
|
@@ -90,6 +90,8 @@ static int execute(char **modes, char **states) {
|
|
FILE *f;
|
|
const char* note = strappenda("SLEEP=", arg_verb);
|
|
|
|
+ if (!delegate_to_pmutils) {
|
|
+
|
|
/* This file is opened first, so that if we hit an error,
|
|
* we can abort before modyfing any state. */
|
|
f = fopen("/sys/power/state", "we");
|
|
@@ -102,6 +104,7 @@ static int execute(char **modes, char **states) {
|
|
r = write_mode(modes);
|
|
if (r < 0)
|
|
return r;
|
|
+ }
|
|
|
|
arguments[0] = NULL;
|
|
arguments[1] = (char*) "pre";
|
|
@@ -114,8 +117,10 @@ static int execute(char **modes, char **states) {
|
|
"MESSAGE=Suspending system...",
|
|
note,
|
|
NULL);
|
|
-
|
|
+ if (!delegate_to_pmutils)
|
|
r = write_state(f, states);
|
|
+ else
|
|
+ r = -system(pmtools);
|
|
if (r < 0)
|
|
return r;
|
|
|
|
@@ -158,6 +163,7 @@ static int parse_argv(int argc, char *argv[]) {
|
|
};
|
|
|
|
int c;
|
|
+ struct stat buf;
|
|
|
|
assert(argc >= 0);
|
|
assert(argv);
|
|
@@ -196,6 +202,18 @@ static int parse_argv(int argc, char *argv[]) {
|
|
return -EINVAL;
|
|
}
|
|
|
|
+ if (streq(arg_verb, "suspend")) {
|
|
+ pmtools = "/usr/sbin/pm-suspend";
|
|
+ }
|
|
+ else if (streq(arg_verb, "hibernate") || streq(arg_verb, "hybrid-sleep")) {
|
|
+ if (streq(arg_verb, "hibernate"))
|
|
+ pmtools = "/usr/sbin/pm-hibernate";
|
|
+ else
|
|
+ pmtools = "/usr/sbin/pm-suspend-hybrid";
|
|
+ }
|
|
+
|
|
+ delegate_to_pmutils = (stat(pmtools, &buf) >= 0 && S_ISREG(buf.st_mode) && (buf.st_mode & 0111));
|
|
+
|
|
return 1 /* work to do */;
|
|
}
|
|
|