]> git.ipfire.org Git - thirdparty/systemd.git/commit
core: add io.systemd.Unit.StartTransient() to the varlink API
authorMichael Vogt <michael@amutable.com>
Tue, 14 Apr 2026 15:04:15 +0000 (17:04 +0200)
committerMichael Vogt <michael@amutable.com>
Mon, 27 Apr 2026 11:49:24 +0000 (13:49 +0200)
commit913b81735e740c9d700647754c466bc8b75943d7
treed4e8c63067d178ad7226d4b9099f54dafb8f80aa
parent8edd9b2b66aacbf4d8bd061b76ba734fd39046b4
core: add io.systemd.Unit.StartTransient() to the varlink API

This commit adds a simple version of io.systemd.Unit.StartTransient
for varlink. It is similar to the dbus version, but there is a key
difference:
1. Instead of building the unit from key/value properties it
   takes a json object in the "service" parameter. It is also
   only implementing a minimal set of what can be done with a
   service (for now)
2. No aux units (for now)
3. When called with --more the varlink socket can notify about
   unit job and state changes controlled via a bool on the
   varlink call inputs: notify{Job,Unit}Changes

We use the new io.systemd.Job interface when outputing the
io.systemd.Unit.StartTransient result as it makes the output
nice and mirrors the input.

Note that the property names follow the D-Bus naming to make a
future "systemctl show" transition from D-Bus -> varlink easier.

Because UnitContext is now also used for the inputs we need
to make a bunch of fields `SD_VARLINK_NULLABLE` so that the
input is even accepted. This does not affect the output, it
is still fully populated, just the schema. The ID of UnitContext
is still required.

Thanks to ikruglov and Lennart for their excellent feedback on
this.
13 files changed:
src/core/job.c
src/core/job.h
src/core/manager.c
src/core/unit.c
src/core/unit.h
src/core/varlink-common.c
src/core/varlink-common.h
src/core/varlink-manager.c
src/core/varlink-unit.c
src/core/varlink-unit.h
src/core/varlink.c
src/shared/varlink-io.systemd.Job.c
src/shared/varlink-io.systemd.Unit.c