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

file-lock, etc.: Be clearer about which locks we do and don't exclude

parent c39561e7
No related branches found
No related tags found
1 merge request!666Add steam-runtime-supervisor, a version of pv-adverb suitable for inclusion in scout
Pipeline #84083 passed
......@@ -35,6 +35,11 @@ temporarily upgraded to an exclusive lock during log rotation.
If running on an older kernel that does not support open file description
locks, then the logger holds a shared **F_SETLK** lock instead, and log
rotation is disabled.
These locks are compatible with those used by **bwrap**(1), **flatpak**(1),
**steam-runtime-supervisor**(1) and **pressure-vessel-adverb**(1).
It is unspecified whether they exclude the **flock**(2) locks used
by util-linux **flock**(1) or not, so using those locks on lock
files used by **steam-runtime-tools** should be avoided.
The name of this tool intentionally does not include **steam** so that
it will not be killed by commands like **pkill steam**, allowing any
......
......@@ -122,6 +122,12 @@ determined by the options.
process-associated record lock (**F_SETLK** or **F_SETLKW**) on older
kernels.
These locks interact in the expected way with **bwrap**(1),
**flatpak**(1) and other parts of **steam-runtime-tools**.
It is unspecified whether they exclude the **flock**(2) locks used
by util-linux **flock**(1) or not, so using those locks on lock
files used by **steam-runtime-tools** should be avoided.
**--lock-wait**
: For each **--lock-file** that appears on the command-line after
this option until a **--no-lock-wait** option is seen, if the file is
......
......@@ -150,6 +150,12 @@ exit status.
process-associated record lock (**F_SETLK** or **F_SETLKW**) on older
kernels.
These locks interact in the expected way with **bwrap**(1),
**flatpak**(1) and other parts of **steam-runtime-tools**.
It is unspecified whether they exclude the **flock**(2) locks used
by util-linux **flock**(1) or not, so using those locks on lock
files used by **steam-runtime-tools** should be avoided.
**--pass-fd** *FD*
: Pass the file descriptor *FD* (specified as a small positive integer)
from the parent process to the *COMMAND*. The default is to only pass
......
......@@ -8,11 +8,12 @@ SPDX-License-Identifier: MIT
pressure-vessel uses fcntl locks to guard concurrent access to runtimes.
They are `F_OFD_SETLK` locks if possible, falling back to POSIX
process-oriented `F_SETLK` locks on older kernels. See `bwrap-lock.c`
for full details.
process-oriented `F_SETLK` locks on older kernels.
See `steam-runtime-tools/file-lock.c` for full details.
Do not use `flock(2)`, `flock(1)` or `lockf(3)` to interact with
pressure-vessel. `bwrap --lock-file` or `pressure-vessel-adverb`
pressure-vessel.
`bwrap --lock-file`, `pressure-vessel-adverb` or `steam-runtime-supervisor`
can be used.
Runtimes
......
......@@ -34,6 +34,25 @@
*
* A read/write lock compatible with the locks taken out by
* `bwrap --lock-file FILENAME` and Flatpak.
*
* More precisely, #SrtFileLock normally attempts to use a Linux open file
* description lock, `F_OFD_SETLK(W)`, but falls back to a POSIX
* process-oriented `fcntl` lock, `F_SETLK(W)` if taking the OFD lock
* fails with `EINVAL` (kernels older than 3.15).
* See `fcntl(2)` for technical details of how these locks behave.
* In particular, holding an OFD lock conflicts with a POSIX lock and
* vice versa, so two processes holding different kinds of lock will
* correctly exclude each other.
*
* If %SRT_FILE_LOCK_FLAGS_PROCESS_ORIENTED is used, #SrtFileLock will
* only use POSIX process-oriented `F_SETLK(W)` locks.
* Conversely, if %SRT_FILE_LOCK_FLAGS_REQUIRE_OFD is used, then
* #SrtFileLock will only use OFD locks, failing on older kernels.
* Setting both flags is not allowed.
*
* It is unspecified whether these locks exclude `flock(2)` locks or not.
* Using `flock(1)` or `flock(2)` on the same lock files that are
* locked by steam-runtime-tools should be avoided.
*/
struct _SrtFileLock
{
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment