git: 42317e642645 - main - linux(4): Implement __vdso_time

From: Dmitry Chagin <dchagin_at_FreeBSD.org>
Date: Mon, 04 Jul 2022 20:43:45 UTC
The branch main has been updated by dchagin:

URL: https://cgit.FreeBSD.org/src/commit/?id=42317e642645b36e711b5dd560d06a303a492e0f

commit 42317e642645b36e711b5dd560d06a303a492e0f
Author:     Dmitry Chagin <dchagin@FreeBSD.org>
AuthorDate: 2022-07-04 20:41:32 +0000
Commit:     Dmitry Chagin <dchagin@FreeBSD.org>
CommitDate: 2022-07-04 20:41:32 +0000

    linux(4): Implement __vdso_time
    
    PR:             240769
    MFC after:      3 days
---
 sys/compat/linux/linux_vdso_gtod.inc | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/sys/compat/linux/linux_vdso_gtod.inc b/sys/compat/linux/linux_vdso_gtod.inc
index f101fe81f7f8..8a3840edd87d 100644
--- a/sys/compat/linux/linux_vdso_gtod.inc
+++ b/sys/compat/linux/linux_vdso_gtod.inc
@@ -372,7 +372,14 @@ __vdso_getcpu(uint32_t *cpu, uint32_t *node, void *cache)
 int
 __vdso_time(long *tm)
 {
+	struct timeval tv;
+	int error;
 
-	return (__vdso_time_fallback(tm));
+	error = freebsd_gettimeofday(&tv, NULL);
+	if (error != 0)
+		return (__vdso_time_fallback(tm));
+	if (tm != NULL)
+		*tm = tv.tv_sec;
+	return (tv.tv_sec);
 }
 #endif