summaryrefslogtreecommitdiffstats
path: root/src/sleep
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2015-01-09 02:47:25 +0100
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2015-01-12 00:17:33 +0100
commite801700e9acdde60078eb1d41b41b06369b83541 (patch)
tree356c3165b7ad9b5203584ff3e802f539b9873fa0 /src/sleep
parentSimplify execute_directory() (diff)
downloadsystemd-e801700e9acdde60078eb1d41b41b06369b83541.tar.xz
systemd-e801700e9acdde60078eb1d41b41b06369b83541.zip
Implement masking and overriding of generators
Sometimes it is necessary to stop a generator from running. Either because of a bug, or for testing, or some other reason. The only way to do that would be to rename or chmod the generator binary, which is inconvenient and does not survive upgrades. Allow masking and overriding generators similarly to units and other configuration files. For the systemd instance, masking would be more common, rather than overriding generators. For the user instances, it may also be useful for users to have generators in $XDG_CONFIG_HOME to augment or override system-wide generators. Directories are searched according to the usual scheme (/usr/lib, /usr/local/lib, /run, /etc), and files with the same name in higher priority directories override files with the same name in lower priority directories. Empty files and links to /dev/null mask a given name. https://bugs.freedesktop.org/show_bug.cgi?id=87230
Diffstat (limited to 'src/sleep')
-rw-r--r--src/sleep/sleep.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/sleep/sleep.c b/src/sleep/sleep.c
index 2fb5f0c8e0..cc1ffa63f1 100644
--- a/src/sleep/sleep.c
+++ b/src/sleep/sleep.c
@@ -92,6 +92,7 @@ static int execute(char **modes, char **states) {
arg_verb,
NULL
};
+ static const char* const dirs[] = {SYSTEM_SLEEP_PATH, NULL};
int r;
_cleanup_fclose_ FILE *f = NULL;
@@ -107,7 +108,7 @@ static int execute(char **modes, char **states) {
if (r < 0)
return r;
- execute_directory(SYSTEM_SLEEP_PATH, DEFAULT_TIMEOUT_USEC, arguments);
+ execute_directories(dirs, DEFAULT_TIMEOUT_USEC, arguments);
log_struct(LOG_INFO,
LOG_MESSAGE_ID(SD_MESSAGE_SLEEP_START),
@@ -126,7 +127,7 @@ static int execute(char **modes, char **states) {
NULL);
arguments[1] = (char*) "post";
- execute_directory(SYSTEM_SLEEP_PATH, DEFAULT_TIMEOUT_USEC, arguments);
+ execute_directories(dirs, DEFAULT_TIMEOUT_USEC, arguments);
return r;
}