2 * Copyright (c) 2016-2018 Dmitry V. Levin <ldv@altlinux.org>
5 * SPDX-License-Identifier: LGPL-2.1-or-later
10 #include DEF_MPERS_TYPE(struct_msghdr)
13 typedef struct msghdr struct_msghdr;
18 * On success, return the number of fetched bytes.
21 * This function cannot use umove_or_printaddr because
22 * it is called by dumpio and therefore cannot print anything.
25 MPERS_PRINTER_DECL(int, fetch_struct_msghdr,
26 struct tcb *const tcp, const kernel_ulong_t addr,
29 struct msghdr *const p_native = p;
30 struct_msghdr v_compat;
32 if (sizeof(*p_native) == sizeof(v_compat))
33 return umove(tcp, addr, p_native) ? 0 : sizeof(*p_native);
35 if (umove(tcp, addr, &v_compat))
38 p_native->msg_name = (void *) (unsigned long)
41 p_native->msg_namelen =
44 p_native->msg_iov = (void *) (unsigned long)
47 p_native->msg_iovlen =
50 p_native->msg_control = (void *) (unsigned long)
53 p_native->msg_controllen =
54 v_compat.msg_controllen;
59 return sizeof(v_compat);