[systemd-devel] [PATCH] Allow disable of SysV init/rcN.d support at compile time.

Lennart Poettering lennart at poettering.net
Mon Sep 13 10:58:18 PDT 2010


On Wed, 08.09.10 11:35, Gustavo Sverzut Barbieri (barbieri at profusion.mobi) wrote:

> 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.

Patch looks mostly good, and I do believe that the ability to disable
SysV is definitely a good idea.

A few comments:

>                  { "org.freedesktop.systemd1.Manager", "ShowStatus",    bus_property_append_bool,      "b",  &m->show_status    },
>                  { "org.freedesktop.systemd1.Manager", "SysVConsole",   bus_property_append_bool,      "b",  &m->sysv_console   },

SysVConsole should also go away if SysV is disabled.

>                  { "org.freedesktop.systemd1.Manager", "UnitPath",      bus_property_append_strv,      "as", m->lookup_paths.unit_path },
> +#ifdef HAVE_SYSV_COMPAT
>                  { "org.freedesktop.systemd1.Manager", "SysVInitPath",  bus_property_append_strv,      "as", m->lookup_paths.sysvinit_path },
>                  { "org.freedesktop.systemd1.Manager", "SysVRcndPath",  bus_property_append_strv,      "as", m->lookup_paths.sysvrcnd_path },
> +#endif

This must disappear from the XML introspection data too (whic you may
find in the same file a bit further up.)

> --- a/src/service.c
> +++ b/src/service.c
> @@ -44,6 +44,7 @@ typedef enum RunlevelType {
>          RUNLEVEL_SYSINIT
>  } RunlevelType;

RunlevelType should be ifdeffed away, too.

>  static int service_enumerate(Manager *m) {

The entire function should go away if SysV is disabled, and the entry in
the vtable can be initialized to NULL.

I am a bit concerned about the compatbility of all of this. I think it
is OK to remove D-Bus properties for legacy stuff if this is disabled at
compilation time, but we should make sure that the configuration files
that include such info still parse fine. i.e. SysVPriority in .service
files should be parsable, though maybe print a warning, that we ignore
the setting. Similar for SysVConsole= in system.conf.

The various sysv prefixed vars from struct Service and struct Manager
should be ifdeffed out too I guess, though I fear this might add quite a
bit of ifdeff's to the code which I'd rather avoid. So be creative
here... ;-)

Otherwise the patch looks good to me, and it would be cool if Gentoo
could become the first post-SysV distro this way... ;-)

Lennart

-- 
Lennart Poettering - Red Hat, Inc.


More information about the systemd-devel mailing list