summaryrefslogtreecommitdiff
path: root/src/load-fragment.c
diff options
context:
space:
mode:
authorFabiano Fidencio <fidencio@profusion.mobi>2010-09-21 00:23:12 -0300
committerLennart Poettering <lennart@poettering.net>2010-09-27 03:25:05 +0200
commit07459bb6b92268beb2599f65cf195708d88c51cc (patch)
treef533168f2e656f3de37a53293b60b1a27b8580be /src/load-fragment.c
parent66d9b3b59551a33398b2201662af5c8c17a367c9 (diff)
sysv: optionally disable of SysV init/rcN.d support at compile time
This patch adds a cpp definition HAVE_SYSV_COMPAT that is used to isolate code dealing with /etc/init.d and /etc/rcN.d for systems where it does not make sense (one that does not use sysv or one that is fully systemd native). The patch tries to be as little intrusive as possible, however in order to minimize the number of #ifdef'ed regions I've reordered some code in path-lookup.c:lookup_paths_init() where all code dealing with sysv is now isolated under running_as == MANAGER_SYSTEM as well. Moreover, In struct Service, some fields were rearranged to reduce the number of ifdefs. Lennart's suggestions were fixed and squashed with the original patch, that was sent by Gustavo Sverzut Barbieri (barbieri@profusion.mobi).
Diffstat (limited to 'src/load-fragment.c')
-rw-r--r--src/load-fragment.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/load-fragment.c b/src/load-fragment.c
index 1190ef4acc..74114c43b8 100644
--- a/src/load-fragment.c
+++ b/src/load-fragment.c
@@ -42,6 +42,21 @@
#include "unit-name.h"
#include "bus-errors.h"
+#ifndef HAVE_SYSV_COMPAT
+static int config_parse_warn_compat(
+ const char *filename,
+ unsigned line,
+ const char *section,
+ const char *lvalue,
+ const char *rvalue,
+ void *data,
+ void *userdata) {
+
+ log_debug("[%s:%u] Support for option %s= has been disabled at compile time and is ignored", filename, line, lvalue);
+ return 0;
+}
+#endif
+
static int config_parse_deps(
const char *filename,
unsigned line,
@@ -959,6 +974,7 @@ static int config_parse_cgroup(
return 0;
}
+#ifdef HAVE_SYSV_COMPAT
static int config_parse_sysv_priority(
const char *filename,
unsigned line,
@@ -984,6 +1000,7 @@ static int config_parse_sysv_priority(
*priority = (int) i;
return 0;
}
+#endif
static DEFINE_CONFIG_PARSE_ENUM(config_parse_kill_mode, kill_mode, KillMode, "Failed to parse kill mode");
@@ -1446,7 +1463,11 @@ static void dump_items(FILE *f, const ConfigItem *items) {
{ config_parse_exec, "PATH [ARGUMENT [...]]" },
{ config_parse_service_type, "SERVICETYPE" },
{ config_parse_service_restart, "SERVICERESTART" },
+#ifdef HAVE_SYSV_COMPAT
{ config_parse_sysv_priority, "SYSVPRIORITY" },
+#else
+ { config_parse_warn_compat, "NOTSUPPORTED" },
+#endif
{ config_parse_kill_mode, "KILLMODE" },
{ config_parse_kill_signal, "SIGNAL" },
{ config_parse_listen, "SOCKET [...]" },
@@ -1597,7 +1618,11 @@ static int load_from_path(Unit *u, const char *path) {
{ "PermissionsStartOnly", config_parse_bool, &u->service.permissions_start_only, "Service" },
{ "RootDirectoryStartOnly", config_parse_bool, &u->service.root_directory_start_only, "Service" },
{ "RemainAfterExit", config_parse_bool, &u->service.remain_after_exit, "Service" },
+#ifdef HAVE_SYSV_COMPAT
{ "SysVStartPriority", config_parse_sysv_priority, &u->service.sysv_start_priority, "Service" },
+#else
+ { "SysVStartPriority", config_parse_warn_compat, NULL, "Service" },
+#endif
{ "NonBlocking", config_parse_bool, &u->service.exec_context.non_blocking, "Service" },
{ "BusName", config_parse_string_printf, &u->service.bus_name, "Service" },
{ "NotifyAccess", config_parse_notify_access, &u->service.notify_access, "Service" },