mirror of
https://github.com/termux/termux-packages.git
synced 2024-12-04 18:45:52 +00:00
241 lines
7.5 KiB
Diff
241 lines
7.5 KiB
Diff
diff -uNr qemu-8.2.0/linux-user/elfload.c qemu-8.2.0.mod/linux-user/elfload.c
|
|
--- qemu-8.2.0/linux-user/elfload.c 2023-12-19 23:24:34.000000000 +0200
|
|
+++ qemu-8.2.0.mod/linux-user/elfload.c 2024-06-12 18:12:21.007126338 +0300
|
|
@@ -3074,7 +3074,7 @@
|
|
abi_ulong guest_hiaddr)
|
|
{
|
|
/* In order to use host shmat, we must be able to honor SHMLBA. */
|
|
- uintptr_t align = MAX(SHMLBA, qemu_host_page_size);
|
|
+ uintptr_t align = MAX(/* SHMLBA */ getpagesize(), qemu_host_page_size);
|
|
|
|
/* Sanity check the guest binary. */
|
|
if (reserved_va) {
|
|
diff -uNr qemu-8.2.0/linux-user/mmap.c qemu-8.2.0.mod/linux-user/mmap.c
|
|
--- qemu-8.2.0/linux-user/mmap.c 2024-06-12 18:21:01.768575000 +0300
|
|
+++ qemu-8.2.0.mod/linux-user/mmap.c 2024-06-12 18:21:30.340658216 +0300
|
|
@@ -1097,7 +1097,7 @@
|
|
|
|
/* In order to use the host shmat, we need to honor host SHMLBA. */
|
|
mmap_start = mmap_find_vma(0, shm_info.shm_segsz,
|
|
- MAX(SHMLBA, shmlba));
|
|
+ MAX(/* SHMLBA */ getpagesize(), shmlba));
|
|
|
|
if (mmap_start == -1) {
|
|
return -TARGET_ENOMEM;
|
|
diff -uNr qemu-8.2.0/linux-user/syscall.c qemu-8.2.0.mod/linux-user/syscall.c
|
|
--- qemu-8.2.0/linux-user/syscall.c 2024-06-12 18:10:51.058895969 +0300
|
|
+++ qemu-8.2.0.mod/linux-user/syscall.c 2024-06-12 18:12:21.011126348 +0300
|
|
@@ -48,7 +48,7 @@
|
|
#include <poll.h>
|
|
#include <sys/times.h>
|
|
#include <sys/shm.h>
|
|
-#include <sys/sem.h>
|
|
+#include <linux/sem.h>
|
|
#include <sys/statfs.h>
|
|
#include <utime.h>
|
|
#include <sys/sysinfo.h>
|
|
@@ -85,12 +85,17 @@
|
|
#endif
|
|
|
|
#define termios host_termios
|
|
+#define termios2 host_termios2
|
|
+#define ktermios host_ktermios
|
|
#define winsize host_winsize
|
|
#define termio host_termio
|
|
#define sgttyb host_sgttyb /* same as target */
|
|
#define tchars host_tchars /* same as target */
|
|
#define ltchars host_ltchars /* same as target */
|
|
|
|
+#undef __ASM_GENERIC_TERMBITS_H
|
|
+#include <asm/termbits.h>
|
|
+
|
|
#include <linux/termios.h>
|
|
#include <linux/unistd.h>
|
|
#include <linux/cdrom.h>
|
|
@@ -285,6 +290,59 @@
|
|
#define __NR__llseek __NR_lseek
|
|
#endif
|
|
|
|
+_syscall0(int, vhangup)
|
|
+#ifdef __NR_msgctl
|
|
+_syscall3(int, msgctl, int, msqid, int, cmd, struct msqid_ds *, buf)
|
|
+#else
|
|
+static int
|
|
+msgctl (int msqid, int cmd, struct msqid_ds *buf)
|
|
+{
|
|
+ return syscall (__NR_ipc, IPCOP_msgctl, msqid, cmd | 0x100, 0, buf);
|
|
+}
|
|
+#endif
|
|
+
|
|
+#ifdef __NR_semget
|
|
+_syscall3(int, semget, key_t, key, int, nsems, int, semflg)
|
|
+#else
|
|
+static int
|
|
+semget (key_t key, int nsems, int semflg)
|
|
+{
|
|
+ return syscall (__NR_ipc, IPCOP_semget, key, nsems, semflg, NULL);
|
|
+}
|
|
+#endif
|
|
+
|
|
+_syscall2(int, setdomainname, const char *, name, size_t, len)
|
|
+#ifdef __NR_msgget
|
|
+_syscall2(int, msgget, key_t, key, int, msgflg)
|
|
+#else
|
|
+static int
|
|
+msgget (key_t key, int msgflg)
|
|
+{
|
|
+ return syscall(__NR_ipc, 5, IPCOP_msgget, key, msgflg, 0, NULL);
|
|
+}
|
|
+#endif
|
|
+
|
|
+#ifdef _NSIG_WORDS
|
|
+static int sigorset(sigset_t *dest, const sigset_t *a, const sigset_t *b)
|
|
+{
|
|
+ int i;
|
|
+ if (!dest || !a || !b)
|
|
+ return -1;
|
|
+ for (i = 0; i < _NSIG_WORDS; i++)
|
|
+ dest->sig[i] = a->sig[i] | b->sig[i];
|
|
+ return 0;
|
|
+}
|
|
+#else
|
|
+static int sigorset(sigset_t *dest, const sigset_t *a, const sigset_t *b)
|
|
+{
|
|
+ int i;
|
|
+ if (!dest || !a || !b)
|
|
+ return -1;
|
|
+ *dest = *a | *b;
|
|
+ return 0;
|
|
+}
|
|
+#endif
|
|
+
|
|
/* Newer kernel ports have llseek() instead of _llseek() */
|
|
#if defined(TARGET_NR_llseek) && !defined(TARGET_NR__llseek)
|
|
#define TARGET_NR__llseek TARGET_NR_llseek
|
|
@@ -746,6 +804,9 @@
|
|
defined(TARGET_NR_mq_timedreceive_time64)
|
|
safe_syscall5(int, mq_timedreceive, int, mqdes, char *, msg_ptr,
|
|
size_t, len, unsigned *, prio, const struct timespec *, timeout)
|
|
+_syscall1(int, mq_unlink, const char *, name)
|
|
+_syscall4(__kernel_mqd_t, mq_open, const char *, name, int, oflag, mode_t, mode,
|
|
+ struct mq_attr *, attr)
|
|
#endif
|
|
#if defined(TARGET_NR_copy_file_range) && defined(__NR_copy_file_range)
|
|
safe_syscall6(ssize_t, copy_file_range, int, infd, loff_t *, pinoff,
|
|
@@ -1247,7 +1308,7 @@
|
|
#endif
|
|
|
|
#if defined(TARGET_NR_mq_open) && defined(__NR_mq_open)
|
|
-#include <mqueue.h>
|
|
+#include <linux/mqueue.h>
|
|
|
|
static inline abi_long copy_from_user_mq_attr(struct mq_attr *attr,
|
|
abi_ulong target_mq_attr_addr)
|
|
@@ -3800,6 +3861,8 @@
|
|
return 0;
|
|
}
|
|
|
|
+#define semid_ds __kernel_legacy_semid_ds
|
|
+
|
|
static inline abi_long target_to_host_semid_ds(struct semid_ds *host_sd,
|
|
abi_ulong target_addr)
|
|
{
|
|
@@ -3879,6 +3942,16 @@
|
|
abi_ulong __buf;
|
|
};
|
|
|
|
+#ifdef __NR_semctl
|
|
+_syscall4(int, semctl, int, semid, int, semnum, int, cmd, union semun, arg4)
|
|
+#else
|
|
+static int semctl(int semid, int semnum, int cmd, union semun arg4)
|
|
+{
|
|
+ return syscall(__NR_ipc, IPCOP_semctl, semid, semnum, cmd | 0x100,
|
|
+ arg4.__buf);
|
|
+}
|
|
+#endif
|
|
+
|
|
static inline abi_long target_to_host_semarray(int semid, unsigned short **host_array,
|
|
abi_ulong target_addr)
|
|
{
|
|
@@ -4009,7 +4082,7 @@
|
|
case GETPID:
|
|
case GETNCNT:
|
|
case GETZCNT:
|
|
- ret = get_errno(semctl(semid, semnum, cmd, NULL));
|
|
+ ret = get_errno(semctl(semid, semnum, cmd, (union semun) {.buf = NULL}));
|
|
break;
|
|
}
|
|
|
|
@@ -4144,7 +4217,7 @@
|
|
host_md->msg_stime = tswapal(target_md->msg_stime);
|
|
host_md->msg_rtime = tswapal(target_md->msg_rtime);
|
|
host_md->msg_ctime = tswapal(target_md->msg_ctime);
|
|
- host_md->__msg_cbytes = tswapal(target_md->__msg_cbytes);
|
|
+ host_md->msg_cbytes = tswapal(target_md->__msg_cbytes);
|
|
host_md->msg_qnum = tswapal(target_md->msg_qnum);
|
|
host_md->msg_qbytes = tswapal(target_md->msg_qbytes);
|
|
host_md->msg_lspid = tswapal(target_md->msg_lspid);
|
|
@@ -4165,7 +4238,7 @@
|
|
target_md->msg_stime = tswapal(host_md->msg_stime);
|
|
target_md->msg_rtime = tswapal(host_md->msg_rtime);
|
|
target_md->msg_ctime = tswapal(host_md->msg_ctime);
|
|
- target_md->__msg_cbytes = tswapal(host_md->__msg_cbytes);
|
|
+ target_md->__msg_cbytes = tswapal(host_md->msg_cbytes);
|
|
target_md->msg_qnum = tswapal(host_md->msg_qnum);
|
|
target_md->msg_qbytes = tswapal(host_md->msg_qbytes);
|
|
target_md->msg_lspid = tswapal(host_md->msg_lspid);
|
|
@@ -5558,6 +5631,9 @@
|
|
return get_errno(safe_ioctl(fd, ie->host_cmd, filter));
|
|
}
|
|
|
|
+#undef winsize
|
|
+#undef termio
|
|
+
|
|
IOCTLEntry ioctl_entries[] = {
|
|
#define IOCTL(cmd, access, ...) \
|
|
{ TARGET_ ## cmd, cmd, #cmd, access, 0, { __VA_ARGS__ } },
|
|
@@ -9405,7 +9481,7 @@
|
|
return ret;
|
|
}
|
|
#endif
|
|
-#ifdef TARGET_NR_stime /* not on alpha */
|
|
+#if 0 //def TARGET_NR_stime /* not on alpha */
|
|
case TARGET_NR_stime:
|
|
{
|
|
struct timespec ts;
|
|
@@ -9469,7 +9545,7 @@
|
|
}
|
|
return ret;
|
|
#endif
|
|
-#if defined(TARGET_NR_futimesat)
|
|
+#if 0 && defined(TARGET_NR_futimesat)
|
|
case TARGET_NR_futimesat:
|
|
{
|
|
struct timeval *tvp, tv[2];
|
|
@@ -9513,7 +9589,7 @@
|
|
if (!(p = lock_user_string(arg2))) {
|
|
return -TARGET_EFAULT;
|
|
}
|
|
- ret = get_errno(faccessat(arg1, p, arg3, arg4));
|
|
+ ret = get_errno(faccessat(arg1, p, arg3, 0)); // https://github.com/termux/proot/discussions/291
|
|
unlock_user(p, arg2, 0);
|
|
return ret;
|
|
#endif
|
|
@@ -12921,7 +12997,7 @@
|
|
/* Not implemented for now... */
|
|
/* case TARGET_NR_mq_notify: */
|
|
/* break; */
|
|
-
|
|
+#if 0
|
|
case TARGET_NR_mq_getsetattr:
|
|
{
|
|
struct mq_attr posix_mq_attr_in, posix_mq_attr_out;
|
|
@@ -12939,6 +13015,7 @@
|
|
}
|
|
return ret;
|
|
#endif
|
|
+#endif
|
|
|
|
#ifdef CONFIG_SPLICE
|
|
#ifdef TARGET_NR_tee
|