mirror of
https://github.com/termux/termux-packages.git
synced 2025-11-02 02:38:59 +00:00
- Switch source URL to https://github.com/eeTools/SimulIDE-dev - official new development location by the same developers - Software has been relicensed to AGPL-V3 - Convert all source code with `dos2unix` before patching - Remove `src-gpsim-protocol.cc.patch` - no longer necessary - Remove `enable-pie.patch`: upstreamed ina0ad4593ee- `angelscript-restore-arm-callfunc.patch`: restores the necessary code to the vendored angelscript to build for 32-bit ARM - by copying and pasting it from upstream angelscript, here: -ec94f25441/sdk/angelscript/source/as_callfunc_arm_gcc.S-ec94f25441/sdk/angelscript/source/as_callfunc_arm.cpp- `use_posix_ipc.patch`: Copy and paste Termux-specific implementation of `shm_open()` found in other Termux packages like `qt5-qtbase` - More information: https://github.com/eeTools/SimulIDE-dev/issues/68 - Provide icon and `.desktop` file - Tested launching using the `.desktop` file and a little bit of basic functionality on Samsung Galaxy A70 SM-A705FN, appears to be working
71 lines
2.0 KiB
Diff
71 lines
2.0 KiB
Diff
shm_unlink() and shm_open() implementations from other packages like qt5-qtbase:
|
|
https://github.com/termux/termux-packages/pull/17789
|
|
|
|
--- a/src/components/micro/qemudevice.cpp
|
|
+++ b/src/components/micro/qemudevice.cpp
|
|
@@ -27,6 +27,64 @@
|
|
#include "utils.h"
|
|
#include "stringprop.h"
|
|
|
|
+static int shm_unlink(const char *name) {
|
|
+ size_t namelen;
|
|
+ char *fname;
|
|
+
|
|
+ /* Construct the filename. */
|
|
+ while (name[0] == '/') ++name;
|
|
+
|
|
+ if (name[0] == '\0') {
|
|
+ /* The name "/" is not supported. */
|
|
+ errno = EINVAL;
|
|
+ return -1;
|
|
+ }
|
|
+
|
|
+ namelen = strlen(name);
|
|
+ fname = (char *) alloca(sizeof("@TERMUX_PREFIX@/tmp/") - 1 + namelen + 1);
|
|
+ memcpy(fname, "@TERMUX_PREFIX@/tmp/", sizeof("@TERMUX_PREFIX@/tmp/") - 1);
|
|
+ memcpy(fname + sizeof("@TERMUX_PREFIX@/tmp/") - 1, name, namelen + 1);
|
|
+
|
|
+ return unlink(fname);
|
|
+}
|
|
+
|
|
+static int shm_open(const char *name, int oflag, mode_t mode) {
|
|
+ size_t namelen;
|
|
+ char *fname;
|
|
+ int fd;
|
|
+
|
|
+ /* Construct the filename. */
|
|
+ while (name[0] == '/') ++name;
|
|
+
|
|
+ if (name[0] == '\0') {
|
|
+ /* The name "/" is not supported. */
|
|
+ errno = EINVAL;
|
|
+ return -1;
|
|
+ }
|
|
+
|
|
+ namelen = strlen(name);
|
|
+ fname = (char *) alloca(sizeof("@TERMUX_PREFIX@/tmp/") - 1 + namelen + 1);
|
|
+ memcpy(fname, "@TERMUX_PREFIX@/tmp/", sizeof("@TERMUX_PREFIX@/tmp/") - 1);
|
|
+ memcpy(fname + sizeof("@TERMUX_PREFIX@/tmp/") - 1, name, namelen + 1);
|
|
+
|
|
+ fd = open(fname, oflag, mode);
|
|
+ if (fd != -1) {
|
|
+ /* We got a descriptor. Now set the FD_CLOEXEC bit. */
|
|
+ int flags = fcntl(fd, F_GETFD, 0);
|
|
+ flags |= FD_CLOEXEC;
|
|
+ flags = fcntl(fd, F_SETFD, flags);
|
|
+
|
|
+ if (flags == -1) {
|
|
+ /* Something went wrong. We cannot return the descriptor. */
|
|
+ int save_errno = errno;
|
|
+ close(fd);
|
|
+ fd = -1;
|
|
+ errno = save_errno;
|
|
+ }
|
|
+ }
|
|
+
|
|
+ return fd;
|
|
+}
|
|
|
|
#define tr(str) simulideTr("QemuDevice",str)
|
|
|