apply termux patches
This commit is contained in:
parent
2308e3519b
commit
c8b2424581
@ -47,6 +47,8 @@
|
||||
#include "exec/ram_addr.h"
|
||||
#endif
|
||||
|
||||
#include <linux/mman.h>
|
||||
|
||||
#include "exec/cputlb.h"
|
||||
#include "exec/tb-hash.h"
|
||||
#include "translate-all.h"
|
||||
|
@ -24,13 +24,15 @@
|
||||
|
||||
#include "qemu/osdep.h"
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/soundcard.h>
|
||||
#include <linux/soundcard.h>
|
||||
#include "qemu/main-loop.h"
|
||||
#include "qemu/module.h"
|
||||
#include "qemu/host-utils.h"
|
||||
#include "audio.h"
|
||||
#include "trace.h"
|
||||
|
||||
#include <linux/mman.h>
|
||||
|
||||
#define AUDIO_CAP "oss"
|
||||
#include "audio_int.h"
|
||||
|
||||
|
2
block.c
2
block.c
@ -764,7 +764,7 @@ int get_tmp_filename(char *filename, int size)
|
||||
const char *tmpdir;
|
||||
tmpdir = getenv("TMPDIR");
|
||||
if (!tmpdir) {
|
||||
tmpdir = "/var/tmp";
|
||||
tmpdir = "@TERMUX_PREFIX@/tmp";
|
||||
}
|
||||
if (snprintf(filename, size, "%s/vl.XXXXXX", tmpdir) >= size) {
|
||||
return -EOVERFLOW;
|
||||
|
@ -59,6 +59,7 @@
|
||||
#include <sys/dkio.h>
|
||||
#endif
|
||||
#ifdef __linux__
|
||||
#include <linux/mman.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/syscall.h>
|
||||
|
15
configure
vendored
15
configure
vendored
@ -2939,6 +2939,8 @@ then
|
||||
fi
|
||||
|
||||
has_libgcrypt() {
|
||||
return 0
|
||||
|
||||
if ! has "libgcrypt-config"
|
||||
then
|
||||
return 1
|
||||
@ -3008,10 +3010,7 @@ if test "$gcrypt" != "no"; then
|
||||
# Debian has removed -lgpg-error from libgcrypt-config
|
||||
# as it "spreads unnecessary dependencies" which in
|
||||
# turn breaks static builds...
|
||||
if test "$static" = "yes"
|
||||
then
|
||||
gcrypt_libs="$gcrypt_libs -lgpg-error"
|
||||
fi
|
||||
gcrypt_libs="$gcrypt_libs -lgpg-error"
|
||||
|
||||
# Link test to make sure the given libraries work (e.g for static).
|
||||
write_c_skeleton
|
||||
@ -4083,6 +4082,7 @@ EOF
|
||||
if compile_prog "" "" ; then
|
||||
signalfd=yes
|
||||
fi
|
||||
signalfd=no
|
||||
|
||||
# check if optreset global is declared by <getopt.h>
|
||||
optreset="no"
|
||||
@ -5947,6 +5947,7 @@ fi
|
||||
if test "$darwin" = "yes" ; then
|
||||
echo "CONFIG_DARWIN=y" >> $config_host_mak
|
||||
fi
|
||||
ivshmem=no
|
||||
|
||||
if test "$solaris" = "yes" ; then
|
||||
echo "CONFIG_SOLARIS=y" >> $config_host_mak
|
||||
@ -6062,9 +6063,9 @@ fi
|
||||
if test "$posix_fallocate" = "yes" ; then
|
||||
echo "CONFIG_POSIX_FALLOCATE=y" >> $config_host_mak
|
||||
fi
|
||||
if test "$sync_file_range" = "yes" ; then
|
||||
echo "CONFIG_SYNC_FILE_RANGE=y" >> $config_host_mak
|
||||
fi
|
||||
#if test "$sync_file_range" = "yes" ; then
|
||||
# echo "CONFIG_SYNC_FILE_RANGE=y" >> $config_host_mak
|
||||
#fi
|
||||
if test "$fiemap" = "yes" ; then
|
||||
echo "CONFIG_FIEMAP=y" >> $config_host_mak
|
||||
fi
|
||||
|
@ -44,6 +44,18 @@ typedef struct V9fsIattr {
|
||||
int64_t mtime_nsec;
|
||||
} V9fsIattr;
|
||||
|
||||
#ifdef st_atime_nsec
|
||||
# undef st_atime_nsec
|
||||
#endif
|
||||
|
||||
#ifdef st_mtime_nsec
|
||||
# undef st_mtime_nsec
|
||||
#endif
|
||||
|
||||
#ifdef st_ctime_nsec
|
||||
# undef st_ctime_nsec
|
||||
#endif
|
||||
|
||||
typedef struct V9fsStatDotl {
|
||||
uint64_t st_result_mask;
|
||||
V9fsQID qid;
|
||||
|
@ -535,9 +535,23 @@ static void local_rewinddir(FsContext *ctx, V9fsFidOpenState *fs)
|
||||
rewinddir(fs->dir.stream);
|
||||
}
|
||||
|
||||
struct DIR {
|
||||
int fd_;
|
||||
};
|
||||
|
||||
static long android_telldir(struct DIR *dirp)
|
||||
{
|
||||
return (long) lseek(dirp->fd_, 0, SEEK_CUR);
|
||||
}
|
||||
|
||||
static void android_seekdir(DIR *dirp, long loc)
|
||||
{
|
||||
(void) lseek(dirp->fd_, loc, SEEK_SET);
|
||||
}
|
||||
|
||||
static off_t local_telldir(FsContext *ctx, V9fsFidOpenState *fs)
|
||||
{
|
||||
return telldir(fs->dir.stream);
|
||||
return android_telldir(fs->dir.stream);
|
||||
}
|
||||
|
||||
static bool local_is_mapped_file_metadata(FsContext *fs_ctx, const char *name)
|
||||
@ -571,7 +585,7 @@ again:
|
||||
|
||||
static void local_seekdir(FsContext *ctx, V9fsFidOpenState *fs, off_t off)
|
||||
{
|
||||
seekdir(fs->dir.stream, off);
|
||||
android_seekdir(fs->dir.stream, off);
|
||||
}
|
||||
|
||||
static ssize_t local_preadv(FsContext *ctx, V9fsFidOpenState *fs,
|
||||
|
@ -675,9 +675,23 @@ static void proxy_rewinddir(FsContext *ctx, V9fsFidOpenState *fs)
|
||||
rewinddir(fs->dir.stream);
|
||||
}
|
||||
|
||||
struct DIR {
|
||||
int fd_;
|
||||
};
|
||||
|
||||
static long android_telldir(struct DIR *dirp)
|
||||
{
|
||||
return (long) lseek(dirp->fd_, 0, SEEK_CUR);
|
||||
}
|
||||
|
||||
static void android_seekdir(DIR *dirp, long loc)
|
||||
{
|
||||
(void) lseek(dirp->fd_, loc, SEEK_SET);
|
||||
}
|
||||
|
||||
static off_t proxy_telldir(FsContext *ctx, V9fsFidOpenState *fs)
|
||||
{
|
||||
return telldir(fs->dir.stream);
|
||||
return android_telldir(fs->dir.stream);
|
||||
}
|
||||
|
||||
static struct dirent *proxy_readdir(FsContext *ctx, V9fsFidOpenState *fs)
|
||||
@ -687,7 +701,7 @@ static struct dirent *proxy_readdir(FsContext *ctx, V9fsFidOpenState *fs)
|
||||
|
||||
static void proxy_seekdir(FsContext *ctx, V9fsFidOpenState *fs, off_t off)
|
||||
{
|
||||
seekdir(fs->dir.stream, off);
|
||||
android_seekdir(fs->dir.stream, off);
|
||||
}
|
||||
|
||||
static ssize_t proxy_preadv(FsContext *ctx, V9fsFidOpenState *fs,
|
||||
|
@ -101,19 +101,19 @@ static FWCfgState *create_fw_cfg(MachineState *ms)
|
||||
fw_cfg_add_i64(fw_cfg, FW_CFG_RAM_SIZE, ms->ram_size);
|
||||
|
||||
val = cpu_to_le64(MIN_SEABIOS_HPPA_VERSION);
|
||||
fw_cfg_add_file(fw_cfg, "/etc/firmware-min-version",
|
||||
fw_cfg_add_file(fw_cfg, "@TERMUX_PREFIX@/etc/firmware-min-version",
|
||||
g_memdup(&val, sizeof(val)), sizeof(val));
|
||||
|
||||
val = cpu_to_le64(HPPA_TLB_ENTRIES);
|
||||
fw_cfg_add_file(fw_cfg, "/etc/cpu/tlb_entries",
|
||||
fw_cfg_add_file(fw_cfg, "@TERMUX_PREFIX@/etc/cpu/tlb_entries",
|
||||
g_memdup(&val, sizeof(val)), sizeof(val));
|
||||
|
||||
val = cpu_to_le64(HPPA_BTLB_ENTRIES);
|
||||
fw_cfg_add_file(fw_cfg, "/etc/cpu/btlb_entries",
|
||||
fw_cfg_add_file(fw_cfg, "@TERMUX_PREFIX@/etc/cpu/btlb_entries",
|
||||
g_memdup(&val, sizeof(val)), sizeof(val));
|
||||
|
||||
val = cpu_to_le64(HPA_POWER_BUTTON);
|
||||
fw_cfg_add_file(fw_cfg, "/etc/power-button-addr",
|
||||
fw_cfg_add_file(fw_cfg, "@TERMUX_PREFIX@/etc/power-button-addr",
|
||||
g_memdup(&val, sizeof(val)), sizeof(val));
|
||||
|
||||
fw_cfg_add_i16(fw_cfg, FW_CFG_BOOT_DEVICE, ms->boot_order[0]);
|
||||
|
@ -417,7 +417,7 @@ static void clean_event_notifier(EmulatedState *card)
|
||||
event_notifier_cleanup(&card->notifier);
|
||||
}
|
||||
|
||||
#define CERTIFICATES_DEFAULT_DB "/etc/pki/nssdb"
|
||||
#define CERTIFICATES_DEFAULT_DB "@TERMUX_PREFIX@/etc/pki/nssdb"
|
||||
#define CERTIFICATES_ARGS_TEMPLATE\
|
||||
"db=\"%s\" use_hw=no soft=(,Virtual Reader,CAC,,%s,%s,%s)"
|
||||
|
||||
|
@ -24,6 +24,7 @@
|
||||
#include <linux/kvm.h>
|
||||
#endif
|
||||
#include <linux/vfio.h>
|
||||
#include <linux/mman.h>
|
||||
|
||||
#include "hw/vfio/vfio-common.h"
|
||||
#include "hw/vfio/vfio.h"
|
||||
|
@ -27,6 +27,8 @@
|
||||
#include "pci.h"
|
||||
#include "trace.h"
|
||||
|
||||
#include <linux/mman.h>
|
||||
|
||||
/*
|
||||
* List of device ids/vendor ids for which to disable
|
||||
* option rom loading. This avoids the guest hangs during rom
|
||||
|
@ -32,6 +32,7 @@
|
||||
#include "standard-headers/linux/vhost_types.h"
|
||||
|
||||
#ifdef CONFIG_LINUX
|
||||
#include <linux/mman.h>
|
||||
#include <linux/userfaultfd.h>
|
||||
#endif
|
||||
|
||||
|
@ -11,6 +11,10 @@
|
||||
#ifndef QAPI_UTIL_H
|
||||
#define QAPI_UTIL_H
|
||||
|
||||
#include <glib.h>
|
||||
|
||||
typedef struct Error Error;
|
||||
|
||||
typedef struct QEnumLookup {
|
||||
const char *const *array;
|
||||
int size;
|
||||
|
@ -38,7 +38,7 @@ struct target_ucontext {
|
||||
target_stack_t tuc_stack;
|
||||
target_sigset_t tuc_sigmask;
|
||||
/* glibc uses a 1024-bit sigset_t */
|
||||
char __unused[1024 / 8 - sizeof(target_sigset_t)];
|
||||
char __qemu_unused[1024 / 8 - sizeof(target_sigset_t)];
|
||||
/* last for future expansion */
|
||||
struct target_sigcontext tuc_mcontext;
|
||||
};
|
||||
|
@ -59,7 +59,7 @@ struct target_ucontext_v2 {
|
||||
target_stack_t tuc_stack;
|
||||
struct target_sigcontext tuc_mcontext;
|
||||
target_sigset_t tuc_sigmask; /* mask last for extensibility */
|
||||
char __unused[128 - sizeof(target_sigset_t)];
|
||||
char __qemu_unused[128 - sizeof(target_sigset_t)];
|
||||
abi_ulong tuc_regspace[128] __attribute__((__aligned__(8)));
|
||||
};
|
||||
|
||||
|
@ -2,6 +2,8 @@
|
||||
#include "qemu/osdep.h"
|
||||
#include <sys/param.h>
|
||||
|
||||
#include <linux/mman.h>
|
||||
|
||||
#include <sys/resource.h>
|
||||
#include <sys/shm.h>
|
||||
|
||||
@ -2446,7 +2448,7 @@ void probe_guest_base(const char *image_name, abi_ulong guest_loaddr,
|
||||
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);
|
||||
|
||||
if (have_guest_base) {
|
||||
pgb_have_guest_base(image_name, guest_loaddr, guest_hiaddr, align);
|
||||
|
@ -35,6 +35,8 @@
|
||||
|
||||
#include "qemu/osdep.h"
|
||||
|
||||
#include <linux/mman.h>
|
||||
|
||||
#include "qemu.h"
|
||||
#include "flat.h"
|
||||
#include "target_flat.h"
|
||||
|
@ -22,6 +22,8 @@
|
||||
#include "qemu.h"
|
||||
#include "cpu_loop-common.h"
|
||||
|
||||
#include <linux/mman.h>
|
||||
|
||||
/***********************************************************/
|
||||
/* CPUX86 core interface */
|
||||
|
||||
|
@ -21,6 +21,8 @@
|
||||
#include "exec/log.h"
|
||||
#include "qemu.h"
|
||||
|
||||
#include <linux/mman.h>
|
||||
|
||||
static pthread_mutex_t mmap_mutex = PTHREAD_MUTEX_INITIALIZER;
|
||||
static __thread int mmap_lock_count;
|
||||
|
||||
|
@ -41,7 +41,7 @@ struct target_ucontext {
|
||||
struct target_ucontext *uc_link;
|
||||
target_stack_t uc_stack;
|
||||
target_sigset_t uc_sigmask;
|
||||
uint8_t __unused[1024 / 8 - sizeof(target_sigset_t)];
|
||||
uint8_t __qemu_unused[1024 / 8 - sizeof(target_sigset_t)];
|
||||
struct target_sigcontext uc_mcontext QEMU_ALIGNED(16);
|
||||
};
|
||||
|
||||
|
@ -198,6 +198,27 @@ int block_signals(void)
|
||||
return qatomic_xchg(&ts->signal_pending, 1);
|
||||
}
|
||||
|
||||
#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
|
||||
|
||||
/* Wrapper for sigprocmask function
|
||||
* Emulates a sigprocmask in a safe way for the guest. Note that set and oldset
|
||||
* are host signal set, not guest ones. Returns -TARGET_ERESTARTSYS if
|
||||
|
@ -1,7 +1,7 @@
|
||||
#include "qemu/osdep.h"
|
||||
#include <sys/ipc.h>
|
||||
#include <sys/msg.h>
|
||||
#include <sys/sem.h>
|
||||
#include <linux/sem.h>
|
||||
#include <sys/shm.h>
|
||||
#include <sys/select.h>
|
||||
#include <sys/mount.h>
|
||||
|
@ -36,6 +36,7 @@
|
||||
#include <sys/resource.h>
|
||||
#include <sys/swap.h>
|
||||
#include <linux/capability.h>
|
||||
#include <linux/mman.h>
|
||||
#include <sched.h>
|
||||
#include <sys/timex.h>
|
||||
#include <sys/socket.h>
|
||||
@ -45,7 +46,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>
|
||||
@ -78,12 +79,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>
|
||||
@ -268,6 +274,59 @@ static type name (type1 arg1,type2 arg2,type3 arg3,type4 arg4,type5 arg5, \
|
||||
#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
|
||||
@ -812,6 +871,9 @@ safe_syscall5(int, mq_timedsend, int, mqdes, const char *, msg_ptr,
|
||||
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
|
||||
/* We do ioctl like this rather than via safe_syscall3 to preserve the
|
||||
* "third argument might be integer or pointer or not present" behaviour of
|
||||
@ -1336,7 +1398,7 @@ static inline abi_long copy_from_user_timezone(struct timezone *tz,
|
||||
#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)
|
||||
@ -3871,6 +3933,8 @@ static inline abi_long host_to_target_ipc_perm(abi_ulong target_addr,
|
||||
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)
|
||||
{
|
||||
@ -3950,6 +4014,16 @@ union target_semun {
|
||||
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)
|
||||
{
|
||||
@ -4080,7 +4154,7 @@ static inline abi_long do_semctl(int semid, int semnum, int cmd,
|
||||
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;
|
||||
}
|
||||
|
||||
@ -4215,7 +4289,7 @@ static inline abi_long target_to_host_msqid_ds(struct msqid_ds *host_md,
|
||||
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);
|
||||
@ -4236,7 +4310,7 @@ static inline abi_long host_to_target_msqid_ds(abi_ulong target_addr,
|
||||
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);
|
||||
@ -4602,7 +4676,7 @@ static inline abi_ulong do_shmat(CPUArchState *cpu_env,
|
||||
abi_ulong mmap_start;
|
||||
|
||||
/* 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));
|
||||
mmap_start = mmap_find_vma(0, shm_info.shm_segsz, MAX(/* SHMLBA */ getpagesize(), shmlba));
|
||||
|
||||
if (mmap_start == -1) {
|
||||
errno = ENOMEM;
|
||||
@ -5703,6 +5777,9 @@ static abi_long do_ioctl_drm_i915(const IOCTLEntry *ie, uint8_t *buf_temp,
|
||||
|
||||
#endif
|
||||
|
||||
#undef winsize
|
||||
#undef termio
|
||||
|
||||
IOCTLEntry ioctl_entries[] = {
|
||||
#define IOCTL(cmd, access, ...) \
|
||||
{ TARGET_ ## cmd, cmd, #cmd, access, 0, { __VA_ARGS__ } },
|
||||
@ -8045,7 +8122,7 @@ static int do_openat(void *cpu_env, int dirfd, const char *pathname, int flags,
|
||||
/* create temporary file to map stat to */
|
||||
tmpdir = getenv("TMPDIR");
|
||||
if (!tmpdir)
|
||||
tmpdir = "/tmp";
|
||||
tmpdir = "@TERMUX_PREFIX@/tmp";
|
||||
snprintf(filename, sizeof(filename), "%s/qemu-open.XXXXXX", tmpdir);
|
||||
fd = mkstemp(filename);
|
||||
if (fd < 0) {
|
||||
@ -8599,7 +8676,7 @@ static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1,
|
||||
unlock_user(p, arg1, 0);
|
||||
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;
|
||||
@ -8663,7 +8740,7 @@ static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1,
|
||||
}
|
||||
return ret;
|
||||
#endif
|
||||
#if defined(TARGET_NR_futimesat)
|
||||
#if 0 && defined(TARGET_NR_futimesat)
|
||||
case TARGET_NR_futimesat:
|
||||
{
|
||||
struct timeval *tvp, tv[2];
|
||||
@ -12424,7 +12501,7 @@ static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1,
|
||||
/* 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;
|
||||
@ -12442,6 +12519,7 @@ static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1,
|
||||
}
|
||||
return ret;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_SPLICE
|
||||
#ifdef TARGET_NR_tee
|
||||
|
@ -1978,7 +1978,7 @@ struct target_stat64 {
|
||||
abi_ulong target_st_mtime_nsec;
|
||||
abi_ulong target_st_ctime;
|
||||
abi_ulong target_st_ctime_nsec;
|
||||
abi_long __unused[3];
|
||||
abi_long __qemu_unused[3];
|
||||
};
|
||||
|
||||
#elif defined(TARGET_SH4)
|
||||
@ -2065,7 +2065,7 @@ struct target_stat {
|
||||
abi_ulong target_st_ctime;
|
||||
abi_ulong target_st_ctime_nsec;
|
||||
|
||||
abi_long __unused[3];
|
||||
abi_long __qemu_unused[3];
|
||||
};
|
||||
#elif defined(TARGET_S390X)
|
||||
struct target_stat {
|
||||
@ -2086,7 +2086,7 @@ struct target_stat {
|
||||
abi_ulong target_st_ctime_nsec;
|
||||
abi_ulong st_blksize;
|
||||
abi_long st_blocks;
|
||||
abi_ulong __unused[3];
|
||||
abi_ulong __qemu_unused[3];
|
||||
};
|
||||
#elif defined(TARGET_AARCH64)
|
||||
#define TARGET_STAT_HAVE_NSEC
|
||||
@ -2109,7 +2109,7 @@ struct target_stat {
|
||||
abi_ulong target_st_mtime_nsec;
|
||||
abi_long target_st_ctime;
|
||||
abi_ulong target_st_ctime_nsec;
|
||||
unsigned int __unused[2];
|
||||
unsigned int __qemu_unused[2];
|
||||
};
|
||||
#elif defined(TARGET_XTENSA)
|
||||
#define TARGET_STAT_HAVE_NSEC
|
||||
|
14
meson.build
14
meson.build
@ -94,11 +94,11 @@ endif
|
||||
|
||||
# Specify linker-script with add_project_link_arguments so that it is not placed
|
||||
# within a linker --start-group/--end-group pair
|
||||
if 'CONFIG_FUZZ' in config_host
|
||||
add_project_link_arguments(['-Wl,-T,',
|
||||
(meson.current_source_dir() / 'tests/qtest/fuzz/fork_fuzz.ld')],
|
||||
native: false, language: ['c', 'cpp', 'objc'])
|
||||
endif
|
||||
#if 'CONFIG_FUZZ' in config_host
|
||||
# add_project_link_arguments(['-Wl,-T,',
|
||||
# (meson.current_source_dir() / 'tests/qtest/fuzz/fork_fuzz.ld')],
|
||||
# native: false, language: ['c', 'cpp', 'objc'])
|
||||
#endif
|
||||
|
||||
add_project_arguments(config_host['QEMU_CFLAGS'].split(),
|
||||
native: false, language: ['c', 'objc'])
|
||||
@ -1612,8 +1612,8 @@ linux_user_ss.add(files('gdbstub.c', 'thunk.c'))
|
||||
specific_ss.add_all(when: 'CONFIG_LINUX_USER', if_true: linux_user_ss)
|
||||
|
||||
# needed for fuzzing binaries
|
||||
subdir('tests/qtest/libqos')
|
||||
subdir('tests/qtest/fuzz')
|
||||
#subdir('tests/qtest/libqos')
|
||||
#subdir('tests/qtest/fuzz')
|
||||
|
||||
########################
|
||||
# Library dependencies #
|
||||
|
@ -28,7 +28,7 @@
|
||||
void exec_start_outgoing_migration(MigrationState *s, const char *command, Error **errp)
|
||||
{
|
||||
QIOChannel *ioc;
|
||||
const char *argv[] = { "/bin/sh", "-c", command, NULL };
|
||||
const char *argv[] = { "@TERMUX_PREFIX@/bin/sh", "-c", command, NULL };
|
||||
|
||||
trace_migration_exec_outgoing(command);
|
||||
ioc = QIO_CHANNEL(qio_channel_command_new_spawn(argv,
|
||||
@ -55,7 +55,7 @@ static gboolean exec_accept_incoming_migration(QIOChannel *ioc,
|
||||
void exec_start_incoming_migration(const char *command, Error **errp)
|
||||
{
|
||||
QIOChannel *ioc;
|
||||
const char *argv[] = { "/bin/sh", "-c", command, NULL };
|
||||
const char *argv[] = { "@TERMUX_PREFIX@/bin/sh", "-c", command, NULL };
|
||||
|
||||
trace_migration_exec_incoming(command);
|
||||
ioc = QIO_CHANNEL(qio_channel_command_new_spawn(argv,
|
||||
|
@ -31,6 +31,8 @@
|
||||
#include "trace.h"
|
||||
#include "hw/boards.h"
|
||||
|
||||
#include <linux/mman.h>
|
||||
|
||||
/* Arbitrary limit on size of each discard command,
|
||||
* keeps them around ~200 bytes
|
||||
*/
|
||||
|
@ -533,7 +533,7 @@ static int net_bridge_run_helper(const char *helper, const char *bridge,
|
||||
*parg++ = helper_cmd;
|
||||
*parg++ = NULL;
|
||||
|
||||
execv("/bin/sh", args);
|
||||
execv("@TERMUX_PREFIX@/bin/sh", args);
|
||||
g_free(helper_cmd);
|
||||
} else {
|
||||
/* assume helper is just the executable path name */
|
||||
|
@ -52,7 +52,6 @@
|
||||
#define HAVE_NBD_DEVICE 0
|
||||
#endif
|
||||
|
||||
#define SOCKET_PATH "/var/lock/qemu-nbd-%s"
|
||||
#define QEMU_NBD_OPT_CACHE 256
|
||||
#define QEMU_NBD_OPT_AIO 257
|
||||
#define QEMU_NBD_OPT_DISCARD 258
|
||||
@ -91,7 +90,7 @@ static void usage(const char *name)
|
||||
" -p, --port=PORT port to listen on (default `%d')\n"
|
||||
" -b, --bind=IFACE interface to bind to (default `0.0.0.0')\n"
|
||||
" -k, --socket=PATH path to the unix socket\n"
|
||||
" (default '"SOCKET_PATH"')\n"
|
||||
" (default '@TERMUX_PREFIX@/tmp/nbd-%s')\n"
|
||||
" -e, --shared=NUM device can be shared by NUM clients (default '1')\n"
|
||||
" -t, --persistent don't exit on the last connection\n"
|
||||
" -v, --verbose display extra debugging information\n"
|
||||
@ -964,7 +963,7 @@ int main(int argc, char **argv)
|
||||
|
||||
if (device != NULL && sockpath == NULL) {
|
||||
sockpath = g_malloc(128);
|
||||
snprintf(sockpath, 128, SOCKET_PATH, basename(device));
|
||||
snprintf(sockpath, 128, "@TERMUX_PREFIX@/tmp/nbd-%s", basename(device));
|
||||
}
|
||||
|
||||
server = qio_net_listener_new();
|
||||
|
@ -17,6 +17,8 @@
|
||||
* License along with this library; if not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <linux/mman.h>
|
||||
|
||||
#include "qemu/osdep.h"
|
||||
#include "qemu-common.h"
|
||||
#include "qapi/error.h"
|
||||
|
@ -29,6 +29,7 @@
|
||||
#include <endian.h>
|
||||
|
||||
#if defined(__linux__)
|
||||
#include <linux/mman.h>
|
||||
#include <sys/syscall.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/ioctl.h>
|
||||
|
@ -1957,7 +1957,12 @@ static int32_t x86_guest_base_offset;
|
||||
# if defined(__x86_64__) && defined(__linux__)
|
||||
# include <asm/prctl.h>
|
||||
# include <sys/prctl.h>
|
||||
int arch_prctl(int code, unsigned long addr);
|
||||
# include <linux/unistd.h>
|
||||
static int arch_prctl(int code, unsigned long addr)
|
||||
{
|
||||
return syscall(__NR_arch_prctl, code, addr);
|
||||
}
|
||||
|
||||
static inline int setup_guest_base_seg(void)
|
||||
{
|
||||
if (arch_prctl(ARCH_SET_GS, guest_base) == 0) {
|
||||
|
@ -4628,7 +4628,8 @@ static void tcg_register_jit_int(void *buf_ptr, size_t buf_size,
|
||||
/* Enable this block to be able to debug the ELF image file creation.
|
||||
One can use readelf, objdump, or other inspection utilities. */
|
||||
{
|
||||
FILE *f = fopen("/tmp/qemu.jit", "w+b");
|
||||
FILE *f = fopen("@TERMUX_PREFIX@/tmp/qemu.jit", "w+b");
|
||||
|
||||
if (f) {
|
||||
if (fwrite(img, img_size, 1, f) != img_size) {
|
||||
/* Avoid stupid unused return value warning for fwrite. */
|
||||
|
@ -285,5 +285,4 @@ if not get_option('tcg').disabled()
|
||||
endif
|
||||
|
||||
subdir('qapi-schema')
|
||||
subdir('qtest')
|
||||
subdir('migration')
|
||||
|
@ -29,6 +29,8 @@
|
||||
|
||||
#define _FILE_OFFSET_BITS 64
|
||||
|
||||
#include <linux/mman.h>
|
||||
|
||||
#include "qemu/osdep.h"
|
||||
#include "qemu/atomic.h"
|
||||
#include "qemu/ctype.h"
|
||||
|
@ -17,7 +17,6 @@
|
||||
#include "qemu/osdep.h"
|
||||
#include "qemu/drm.h"
|
||||
|
||||
#include <glob.h>
|
||||
#include <dirent.h>
|
||||
|
||||
int qemu_drm_rendernode_open(const char *rendernode)
|
||||
|
@ -32,6 +32,7 @@
|
||||
#include "qemu/host-utils.h"
|
||||
|
||||
#if defined CONFIG_LINUX && !defined CONFIG_MEMFD
|
||||
#include <linux/mman.h>
|
||||
#include <sys/syscall.h>
|
||||
#include <asm/unistd.h>
|
||||
|
||||
|
@ -10,7 +10,7 @@
|
||||
* later. See the COPYING file in the top-level directory.
|
||||
*/
|
||||
|
||||
#ifdef CONFIG_LINUX
|
||||
#ifdef __linux__
|
||||
#include <linux/mman.h>
|
||||
#else /* !CONFIG_LINUX */
|
||||
#define MAP_SYNC 0x0
|
||||
|
@ -246,7 +246,7 @@ bool module_load_one(const char *prefix, const char *lib_name, bool mayfail)
|
||||
version_dir = g_strcanon(g_strdup(QEMU_PKGVERSION),
|
||||
G_CSET_A_2_Z G_CSET_a_2_z G_CSET_DIGITS "+-.~",
|
||||
'_');
|
||||
dirs[n_dirs++] = g_strdup_printf("/var/run/qemu/%s", version_dir);
|
||||
dirs[n_dirs++] = g_strdup_printf("@TERMUX_PREFIX@/var/run/qemu/%s", version_dir);
|
||||
#endif
|
||||
|
||||
assert(n_dirs <= ARRAY_SIZE(dirs));
|
||||
|
@ -41,6 +41,7 @@
|
||||
#include "qemu/cutils.h"
|
||||
|
||||
#ifdef CONFIG_LINUX
|
||||
#include <linux/mman.h>
|
||||
#include <sys/syscall.h>
|
||||
#endif
|
||||
|
||||
|
@ -900,7 +900,7 @@ static int unix_listen_saddr(UnixSocketAddress *saddr,
|
||||
path = saddr->path;
|
||||
} else {
|
||||
const char *tmpdir = getenv("TMPDIR");
|
||||
tmpdir = tmpdir ? tmpdir : "/tmp";
|
||||
tmpdir = tmpdir ? tmpdir : "@TERMUX_PREFIX@/tmp";
|
||||
path = pathbuf = g_strdup_printf("%s/qemu-socket-XXXXXX", tmpdir);
|
||||
}
|
||||
|
||||
|
@ -13,6 +13,7 @@
|
||||
#include "qemu/osdep.h"
|
||||
#include <sys/ioctl.h>
|
||||
#include <linux/vfio.h>
|
||||
#include <linux/mman.h>
|
||||
#include "qapi/error.h"
|
||||
#include "exec/ramlist.h"
|
||||
#include "exec/cpu-common.h"
|
||||
|
Loading…
Reference in New Issue
Block a user