1
0
mirror of https://github.com/systemd/systemd synced 2026-03-18 19:14:46 +01:00

Compare commits

...

9 Commits

Author SHA1 Message Date
Luca Boccassi
e4948b0f0a
Merge pull request #19921 from yuwata/service-verify-bus-type
core/service: fix assertion when Type=dbus but BusName= is not specified
2021-06-15 12:21:53 +01:00
Yu Watanabe
e19b0746f1 unit: use alias name of man page 2021-06-15 12:14:26 +01:00
Matt Johnston
e65357b658 man: fix sd_bus_add_node_enumerator() ret_nodes
ret_nodes is NULL terminated, the return value isn't a count.
2021-06-15 11:29:44 +01:00
Yu Watanabe
21d03e6c63 man: add an example to configure default route on device with table
Prompted by #19911.
2021-06-15 11:29:20 +01:00
Luca Boccassi
c35949a51c
Merge pull request #19930 from yuwata/update-comments
Update comments
2021-06-15 11:28:51 +01:00
Yu Watanabe
a3f5f4a5c0 fix typo 2021-06-15 14:19:30 +09:00
Yu Watanabe
7802194ac0 tree-wide: add missing whitespace at the end of comments 2021-06-15 14:09:29 +09:00
Yu Watanabe
2429808b29 test: add a test case for #19920 2021-06-15 03:06:09 +09:00
Yu Watanabe
0f97b7c338 core/service: fix assertion when Type=dbus but BusName= is not specified
Fixes #19920.
2021-06-15 03:06:09 +09:00
53 changed files with 80 additions and 65 deletions

View File

@ -58,8 +58,9 @@
<para><parameter>callback</parameter> is called with the path and userdata pointer registered <para><parameter>callback</parameter> is called with the path and userdata pointer registered
with <function>sd_bus_add_node_enumerator()</function>. When called, it should store all the with <function>sd_bus_add_node_enumerator()</function>. When called, it should store all the
child object paths of the given path prefix in <parameter>ret_nodes</parameter> and return the child object paths of the given path prefix in <parameter>ret_nodes</parameter> with a NULL
number of child objects under the given prefix. If an error occurs, it can either return a terminator item. The callback should return a non-negative value on success.
If an error occurs, it can either return a
negative integer, set <parameter>ret_error</parameter> to a non-empty error or do both. Any negative integer, set <parameter>ret_error</parameter> to a non-empty error or do both. Any
errors returned by the callback are encoded as D-Bus errors and sent back to the caller. Errors errors returned by the callback are encoded as D-Bus errors and sent back to the caller. Errors
in <parameter>ret_error</parameter> take priority over negative return values.</para> in <parameter>ret_error</parameter> take priority over negative return values.</para>

View File

@ -253,7 +253,7 @@
<para><function>sd_bus_error_move()</function> is similar to <function>sd_bus_error_copy()</function>, <para><function>sd_bus_error_move()</function> is similar to <function>sd_bus_error_copy()</function>,
but will move any error information from <parameter>e</parameter> into <parameter>dst</parameter>, but will move any error information from <parameter>e</parameter> into <parameter>dst</parameter>,
resetting the former. This function cannot fail, as no new memory is allocated. Note that if resetting the former. This function cannot fail, as no new memory is allocated. Note that if
<parameter>e</parameter> is not set, <parameter>dst</parameter> is initializated to <parameter>e</parameter> is not set, <parameter>dst</parameter> is initialized to
<constant>SD_BUS_ERROR_NULL</constant>. Moreover, if <parameter>dst</parameter> is <constant>SD_BUS_ERROR_NULL</constant>. Moreover, if <parameter>dst</parameter> is
<constant>NULL</constant> no operation is executed on it and resources held by <parameter>e</parameter> <constant>NULL</constant> no operation is executed on it and resources held by <parameter>e</parameter>
are freed and reset. Returns a converted <varname>errno</varname>-like, non-positive error value.</para> are freed and reset. Returns a converted <varname>errno</varname>-like, non-positive error value.</para>

View File

