]> git.ipfire.org Git - thirdparty/systemd.git/commit - src/core/manager.c
Introduce sd_notify_barrier
authorKumar Kartikeya Dwivedi <memxor@gmail.com>
Tue, 28 Apr 2020 14:09:27 +0000 (19:39 +0530)
committerKumar Kartikeya Dwivedi <memxor@gmail.com>
Thu, 30 Apr 2020 21:52:47 +0000 (03:22 +0530)
commit4f07ddfa9bc2242eaa6c288a15b8bce4e4383931
tree408c9202f13b2200bb21720e01931b8bfd94ea7b
parentcad67279067b03e64df5421b9a1e9fef077863d9
Introduce sd_notify_barrier

This adds the sd_notify_barrier function, to allow users to synchronize against
the reception of sd_notify(3) status messages. It acts as a synchronization
point, and a successful return gurantees that all previous messages have been
consumed by the manager. This can be used to eliminate race conditions where
the sending process exits too early for systemd to associate its PID to a
cgroup and attribute the status message to a unit correctly.

systemd-notify now uses this function for proper notification delivery and be
useful for NotifyAccess=all units again in user mode, or in cases where it
doesn't have a control process as parent.

Fixes: #2739
man/rules/meson.build
man/sd_notify.xml
src/core/manager.c
src/libsystemd/sd-daemon/sd-daemon.c
src/notify/notify.c
src/systemd/sd-daemon.h