qemu-common: update to 4.0.0

This commit is contained in:
Leonid Pliushch 2019-05-27 17:34:58 +03:00 committed by Yaksh Bariya
parent 51fe438376
commit 4e4bc08cc2
No known key found for this signature in database
GPG Key ID: F7486BA7D3D27581
19 changed files with 481 additions and 218 deletions

View File

@ -1,56 +1,90 @@
diff -uNr qemu-3.1.0/block/cloop.c qemu-3.1.0.mod/block/cloop.c
--- qemu-3.1.0/block/cloop.c 2018-12-11 19:44:34.000000000 +0200
+++ qemu-3.1.0.mod/block/cloop.c 2019-02-14 00:15:08.360296821 +0200
@@ -47,7 +47,7 @@
static int cloop_probe(const uint8_t *buf, int buf_size, const char *filename)
{
- const char *magic_version_2_0 = "#!/bin/sh\n"
+ const char *magic_version_2_0 = "#!@TERMUX_PREFIX@/bin/sh\n"
"#V2.0 Format\n"
"modprobe cloop file=$0 && mount -r -t iso9660 /dev/cloop $1\n";
int length = strlen(magic_version_2_0);
diff -uNr qemu-3.1.0/block.c qemu-3.1.0.mod/block.c
--- qemu-3.1.0/block.c 2018-12-11 19:44:34.000000000 +0200
+++ qemu-3.1.0.mod/block.c 2019-02-14 00:15:08.366963525 +0200
@@ -568,7 +568,7 @@
diff -uNr qemu-4.0.0/block.c qemu-4.0.0.mod/block.c
--- qemu-4.0.0/block.c 2019-04-23 21:14:45.000000000 +0300
+++ qemu-4.0.0.mod/block.c 2019-04-30 15:48:40.350266539 +0300
@@ -603,20 +603,26 @@
int fd;
const char *tmpdir;
tmpdir = getenv("TMPDIR");
+
if (!tmpdir) {
- tmpdir = "/var/tmp";
+ tmpdir = "@TERMUX_PREFIX@/var/tmp";
+ tmpdir = "@TERMUX_PREFIX@/tmp";
}
+
if (snprintf(filename, size, "%s/vl.XXXXXX", tmpdir) >= size) {
return -EOVERFLOW;
diff -uNr qemu-3.1.0/hw/usb/ccid-card-emulated.c qemu-3.1.0.mod/hw/usb/ccid-card-emulated.c
--- qemu-3.1.0/hw/usb/ccid-card-emulated.c 2018-12-11 19:44:34.000000000 +0200
+++ qemu-3.1.0.mod/hw/usb/ccid-card-emulated.c 2019-02-14 00:15:08.370296877 +0200
@@ -415,7 +415,7 @@
}
+
fd = mkstemp(filename);
+
if (fd < 0) {
return -errno;
}
+
if (close(fd) != 0) {
unlink(filename);
return -errno;
}
+
return 0;
#endif
}
diff -uNr qemu-4.0.0/hw/usb/ccid-card-emulated.c qemu-4.0.0.mod/hw/usb/ccid-card-emulated.c
--- qemu-4.0.0/hw/usb/ccid-card-emulated.c 2019-04-23 21:14:46.000000000 +0300
+++ qemu-4.0.0.mod/hw/usb/ccid-card-emulated.c 2019-04-30 15:50:31.485832837 +0300
@@ -415,7 +415,6 @@
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)"
diff -uNr qemu-3.1.0/include/net/net.h qemu-3.1.0.mod/include/net/net.h
--- qemu-3.1.0/include/net/net.h 2018-12-11 19:44:34.000000000 +0200
+++ qemu-3.1.0.mod/include/net/net.h 2019-02-14 00:15:08.373630230 +0200
@@ -207,8 +207,8 @@
@@ -445,13 +444,16 @@
VCardEmulOptions *options = NULL;
snprintf(emul_args, sizeof(emul_args) - 1, CERTIFICATES_ARGS_TEMPLATE,
- card->db ? card->db : CERTIFICATES_DEFAULT_DB,
+ card->db ? card->db : "@TERMUX_PREFIX@/etc/pki/nssdb",
card->cert1, card->cert2, card->cert3);
+
options = vcard_emul_options(emul_args);
+
if (options == NULL) {
printf("%s: warning: not using certificates due to"
" initialization error\n", __func__);
}
+
return wrap_vcard_emul_init(options);
}
diff -uNr qemu-4.0.0/include/net/net.h qemu-4.0.0.mod/include/net/net.h
--- qemu-4.0.0/include/net/net.h 2019-04-23 21:14:46.000000000 +0300
+++ qemu-4.0.0.mod/include/net/net.h 2019-04-30 15:47:35.503933215 +0300
@@ -209,8 +209,6 @@
int net_hub_id_for_client(NetClientState *nc, int *id);
NetClientState *net_hub_port_find(int hub_id);
-#define DEFAULT_NETWORK_SCRIPT "/etc/qemu-ifup"
-#define DEFAULT_NETWORK_DOWN_SCRIPT "/etc/qemu-ifdown"
+#define DEFAULT_NETWORK_SCRIPT "@TERMUX_PREFIX@/etc/qemu-ifup"
+#define DEFAULT_NETWORK_DOWN_SCRIPT "@TERMUX_PREFIX@/etc/qemu-ifdown"
#define DEFAULT_BRIDGE_HELPER CONFIG_QEMU_HELPERDIR "/qemu-bridge-helper"
#define DEFAULT_BRIDGE_INTERFACE "br0"
diff -uNr qemu-3.1.0/migration/exec.c qemu-3.1.0.mod/migration/exec.c
--- qemu-3.1.0/migration/exec.c 2018-12-11 19:44:34.000000000 +0200
+++ qemu-3.1.0.mod/migration/exec.c 2019-02-14 00:15:08.376963581 +0200
diff -uNr qemu-4.0.0/linux-user/syscall.c qemu-4.0.0.mod/linux-user/syscall.c
--- qemu-4.0.0/linux-user/syscall.c 2019-04-23 21:14:46.000000000 +0300
+++ qemu-4.0.0.mod/linux-user/syscall.c 2019-04-30 15:51:37.599167189 +0300
@@ -6833,7 +6833,7 @@
/* 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) {
diff -uNr qemu-4.0.0/migration/exec.c qemu-4.0.0.mod/migration/exec.c
--- qemu-4.0.0/migration/exec.c 2019-04-23 21:14:46.000000000 +0300
+++ qemu-4.0.0.mod/migration/exec.c 2019-04-30 15:52:19.661379049 +0300
@@ -28,7 +28,7 @@
void exec_start_outgoing_migration(MigrationState *s, const char *command, Error **errp)
{
@ -69,9 +103,9 @@ diff -uNr qemu-3.1.0/migration/exec.c qemu-3.1.0.mod/migration/exec.c
trace_migration_exec_incoming(command);
ioc = QIO_CHANNEL(qio_channel_command_new_spawn(argv,
diff -uNr qemu-3.1.0/net/tap.c qemu-3.1.0.mod/net/tap.c
--- qemu-3.1.0/net/tap.c 2018-12-11 19:44:34.000000000 +0200
+++ qemu-3.1.0.mod/net/tap.c 2019-02-14 00:15:08.380296934 +0200
diff -uNr qemu-4.0.0/net/tap.c qemu-4.0.0.mod/net/tap.c
--- qemu-4.0.0/net/tap.c 2019-04-23 21:14:46.000000000 +0300
+++ qemu-4.0.0.mod/net/tap.c 2019-04-30 15:54:00.958886851 +0300
@@ -526,7 +526,7 @@
*parg++ = helper_cmd;
*parg++ = NULL;
@ -81,54 +115,134 @@ diff -uNr qemu-3.1.0/net/tap.c qemu-3.1.0.mod/net/tap.c
} else {
/* assume helper is just the executable path name */
diff -uNr qemu-3.1.0/qemu-nbd.c qemu-3.1.0.mod/qemu-nbd.c
--- qemu-3.1.0/qemu-nbd.c 2018-12-11 19:44:34.000000000 +0200
+++ qemu-3.1.0.mod/qemu-nbd.c 2019-02-14 00:15:08.383630286 +0200
@@ -43,7 +43,7 @@
#include "trace/control.h"
#include "qemu-version.h"
@@ -903,9 +903,9 @@
error_setg(errp, "vhostfds= is invalid if fds= wasn't specified");
return -1;
}
- script = tap->has_script ? tap->script : DEFAULT_NETWORK_SCRIPT;
- downscript = tap->has_downscript ? tap->downscript :
- DEFAULT_NETWORK_DOWN_SCRIPT;
+
+ script = tap->has_script ? tap->script : "@TERMUX_PREFIX@/etc/qemu-ifup";
+ downscript = tap->has_downscript ? tap->downscript : "@TERMUX_PREFIX@/etc/qemu-ifdown";
if (tap->has_ifname) {
pstrcpy(ifname, sizeof ifname, tap->ifname);
@@ -932,6 +932,7 @@
i >= 1 ? "no" : script,
i >= 1 ? "no" : downscript,
vhostfdname, vnet_hdr, fd, &err);
+
if (err) {
error_propagate(errp, err);
close(fd);
diff -uNr qemu-4.0.0/qemu-nbd.c qemu-4.0.0.mod/qemu-nbd.c
--- qemu-4.0.0/qemu-nbd.c 2019-04-23 21:14:46.000000000 +0300
+++ qemu-4.0.0.mod/qemu-nbd.c 2019-04-30 15:55:17.646269318 +0300
@@ -49,7 +49,6 @@
#define HAVE_NBD_DEVICE 0
#endif
-#define SOCKET_PATH "/var/lock/qemu-nbd-%s"
+#define SOCKET_PATH "@TERMUX_PREFIX@/var/lock/qemu-nbd-%s"
#define QEMU_NBD_OPT_CACHE 256
#define QEMU_NBD_OPT_AIO 257
#define QEMU_NBD_OPT_DISCARD 258
diff -uNr qemu-3.1.0/slirp/slirp.c qemu-3.1.0.mod/slirp/slirp.c
--- qemu-3.1.0/slirp/slirp.c 2018-12-11 19:44:34.000000000 +0200
+++ qemu-3.1.0.mod/slirp/slirp.c 2019-02-14 00:15:08.386963638 +0200
@@ -133,7 +133,7 @@
@@ -88,7 +87,7 @@
" -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/qemu-nbd-sock-%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"
@@ -1050,7 +1049,7 @@
if (device != NULL && sockpath == NULL) {
sockpath = g_malloc(128);
- snprintf(sockpath, 128, SOCKET_PATH, basename(device));
+ snprintf(sockpath, 128, "@TERMUX_PREFIX@/tmp/qemu-nbd-sock-%s", basename(device));
}
server = qio_net_listener_new();
diff -uNr qemu-4.0.0/qemu-options.hx qemu-4.0.0.mod/qemu-options.hx
--- qemu-4.0.0/qemu-options.hx 2019-04-23 21:14:46.000000000 +0300
+++ qemu-4.0.0.mod/qemu-options.hx 2019-04-30 15:47:35.506933231 +0300
@@ -2086,8 +2086,8 @@
" [,poll-us=n]\n"
" configure a host TAP network backend with ID 'str'\n"
" connected to a bridge (default=" DEFAULT_BRIDGE_INTERFACE ")\n"
- " use network scripts 'file' (default=" DEFAULT_NETWORK_SCRIPT ")\n"
- " to configure it and 'dfile' (default=" DEFAULT_NETWORK_DOWN_SCRIPT ")\n"
+ " use network scripts 'file' (default=@TERMUX_PREFIX@/etc/qemu-ifup)\n"
+ " to configure it and 'dfile' (default=@TERMUX_PREFIX@/etc/qemu-ifdown)\n"
" to deconfigure it\n"
" use '[down]script=no' to disable script execution\n"
" use network helper 'helper' (default=" DEFAULT_BRIDGE_HELPER ") to\n"
diff -uNr qemu-4.0.0/slirp/src/slirp.c qemu-4.0.0.mod/slirp/src/slirp.c
--- qemu-4.0.0/slirp/src/slirp.c 2019-04-23 21:14:46.000000000 +0300
+++ qemu-4.0.0.mod/slirp/src/slirp.c 2019-04-30 15:56:37.710667145 +0300
@@ -124,14 +124,20 @@
struct stat *cached_stat, unsigned *cached_time)
{
struct stat old_stat;
+
if (curtime - *cached_time < TIMEOUT_DEFAULT) {
memcpy(pdns_addr, cached_addr, addrlen);
return 0;
}
+
old_stat = *cached_stat;
- if (stat("/etc/resolv.conf", cached_stat) != 0) {
+ if (stat("@TERMUX_PREFIX@/etc/resolv.conf", cached_stat) != 0) {
+
+ int ret = stat("@TERMUX_PREFIX@/etc/resolv.conf", cached_stat);
+
+ if (ret != 0) {
return -1;
}
+
if (cached_stat->st_dev == old_stat.st_dev
@@ -157,7 +157,7 @@
&& cached_stat->st_ino == old_stat.st_ino
&& cached_stat->st_size == old_stat.st_size
@@ -139,6 +145,7 @@
memcpy(pdns_addr, cached_addr, addrlen);
return 0;
}
+
return 1;
}
@@ -153,7 +160,8 @@
void *tmp_addr = alloca(addrlen);
unsigned if_index;
- f = fopen("/etc/resolv.conf", "r");
+ f = fopen("@TERMUX_PREFIX@/etc/resolv.conf", "r");
+
if (!f)
return -1;
diff -uNr qemu-3.1.0/tcg/tcg.c qemu-3.1.0.mod/tcg/tcg.c
--- qemu-3.1.0/tcg/tcg.c 2018-12-11 19:44:35.000000000 +0200
+++ qemu-3.1.0.mod/tcg/tcg.c 2019-02-14 00:15:08.393630343 +0200
@@ -3932,7 +3932,7 @@
diff -uNr qemu-4.0.0/tcg/tcg.c qemu-4.0.0.mod/tcg/tcg.c
--- qemu-4.0.0/tcg/tcg.c 2019-04-23 21:14:46.000000000 +0300
+++ qemu-4.0.0.mod/tcg/tcg.c 2019-04-30 15:57:46.031820043 +0300
@@ -4315,11 +4315,13 @@
/* 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. */
diff -uNr qemu-3.1.0/util/qemu-sockets.c qemu-3.1.0.mod/util/qemu-sockets.c
--- qemu-3.1.0/util/qemu-sockets.c 2018-12-11 19:44:35.000000000 +0200
+++ qemu-3.1.0.mod/util/qemu-sockets.c 2019-02-14 00:15:08.400297047 +0200
}
+
fclose(f);
}
}
diff -uNr qemu-4.0.0/util/qemu-sockets.c qemu-4.0.0.mod/util/qemu-sockets.c
--- qemu-4.0.0/util/qemu-sockets.c 2019-04-23 21:14:46.000000000 +0300
+++ qemu-4.0.0.mod/util/qemu-sockets.c 2019-04-30 15:58:34.510637663 +0300
@@ -841,7 +841,7 @@
path = saddr->path;
} else {

View File

@ -0,0 +1,17 @@
diff -uNr qemu-4.0.0/tcg/i386/tcg-target.inc.c qemu-4.0.0.mod/tcg/i386/tcg-target.inc.c
--- qemu-4.0.0/tcg/i386/tcg-target.inc.c 2019-04-23 21:14:46.000000000 +0300
+++ qemu-4.0.0.mod/tcg/i386/tcg-target.inc.c 2019-04-27 03:36:23.678807870 +0300
@@ -1888,7 +1888,12 @@
# 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) {

View File

@ -1,17 +0,0 @@
diff -uNr qemu-3.0.0/tcg/i386/tcg-target.inc.c qemu-3.0.0.mod/tcg/i386/tcg-target.inc.c
--- qemu-3.0.0/tcg/i386/tcg-target.inc.c 2018-08-14 22:10:35.000000000 +0300
+++ qemu-3.0.0.mod/tcg/i386/tcg-target.inc.c 2018-10-26 16:49:45.303598647 +0300
@@ -1869,8 +1869,12 @@
#elif defined(__x86_64__) && defined(__linux__)
# include <asm/prctl.h>
# include <sys/prctl.h>
+# include <linux/unistd.h>
-int arch_prctl(int code, unsigned long addr);
+static int arch_prctl(int code, unsigned long addr)
+{
+ return syscall(__NR_arch_prctl, code, addr);
+}
static int guest_base_flags;
static inline void setup_guest_base_seg(void)

View File

@ -1,24 +0,0 @@
diff -uNr qemu-3.1.0/hw/xenpv/xen_domainbuild.c qemu-3.1.0.mod/hw/xenpv/xen_domainbuild.c
--- qemu-3.1.0/hw/xenpv/xen_domainbuild.c 2018-12-11 19:44:34.000000000 +0200
+++ qemu-3.1.0.mod/hw/xenpv/xen_domainbuild.c 2019-02-14 00:22:00.426001716 +0200
@@ -167,7 +167,7 @@
/* close all file handles, except stdio/out/err,
* our watch pipe and the xen interface handle */
- n = getdtablesize();
+ n = sysconf(_SC_OPEN_MAX);
for (i = 3; i < n; i++) {
if (i == fd[0])
continue;
diff -uNr qemu-3.1.0/slirp/misc.c qemu-3.1.0.mod/slirp/misc.c
--- qemu-3.1.0/slirp/misc.c 2018-12-11 19:44:34.000000000 +0200
+++ qemu-3.1.0.mod/slirp/misc.c 2019-02-14 00:22:06.729371848 +0200
@@ -161,7 +161,7 @@
dup2(cs, 0);
dup2(cs, 1);
dup2(cs, 2);
- for (s = getdtablesize() - 1; s >= 3; s--)
+ for (s = sysconf(_SC_OPEN_MAX) - 1; s >= 3; s--)
close(s);
i = 0;

View File

@ -0,0 +1,27 @@
diff -uNr qemu-3.1.0/fsdev/virtfs-proxy-helper.c qemu-3.1.0.mod/fsdev/virtfs-proxy-helper.c
--- qemu-3.1.0/fsdev/virtfs-proxy-helper.c 2018-12-11 19:44:34.000000000 +0200
+++ qemu-3.1.0.mod/fsdev/virtfs-proxy-helper.c 2018-12-29 00:45:59.721725318 +0200
@@ -62,21 +62,13 @@
va_list ap;
va_start(ap, format);
- if (is_daemon) {
- vsyslog(LOG_CRIT, format, ap);
- } else {
- vfprintf(stderr, format, ap);
- }
+ vfprintf(stderr, format, ap);
va_end(ap);
}
static void do_perror(const char *string)
{
- if (is_daemon) {
- syslog(LOG_CRIT, "%s:%s", string, strerror(errno));
- } else {
- fprintf(stderr, "%s:%s\n", string, strerror(errno));
- }
+ fprintf(stderr, "%s:%s\n", string, strerror(errno));
}
static int do_cap_set(cap_value_t *cap_value, int size, int reset)

View File

@ -1,6 +1,6 @@
diff -uNr qemu-3.1.0/linux-user/aarch64/signal.c qemu-3.1.0.mod/linux-user/aarch64/signal.c
--- qemu-3.1.0/linux-user/aarch64/signal.c 2018-12-11 19:44:34.000000000 +0200
+++ qemu-3.1.0.mod/linux-user/aarch64/signal.c 2019-02-14 00:32:44.839805693 +0200
diff -uNr qemu-4.0.0/linux-user/aarch64/signal.c qemu-4.0.0.mod/linux-user/aarch64/signal.c
--- qemu-4.0.0/linux-user/aarch64/signal.c 2019-04-23 21:14:46.000000000 +0300
+++ qemu-4.0.0.mod/linux-user/aarch64/signal.c 2019-04-27 15:15:35.724365997 +0300
@@ -38,7 +38,7 @@
target_stack_t tuc_stack;
target_sigset_t tuc_sigmask;
@ -10,9 +10,9 @@ diff -uNr qemu-3.1.0/linux-user/aarch64/signal.c qemu-3.1.0.mod/linux-user/aarch
/* last for future expansion */
struct target_sigcontext tuc_mcontext;
};
diff -uNr qemu-3.1.0/linux-user/arm/signal.c qemu-3.1.0.mod/linux-user/arm/signal.c
--- qemu-3.1.0/linux-user/arm/signal.c 2018-12-11 19:44:34.000000000 +0200
+++ qemu-3.1.0.mod/linux-user/arm/signal.c 2019-02-14 00:32:51.129843092 +0200
diff -uNr qemu-4.0.0/linux-user/arm/signal.c qemu-4.0.0.mod/linux-user/arm/signal.c
--- qemu-4.0.0/linux-user/arm/signal.c 2019-04-23 21:14:46.000000000 +0300
+++ qemu-4.0.0.mod/linux-user/arm/signal.c 2019-04-27 15:15:48.572413658 +0300
@@ -59,7 +59,7 @@
target_stack_t tuc_stack;
struct target_sigcontext tuc_mcontext;
@ -22,9 +22,9 @@ diff -uNr qemu-3.1.0/linux-user/arm/signal.c qemu-3.1.0.mod/linux-user/arm/signa
abi_ulong tuc_regspace[128] __attribute__((__aligned__(8)));
};
diff -uNr qemu-3.1.0/linux-user/syscall_defs.h qemu-3.1.0.mod/linux-user/syscall_defs.h
--- qemu-3.1.0/linux-user/syscall_defs.h 2018-12-11 19:44:34.000000000 +0200
+++ qemu-3.1.0.mod/linux-user/syscall_defs.h 2019-02-14 00:33:02.683245125 +0200
diff -uNr qemu-4.0.0/linux-user/syscall_defs.h qemu-4.0.0.mod/linux-user/syscall_defs.h
--- qemu-4.0.0/linux-user/syscall_defs.h 2019-04-23 21:14:46.000000000 +0300
+++ qemu-4.0.0.mod/linux-user/syscall_defs.h 2019-04-27 15:15:06.028256027 +0300
@@ -1731,7 +1731,7 @@
abi_ulong target_st_mtime_nsec;
abi_ulong target_st_ctime;
@ -38,8 +38,8 @@ diff -uNr qemu-3.1.0/linux-user/syscall_defs.h qemu-3.1.0.mod/linux-user/syscall
abi_ulong target_st_ctime;
abi_ulong target_st_ctime_nsec;
- abi_long __unused[3];
+ abi_long __qemu_unused[3];
- abi_long __unused[3];
+ abi_long __qemu_unused[3];
};
#elif defined(TARGET_S390X)
struct target_stat {

View File

@ -1,7 +1,7 @@
diff -uNr qemu-3.1.0/configure qemu-3.1.0.mod/configure
--- qemu-3.1.0/configure 2018-12-11 19:44:34.000000000 +0200
+++ qemu-3.1.0.mod/configure 2019-05-27 15:22:24.348241357 +0300
@@ -2208,23 +2208,10 @@
diff -uNr qemu-4.0.0/configure qemu-4.0.0.mod/configure
--- qemu-4.0.0/configure 2019-04-23 21:14:45.000000000 +0300
+++ qemu-4.0.0.mod/configure 2019-04-27 04:00:44.774004972 +0300
@@ -2301,23 +2301,10 @@
fi
##########################################
@ -28,7 +28,7 @@ diff -uNr qemu-3.1.0/configure qemu-3.1.0.mod/configure
##########################################
# snappy check
@@ -2246,22 +2233,9 @@
@@ -2339,22 +2326,9 @@
fi
##########################################
@ -52,16 +52,16 @@ diff -uNr qemu-3.1.0/configure qemu-3.1.0.mod/configure
+bzip2="yes"
##########################################
# libseccomp check
@@ -3068,6 +3042,7 @@
# lzfse check
@@ -3183,6 +3157,7 @@
# VNC SASL detection
if test "$vnc" = "yes" -a "$vnc_sasl" != "no" ; then
if test "$vnc" = "yes" && test "$vnc_sasl" != "no" ; then
cat > $TMPC <<EOF
+#include <sys/types.h>
#include <sasl/sasl.h>
#include <stdio.h>
int main(void) { sasl_server_init(NULL, "qemu"); return 0; }
@@ -4161,16 +4136,6 @@
@@ -4381,16 +4356,6 @@
##########################################
# signalfd probe
signalfd="no"
@ -76,21 +76,9 @@ diff -uNr qemu-3.1.0/configure qemu-3.1.0.mod/configure
- signalfd=yes
-fi
# check if eventfd is supported
eventfd=no
@@ -4549,11 +4514,6 @@
libs_qga="$libs_qga -lrt"
fi
-if test "$darwin" != "yes" -a "$mingw32" != "yes" -a "$solaris" != yes -a \
- "$haiku" != "yes" ; then
- libs_softmmu="-lutil $libs_softmmu"
-fi
-
##########################################
# spice probe
if test "$spice" != "no" ; then
@@ -5710,7 +5670,7 @@
# check if optreset global is declared by <getopt.h>
optreset="no"
@@ -6029,7 +5994,7 @@
# We can only support ivshmem if we have eventfd
if [ "$eventfd" = "yes" ]; then
@ -99,3 +87,13 @@ diff -uNr qemu-3.1.0/configure qemu-3.1.0.mod/configure
fi
tools=""
@@ -6699,9 +6664,6 @@
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 "$fiemap" = "yes" ; then
echo "CONFIG_FIEMAP=y" >> $config_host_mak
fi

View File

@ -1,14 +0,0 @@
diff -uNr qemu-3.1.0/tests/Makefile.include qemu-3.1.0.mod/tests/Makefile.include
--- qemu-3.1.0/tests/Makefile.include 2018-12-11 19:44:35.000000000 +0200
+++ qemu-3.1.0.mod/tests/Makefile.include 2019-05-27 15:42:32.554434009 +0300
@@ -777,10 +777,6 @@
rm $(INITRD_WORK_DIR)/init
rmdir $(INITRD_WORK_DIR)
-ifeq ($(CONFIG_POSIX),y)
-LIBS += -lutil
-endif
-
# QTest rules
TARGETS=$(patsubst %-softmmu,%, $(filter %-softmmu,$(TARGET_DIRS)))

View File

@ -1,25 +0,0 @@
commit cb61bc8a42da1a971079767e63df4503b6ab2efb
Author: Anatol Pomozov <anatol.pomozov@gmail.com>
Date: Mon Jan 29 10:08:53 2018 -0800
multiboot: Make elf64 loading functionality compatible with GRUB
GRUB is a reference multiboot implementation and supports loading elf64
binaries. Make QEMU to work similar was as GRUB.
diff --git a/hw/i386/multiboot.c b/hw/i386/multiboot.c
index 5bc0a2cddb..0907e42a39 100644
--- a/hw/i386/multiboot.c
+++ b/hw/i386/multiboot.c
@@ -193,11 +193,6 @@ int load_multiboot(FWCfgState *fw_cfg,
int kernel_size;
fclose(f);
- if (((struct elf64_hdr*)header)->e_machine == EM_X86_64) {
- error_report("Cannot load x86-64 image, give a 32bit one.");
- exit(1);
- }
-
kernel_size = load_elf(kernel_filename, NULL, NULL, &elf_entry,
&elf_low, &elf_high, 0, I386_ELF_MACHINE,
0, 0);

View File

@ -1,6 +1,6 @@
diff -uNr qemu-3.1.0/linux-user/syscall.c qemu-3.1.0.mod/linux-user/syscall.c
--- qemu-3.1.0/linux-user/syscall.c 2018-12-11 19:44:34.000000000 +0200
+++ qemu-3.1.0.mod/linux-user/syscall.c 2019-02-14 01:14:19.407552213 +0200
diff -uNr qemu-4.0.0/linux-user/syscall.c qemu-4.0.0.mod/linux-user/syscall.c
--- qemu-4.0.0/linux-user/syscall.c 2019-05-01 02:55:06.401703214 +0300
+++ qemu-4.0.0.mod/linux-user/syscall.c 2019-05-01 02:56:06.894984667 +0300
@@ -42,7 +42,7 @@
#include <poll.h>
#include <sys/times.h>
@ -10,7 +10,7 @@ diff -uNr qemu-3.1.0/linux-user/syscall.c qemu-3.1.0.mod/linux-user/syscall.c
#include <sys/statfs.h>
#include <utime.h>
#include <sys/sysinfo.h>
@@ -76,12 +76,16 @@
@@ -76,12 +76,17 @@
#endif
#define termios host_termios
@ -21,13 +21,14 @@ diff -uNr qemu-3.1.0/linux-user/syscall.c qemu-3.1.0.mod/linux-user/syscall.c
#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
+#undef __ASM_GENERIC_TERMBITS_H
+#include <asm/termbits.h>
+
#include <linux/termios.h>
#include <linux/unistd.h>
#include <linux/cdrom.h>
@@ -244,11 +248,67 @@
@@ -244,6 +249,61 @@
#define __NR__llseek __NR_lseek
#endif
@ -48,7 +49,7 @@ diff -uNr qemu-3.1.0/linux-user/syscall.c qemu-3.1.0.mod/linux-user/syscall.c
+static int
+semget (key_t key, int nsems, int semflg)
+{
+ return syscall (__NR_ipc, IPCOP_semget, key, nsems, semflg, NULL);
+ return syscall (__NR_ipc, IPCOP_semget, key, nsems, semflg, NULL);
+}
+#endif
+
@ -89,21 +90,7 @@ diff -uNr qemu-3.1.0/linux-user/syscall.c qemu-3.1.0.mod/linux-user/syscall.c
/* Newer kernel ports have llseek() instead of _llseek() */
#if defined(TARGET_NR_llseek) && !defined(TARGET_NR__llseek)
#define TARGET_NR__llseek TARGET_NR_llseek
#endif
+#if 0
#ifdef __NR_gettid
_syscall0(int, gettid)
#else
@@ -258,6 +318,7 @@
return -ENOSYS;
}
#endif
+#endif
/* For the 64-bit guest on 32-bit host case we must emulate
* getdents using getdents64, because otherwise the host
@@ -813,6 +874,9 @@
@@ -806,6 +866,9 @@
size_t, len, unsigned, prio, const struct timespec *, timeout)
safe_syscall5(int, mq_timedreceive, int, mqdes, char *, msg_ptr,
size_t, len, unsigned *, prio, const struct timespec *, timeout)
@ -113,7 +100,7 @@ diff -uNr qemu-3.1.0/linux-user/syscall.c qemu-3.1.0.mod/linux-user/syscall.c
#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
@@ -1191,7 +1255,7 @@
@@ -1184,7 +1247,7 @@
}
#if defined(TARGET_NR_mq_open) && defined(__NR_mq_open)
@ -122,7 +109,7 @@ diff -uNr qemu-3.1.0/linux-user/syscall.c qemu-3.1.0.mod/linux-user/syscall.c
static inline abi_long copy_from_user_mq_attr(struct mq_attr *attr,
abi_ulong target_mq_attr_addr)
@@ -3189,6 +3253,8 @@
@@ -3231,6 +3294,8 @@
return 0;
}
@ -131,7 +118,7 @@ diff -uNr qemu-3.1.0/linux-user/syscall.c qemu-3.1.0.mod/linux-user/syscall.c
static inline abi_long target_to_host_semid_ds(struct semid_ds *host_sd,
abi_ulong target_addr)
{
@@ -3268,6 +3334,16 @@
@@ -3310,6 +3375,16 @@
abi_ulong __buf;
};
@ -148,7 +135,7 @@ diff -uNr qemu-3.1.0/linux-user/syscall.c qemu-3.1.0.mod/linux-user/syscall.c
static inline abi_long target_to_host_semarray(int semid, unsigned short **host_array,
abi_ulong target_addr)
{
@@ -3398,7 +3474,7 @@
@@ -3440,7 +3515,7 @@
case GETPID:
case GETNCNT:
case GETZCNT:
@ -157,7 +144,7 @@ diff -uNr qemu-3.1.0/linux-user/syscall.c qemu-3.1.0.mod/linux-user/syscall.c
break;
}
@@ -3480,7 +3556,7 @@
@@ -3522,7 +3597,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);
@ -166,7 +153,7 @@ diff -uNr qemu-3.1.0/linux-user/syscall.c qemu-3.1.0.mod/linux-user/syscall.c
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);
@@ -3501,7 +3577,7 @@
@@ -3543,7 +3618,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);
@ -175,7 +162,7 @@ diff -uNr qemu-3.1.0/linux-user/syscall.c qemu-3.1.0.mod/linux-user/syscall.c
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);
@@ -4748,6 +4824,9 @@
@@ -4799,6 +4874,9 @@
}
#endif
@ -185,16 +172,7 @@ diff -uNr qemu-3.1.0/linux-user/syscall.c qemu-3.1.0.mod/linux-user/syscall.c
static IOCTLEntry ioctl_entries[] = {
#define IOCTL(cmd, access, ...) \
{ TARGET_ ## cmd, cmd, #cmd, access, 0, { __VA_ARGS__ } },
@@ -6776,7 +6855,7 @@
/* 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) {
@@ -7321,7 +7400,7 @@
@@ -7378,7 +7456,7 @@
unlock_user(p, arg1, 0);
return ret;
#endif
@ -203,7 +181,7 @@ diff -uNr qemu-3.1.0/linux-user/syscall.c qemu-3.1.0.mod/linux-user/syscall.c
case TARGET_NR_stime:
{
time_t host_time;
@@ -7383,7 +7462,7 @@
@@ -7440,7 +7518,7 @@
}
return ret;
#endif
@ -212,15 +190,16 @@ diff -uNr qemu-3.1.0/linux-user/syscall.c qemu-3.1.0.mod/linux-user/syscall.c
case TARGET_NR_futimesat:
{
struct timeval *tvp, tv[2];
@@ -10950,6 +11029,7 @@
@@ -11056,7 +11134,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;
@@ -10967,6 +11047,7 @@
@@ -11074,6 +11152,7 @@
}
return ret;
#endif

View File

@ -0,0 +1,207 @@
diff -uNr qemu-4.0.0/linux-user/syscall.c qemu-4.0.0.mod/linux-user/syscall.c
--- qemu-4.0.0/linux-user/syscall.c 2019-04-30 15:40:56.544812530 +0300
+++ qemu-4.0.0.mod/linux-user/syscall.c 2019-04-30 15:41:21.775951365 +0300
@@ -42,7 +42,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>
@@ -76,12 +76,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>
@@ -244,6 +249,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
@@ -806,6 +864,9 @@
size_t, len, unsigned, prio, const struct timespec *, timeout)
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
@@ -1184,7 +1245,7 @@
}
#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)
@@ -3231,6 +3292,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)
{
@@ -3310,6 +3373,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)
{
@@ -3440,7 +3513,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;
}
@@ -3522,7 +3595,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);
@@ -3543,7 +3616,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);
@@ -4799,6 +4872,9 @@
}
#endif
+#undef winsize
+#undef termio
+
static IOCTLEntry ioctl_entries[] = {
#define IOCTL(cmd, access, ...) \
{ TARGET_ ## cmd, cmd, #cmd, access, 0, { __VA_ARGS__ } },
@@ -7399,7 +7475,7 @@
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:
{
time_t host_time;
@@ -7461,7 +7537,7 @@
}
return ret;
#endif
-#if defined(TARGET_NR_futimesat)
+#if 0 && defined(TARGET_NR_futimesat)
case TARGET_NR_futimesat:
{
struct timeval *tvp, tv[2];
@@ -11077,7 +11153,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;
@@ -11095,6 +11171,7 @@
}
return ret;
#endif
+#endif
#ifdef CONFIG_SPLICE
#ifdef TARGET_NR_tee

View File

@ -2,17 +2,19 @@ TERMUX_PKG_HOMEPAGE=https://www.qemu.org
TERMUX_PKG_DESCRIPTION="A set common files for the QEMU emulators"
TERMUX_PKG_LICENSE="LGPL-2.1"
TERMUX_PKG_MAINTAINER="Leonid Plyushch <leonid.plyushch@gmail.com>"
TERMUX_PKG_VERSION=3.1.0
TERMUX_PKG_REVISION=9
TERMUX_PKG_VERSION=4.0.0
TERMUX_PKG_SRCURL=https://download.qemu.org/qemu-$TERMUX_PKG_VERSION.tar.xz
TERMUX_PKG_SHA256=6a0508df079a0a33c2487ca936a56c12122f105b8a96a44374704bef6c69abfc
TERMUX_PKG_SHA256=13a93dfe75b86734326f8d5b475fde82ec692d5b5a338b4262aeeb6b0fa4e469
TERMUX_PKG_DEPENDS="capstone, dtc, glib, libandroid-shmem, libbz2, libc++, libcap, libcurl, libffi, libgnutls, libjpeg-turbo, liblzo, libnettle, libnfs, libpixman, libpng, libsasl, libssh2, libxml2, ncurses, openssl, pcre, sdl2, zlib"
TERMUX_PKG_BUILD_IN_SRC=true
termux_step_pre_configure() {
if [ $TERMUX_PKG_API_LEVEL -lt 24 ]; then
patch -p1 -i "$TERMUX_PKG_BUILDER_DIR"/android-5/0001-implement-lockf.patch
patch -p1 -i "$TERMUX_PKG_BUILDER_DIR"/android-5/0002-implement-openpty.patch
patch -p1 -i "$TERMUX_PKG_BUILDER_DIR"/android-5/0008-fix-syscalls-android5.patch
patch -p1 -i "$TERMUX_PKG_BUILDER_DIR"/android-5/0012-implement-lockf.patch
patch -p1 -i "$TERMUX_PKG_BUILDER_DIR"/android-5/0013-implement-openpty.patch
else
patch -p1 -i "$TERMUX_PKG_BUILDER_DIR"/android-7/0008-fix-syscalls-android7.patch
fi
}
@ -74,7 +76,6 @@ termux_step_configure() {
--disable-gtk \
--disable-opengl \
--enable-sdl \
--with-sdlabi="2.0" \
--disable-vte \
--enable-vnc \
--enable-vnc-jpeg \