This change supports SO_TIMESTAMPNS and SO_TIMESTAMPING for
setsocketopt() with SOL_SOCKET.
The TARGET_SO_TIMESTAMP{NS,ING} constants are already defined for
alpha, hppa, and sparc. In include/uapi/asm-generic/socket.h:
In arch/mips/include/uapi/asm/socket.h:
Signed-off-by: Shu-Chun Weng <scw@google.com>
---
linux-user/generic/sockbits.h | 4 ++++
linux-user/mips/sockbits.h | 4 ++++
linux-user/syscall.c | 10 ++++++++--
3 files changed, 16 insertions(+), 2 deletions(-)
diff --git a/linux-user/generic/sockbits.h b/linux-user/generic/sockbits.h
index e44733c601..5cbafdb49b 100644
--- a/linux-user/generic/sockbits.h
+++ b/linux-user/generic/sockbits.h
@@ -51,6 +51,10 @@
#define TARGET_SO_PEERNAME 28
#define TARGET_SO_TIMESTAMP 29
#define TARGET_SCM_TIMESTAMP TARGET_SO_TIMESTAMP
+#define TARGET_SO_TIMESTAMPNS 35
+#define TARGET_SCM_TIMESTAMPNS TARGET_SO_TIMESTAMPNS
+#define TARGET_SO_TIMESTAMPING 37
+#define TARGET_SCM_TIMESTAMPING TARGET_SO_TIMESTAMPING
#define TARGET_SO_ACCEPTCONN 30
diff --git a/linux-user/mips/sockbits.h b/linux-user/mips/sockbits.h
index 0f022cd598..1246b7d988 100644
--- a/linux-user/mips/sockbits.h
+++ b/linux-user/mips/sockbits.h
@@ -63,6 +63,10 @@
#define TARGET_SO_PEERNAME 28
#define TARGET_SO_TIMESTAMP 29
#define SCM_TIMESTAMP SO_TIMESTAMP
+#define TARGET_SO_TIMESTAMPNS 35
+#define SCM_TIMESTAMPNS SO_TIMESTAMPNS
+#define TARGET_SO_TIMESTAMPING 37
+#define SCM_TIMESTAMPING SO_TIMESTAMPING
#define TARGET_SO_PEERSEC 30
#define TARGET_SO_SNDBUFFORCE 31
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 8dc4255f12..bac00d3fd4 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -2230,8 +2230,14 @@ set_timeout:
optname = SO_PASSSEC;
break;
case TARGET_SO_TIMESTAMP:
- optname = SO_TIMESTAMP;
- break;
+ optname = SO_TIMESTAMP;
+ break;
+ case TARGET_SO_TIMESTAMPNS:
+ optname = SO_TIMESTAMPNS;
+ break;
+ case TARGET_SO_TIMESTAMPING:
+ optname = SO_TIMESTAMPING;
+ break;
case TARGET_SO_RCVLOWAT:
optname = SO_RCVLOWAT;
break;
--
2.23.0.187.g17f5b7556c-goog
Le 23/08/2019 à 01:14, Shu-Chun Weng via Qemu-devel a écrit :
> This change supports SO_TIMESTAMPNS and SO_TIMESTAMPING for
> setsocketopt() with SOL_SOCKET.
>
> The TARGET_SO_TIMESTAMP{NS,ING} constants are already defined for
> alpha, hppa, and sparc. In include/uapi/asm-generic/socket.h:
>
> In arch/mips/include/uapi/asm/socket.h:
>
> Signed-off-by: Shu-Chun Weng <scw@google.com>
> ---
> linux-user/generic/sockbits.h | 4 ++++
> linux-user/mips/sockbits.h | 4 ++++
> linux-user/syscall.c | 10 ++++++++--
> 3 files changed, 16 insertions(+), 2 deletions(-)
>
> diff --git a/linux-user/generic/sockbits.h b/linux-user/generic/sockbits.h
> index e44733c601..5cbafdb49b 100644
> --- a/linux-user/generic/sockbits.h
> +++ b/linux-user/generic/sockbits.h
> @@ -51,6 +51,10 @@
> #define TARGET_SO_PEERNAME 28
> #define TARGET_SO_TIMESTAMP 29
> #define TARGET_SCM_TIMESTAMP TARGET_SO_TIMESTAMP
> +#define TARGET_SO_TIMESTAMPNS 35
> +#define TARGET_SCM_TIMESTAMPNS TARGET_SO_TIMESTAMPNS
> +#define TARGET_SO_TIMESTAMPING 37
> +#define TARGET_SCM_TIMESTAMPING TARGET_SO_TIMESTAMPING
We must not rely on TARGET_SO_TIMESTAMP and TARGET_SO_TIMESTAMPNS but on
the _OLD and _NEW versions.
See:
6d5d5dde9adb ("linux-user: fix to handle variably sized SIOCGSTAMP with
new kernels")
So the existing definitions must be removed and the _NEW and _OLD
versions added.
Thanks,
Laurent
© 2016 - 2026 Red Hat, Inc.