From: Laurent Vivier <laurent@vivier.eu>
To: qemu-devel@nongnu.org
Cc: Filip Bozuta <Filip.Bozuta@syrmia.com>,
Riku Voipio <riku.voipio@iki.fi>,
Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>,
Laurent Vivier <laurent@vivier.eu>,
Artyom Tarasenko <atar4qemu@gmail.com>
Subject: [PULL 10/12] linux-user: Add thunk argument types for SIOCGSTAMP and SIOCGSTAMPNS
Date: Sat, 4 Jul 2020 18:25:43 +0200 [thread overview]
Message-ID: <20200704162545.311133-11-laurent@vivier.eu> (raw)
In-Reply-To: <20200704162545.311133-1-laurent@vivier.eu>
From: Filip Bozuta <Filip.Bozuta@syrmia.com>
Socket ioctls SIOCGSTAMP and SIOCGSTAMPNS, used for timestamping the socket
connection, are defined in file "ioctls.h" differently from other ioctls.
The reason for this difference is explained in the comments above their definition.
These ioctls didn't have defined thunk argument types before changes from this
patch. They have special handling functions ("do_ioctl_SIOCGSTAMP" and
"do_ioctl_SIOCGSTAMPNS") that take care of setting values for approppriate argument
types (struct timeval and struct timespec) and thus no thunk argument types were
needed for their implementation. But this patch adds those argument type definitions
in file "syscall_types.h" and "ioctls.h" as it is needed for printing arguments
of these ioctls with strace.
Implementation notes:
There are two variants of these ioctls: SIOCGSTAMP_OLD/SIOCGSTAM_NEW and
SIOCGSTAMPNS_OLD/SIOCGSTAMPNS_NEW. One is the old existing definition and the
other is the 2038 safe variant used for 32-bit architectures. Corresponding
structure definitions STRUCT_timespec/STRUCT__kernel_timespec and
STRUCT_timeval/STRUCT__kernel_sock_timeval were added for these variants.
STRUCT_timeval definition was already inside the file as it is used by
another implemented ioctl. Two cases were added for definitions
STRUCT_timeval/STRUCT__kernel_sock_timeval to manage the case when the
"u_sec" field of the timeval structure is of type int.
Signed-off-by: Filip Bozuta <Filip.Bozuta@syrmia.com>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Message-Id: <20200619124727.18080-2-filip.bozuta@syrmia.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
---
linux-user/ioctls.h | 12 ++++++++----
linux-user/syscall_types.h | 22 ++++++++++++++++++++++
2 files changed, 30 insertions(+), 4 deletions(-)
diff --git a/linux-user/ioctls.h b/linux-user/ioctls.h
index f2e2fa9c878b..0713ae131162 100644
--- a/linux-user/ioctls.h
+++ b/linux-user/ioctls.h
@@ -279,13 +279,17 @@
* FIXME: create a macro to define this kind of entry
*/
{ TARGET_SIOCGSTAMP_OLD, TARGET_SIOCGSTAMP_OLD,
- "SIOCGSTAMP_OLD", IOC_R, do_ioctl_SIOCGSTAMP },
+ "SIOCGSTAMP_OLD", IOC_R, do_ioctl_SIOCGSTAMP,
+ { MK_PTR(MK_STRUCT(STRUCT_timeval)) } },
{ TARGET_SIOCGSTAMPNS_OLD, TARGET_SIOCGSTAMPNS_OLD,
- "SIOCGSTAMPNS_OLD", IOC_R, do_ioctl_SIOCGSTAMPNS },
+ "SIOCGSTAMPNS_OLD", IOC_R, do_ioctl_SIOCGSTAMPNS,
+ { MK_PTR(MK_STRUCT(STRUCT_timespec)) } },
{ TARGET_SIOCGSTAMP_NEW, TARGET_SIOCGSTAMP_NEW,
- "SIOCGSTAMP_NEW", IOC_R, do_ioctl_SIOCGSTAMP },
+ "SIOCGSTAMP_NEW", IOC_R, do_ioctl_SIOCGSTAMP,
+ { MK_PTR(MK_STRUCT(STRUCT__kernel_sock_timeval)) } },
{ TARGET_SIOCGSTAMPNS_NEW, TARGET_SIOCGSTAMPNS_NEW,
- "SIOCGSTAMPNS_NEW", IOC_R, do_ioctl_SIOCGSTAMPNS },
+ "SIOCGSTAMPNS_NEW", IOC_R, do_ioctl_SIOCGSTAMPNS,
+ { MK_PTR(MK_STRUCT(STRUCT__kernel_timespec)) } },
IOCTL(RNDGETENTCNT, IOC_R, MK_PTR(TYPE_INT))
IOCTL(RNDADDTOENTCNT, IOC_W, MK_PTR(TYPE_INT))
diff --git a/linux-user/syscall_types.h b/linux-user/syscall_types.h
index e2b0484f50e5..3f1f0334649b 100644
--- a/linux-user/syscall_types.h
+++ b/linux-user/syscall_types.h
@@ -137,10 +137,32 @@ STRUCT(snd_timer_params,
TYPE_INT, /* filter */
MK_ARRAY(TYPE_CHAR, 60)) /* reserved */
+#if defined(TARGET_SPARC64) && !defined(TARGET_ABI32)
+STRUCT(timeval,
+ TYPE_LONG, /* tv_sec */
+ TYPE_INT) /* tv_usec */
+
+STRUCT(_kernel_sock_timeval,
+ TYPE_LONG, /* tv_sec */
+ TYPE_INT) /* tv_usec */
+#else
+STRUCT(timeval,
+ TYPE_LONG, /* tv_sec */
+ TYPE_LONG) /* tv_usec */
+
+STRUCT(_kernel_sock_timeval,
+ TYPE_LONGLONG, /* tv_sec */
+ TYPE_LONGLONG) /* tv_usec */
+#endif
+
STRUCT(timespec,
TYPE_LONG, /* tv_sec */
TYPE_LONG) /* tv_nsec */
+STRUCT(_kernel_timespec,
+ TYPE_LONGLONG, /* tv_sec */
+ TYPE_LONGLONG) /* tv_nsec */
+
STRUCT(snd_timer_status,
MK_STRUCT(STRUCT_timespec), /* tstamp */
TYPE_INT, /* resolution */
--
2.26.2
next prev parent reply other threads:[~2020-07-04 16:29 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-04 16:25 [PULL 00/12] Linux user for 5.1 patches Laurent Vivier
2020-07-04 16:25 ` [PULL 01/12] target/sparc: Translate flushw opcode Laurent Vivier
2020-07-04 16:25 ` [PULL 02/12] linux-user/sparc64: Fix the handling of window spill trap Laurent Vivier
2020-07-04 16:25 ` [PULL 03/12] linux-user: syscall: ioctls: support DRM_IOCTL_VERSION Laurent Vivier
2020-07-04 16:25 ` [PULL 04/12] linux-user: Extend strace support to enable argument printing after syscall execution Laurent Vivier
2020-07-04 16:25 ` [PULL 05/12] linux-user: Add strace support for a group of syscalls Laurent Vivier
2020-07-04 16:25 ` [PULL 06/12] linux-user: Add strace support for printing argument of syscalls used for extended attributes Laurent Vivier
2020-07-04 16:25 ` [PULL 07/12] linux-user: Add strace support for printing arguments of lseek() Laurent Vivier
2020-07-04 16:25 ` [PULL 08/12] linux-user: Add strace support for printing arguments of chown()/lchown() Laurent Vivier
2020-07-04 16:25 ` [PULL 09/12] linux-user: Add strace support for printing arguments of fallocate() Laurent Vivier
2020-07-04 16:25 ` Laurent Vivier [this message]
2020-07-04 16:25 ` [PULL 11/12] linux-user: Add strace support for printing arguments of ioctl() Laurent Vivier
2020-07-09 15:20 ` Peter Maydell
2020-07-09 15:28 ` Laurent Vivier
2020-07-04 16:25 ` [PULL 12/12] MAINTAINERS: update linux-user maintainer Laurent Vivier
2020-07-04 16:40 ` [PULL 00/12] Linux user for 5.1 patches no-reply
2020-07-04 16:53 ` no-reply
2020-07-07 10:16 ` Peter Maydell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200704162545.311133-11-laurent@vivier.eu \
--to=laurent@vivier.eu \
--cc=Filip.Bozuta@syrmia.com \
--cc=atar4qemu@gmail.com \
--cc=mark.cave-ayland@ilande.co.uk \
--cc=qemu-devel@nongnu.org \
--cc=riku.voipio@iki.fi \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).