summary refs log tree commit diff stats
path: root/linux-user/qemu.h
diff options
context:
space:
mode:
authorMichael Vogt <mvogt@redhat.com>2024-10-01 17:14:54 +0200
committerRichard Henderson <richard.henderson@linaro.org>2024-10-08 06:31:36 -0700
commit9729930344687c7077531ab07cb9dc275795b413 (patch)
treeed305f54422b61fcbe79c6a16108e0c03d7c13c1 /linux-user/qemu.h
parent9651cead2f1bb34b9b72f9c2c5dc81baea2b082e (diff)
downloadfocaccia-qemu-9729930344687c7077531ab07cb9dc275795b413.tar.gz
focaccia-qemu-9729930344687c7077531ab07cb9dc275795b413.zip
linux-user: add strace support for openat2
This commit adds support for the `openat2()` to `QEMU_STRACE`. It
will use the `openat2.h` header if available to create user
readable flags for the `resolve` argument but does not require
the header otherwise.

It also makes `copy_struct_from_user()` available via `qemu.h`
and `open_how_ver0` via `syscall_defs.h` so that strace.c can use
them.

Signed-off-by: Michael Vogt <mvogt@redhat.com>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Message-ID: <f02d40c7751c03af885ced6dd94e4734d4be4d8f.1727795334.git.mvogt@redhat.com>
[rth: Add braces around the expanded how structure, like strace(3)]
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Diffstat (limited to 'linux-user/qemu.h')
-rw-r--r--linux-user/qemu.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/linux-user/qemu.h b/linux-user/qemu.h
index 2e90a97175..98ad848ab2 100644
--- a/linux-user/qemu.h
+++ b/linux-user/qemu.h
@@ -313,6 +313,15 @@ static inline bool access_ok(CPUState *cpu, int type,
 int copy_from_user(void *hptr, abi_ulong gaddr, ssize_t len);
 int copy_to_user(abi_ulong gaddr, void *hptr, ssize_t len);
 
+/*
+ * copy_struct_from_user() copies a target struct to a host struct, in
+ * a way that guarantees backwards-compatibility for struct syscall
+ * arguments.
+ *
+ * Similar to kernels uaccess.h:copy_struct_from_user()
+ */
+int copy_struct_from_user(void *dst, size_t ksize, abi_ptr src, size_t usize);
+
 /* Functions for accessing guest memory.  The tget and tput functions
    read/write single values, byteswapping as necessary.  The lock_user function
    gets a pointer to a contiguous area of guest memory, but does not perform