[systemd-devel] What are Abandon() and AbandonScope() used for?

Michal Koutný mkoutny at suse.com
Tue Jan 30 14:27:30 UTC 2024


Hello.

On Tue, Jan 23, 2024 at 04:40:35PM +0100, Felip Moll <felip at schedmd.com> wrote:
> Can somebody give me an insight of what these methods really do?
> The documentation is pretty vague:
> https://www.freedesktop.org/wiki/Software/systemd/dbus/

Those would most probably pair with
org.freedesktop.systemd1.Scope.RequestStop DBus signal -- an organized
way how systemd stops scope.

I.e. there can be a "controller" of the scope that would respond to such a
signal with some graceful termination of the scope. Lifetimes of the
scope and controller may be independent and when controller terminates,
it can mark the scope as abandoned (instead of killing its processes or
disappearing without notice).

That's the theory, practice would be logind~controller of its session
scopes.

> When should I use this? For example I am creating a scope which will
> allocate some pids into their cgroups. The scope is created from a daemon
> run from a service unit. The service will eventually be shut down and I
> want the scope to remain if it has pids in it. Should the service "abandon"
> the scope?

That depends whether you want some extra stopping procedure for your
scope besides regular SIGTERM logic.

HTH,
Michal
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 228 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/systemd-devel/attachments/20240130/f2096ca8/attachment.sig>


More information about the systemd-devel mailing list