mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-18 12:28:40 +00:00
* chore(i18n): translate every missing string in all locales Adds the 87 strings the bottom-screen Dashboard and in-game stats pages introduced to all 32 locales, plus the 51 older settings strings Japanese and the 50 Chinese locales were still missing. Every locale now has all 3456 translatable strings with the same placeholders as English. Also translates 36 entries that were still English where the language does not use the English word, and makes es-419 touch_app_id use the same %1$s placeholder as English. * chore(patches): drop comments from the lines downstream patches add Removes comment lines and trailing comments from lines our patches add, with hunk headers recounted. Lines that a later patch uses as context and the upstream backport 0123 are left as they are. The gamescope, FEX, proot and xodus series still apply to their pinned sources, and the patched trees differ only in those comments. test_hud_frames now finds the HUD writer by its first declaration. * docs: credit Greenlight, Better xCloud, viture-v2, GameNative and DiRTTelemetryErrorFix These were credited only in source headers and NOTICE files. * chore: remove source comments and unused functions Removes explanatory comments from first-party Kotlin, Java, C, C++, Rust, TypeScript, Python, shell, Gradle, CMake and workflow files. License and attribution headers stay, and vendored third-party trees, generated files and license files are untouched. A shellcheck directive is kept, and udevmon's fallthrough comments became fallthrough attributes. Syntax trees and token streams match the previous sources apart from the comments and Python docstrings. Module docstrings that argparse prints are kept, and device-smoke.sh prints the same --help text from a heredoc. Also removes 37 functions and 4 fields that nothing referenced. * chore: remove comments from the Syncthing integration and the latest main sources * docs: credit Syncthing and the syncthing-android fork * chore(i18n): translate the Syncthing strings in all locales The 107 strings the Syncthing integration added are now in all 32 locales. sync_web_path_locked names the Syncthing tab by its label. * docs: credit @xXJSONDeruloXx for the HUD metric readers The CPU, GPU load, thermal and battery readers come from their PerformanceHudView pull requests #777, #877, #991, #1406 and #1573. The FusionHUD credit line is unchanged. * docs: credit the HUD metric readers to @xXJSONDeruloXx's work
91 lines
2.9 KiB
C
91 lines
2.9 KiB
C
#ifndef DROIDDECK_PROOT_STATX_MNT_ID_H
|
|
#define DROIDDECK_PROOT_STATX_MNT_ID_H
|
|
|
|
#include <errno.h>
|
|
#include <fcntl.h>
|
|
#include <stdbool.h>
|
|
#include <stdint.h>
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <string.h>
|
|
#include <sys/stat.h>
|
|
#include <sys/sysmacros.h>
|
|
#include <sys/types.h>
|
|
#include <unistd.h>
|
|
|
|
static inline bool droiddeck_proot_read_fdinfo(int fd, uint64_t *mnt_id, uint64_t *ino) {
|
|
if (fd < 0 || !mnt_id || !ino) return false;
|
|
|
|
char fdinfo_path[64];
|
|
int n = snprintf(fdinfo_path, sizeof fdinfo_path, "/proc/self/fdinfo/%d", fd);
|
|
if (n < 0 || (size_t)n >= sizeof fdinfo_path) return false;
|
|
|
|
FILE *fdinfo = fopen(fdinfo_path, "r");
|
|
if (!fdinfo) return false;
|
|
|
|
bool have_mnt_id = false, have_ino = false;
|
|
uint64_t parsed_mnt_id = 0, parsed_ino = 0;
|
|
char line[256];
|
|
while (fgets(line, sizeof line, fdinfo)) {
|
|
const char *value = NULL;
|
|
uint64_t *field = NULL;
|
|
if (strncmp(line, "mnt_id:", 7) == 0) {
|
|
value = line + 7;
|
|
field = &parsed_mnt_id;
|
|
have_mnt_id = true;
|
|
} else if (strncmp(line, "ino:", 4) == 0) {
|
|
value = line + 4;
|
|
field = &parsed_ino;
|
|
have_ino = true;
|
|
}
|
|
if (!value) continue;
|
|
|
|
errno = 0;
|
|
char *end = NULL;
|
|
unsigned long long parsed = strtoull(value, &end, 10);
|
|
if (errno || end == value || (*end && *end != '\n' && *end != '\r')) {
|
|
if (field == &parsed_mnt_id) have_mnt_id = false;
|
|
else have_ino = false;
|
|
continue;
|
|
}
|
|
*field = (uint64_t)parsed;
|
|
}
|
|
bool read_error = ferror(fdinfo);
|
|
fclose(fdinfo);
|
|
|
|
if (read_error || !have_mnt_id || !have_ino || parsed_mnt_id == 0) return false;
|
|
*mnt_id = parsed_mnt_id;
|
|
*ino = parsed_ino;
|
|
return true;
|
|
}
|
|
|
|
static inline bool droiddeck_proot_statx_fill_mnt_id(pid_t pid, int fd,
|
|
int flags, const char *path,
|
|
unsigned int mask,
|
|
struct statx *buf) {
|
|
if (fd < 0 || !(flags & AT_EMPTY_PATH) || !path || path[0] != '\0'
|
|
|| !(mask & STATX_MNT_ID) || (buf->stx_mask & STATX_MNT_ID)
|
|
|| !(buf->stx_mask & STATX_INO))
|
|
return false;
|
|
|
|
char tracee_fd_path[64];
|
|
int n = snprintf(tracee_fd_path, sizeof tracee_fd_path, "/proc/%ld/fd/%d", (long)pid, fd);
|
|
if (n < 0 || (size_t)n >= sizeof tracee_fd_path) return false;
|
|
|
|
int pinned = open(tracee_fd_path, O_PATH | O_CLOEXEC);
|
|
if (pinned < 0) return false;
|
|
struct stat st;
|
|
bool same = fstat(pinned, &st) == 0 && st.st_ino == buf->stx_ino &&
|
|
major(st.st_dev) == buf->stx_dev_major && minor(st.st_dev) == buf->stx_dev_minor;
|
|
uint64_t mnt_id = 0, ino = 0;
|
|
bool have_fdinfo = same && droiddeck_proot_read_fdinfo(pinned, &mnt_id, &ino);
|
|
close(pinned);
|
|
if (!have_fdinfo || ino != st.st_ino) return false;
|
|
|
|
buf->stx_mnt_id = mnt_id;
|
|
buf->stx_mask |= STATX_MNT_ID;
|
|
return true;
|
|
}
|
|
|
|
#endif
|