mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-20 05:16:01 +00:00
cleanup (#764)
This commit is contained in:
1 parent
4163b31b02
commit
83ec5708ed
852 files changed
+4844
-46144
No files matched your search
@@ -1,24 +1,7 @@
|
||||
/*
|
||||
* Ported from WinNative (maxjivi05, feature/wayland-gamescope, 2026-09-18/19), GPL-3.0, with names
|
||||
* changed to this project's. The reasoning below is the original author's.
|
||||
*
|
||||
* File locking for the game library on external storage.
|
||||
*
|
||||
* The user's games are bound in from /storage/emulated, which Android serves over FUSE, and that
|
||||
* filesystem implements no locking at all: flock() and fcntl()'s lock commands answer ENOSYS for
|
||||
* every file under it. The Steam client takes a shared lock on each content file as it validates
|
||||
* or updates a title and treats the refusal as a failure, so a download walks its progress back
|
||||
* and forth instead of finishing; a game reading its own data hits the same wall.
|
||||
*
|
||||
* Where the kernel can lock, it does: the real call runs first and its answer stands, so files on
|
||||
* the app's own f2fs storage keep genuine cross-process exclusion. Only the filesystem that cannot
|
||||
* lock at all is answered here, and granting is the honest reading of it - a filesystem with no
|
||||
* lock state has nothing to contend over, and the one other party that could contend is inside
|
||||
* this same session. Reporting failure instead buys no safety and costs the download.
|
||||
*
|
||||
* F_GETLK is the exception: it asks who holds a lock, and on a filesystem holding none the true
|
||||
* answer is "nobody", so it is reported unlocked rather than granted.
|
||||
* Ported from WinNative (maxjivi05, feature/wayland-gamescope, 2026-09-18/19), GPL-3.0.
|
||||
*/
|
||||
|
||||
#define _GNU_SOURCE
|
||||
#include <dlfcn.h>
|
||||
#include <errno.h>
|
||||
@@ -28,7 +11,6 @@
|
||||
#include <sys/file.h>
|
||||
#include <unistd.h>
|
||||
|
||||
/* The filesystem refuses the whole operation, rather than declining this particular lock. */
|
||||
static int unsupported(int error) {
|
||||
return error == ENOSYS || error == ENOTSUP || error == EOPNOTSUPP;
|
||||
}
|
||||
@@ -44,12 +26,6 @@ int flock(int fd, int operation) {
|
||||
return result;
|
||||
}
|
||||
|
||||
/*
|
||||
* fcntl()'s third argument is an int, a pointer, or absent depending on the command; only the
|
||||
* lock commands are of interest here and all of those take a struct flock *. Anything else is
|
||||
* passed straight through as a void * - wide enough for both an int and a pointer on every ABI
|
||||
* the runtime is built for.
|
||||
*/
|
||||
static int is_lock_command(int cmd) {
|
||||
switch (cmd) {
|
||||
case F_SETLK:
|
||||
@@ -104,6 +80,5 @@ int fcntl(int fd, int cmd, ...) {
|
||||
}
|
||||
|
||||
#if defined(__GLIBC__) && defined(F_SETLK64)
|
||||
/* glibc's large-file build redirects both names; the runtime is 64-bit, so they are the same call. */
|
||||
int fcntl64(int fd, int cmd, ...) __attribute__((alias("fcntl")));
|
||||
#endif
|
||||
Reference in new issue
Block a user