@ -461,8 +461,17 @@
<listitem> <listitem>
<para>Takes a boolean. If set to true, sets up the default route bound to the interface. <para>Takes a boolean. If set to true, sets up the default route bound to the interface.
Defaults to false. This is useful when creating routes on point-to-point interfaces. Defaults to false. This is useful when creating routes on point-to-point interfaces.
This is equivalent to e.g. the following. This is equivalent to e.g. the following,
<programlisting>ip route add default dev veth99</programlisting></para> <programlisting>ip route add default dev veth99</programlisting>
or,
<programlisting>[Route]
Gateway=0.0.0.0</programlisting></para>
<para>Currently, there are no way to specify e.g., the table for the route configured by
this setting. To configure the default route with such an additional property, please use
the following instead:
<programlisting>[Route]
Gateway=0.0.0.0
Table=1234</programlisting></para>
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>

View File

@ -188,7 +188,7 @@ int genuine_random_bytes(void *p, size_t n, RandomFlags flags) {
* invocations or so. That's because we don't really care about the quality here. We * invocations or so. That's because we don't really care about the quality here. We
* generally prefer using RDRAND if the caller allows us to, since this way we won't upset * generally prefer using RDRAND if the caller allows us to, since this way we won't upset
* the kernel's random subsystem by accessing it before the pool is initialized (after all it * the kernel's random subsystem by accessing it before the pool is initialized (after all it
* will kmsg log about every attempt to do so)..*/ * will kmsg log about every attempt to do so). */
for (;;) { for (;;) {
unsigned long u; unsigned long u;
size_t m; size_t m;

View File

@ -1192,7 +1192,7 @@ int sockaddr_un_set_path(struct sockaddr_un *ret, const char *path) {
/* Don't allow paths larger than the space in sockaddr_un. Note that we are a tiny bit more restrictive than /* Don't allow paths larger than the space in sockaddr_un. Note that we are a tiny bit more restrictive than
* the kernel is: we insist on NUL termination (both for abstract namespace and regular file system socket * the kernel is: we insist on NUL termination (both for abstract namespace and regular file system socket
* addresses!), which the kernel doesn't. We do this to reduce chance of incompatibility with other apps that * addresses!), which the kernel doesn't. We do this to reduce chance of incompatibility with other apps that
* do not expect non-NUL terminated file system path*/ * do not expect non-NUL terminated file system path. */
if (l+1 > sizeof(ret->sun_path)) if (l+1 > sizeof(ret->sun_path))
return -EINVAL; return -EINVAL;

View File

@ -668,7 +668,8 @@ static int service_setup_bus_name(Service *s) {
assert(s); assert(s);
if (s->type != SERVICE_DBUS) /* If s->bus_name is not set, then the unit will be refused by service_verify() later. */
if (s->type != SERVICE_DBUS || !s->bus_name)
return 0; return 0;
r = unit_add_dependency_by_name(UNIT(s), UNIT_REQUIRES, SPECIAL_DBUS_SOCKET, true, UNIT_DEPENDENCY_FILE); r = unit_add_dependency_by_name(UNIT(s), UNIT_REQUIRES, SPECIAL_DBUS_SOCKET, true, UNIT_DEPENDENCY_FILE);

View File

@ -242,7 +242,7 @@ void server_space_usage_message(Server *s, JournalStorage *storage) {
static bool uid_for_system_journal(uid_t uid) { static bool uid_for_system_journal(uid_t uid) {
/* Returns true if the specified UID shall get its data stored in the system journal*/ /* Returns true if the specified UID shall get its data stored in the system journal. */
return uid_is_system(uid) || uid_is_dynamic(uid) || uid == UID_NOBODY; return uid_is_system(uid) || uid_is_dynamic(uid) || uid == UID_NOBODY;
} }

View File

@ -2854,7 +2854,7 @@ int journal_file_compare_locations(JournalFile *af, JournalFile *bf) {
assert(bf->location_type == LOCATION_SEEK); assert(bf->location_type == LOCATION_SEEK);
/* If contents, timestamps and seqnum match, these entries are /* If contents, timestamps and seqnum match, these entries are
* identical*/ * identical. */
if (sd_id128_equal(af->current_boot_id, bf->current_boot_id) && if (sd_id128_equal(af->current_boot_id, bf->current_boot_id) &&
af->current_monotonic == bf->current_monotonic && af->current_monotonic == bf->current_monotonic &&
af->current_realtime == bf->current_realtime && af->current_realtime == bf->current_realtime &&

View File

@ -560,7 +560,7 @@ static int umount_with_timeout(MountPoint *m, int umount_log_level) {
* rather than blocking indefinitely. If the filesysten is * rather than blocking indefinitely. If the filesysten is
* "busy", this may allow processes to die, thus making the * "busy", this may allow processes to die, thus making the
* filesystem less busy so the unmount might succeed (rather * filesystem less busy so the unmount might succeed (rather
* then return EBUSY).*/ * than return EBUSY). */
r = umount2(m->path, MNT_FORCE); r = umount2(m->path, MNT_FORCE);
if (r < 0) if (r < 0)
log_full_errno(umount_log_level, errno, "Failed to unmount %s: %m", m->path); log_full_errno(umount_log_level, errno, "Failed to unmount %s: %m", m->path);

View File

@ -36,7 +36,7 @@ static void test_make_salt(void) {
static int test_hash_password(void) { static int test_hash_password(void) {
log_info("/* %s */", __func__); log_info("/* %s */", __func__);
/* As a warmup exercise, check if we can hash passwords. */ /* As a warm-up exercise, check if we can hash passwords. */
bool have_sane_hash = false; bool have_sane_hash = false;
const char *hash; const char *hash;

View File

@ -65,6 +65,10 @@ test -f /run/dbus1
systemd-run --unit=dbus2.service --wait -p StandardOutput=tty -p StandardError=tty -p Type=dbus -p BusName=systemd.test.ExecStopPost -p ExecStopPost='/bin/touch /run/dbus2' true systemd-run --unit=dbus2.service --wait -p StandardOutput=tty -p StandardError=tty -p Type=dbus -p BusName=systemd.test.ExecStopPost -p ExecStopPost='/bin/touch /run/dbus2' true
test -f /run/dbus2 test -f /run/dbus2
# https://github.com/systemd/systemd/issues/19920
systemd-run --unit=dbus3.service --wait -p StandardOutput=tty -p StandardError=tty -p Type=dbus -p ExecStopPost='/bin/touch /run/dbus3' true \
&& { echo 'unexpected success'; exit 1; }
cat >/tmp/notify1.sh <<EOF cat >/tmp/notify1.sh <<EOF
#!/usr/bin/env bash #!/usr/bin/env bash

View File

@ -9,7 +9,7 @@
[Unit] [Unit]
Description=Dispatch Password Requests to Console Directory Watch Description=Dispatch Password Requests to Console Directory Watch
Documentation=man:systemd-ask-password-console.service(8) Documentation=man:systemd-ask-password-console.path(8)
DefaultDependencies=no DefaultDependencies=no
Conflicts=shutdown.target emergency.service Conflicts=shutdown.target emergency.service
After=plymouth-start.service After=plymouth-start.service

View File

@ -9,7 +9,7 @@
[Unit] [Unit]
Description=Forward Password Requests to Wall Directory Watch Description=Forward Password Requests to Wall Directory Watch
Documentation=man:systemd-ask-password-console.service(8) Documentation=man:systemd-ask-password-wall.path(8)
DefaultDependencies=no DefaultDependencies=no
Conflicts=shutdown.target emergency.service Conflicts=shutdown.target emergency.service
Before=paths.target shutdown.target cryptsetup.target Before=paths.target shutdown.target cryptsetup.target

View File

@ -9,7 +9,7 @@
[Unit] [Unit]
Description=Forward Password Requests to Wall Description=Forward Password Requests to Wall
Documentation=man:systemd-ask-password-console.service(8) Documentation=man:systemd-ask-password-wall.service(8)
After=systemd-user-sessions.service After=systemd-user-sessions.service
[Service] [Service]

View File

@ -9,7 +9,7 @@
[Unit] [Unit]
Description=Hibernate Description=Hibernate
Documentation=man:systemd-suspend.service(8) Documentation=man:systemd-hibernate.service(8)
DefaultDependencies=no DefaultDependencies=no
Requires=sleep.target Requires=sleep.target
After=sleep.target After=sleep.target

View File

@ -9,7 +9,7 @@
[Unit] [Unit]
Description=Hybrid Suspend+Hibernate Description=Hybrid Suspend+Hibernate
Documentation=man:systemd-suspend.service(8) Documentation=man:systemd-hybrid-sleep.service(8)
DefaultDependencies=no DefaultDependencies=no
Requires=sleep.target Requires=sleep.target
After=sleep.target After=sleep.target

View File

@ -9,7 +9,7 @@
[Unit] [Unit]
Description=initctl Compatibility Named Pipe Description=initctl Compatibility Named Pipe
Documentation=man:systemd-initctl.service(8) Documentation=man:systemd-initctl.socket(8)
DefaultDependencies=no DefaultDependencies=no
Before=sockets.target Before=sockets.target

View File

@ -9,7 +9,7 @@
[Unit] [Unit]
Description=Reboot via kexec Description=Reboot via kexec
Documentation=man:systemd-halt.service(8) Documentation=man:systemd-kexec.service(8)
DefaultDependencies=no DefaultDependencies=no
Requires=shutdown.target umount.target final.target Requires=shutdown.target umount.target final.target
After=shutdown.target umount.target final.target After=shutdown.target umount.target final.target

View File

@ -9,7 +9,7 @@
[Unit] [Unit]
Description=Power-Off Description=Power-Off
Documentation=man:systemd-halt.service(8) Documentation=man:systemd-poweroff.service(8)
DefaultDependencies=no DefaultDependencies=no
Requires=shutdown.target umount.target final.target Requires=shutdown.target umount.target final.target
After=shutdown.target umount.target final.target After=shutdown.target umount.target final.target

View File

@ -9,7 +9,7 @@
[Unit] [Unit]
Description=Reboot Description=Reboot
Documentation=man:systemd-halt.service(8) Documentation=man:systemd-reboot.service(8)
DefaultDependencies=no DefaultDependencies=no
Requires=shutdown.target umount.target final.target Requires=shutdown.target umount.target final.target
After=shutdown.target umount.target final.target After=shutdown.target umount.target final.target

View File

@ -9,7 +9,7 @@
[Unit] [Unit]
Description=Suspend; Hibernate if not used for a period of time Description=Suspend; Hibernate if not used for a period of time
Documentation=man:systemd-suspend.service(8) Documentation=man:systemd-suspend-then-hibernate.service(8)
DefaultDependencies=no DefaultDependencies=no
Requires=sleep.target Requires=sleep.target
After=sleep.target After=sleep.target

View File

@ -9,7 +9,7 @@
[Unit] [Unit]
Description=udev Control Socket Description=udev Control Socket
Documentation=man:systemd-udevd.service(8) man:udev(7) Documentation=man:systemd-udevd-control.socket(8) man:udev(7)
DefaultDependencies=no DefaultDependencies=no
Before=sockets.target Before=sockets.target
ConditionPathIsReadWrite=/sys ConditionPathIsReadWrite=/sys

View File

@ -9,7 +9,7 @@
[Unit] [Unit]
Description=udev Kernel Socket Description=udev Kernel Socket
Documentation=man:systemd-udevd.service(8) man:udev(7) Documentation=man:systemd-udevd-kernel.socket(8) man:udev(7)
DefaultDependencies=no DefaultDependencies=no
Before=sockets.target Before=sockets.target
ConditionPathIsReadWrite=/sys ConditionPathIsReadWrite=/sys

View File

@ -9,7 +9,7 @@
[Unit] [Unit]
Description=Update UTMP about System Runlevel Changes Description=Update UTMP about System Runlevel Changes
Documentation=man:systemd-update-utmp.service(8) man:utmp(5) Documentation=man:systemd-update-utmp-runlevel.service(8) man:utmp(5)
DefaultDependencies=no DefaultDependencies=no
RequiresMountsFor=/var/log/wtmp RequiresMountsFor=/var/log/wtmp
Conflicts=shutdown.target Conflicts=shutdown.target