bsd-user: Add target_sockaddr and safe_ioctl to syscall_defs.h

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 <sson@FreeBSD.org>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
Signed-off-by: Warner Losh <imp@bsdimp.com>
This commit is contained in:
Stacey Son
2026-03-13 22:15:34 -06:00
committed by Warner Losh
parent 573028b263
commit 1f58a7c8a1

View File

@@ -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 */