Several preparation for killing SysV compat (#37207)

This commit is contained in:
Daan De Meyer
2025-04-22 10:13:44 +02:00
committed by GitHub
6 changed files with 25 additions and 82 deletions
+2 -3
View File
@@ -163,10 +163,9 @@ PATH CONDITION UNIT
shown. Produces output similar to
<programlisting>
LISTEN UNIT ACTIVATES
/dev/initctl systemd-initctl.socket systemd-initctl.service
…
[::]:22 sshd.socket sshd.service
kobject-uevent 1 systemd-udevd-kernel.socket systemd-udevd.service
/dev/rfkill systemd-rfkill.socket systemd-rfkill.service
…
5 sockets listed.</programlisting>
Note: because the addresses might contains spaces, this output
+5 -58
View File
@@ -30,7 +30,6 @@
<cmdsynopsis>
<command>init</command>
<arg choice="opt" rep="repeat">OPTIONS</arg>
<arg choice="req">COMMAND</arg>
</cmdsynopsis>
</refsynopsisdiv>
@@ -47,13 +46,6 @@
<citerefentry><refentrytitle>user@.service</refentrytitle><manvolnum>5</manvolnum></citerefentry>
service.</para>
<para>For compatibility with SysV, if the binary is called as <command>init</command> and is not the
first process on the machine (PID is not 1), it will execute <command>telinit</command> and pass all
command line arguments unmodified. That means <command>init</command> and <command>telinit</command> are
mostly equivalent when invoked from normal login sessions. See
<citerefentry><refentrytitle>telinit</refentrytitle><manvolnum>8</manvolnum></citerefentry> for more
information.</para>
<para>When run as a system instance, systemd interprets the
configuration file <filename>system.conf</filename> and the files
in <filename>system.conf.d</filename> directories; when run as a
@@ -235,14 +227,8 @@
xawf -eo pid,user,cgroup,args</command> is particularly useful to list all processes and the systemd
units they belong to.).</para>
<para>systemd is compatible with the SysV init system to a large
degree: SysV init scripts are supported and simply read as an
alternative (though limited) configuration file format. The SysV
<filename>/dev/initctl</filename> interface is provided, and
compatibility implementations of the various SysV client tools are
available. In addition to that, various established Unix
functionality such as <filename>/etc/fstab</filename> or the
<filename>utmp</filename> database are supported.</para>
<para>systemd is compatible with various established Unix functionality such as
<filename>/etc/fstab</filename> or the <filename>utmp</filename> database.</para>
<para>systemd has a minimal transaction system: if a unit is
requested to start up or shut down it will add it and all its
@@ -328,32 +314,6 @@
</para></listitem>
</varlistentry>
</variablelist>
<variablelist>
<varlistentry>
<term>SysV init scripts directory</term>
<listitem><para>The location of the SysV init script directory
varies between distributions. If systemd cannot find a native
unit file for a requested service, it will look for a SysV
init script of the same name (with the
<filename>.service</filename> suffix
removed).</para></listitem>
</varlistentry>
</variablelist>
<variablelist>
<varlistentry>
<term>SysV runlevel link farm directory</term>
<listitem><para>The location of the SysV runlevel link farm
directory varies between distributions. systemd will take the
link farm into account when figuring out whether a service
shall be enabled. Note that a service unit with a native unit
configuration file cannot be started by activating it in the
SysV runlevel link farm.</para></listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1>
@@ -1066,12 +1026,9 @@
<term><varname>5</varname></term>
<listitem><para>Boot into the specified legacy SysV runlevel.
These are equivalent to
<varname>systemd.unit=runlevel2.target</varname>,
<varname>systemd.unit=runlevel3.target</varname>,
<varname>systemd.unit=runlevel4.target</varname>, and
<varname>systemd.unit=runlevel5.target</varname>,
respectively, and provided for compatibility reasons and to be
<varname>2</varname>, <varname>3</varname>, and <varname>4</varname> are equivalent to
<varname>systemd.unit=multi-user.target</varname>; and <varname>5</varname> is equivalent to
<varname>systemd.unit=graphical.target</varname>, and provided for compatibility reasons and to be
easier to type.</para>
<xi:include href="version-info.xml" xpointer="v186"/></listitem>
@@ -1522,16 +1479,6 @@
projects.</para></listitem>
</varlistentry>
<varlistentry>
<term><filename>/dev/initctl</filename></term>
<listitem><para>Limited compatibility support for the SysV
client interface, as implemented by the
<filename>systemd-initctl.service</filename> unit. This is a
named pipe in the file system. This interface is obsolete and
should not be used in new applications.</para></listitem>
</varlistentry>
<varlistentry>
<term><filename>/usr/lib/clock-epoch</filename></term>
+6 -5
View File
@@ -838,13 +838,14 @@ const char* runlevel_to_target(const char *word) {
word = startswith(word, "rd.");
if (!word)
return NULL;
}
rlmap_ptr = in_initrd() ? rlmap_initrd : rlmap;
rlmap_ptr = rlmap_initrd;
} else
rlmap_ptr = rlmap;
for (size_t i = 0; rlmap_ptr[i]; i += 2)
if (streq(word, rlmap_ptr[i]))
return rlmap_ptr[i+1];
STRV_FOREACH_PAIR(rl, target, rlmap_ptr)
if (streq(word, *rl))
return *target;
return NULL;
}
+12 -10
View File
@@ -89,25 +89,27 @@ TEST(specifier_printf) {
TEST(specifier_real_path) {
static const Specifier table[] = {
{ 'p', specifier_string, "/dev/initctl" },
{ 'y', specifier_real_path, "/dev/initctl" },
{ 'Y', specifier_real_directory, "/dev/initctl" },
{ 'p', specifier_string, "/dev/fd" },
{ 'y', specifier_real_path, "/dev/fd" },
{ 'Y', specifier_real_directory, "/dev/fd" },
{ 'w', specifier_real_path, "/dev/tty" },
{ 'W', specifier_real_directory, "/dev/tty" },
{}
};
_cleanup_free_ char *w = NULL;
_cleanup_free_ char *w = NULL, *expected = NULL;
int r;
r = specifier_printf("p=%p y=%y Y=%Y w=%w W=%W", SIZE_MAX, table, NULL, NULL, &w);
assert_se(r >= 0 || r == -ENOENT);
assert_se(w || r == -ENOENT);
puts(strnull(w));
if (r < 0) {
ASSERT_ERROR(r, ENOENT);
return (void) log_tests_skipped_errno(r, "/dev/fd and/or /dev/tty do not exist");
}
/* /dev/initctl should normally be a symlink to /run/initctl */
if (inode_same("/dev/initctl", "/run/initctl", 0) > 0)
ASSERT_STREQ(w, "p=/dev/initctl y=/run/initctl Y=/run w=/dev/tty W=/dev");
ASSERT_OK(asprintf(&expected,
"p=/dev/fd y=/proc/"PID_FMT"/fd Y=/proc/"PID_FMT" w=/dev/tty W=/dev",
getpid_cached(), getpid_cached()));
ASSERT_STREQ(w, expected);
}
TEST(specifier_real_path_missing_file) {
-4
View File
@@ -840,7 +840,6 @@ TEST(unit_name_from_dbus_path) {
test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/polkit_2eservice", 0, "polkit.service");
test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/proc_2dsys_2dfs_2dbinfmt_5fmisc_2eautomount", 0, "proc-sys-fs-binfmt_misc.automount");
test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/proc_2dsys_2dfs_2dbinfmt_5fmisc_2emount", 0, "proc-sys-fs-binfmt_misc.mount");
test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/rc_2dlocal_2eservice", 0, "rc-local.service");
test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/remote_2dcryptsetup_2etarget", 0, "remote-cryptsetup.target");
test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/remote_2dfs_2dpre_2etarget", 0, "remote-fs-pre.target");
test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/remote_2dfs_2etarget", 0, "remote-fs.target");
@@ -935,8 +934,6 @@ TEST(unit_name_from_dbus_path) {
test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/systemd_2dfirstboot_2eservice", 0, "systemd-firstboot.service");
test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/systemd_2dfsck_2droot_2eservice", 0, SPECIAL_FSCK_ROOT_SERVICE);
test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/systemd_2dhwdb_2dupdate_2eservice", 0, "systemd-hwdb-update.service");
test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/systemd_2dinitctl_2eservice", 0, "systemd-initctl.service");
test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/systemd_2dinitctl_2esocket", 0, "systemd-initctl.socket");
test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/systemd_2djournal_2dcatalog_2dupdate_2eservice", 0, "systemd-journal-catalog-update.service");
test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/systemd_2djournal_2dflush_2eservice", 0, "systemd-journal-flush.service");
test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/systemd_2djournald_2daudit_2esocket", 0, "systemd-journald-audit.socket");
@@ -965,7 +962,6 @@ TEST(unit_name_from_dbus_path) {
test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/systemd_2dudevd_2dkernel_2esocket", 0, "systemd-udevd-kernel.socket");
test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/systemd_2dudevd_2eservice", 0, "systemd-udevd.service");
test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/systemd_2dupdate_2ddone_2eservice", 0, "systemd-update-done.service");
test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/systemd_2dupdate_2dutmp_2drunlevel_2eservice", 0, "systemd-update-utmp-runlevel.service");
test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/systemd_2dupdate_2dutmp_2eservice", 0, "systemd-update-utmp.service");
test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/systemd_2duser_2dsessions_2eservice", 0, "systemd-user-sessions.service");
test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/systemd_2dvconsole_2dsetup_2eservice", 0, "systemd-vconsole-setup.service");
-2
View File
@@ -359,8 +359,6 @@ systemd.xml ./refsect1[title="Options"]/refsect2[title="Options that duplicate k
systemd.xml ./refsect1[title="Options"]/refsect2[title="Options that duplicate kernel command line settings"]/variablelist/varlistentry[term="--default-standard-output="]
systemd.xml ./refsect1[title="Directories"]/variablelist[1]/varlistentry[term="System unit directories"]
systemd.xml ./refsect1[title="Directories"]/variablelist[2]/varlistentry[term="User unit directories"]
systemd.xml ./refsect1[title="Directories"]/variablelist[3]/varlistentry[term="SysV init scripts directory"]
systemd.xml ./refsect1[title="Directories"]/variablelist[4]/varlistentry[term="SysV runlevel link farm directory"]
systemd.xml ./refsect1[title="Signals"]/variablelist/varlistentry[term="SIGTERM"]
systemd.xml ./refsect1[title="Signals"]/variablelist/varlistentry[term="SIGINT"]
systemd.xml ./refsect1[title="Signals"]/variablelist/varlistentry[term="SIGWINCH"]