diff options
author | Fabiano Fidencio <fidencio@profusion.mobi> | 2010-09-21 00:23:12 -0300 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2010-09-27 03:25:05 +0200 |
commit | 07459bb6b92268beb2599f65cf195708d88c51cc (patch) | |
tree | f533168f2e656f3de37a53293b60b1a27b8580be /src/systemctl.c | |
parent | 66d9b3b59551a33398b2201662af5c8c17a367c9 (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/systemctl.c')
-rw-r--r-- | src/systemctl.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/src/systemctl.c b/src/systemctl.c index 2525967bcc..1f2b43be03 100644 --- a/src/systemctl.c +++ b/src/systemctl.c @@ -1581,7 +1581,9 @@ typedef struct UnitStatusInfo { pid_t control_pid; const char *status_text; bool running:1; +#ifdef HAVE_SYSV_COMPAT bool is_sysv:1; +#endif usec_t start_timestamp; usec_t exit_timestamp; @@ -1701,7 +1703,11 @@ static void print_status_info(UnitStatusInfo *i) { printf("status=%i", p->status); +#ifdef HAVE_SYSV_COMPAT if ((c = exit_status_to_string(p->status, i->is_sysv ? EXIT_STATUS_LSB : EXIT_STATUS_SYSTEMD))) +#else + if ((c = exit_status_to_string(p->status, EXIT_STATUS_SYSTEMD))) +#endif printf("/%s", c); } else @@ -1739,7 +1745,11 @@ static void print_status_info(UnitStatusInfo *i) { printf("status=%i", i->exit_status); +#ifdef HAVE_SYSV_COMPAT if ((c = exit_status_to_string(i->exit_status, i->is_sysv ? EXIT_STATUS_LSB : EXIT_STATUS_SYSTEMD))) +#else + if ((c = exit_status_to_string(i->exit_status, EXIT_STATUS_SYSTEMD))) +#endif printf("/%s", c); } else @@ -1811,10 +1821,13 @@ static int status_property(const char *name, DBusMessageIter *iter, UnitStatusIn i->description = s; else if (streq(name, "FragmentPath")) i->path = s; +#ifdef HAVE_SYSV_COMPAT else if (streq(name, "SysVPath")) { i->is_sysv = true; i->path = s; - } else if (streq(name, "DefaultControlGroup")) + } +#endif + else if (streq(name, "DefaultControlGroup")) i->default_control_group = s; else if (streq(name, "StatusText")) i->status_text = s; |