[systemd-devel] Still confused with socket activation

Benjamin Berg benjamin at sipsolutions.net
Wed Feb 3 19:25:06 UTC 2021


On Wed, 2021-02-03 at 20:47 +0300, Andrei Borzenkov wrote:
> 03.02.2021 00:25, Benjamin Berg пишет:
> > On Tue, 2021-02-02 at 22:50 +0300, Andrei Borzenkov wrote:
> > > 02.02.2021 17:59, Lennart Poettering пишет:
> > > > 
> > > > Note that Requires= in almost all cases should be combined with
> > > > an
> > > > order dep of After= onto the same unit.
> > > 
> > > Years ago I asked for example when Requires makes sense without
> > > After.
> > > Care to show it? I assume you must have use case if you say "in
> > > almost all".
> > 
> > In the GNOME systemd units there are a few places where a Requires=
> > is
> > combined with Before=.
> > 
> 
> This is functionally completely equivalent to simply using
> Wants+Before.
> At least as long as you rely on *documented* functions.

Requires= actually has the difference that the unit must become part of
the transaction (if it is not active already). So you get a hard
failure and appropriate logging if the unit cannot be added to the
transaction for some reason.

> Care to show more complete example and explain why Wants does not
> work in this case?

Wants= would work fine. I think it boils down to whether you find the
extra assertions useful. The Requires= documentation actually suggests
using Wants= exactly to avoid this.

Benjamin

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: This is a digitally signed message part
URL: <https://lists.freedesktop.org/archives/systemd-devel/attachments/20210203/e071f2df/attachment.sig>


More information about the systemd-devel mailing list