From: Stacey Son <[email protected]>

Add struct target_sockaddr and target_in_addr definitions for socket
address handling and safe_ioctl macro for safe ioctl system calls.

Signed-off-by: Stacey Son <[email protected]>
Reviewed-by: Pierrick Bouvier <[email protected]>
Signed-off-by: Warner Losh <[email protected]>
---
 bsd-user/syscall_defs.h | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/bsd-user/syscall_defs.h b/bsd-user/syscall_defs.h
index 81f567cb33..0612be8bbb 100644
--- a/bsd-user/syscall_defs.h
+++ b/bsd-user/syscall_defs.h
@@ -537,6 +537,20 @@ type safe_##name(type1 arg1, type2 arg2, type3 arg3, type4 
arg4, \
     return safe_syscall(SYS_##name, arg1, arg2, arg3, arg4, arg5, arg6); \
 }
 
+/*
+ * sys/socket.h
+ */
+struct target_sockaddr {
+    uint8_t sa_len;
+    uint8_t sa_family;
+    uint8_t sa_data[14];
+} QEMU_PACKED;
+
+struct target_in_addr {
+    uint32_t s_addr; /* big endian */
+};
+
+#define safe_ioctl(...) safe_syscall(SYS_ioctl, __VA_ARGS__)
 #define safe_fcntl(...) safe_syscall(SYS_fcntl, __VA_ARGS__)
 
 /* So far all target and host bitmasks are the same */
-- 
2.52.0


Reply via email to