[systemd-devel] homed: Purpose of assert(!h->current_operation)
Lennart Poettering
mzerqung at 0pointer.de
Mon Jul 4 08:56:34 UTC 2022
On So, 26.06.22 02:57, Léo (leeo97one at gmail.com) wrote:
> Hello,
>
> I would like to know the purpose of this assert operation:
> https://github.com/systemd/systemd/blob/v251/src/home/homed-home.c#L2697
>
> What does it mean if it fails?
It just encodes that this function expects to be called with no
operation currently being executed.
Like all assert() it just encodes assumptions made by the programmer,
i.e. stuff that should be guranteed at this point, and if not met
indicate a programming error (as opposed to a runtime error).
Specifically, for each home dir, we allow exactly one operation to be
executed at once, and all other ones are queued. Thus, when we start
to execute one operation we check that there is none already being
executed, because if it was, then there's a bug somewhere.
Why do you ask? did you actually see the assertion being hit?
Lennart
--
Lennart Poettering, Berlin
More information about the systemd-devel
mailing list