Add steam-runtime-supervisor, a version of pv-adverb suitable for inclusion in scout
Continuation of !671 (merged), !672 (merged), !665 (merged).
This will let us use it as a general-purpose process supervisor any time we need to have a parent process monitoring its child, for example to be a subreaper or hold a lock.
Possible future work in this direction would be to make pv-adverb do its setup and then execve() s-r-supervisor, instead of them both linking to the same code, which would leave a smaller process running long-term - but for now there doesn't seem to be any particular need to do that.
-
file-lock: Factor out _srt_file_lock_acquire()
No functional change intended.
-
file-lock: Use "shared lock" or "exclusive lock" in error messages
Saying "reading" or "writing" here is somewhat misleading.
-
file-lock: Add a verbose mode
If we're waiting for a lock before doing something (for example unpacking the runtime for steamwebhelper) and we expect that under normal circumstances the lock will not be held, it's helpful to log a message in the rare case where we have to wait for it, so that a reader can think "why is this locked? should it be locked?" and take any action that might be required.
This is implemented by trying to take the lock without waiting, and if that fails, logging a message and then retrying with the wait.
The messages will look like:
steam-runtime-supervisor[12345]: N: Waiting for exclusive lock to be available: /path/to/lock ... time passes ... steam-runtime-supervisor[12345]: N: Acquired lock /path/to/lock, continuing
-
pv-adverb: Divert stdout to stderr before parsing options
Otherwise, if we emit a g_debug() message during command-line parsing, it will corrupt stdout.
-
file-lock: Add some debug messages
A caveat with these is that because they're emitted during command-line parsing, it's too early for -v -v or PRESSURE_VESSEL_VERBOSE to be taken into account. SRT_LOG=debug or G_MESSAGES_DEBUG=all will work, though.
-
steam-runtime-supervisor: Add
This is a subset of the pressure-vessel-adverb interface, with highly specific functionality like setting up the LD_LIBRARY_PATH omitted, and without the resulting Flatpak dependencies. As a result, it's considerably smaller (120K vs. 500K).
Helps: steamrt/tasks#387
-
file-lock, etc.: Be clearer about which locks we do and don't exclude