Skip to content
Snippets Groups Projects
Commit 76fb464d authored by Simon McVittie's avatar Simon McVittie
Browse files

launcher-service(1): Remove details of how it was used in the past


Since the removal of PRESSURE_VESSEL_RELAUNCH_CONTAINER=0, we no
longer use launcher-service for routine game launching, only for
debugging.

Signed-off-by: default avatarSimon McVittie <smcv@collabora.com>
parent d7b0b7f4
No related branches found
No related tags found
1 merge request!475Update documentation around launch-client(1)
......@@ -256,75 +256,7 @@ inherits standard error.
Other nonzero values
: Startup failed.
# INTENDED USE IN STEAM
## Once per game launch
When a game is launched, run one **steam-runtime-launcher-service** per game
(whatever that means in practice - probably one per app-ID) as an
asynchronous child process, wrapped in **pressure-vessel-wrap**
(either directly or by using **run-in-steamrt** or **run-in-scout**),
with the write end of a **pipe**(2) as its standard output.
Read from the read end of the pipe until EOF is reached,
then leave it running.
Steam should choose a **--socket**, **--socket-directory** or
**--bus-name** according to the granularity required.
If the **realpath**(3) of **~/.steam** is sufficiently short, then Steam
could use a subdirectory of that path as a **--socket-directory**,
but if the user's home directory is very long, that might not work
(the maximum length for a **--socket-directory** is only 64 bytes).
Otherwise, if Steam itself is in a container (for example if
**/.flatpak-info** exists), then it must choose a way to communicate
that can be shared with other containers and the host system. Using the
D-Bus session bus and **--bus-name** is probably the most reliable option
in this case.
If Steam is not in a container, then it can create a random subdirectory
of **/tmp**, for example with **mkdtemp**(3), and either use it as a
**--socket-directory** or create a **--socket** with a meaningful name
in that directory.
In the case of a **--socket-directory**, the socket can be determined by
parsing the data read from standard output.
When the game is to be terminated, Steam should send **SIGINT** or
**SIGTERM** to the child process (which by now will be the
**pressure-vessel-adverb** process that replaces **pressure-vessel-wrap**),
and to the process group that it leads (if any):
assert (child_pid > 1);
kill (child_pid, SIGTERM);
kill (-child_pid, SIGTERM);
It must not use **SIGKILL**, because that cannot be forwarded across
the IPC connection.
## Once per command
For each command that is to be run as part of the game, Steam must
run **steam-runtime-launch-client**(1) with a **--socket**, **--dbus-address**
or **--bus-name** option that indicates how to communicate with the
launcher. Alternatively, it could do this itself by using D-Bus.
If Steam needs to set environment variables for the commands that are
run as part of the game, it can do so in one of two ways:
* If the environment variable is equally valid for all commands, it can
be part of the environment of **steam-runtime-launcher-service**.
* If the environment variable is specific to one command, Steam can pass
**--env VAR=VALUE** to **steam-runtime-launch-client**.
If the command is to be terminated without affecting other commands,
Steam should send **SIGINT** to **steam-runtime-launch-client**.
It must not use **SIGKILL**, because that cannot be forwarded across the
IPC connection. It should not use **SIGTERM** unless the entire game is
being terminated, because that's only sent to a single process and not
to an entire process group.
# EXAMPLES
# EXAMPLE
Listen on the session bus, and run two commands, and exit:
......@@ -348,51 +280,4 @@ Listen on the session bus, and run two commands, and exit:
kill -TERM "$launcher_pid"
wait "$launcher_pid"
Listen on a socket in a temporary directory, and use `--exit-with-fd`.
Production code would be more likely to invoke **steam-runtime-launch-client**
from C, C++ or Python code rather than a shell script, and use pipes
instead of fifos.
tmpdir="$(mktemp -d)"
mkfifo "${tmpdir}/exit-fifo"
mkfifo "${tmpdir}/ready-fifo"
pressure-vessel-wrap \
--filesystem="${tmpdir}" \
--pass-fd=3
... \
-- \
steam-runtime-launcher-service \
--exit-on-readable=0 \
--info-fd=3 \
--socket="${tmpdir}/launcher" \
< "${tmpdir}/exit-fifo" \
3> "${tmpdir}/ready-fifo" \
&
launcher_pid="$!"
sleep infinity > "${tmpdir}/exit-fifo" &
sleep_pid="$!"
# Wait for EOF so we know the socket is available
cat "${tmpdir}/ready-fifo" > /dev/null
steam-runtime-launch-client \
--socket="${tmpdir}/launcher" \
-- \
ls -al
steam-runtime-launch-client \
--socket="${tmpdir}/launcher" \
-- \
id
steam-runtime-launch-client \
--socket="${tmpdir}/launcher" \
-- \
sleep infinity &
launch_sleep_pid="$!"
# Make steam-runtime-launcher-service's stdin become readable, which
# will make it exit due to --exit-on-readable
kill "$sleep_pid"
wait "$launcher_pid" || echo "launcher exit status: $?"
wait "$launch_sleep_pid" || echo "launched process exit status: $?"
rm -fr "$tmpdir"
<!-- vim:set sw=4 sts=4 et: -->
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment