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_mmsghdr)
13 typedef struct mmsghdr struct_mmsghdr;
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_mmsghdr,
26 struct tcb *const tcp, const kernel_ulong_t addr,
29 struct mmsghdr *p_native = p;
30 struct_mmsghdr 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_hdr.msg_name = (void *) (unsigned long)
39 v_compat.msg_hdr.msg_name;
41 p_native->msg_hdr.msg_namelen =
42 v_compat.msg_hdr.msg_namelen;
44 p_native->msg_hdr.msg_iov = (void *) (unsigned long)
45 v_compat.msg_hdr.msg_iov;
47 p_native->msg_hdr.msg_iovlen =
48 v_compat.msg_hdr.msg_iovlen;
50 p_native->msg_hdr.msg_control = (void *) (unsigned long)
51 v_compat.msg_hdr.msg_control;
53 p_native->msg_hdr.msg_controllen =
54 v_compat.msg_hdr.msg_controllen;
56 p_native->msg_hdr.msg_flags =
57 v_compat.msg_hdr.msg_flags;
62 return sizeof(v_compat);
65 MPERS_PRINTER_DECL(unsigned int, sizeof_struct_mmsghdr, void)
67 return sizeof(struct_mmsghdr);