mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-25 07:46:01 +00:00
Merge main (67b82ad9) into feat/bionic-runtime
No conflicts. EnhancedSessionLogShare.kt keeps main's RPCS3 log entries (#3130) next to this branch's bionic ones; SessionService.kt changes are apart. (The previous sync,cc5de0ba, merged main at7c8f5c27, notc298da6fas its message says.)
This commit is contained in:
commit
fbed69cef9
57 files changed
+1054
-99
No files matched your search
@@ -31,7 +31,7 @@ static int store_root(char *out, size_t size) {
|
||||
return n > 0 && (size_t)n < size ? n : -1;
|
||||
}
|
||||
|
||||
static int store_exists(void) {
|
||||
static __attribute__((noinline)) int store_exists(void) {
|
||||
char root[PATH_MAX];
|
||||
|
||||
if (store_seen) return 1;
|
||||
@@ -223,10 +223,18 @@ int fremovexattr(int fd, const char *name) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int watched(void) {
|
||||
int saved = errno, found;
|
||||
|
||||
found = dd_is_wineserver() && store_exists();
|
||||
errno = saved;
|
||||
return found;
|
||||
}
|
||||
|
||||
static int tracked(const char *path, char *out, size_t size) {
|
||||
int saved = errno, found;
|
||||
|
||||
found = dd_is_wineserver() && store_exists() && resolved(path, out, size) == 0;
|
||||
found = resolved(path, out, size) == 0;
|
||||
errno = saved;
|
||||
return found;
|
||||
}
|
||||
@@ -258,22 +266,30 @@ static void follow(const char *from, const char *to) {
|
||||
errno = saved;
|
||||
}
|
||||
|
||||
__attribute__((visibility("hidden")))
|
||||
int dd_descriptor_unlink(const char *path, int (*real)(const char *)) {
|
||||
static __attribute__((noinline)) int removed(const char *path, int (*real)(const char *), int folder) {
|
||||
char target[PATH_MAX];
|
||||
int known = tracked(path, target, sizeof(target)), result = real(path);
|
||||
|
||||
if (result == 0 && known) forget(target, 0);
|
||||
if (result == 0 && known) forget(target, folder);
|
||||
return result;
|
||||
}
|
||||
|
||||
static __attribute__((noinline)) int moved(const char *from, const char *to, int (*real)(const char *, const char *)) {
|
||||
char old[PATH_MAX], new[PATH_MAX];
|
||||
int known = tracked(from, old, sizeof(old)), result = real(from, to);
|
||||
|
||||
if (result == 0 && known && tracked(to, new, sizeof(new))) follow(old, new);
|
||||
return result;
|
||||
}
|
||||
|
||||
__attribute__((visibility("hidden")))
|
||||
int dd_descriptor_rmdir(const char *path, int (*real)(const char *)) {
|
||||
char target[PATH_MAX];
|
||||
int known = tracked(path, target, sizeof(target)), result = real(path);
|
||||
int dd_descriptor_unlink(const char *path, int (*real)(const char *)) {
|
||||
return watched() ? removed(path, real, 0) : real(path);
|
||||
}
|
||||
|
||||
if (result == 0 && known) forget(target, 1);
|
||||
return result;
|
||||
__attribute__((visibility("hidden")))
|
||||
int dd_descriptor_rmdir(const char *path, int (*real)(const char *)) {
|
||||
return watched() ? removed(path, real, 1) : real(path);
|
||||
}
|
||||
|
||||
__attribute__((visibility("hidden")))
|
||||
@@ -283,9 +299,5 @@ int dd_descriptor_remove(const char *path, int (*real)(const char *)) {
|
||||
|
||||
__attribute__((visibility("hidden")))
|
||||
int dd_descriptor_rename(const char *from, const char *to, int (*real)(const char *, const char *)) {
|
||||
char old[PATH_MAX], new[PATH_MAX];
|
||||
int known = tracked(from, old, sizeof(old)), result = real(from, to);
|
||||
|
||||
if (result == 0 && known && tracked(to, new, sizeof(new))) follow(old, new);
|
||||
return result;
|
||||
return watched() ? moved(from, to, real) : real(from, to);
|
||||
}
|
||||
@@ -72,15 +72,12 @@ static int read_only_copy(const char *data, size_t len, int flags) {
|
||||
return ro;
|
||||
}
|
||||
|
||||
__attribute__((visibility("hidden"))) int dd_status_without_tracer(const char *path, int flags, const void *caller) {
|
||||
static __attribute__((noinline)) int status_copy(const char *path, int flags, long pid) {
|
||||
char text[STATUS_MAX];
|
||||
size_t len = 0;
|
||||
int saved = errno;
|
||||
int out = -1;
|
||||
|
||||
long pid;
|
||||
if ((flags & O_ACCMODE) != O_RDONLY || (pid = status_pid(path)) < 0 || is_web_helper(caller) || dd_from_ntdll(caller))
|
||||
return -1;
|
||||
// through the next open(): the native userland's hook gives the app's ids as root's there
|
||||
static int (*next_open)(const char *, int, ...) = NULL;
|
||||
if (!next_open) next_open = (int (*)(const char *, int, ...))dlsym(RTLD_NEXT, "open");
|
||||
@@ -116,3 +113,10 @@ done:
|
||||
errno = saved;
|
||||
return out;
|
||||
}
|
||||
|
||||
__attribute__((visibility("hidden"))) int dd_status_without_tracer(const char *path, int flags, const void *caller) {
|
||||
long pid;
|
||||
if ((flags & O_ACCMODE) != O_RDONLY || (pid = status_pid(path)) < 0 || is_web_helper(caller) || dd_from_ntdll(caller))
|
||||
return -1;
|
||||
return status_copy(path, flags, pid);
|
||||
}
|
||||
Reference in new issue
Block a user