From 67df2aa46a041e7ad1dd67fac5b69cf87dc983cd Mon Sep 17 00:00:00 2001 From: Sam2159 <81921831+Sam2159@users.noreply.github.com> Date: Tue, 1 Jul 2025 21:35:46 +0200 Subject: [PATCH 01/21] Update 9p-local.c Signed-off-by: Sam2159 <81921831+Sam2159@users.noreply.github.com> --- hw/9pfs/9p-local.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/hw/9pfs/9p-local.c b/hw/9pfs/9p-local.c index 928523afcc6..aec76126532 100644 --- a/hw/9pfs/9p-local.c +++ b/hw/9pfs/9p-local.c @@ -14,7 +14,7 @@ * Not so fast! You might want to read the 9p developer docs first: * https://wiki.qemu.org/Documentation/9p */ - +#include #include "qemu/osdep.h" #include "9p.h" #include "9p-local.h" @@ -626,8 +626,14 @@ static ssize_t local_pwritev(FsContext *ctx, V9fsFidOpenState *fs, * We want to ensure that we don't leave dirty pages in the cache * after write when writeout=immediate is specified. */ +#ifndef defined(__ANDROID__) sync_file_range(fs->fd, offset, ret, SYNC_FILE_RANGE_WAIT_BEFORE | SYNC_FILE_RANGE_WRITE); +#else + (void)fs; + (void)offset; + (void)ret; +#endif } #endif return ret; From a1cd57598b0d62cd3c20a14124dfb82277521f33 Mon Sep 17 00:00:00 2001 From: Sam2159 <81921831+Sam2159@users.noreply.github.com> Date: Tue, 1 Jul 2025 21:47:35 +0200 Subject: [PATCH 02/21] Update 9p-marshal.h Signed-off-by: Sam2159 <81921831+Sam2159@users.noreply.github.com> --- fsdev/9p-marshal.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/fsdev/9p-marshal.h b/fsdev/9p-marshal.h index f1abbe151c3..ffae6a4b9bd 100644 --- a/fsdev/9p-marshal.h +++ b/fsdev/9p-marshal.h @@ -1,3 +1,15 @@ +#ifdef defined(__ANDROID__) +#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 +#endif + #ifndef QEMU_9P_MARSHAL_H #define QEMU_9P_MARSHAL_H From 5f2e98133ceb2a6bd2d3e754debc2312713959b2 Mon Sep 17 00:00:00 2001 From: Sam2159 <81921831+Sam2159@users.noreply.github.com> Date: Tue, 1 Jul 2025 21:51:35 +0200 Subject: [PATCH 03/21] Update file-posix.c Signed-off-by: Sam2159 <81921831+Sam2159@users.noreply.github.com> --- block/file-posix.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/block/file-posix.c b/block/file-posix.c index 56d1972d156..6e3225d9d35 100644 --- a/block/file-posix.c +++ b/block/file-posix.c @@ -2173,6 +2173,7 @@ static int handle_aiocb_copy_range(void *opaque) off_t out_off = aiocb->copy_range.aio_offset2; while (bytes) { + #ifndef __ANDROID__ ssize_t ret = copy_file_range(aiocb->aio_fildes, &in_off, aiocb->copy_range.aio_fd2, &out_off, bytes, 0); @@ -2195,6 +2196,7 @@ static int handle_aiocb_copy_range(void *opaque) } } bytes -= ret; + #endif } return 0; } From f93540ef8c5aafb17573eb60175e7ec05c0f3b46 Mon Sep 17 00:00:00 2001 From: Sam2159 <81921831+Sam2159@users.noreply.github.com> Date: Tue, 1 Jul 2025 21:52:32 +0200 Subject: [PATCH 04/21] Update 9p-local.c Signed-off-by: Sam2159 <81921831+Sam2159@users.noreply.github.com> --- hw/9pfs/9p-local.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/9pfs/9p-local.c b/hw/9pfs/9p-local.c index aec76126532..121d6f6df6c 100644 --- a/hw/9pfs/9p-local.c +++ b/hw/9pfs/9p-local.c @@ -626,7 +626,7 @@ static ssize_t local_pwritev(FsContext *ctx, V9fsFidOpenState *fs, * We want to ensure that we don't leave dirty pages in the cache * after write when writeout=immediate is specified. */ -#ifndef defined(__ANDROID__) +#ifndef __ANDROID__ sync_file_range(fs->fd, offset, ret, SYNC_FILE_RANGE_WAIT_BEFORE | SYNC_FILE_RANGE_WRITE); #else From 3187d41ef61dade925c15a67035546e70ff46839 Mon Sep 17 00:00:00 2001 From: Sam2159 <81921831+Sam2159@users.noreply.github.com> Date: Tue, 1 Jul 2025 21:53:21 +0200 Subject: [PATCH 05/21] Update 9p-marshal.h Signed-off-by: Sam2159 <81921831+Sam2159@users.noreply.github.com> --- fsdev/9p-marshal.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fsdev/9p-marshal.h b/fsdev/9p-marshal.h index ffae6a4b9bd..4276a03846c 100644 --- a/fsdev/9p-marshal.h +++ b/fsdev/9p-marshal.h @@ -1,4 +1,4 @@ -#ifdef defined(__ANDROID__) +#ifdef __ANDROID__ #ifdef st_atime_nsec #undef st_atime_nsec #endif From a63ab96685abdeee65cb74142c6660cad84c4df5 Mon Sep 17 00:00:00 2001 From: Sam2159 <81921831+Sam2159@users.noreply.github.com> Date: Tue, 1 Jul 2025 22:13:59 +0200 Subject: [PATCH 06/21] Update ivshmem-server.c Signed-off-by: Sam2159 <81921831+Sam2159@users.noreply.github.com> --- contrib/ivshmem-server/ivshmem-server.c | 42 ++++++++++++++++++++++--- 1 file changed, 38 insertions(+), 4 deletions(-) diff --git a/contrib/ivshmem-server/ivshmem-server.c b/contrib/ivshmem-server/ivshmem-server.c index 2f3c7320a67..e175038ddee 100644 --- a/contrib/ivshmem-server/ivshmem-server.c +++ b/contrib/ivshmem-server/ivshmem-server.c @@ -5,6 +5,13 @@ * (at your option) any later version. See the COPYING file in the * top-level directory. */ +#include +#include +#include +#ifdef __ANDROID__ +#define SHM_SIZE 4096 +#endif + #include "qemu/osdep.h" #include "qemu/host-utils.h" #include "qemu/sockets.h" @@ -275,7 +282,11 @@ ivshmem_server_init(IvshmemServer *server, const char *unix_sock_path, return -1; } +#ifndef __ANDROID__ server->use_shm_open = use_shm_open; +#else + server->use_shm_open = false; +#endif server->shm_size = shm_size; server->n_vectors = n_vectors; @@ -297,12 +308,31 @@ ivshmem_server_start(IvshmemServer *server) server->shm_path); shm_fd = shm_open(server->shm_path, O_CREAT | O_RDWR, S_IRWXU); } else { - gchar *filename = g_strdup_printf("%s/ivshmem.XXXXXX", server->shm_path); - IVSHMEM_SERVER_DEBUG(server, "Using file-backed shared memory: %s\n", - server->shm_path); - shm_fd = mkstemp(filename); +#ifdef __ANDROID__ + if (shm_fd == -1) { + perror("Failed to create temporary shm file"); + g_free(filename); + return -1; + } + unlink(filename); + g_free(filename); + + if (ftruncate(shm_fd, SHM_SIZE) == -1) { + perror("Failed to set size of shared memory"); + close(shm_fd); + return -1; + } + + void *shm_ptr = mmap(NULL, SHM_SIZE, PROT_READ | PROT_WRITE, MAP_SHARED, shm_fd, 0); + if (shm_ptr == MAP_FAILED) { + perror("Failed to map shared memory"); + close(shm_fd); + return -1; + } +#else unlink(filename); g_free(filename); +#endif } if (shm_fd < 0) { @@ -354,7 +384,9 @@ ivshmem_server_start(IvshmemServer *server) close(sock_fd); err_close_shm: if (server->use_shm_open) { +#ifndef __ANDROID__ shm_unlink(server->shm_path); +#endif } close(shm_fd); return -1; @@ -374,7 +406,9 @@ ivshmem_server_close(IvshmemServer *server) unlink(server->unix_sock_path); if (server->use_shm_open) { +#ifndef __ANDROID__ shm_unlink(server->shm_path); +#endif } close(server->sock_fd); close(server->shm_fd); From e6e628d065515d9a4950a91de0d6ba9a1a839b9e Mon Sep 17 00:00:00 2001 From: Sam2159 <81921831+Sam2159@users.noreply.github.com> Date: Tue, 1 Jul 2025 22:23:18 +0200 Subject: [PATCH 07/21] Update ivshmem-test.c Signed-off-by: Sam2159 <81921831+Sam2159@users.noreply.github.com> --- tests/qtest/ivshmem-test.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tests/qtest/ivshmem-test.c b/tests/qtest/ivshmem-test.c index fb45fdeb07b..bb2f7599c09 100644 --- a/tests/qtest/ivshmem-test.c +++ b/tests/qtest/ivshmem-test.c @@ -435,7 +435,9 @@ static void cleanup(void) } if (tmpshm) { + #ifndef __ANDROID__ shm_unlink(tmpshm); + #endif g_free(tmpshm); tmpshm = NULL; } @@ -463,8 +465,14 @@ static gchar *mktempshm(int size, int *fd) gchar *name; name = g_strdup_printf("/qtest-%u-%u", getpid(), g_test_rand_int()); + #ifndef __ANDROID__ *fd = shm_open(name, O_CREAT|O_RDWR|O_EXCL, S_IRWXU|S_IRWXG|S_IRWXO); + #else + gchar *filename = g_strdup_printf("/data/data/com.termux/files/usr/tmp/%s", name); + *fd = open(filename, O_CREAT | O_RDWR | O_EXCL, 0600); + g_free(filename); + #endif if (*fd > 0) { g_assert(ftruncate(*fd, size) == 0); return name; From 89976895bc48695194db8130be32f0dcb54e9c22 Mon Sep 17 00:00:00 2001 From: Sam2159 <81921831+Sam2159@users.noreply.github.com> Date: Tue, 1 Jul 2025 22:31:14 +0200 Subject: [PATCH 08/21] Update ivshmem-server.c Signed-off-by: Sam2159 <81921831+Sam2159@users.noreply.github.com> --- contrib/ivshmem-server/ivshmem-server.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/contrib/ivshmem-server/ivshmem-server.c b/contrib/ivshmem-server/ivshmem-server.c index e175038ddee..fadbd8b2cb5 100644 --- a/contrib/ivshmem-server/ivshmem-server.c +++ b/contrib/ivshmem-server/ivshmem-server.c @@ -282,11 +282,11 @@ ivshmem_server_init(IvshmemServer *server, const char *unix_sock_path, return -1; } -#ifndef __ANDROID__ + #ifndef __ANDROID__ server->use_shm_open = use_shm_open; -#else + #else server->use_shm_open = false; -#endif + #endif server->shm_size = shm_size; server->n_vectors = n_vectors; @@ -308,7 +308,7 @@ ivshmem_server_start(IvshmemServer *server) server->shm_path); shm_fd = shm_open(server->shm_path, O_CREAT | O_RDWR, S_IRWXU); } else { -#ifdef __ANDROID__ + #ifdef __ANDROID__ if (shm_fd == -1) { perror("Failed to create temporary shm file"); g_free(filename); @@ -329,10 +329,10 @@ ivshmem_server_start(IvshmemServer *server) close(shm_fd); return -1; } -#else + #else unlink(filename); g_free(filename); -#endif + #endif } if (shm_fd < 0) { @@ -384,9 +384,9 @@ ivshmem_server_start(IvshmemServer *server) close(sock_fd); err_close_shm: if (server->use_shm_open) { -#ifndef __ANDROID__ + #ifndef __ANDROID__ shm_unlink(server->shm_path); -#endif + #endif } close(shm_fd); return -1; @@ -406,9 +406,9 @@ ivshmem_server_close(IvshmemServer *server) unlink(server->unix_sock_path); if (server->use_shm_open) { -#ifndef __ANDROID__ + #ifndef __ANDROID__ shm_unlink(server->shm_path); -#endif + #endif } close(server->sock_fd); close(server->shm_fd); From 0a45185895b128818a41ba1d4e076e217cbf3863 Mon Sep 17 00:00:00 2001 From: Sam2159 <81921831+Sam2159@users.noreply.github.com> Date: Tue, 1 Jul 2025 22:42:04 +0200 Subject: [PATCH 09/21] Update libvhost-user.c Signed-off-by: Sam2159 <81921831+Sam2159@users.noreply.github.com> --- subprojects/libvhost-user/libvhost-user.c | 25 +++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/subprojects/libvhost-user/libvhost-user.c b/subprojects/libvhost-user/libvhost-user.c index 9c630c2170d..e5924f74588 100644 --- a/subprojects/libvhost-user/libvhost-user.c +++ b/subprojects/libvhost-user/libvhost-user.c @@ -17,6 +17,8 @@ #define _GNU_SOURCE #endif +#include + /* this code avoids GLib dependency */ #include #include @@ -1876,6 +1878,21 @@ vu_inflight_queue_size(uint16_t queue_size) } #ifdef MFD_ALLOW_SEALING + +#ifdef __ANDROID__ +#ifndef __NR_memfd_create +#define __NR_memfd_create 319 +#endif + +static inline int safe_memfd_create(const char *name, unsigned int flags) { +#ifdef __ANDROID__ + return syscall(__NR_memfd_create, name, flags); +#else + return memfd_create(name, flags); +#endif +} +#endif + static void * memfd_alloc(const char *name, size_t size, unsigned int flags, int *fd) { @@ -1884,7 +1901,15 @@ memfd_alloc(const char *name, size_t size, unsigned int flags, int *fd) *fd = memfd_create(name, MFD_ALLOW_SEALING); if (*fd < 0) { +#ifdef __ANDROID__ + char path[] = "/data/data/com.termux/files/usr/tmp/memfd-XXXXXX"; + *fd = mkstemp(path); + if (*fd < 0) + return NULL; + unlink(path); +#else return NULL; +#endif } ret = ftruncate(*fd, size); From e834f898cd301c56b9d8b76e19b8df16dd46d16d Mon Sep 17 00:00:00 2001 From: Sam2159 <81921831+Sam2159@users.noreply.github.com> Date: Tue, 1 Jul 2025 22:48:19 +0200 Subject: [PATCH 10/21] Update oslib-posix.c Signed-off-by: Sam2159 <81921831+Sam2159@users.noreply.github.com> --- util/oslib-posix.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/util/oslib-posix.c b/util/oslib-posix.c index a697c602c60..3c708266ebf 100644 --- a/util/oslib-posix.c +++ b/util/oslib-posix.c @@ -60,6 +60,19 @@ #include "qemu/mmap-alloc.h" +#ifdef __ANDROID__ +#ifndef HAVE_CLOSE_RANGE +static int close_range(unsigned int first, unsigned int last, unsigned int flags) { + int ret = 0; + for (unsigned int fd = first; fd <= last; fd++) { + if (close(fd) < 0) + ret = -1; + } + return ret; +} +#endif +#endif + #define MAX_MEM_PREALLOC_THREAD_COUNT 16 struct MemsetThread; @@ -975,7 +988,11 @@ int qemu_shm_alloc(size_t size, Error **errp) g_string_printf(shm_name, "/qemu-" FMT_pid "-shm-%d", getpid(), cur_sequence); + #ifdef __ANDROID__ + fd = open(shm_name->str, oflag, mode); + #else fd = shm_open(shm_name->str, oflag, mode); + #endif if (fd < 0) { error_setg_errno(errp, errno, "failed to create POSIX shared memory"); @@ -987,7 +1004,11 @@ int qemu_shm_alloc(size_t size, Error **errp) * POSIX shared memory object. However it will remain allocated as long as * there are file descriptors pointing to it. */ + #ifdef __ANDROID__ + unlink(shm_name->str); + #else shm_unlink(shm_name->str); + #endif if (ftruncate(fd, size) == -1) { error_setg_errno(errp, errno, From e66b3703d604261d8143ee3c1c7411c3a5fc435e Mon Sep 17 00:00:00 2001 From: Sam2159 <81921831+Sam2159@users.noreply.github.com> Date: Wed, 2 Jul 2025 00:10:41 +0200 Subject: [PATCH 11/21] Update libvhost-user.c Signed-off-by: Sam2159 <81921831+Sam2159@users.noreply.github.com> --- subprojects/libvhost-user/libvhost-user.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/subprojects/libvhost-user/libvhost-user.c b/subprojects/libvhost-user/libvhost-user.c index e5924f74588..94de9099aa9 100644 --- a/subprojects/libvhost-user/libvhost-user.c +++ b/subprojects/libvhost-user/libvhost-user.c @@ -1899,7 +1899,11 @@ memfd_alloc(const char *name, size_t size, unsigned int flags, int *fd) void *ptr; int ret; +#ifdef __ANDROID__ + *fd = safe_memfd_create(name, MFD_ALLOW_SEALING); +#else *fd = memfd_create(name, MFD_ALLOW_SEALING); +#endif if (*fd < 0) { #ifdef __ANDROID__ char path[] = "/data/data/com.termux/files/usr/tmp/memfd-XXXXXX"; From 6d108637c9868d92dfe669d9eeb0944300db5a97 Mon Sep 17 00:00:00 2001 From: Sam2159 <81921831+Sam2159@users.noreply.github.com> Date: Wed, 2 Jul 2025 00:59:50 +0200 Subject: [PATCH 12/21] Update ivshmem-server.c Signed-off-by: Sam2159 <81921831+Sam2159@users.noreply.github.com> --- contrib/ivshmem-server/ivshmem-server.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/contrib/ivshmem-server/ivshmem-server.c b/contrib/ivshmem-server/ivshmem-server.c index fadbd8b2cb5..9d57d2e0a5c 100644 --- a/contrib/ivshmem-server/ivshmem-server.c +++ b/contrib/ivshmem-server/ivshmem-server.c @@ -303,12 +303,23 @@ ivshmem_server_start(IvshmemServer *server) int shm_fd, sock_fd, ret; /* open shm file */ + #ifndef __ANDROID__ if (server->use_shm_open) { IVSHMEM_SERVER_DEBUG(server, "Using POSIX shared memory: %s\n", server->shm_path); shm_fd = shm_open(server->shm_path, O_CREAT | O_RDWR, S_IRWXU); } else { + gchar *filename = g_strdup_printf("%s/ivshmem.XXXXXX", server->shm_path); + IVSHMEM_SERVER_DEBUG(server, "Using file-backed shared memory: %s\n", server->shm_path); + shm_fd = mkstemp(filename); + unlink(filename); + g_free(filename); + } + #endif #ifdef __ANDROID__ + gchar *filename = g_strdup_printf("%s/ivshmem.XXXXXX", server->shm_path); + IVSHMEM_SERVER_DEBUG(server, "Using file-backed shared memory: %s\n", server->shm_path); + shm_fd = mkstemp(filename); if (shm_fd == -1) { perror("Failed to create temporary shm file"); g_free(filename); @@ -329,11 +340,6 @@ ivshmem_server_start(IvshmemServer *server) close(shm_fd); return -1; } - #else - unlink(filename); - g_free(filename); - #endif - } if (shm_fd < 0) { fprintf(stderr, "cannot open shm file %s: %s\n", server->shm_path, From 001caf4545a2219604ee3ae60eb903ce8228b3ff Mon Sep 17 00:00:00 2001 From: Sam2159 <81921831+Sam2159@users.noreply.github.com> Date: Wed, 2 Jul 2025 01:10:09 +0200 Subject: [PATCH 13/21] Update ivshmem-server.c Signed-off-by: Sam2159 <81921831+Sam2159@users.noreply.github.com> --- contrib/ivshmem-server/ivshmem-server.c | 28 ++++++++++++------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/contrib/ivshmem-server/ivshmem-server.c b/contrib/ivshmem-server/ivshmem-server.c index 9d57d2e0a5c..b62c6ce74c1 100644 --- a/contrib/ivshmem-server/ivshmem-server.c +++ b/contrib/ivshmem-server/ivshmem-server.c @@ -302,20 +302,6 @@ ivshmem_server_start(IvshmemServer *server) struct sockaddr_un s_un; int shm_fd, sock_fd, ret; - /* open shm file */ - #ifndef __ANDROID__ - if (server->use_shm_open) { - IVSHMEM_SERVER_DEBUG(server, "Using POSIX shared memory: %s\n", - server->shm_path); - shm_fd = shm_open(server->shm_path, O_CREAT | O_RDWR, S_IRWXU); - } else { - gchar *filename = g_strdup_printf("%s/ivshmem.XXXXXX", server->shm_path); - IVSHMEM_SERVER_DEBUG(server, "Using file-backed shared memory: %s\n", server->shm_path); - shm_fd = mkstemp(filename); - unlink(filename); - g_free(filename); - } - #endif #ifdef __ANDROID__ gchar *filename = g_strdup_printf("%s/ivshmem.XXXXXX", server->shm_path); IVSHMEM_SERVER_DEBUG(server, "Using file-backed shared memory: %s\n", server->shm_path); @@ -340,6 +326,20 @@ ivshmem_server_start(IvshmemServer *server) close(shm_fd); return -1; } + #else + /* open shm file */ + if (server->use_shm_open) { + IVSHMEM_SERVER_DEBUG(server, "Using POSIX shared memory: %s\n", + server->shm_path); + shm_fd = shm_open(server->shm_path, O_CREAT | O_RDWR, S_IRWXU); + } else { + gchar *filename = g_strdup_printf("%s/ivshmem.XXXXXX", server->shm_path); + IVSHMEM_SERVER_DEBUG(server, "Using file-backed shared memory: %s\n", server->shm_path); + shm_fd = mkstemp(filename); + unlink(filename); + g_free(filename); + } + #endif if (shm_fd < 0) { fprintf(stderr, "cannot open shm file %s: %s\n", server->shm_path, From 8b202f8a21b422c5dc0b7d72f0a8206b55dcdce7 Mon Sep 17 00:00:00 2001 From: Sam2159 <81921831+Sam2159@users.noreply.github.com> Date: Wed, 2 Jul 2025 02:06:58 +0200 Subject: [PATCH 14/21] Update libvhost-user.h Signed-off-by: Sam2159 <81921831+Sam2159@users.noreply.github.com> --- subprojects/libvhost-user/libvhost-user.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/subprojects/libvhost-user/libvhost-user.h b/subprojects/libvhost-user/libvhost-user.h index 2ffc58c11b1..788b961a805 100644 --- a/subprojects/libvhost-user/libvhost-user.h +++ b/subprojects/libvhost-user/libvhost-user.h @@ -20,7 +20,7 @@ #include #include #include -#include "standard-headers/linux/virtio_ring.h" +#include "../../../include/standard-headers/linux/virtio_ring.h" /* Based on qemu/hw/virtio/vhost-user.c */ #define VHOST_USER_F_PROTOCOL_FEATURES 30 From db5bd48baf60972ce9a53c1adde8bddb2041885a Mon Sep 17 00:00:00 2001 From: Sam2159 <81921831+Sam2159@users.noreply.github.com> Date: Wed, 2 Jul 2025 02:29:26 +0200 Subject: [PATCH 15/21] Update libvhost-user.h Signed-off-by: Sam2159 <81921831+Sam2159@users.noreply.github.com> --- subprojects/libvhost-user/libvhost-user.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/subprojects/libvhost-user/libvhost-user.h b/subprojects/libvhost-user/libvhost-user.h index 788b961a805..2ffc58c11b1 100644 --- a/subprojects/libvhost-user/libvhost-user.h +++ b/subprojects/libvhost-user/libvhost-user.h @@ -20,7 +20,7 @@ #include #include #include -#include "../../../include/standard-headers/linux/virtio_ring.h" +#include "standard-headers/linux/virtio_ring.h" /* Based on qemu/hw/virtio/vhost-user.c */ #define VHOST_USER_F_PROTOCOL_FEATURES 30 From b106be378b9053981e017a89042b0a041588f11b Mon Sep 17 00:00:00 2001 From: Sam2159 <81921831+Sam2159@users.noreply.github.com> Date: Wed, 2 Jul 2025 03:09:34 +0200 Subject: [PATCH 16/21] Update configure Signed-off-by: Sam2159 <81921831+Sam2159@users.noreply.github.com> --- configure | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/configure b/configure index 02f1dd2311f..5f20b2906af 100755 --- a/configure +++ b/configure @@ -427,6 +427,11 @@ else fi fi +if check_define __ANDROID__ ; then + rm /data/data/com.termux/files/usr/include/linux/virtio_ring.h + cp /data/data/com.termux/files/QEMUAppleSilicon/include/standard-headers/linux/virtio_ring.h /data/data/com.termux/files/usr/include/linux/ +fi + # Normalise host CPU name to the values used by Meson cross files and in source # directories, and set multilib cflags. The canonicalization isn't really # necessary, because the architectures that we check for should not hit the From e8fcd7b76cdd50a9c16c01076f75e69d90b55653 Mon Sep 17 00:00:00 2001 From: Sam2159 <81921831+Sam2159@users.noreply.github.com> Date: Wed, 2 Jul 2025 03:24:12 +0200 Subject: [PATCH 17/21] Update configure Signed-off-by: Sam2159 <81921831+Sam2159@users.noreply.github.com> --- configure | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure b/configure index 5f20b2906af..7ab5abe3013 100755 --- a/configure +++ b/configure @@ -429,7 +429,7 @@ fi if check_define __ANDROID__ ; then rm /data/data/com.termux/files/usr/include/linux/virtio_ring.h - cp /data/data/com.termux/files/QEMUAppleSilicon/include/standard-headers/linux/virtio_ring.h /data/data/com.termux/files/usr/include/linux/ + cp /data/data/com.termux/files/home/QEMUAppleSilicon/include/standard-headers/linux/virtio_ring.h /data/data/com.termux/files/usr/include/linux/ fi # Normalise host CPU name to the values used by Meson cross files and in source From 2a29b793a02b3bc63aa58a0ff5f9f89ed9072dd2 Mon Sep 17 00:00:00 2001 From: Sam2159 <81921831+Sam2159@users.noreply.github.com> Date: Wed, 2 Jul 2025 22:18:14 +0200 Subject: [PATCH 18/21] Update configure Signed-off-by: Sam2159 <81921831+Sam2159@users.noreply.github.com> --- configure | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/configure b/configure index 7ab5abe3013..6f4574980bf 100755 --- a/configure +++ b/configure @@ -360,6 +360,10 @@ elif check_define __NetBSD__; then host_os=netbsd elif check_define __APPLE__; then host_os=darwin +elif check_define __ANDROID__ ; then + host_os=linux + rm /data/data/com.termux/files/usr/include/linux/virtio_ring.h + cp /data/data/com.termux/files/home/QEMUAppleSilicon/include/standard-headers/linux/virtio_ring.h /data/data/com.termux/files/usr/include/linux/ else # This is a fatal error, but don't report it yet, because we # might be going to just print the --help text, or it might @@ -427,11 +431,6 @@ else fi fi -if check_define __ANDROID__ ; then - rm /data/data/com.termux/files/usr/include/linux/virtio_ring.h - cp /data/data/com.termux/files/home/QEMUAppleSilicon/include/standard-headers/linux/virtio_ring.h /data/data/com.termux/files/usr/include/linux/ -fi - # Normalise host CPU name to the values used by Meson cross files and in source # directories, and set multilib cflags. The canonicalization isn't really # necessary, because the architectures that we check for should not hit the From f5fbaad2c4778e87beb798c0d97199ee165c6900 Mon Sep 17 00:00:00 2001 From: Sam2159 <81921831+Sam2159@users.noreply.github.com> Date: Wed, 2 Jul 2025 22:46:03 +0200 Subject: [PATCH 19/21] Update configure Signed-off-by: Sam2159 <81921831+Sam2159@users.noreply.github.com> --- configure | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/configure b/configure index 6f4574980bf..9a6aff29754 100755 --- a/configure +++ b/configure @@ -362,8 +362,6 @@ elif check_define __APPLE__; then host_os=darwin elif check_define __ANDROID__ ; then host_os=linux - rm /data/data/com.termux/files/usr/include/linux/virtio_ring.h - cp /data/data/com.termux/files/home/QEMUAppleSilicon/include/standard-headers/linux/virtio_ring.h /data/data/com.termux/files/usr/include/linux/ else # This is a fatal error, but don't report it yet, because we # might be going to just print the --help text, or it might @@ -431,6 +429,11 @@ else fi fi +if check_define __ANDROID__ ; then + rm /data/data/com.termux/files/usr/include/linux/virtio_ring.h + cp /data/data/com.termux/files/home/QEMUAppleSilicon/include/standard-headers/linux/virtio_ring.h /data/data/com.termux/files/usr/include/linux/ +fi + # Normalise host CPU name to the values used by Meson cross files and in source # directories, and set multilib cflags. The canonicalization isn't really # necessary, because the architectures that we check for should not hit the From bd6f6194fd4c46fe798e4c69148cadaa3dc8caeb Mon Sep 17 00:00:00 2001 From: Sam2159 <81921831+Sam2159@users.noreply.github.com> Date: Wed, 2 Jul 2025 23:26:39 +0200 Subject: [PATCH 20/21] Update configure Signed-off-by: Sam2159 <81921831+Sam2159@users.noreply.github.com> --- configure | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure b/configure index 9a6aff29754..839d8c42f63 100755 --- a/configure +++ b/configure @@ -361,7 +361,7 @@ elif check_define __NetBSD__; then elif check_define __APPLE__; then host_os=darwin elif check_define __ANDROID__ ; then - host_os=linux + host_os=android else # This is a fatal error, but don't report it yet, because we # might be going to just print the --help text, or it might From ce00daf0da11bec4a830b5ae8ec68335fd91f9ac Mon Sep 17 00:00:00 2001 From: Sam2159 <81921831+Sam2159@users.noreply.github.com> Date: Thu, 3 Jul 2025 00:03:53 +0200 Subject: [PATCH 21/21] Update configure Signed-off-by: Sam2159 <81921831+Sam2159@users.noreply.github.com> --- configure | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/configure b/configure index 839d8c42f63..bcd69d3e26a 100755 --- a/configure +++ b/configure @@ -340,7 +340,7 @@ int main(void) { return 0; } EOF } -if check_define __linux__ ; then +if check_define __linux__ || check_define __ANDROID__ ; then host_os=linux elif check_define _WIN32 ; then host_os=windows @@ -360,8 +360,6 @@ elif check_define __NetBSD__; then host_os=netbsd elif check_define __APPLE__; then host_os=darwin -elif check_define __ANDROID__ ; then - host_os=android else # This is a fatal error, but don't report it yet, because we # might be going to just print the --help text, or it might