diff mbox series

[4/4] oslib: drop qemu_gettimeofday()

Message ID 20220304152704.3466036-5-marcandre.lureau@redhat.com
State New
Headers show
Series RFC: remove qemu_gettimeofday() | expand

Commit Message

Marc-André Lureau March 4, 2022, 3:27 p.m. UTC
From: Marc-André Lureau <marcandre.lureau@redhat.com>

No longer used after the previous patches.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
 include/sysemu/os-posix.h |  3 ---
 include/sysemu/os-win32.h |  6 ------
 util/oslib-win32.c        | 20 --------------------
 3 files changed, 29 deletions(-)

Comments

Laurent Vivier March 4, 2022, 4:09 p.m. UTC | #1
Le 04/03/2022 à 16:27, marcandre.lureau@redhat.com a écrit :
> From: Marc-André Lureau <marcandre.lureau@redhat.com>
> 
> No longer used after the previous patches.
> 
> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> ---
>   include/sysemu/os-posix.h |  3 ---
>   include/sysemu/os-win32.h |  6 ------
>   util/oslib-win32.c        | 20 --------------------
>   3 files changed, 29 deletions(-)
> 

Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Stefan Weil March 4, 2022, 4:21 p.m. UTC | #2
Am 04.03.22 um 16:27 schrieb marcandre.lureau@redhat.com:

> From: Marc-André Lureau <marcandre.lureau@redhat.com>
>
> No longer used after the previous patches.
>
> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> ---
>   include/sysemu/os-posix.h |  3 ---
>   include/sysemu/os-win32.h |  6 ------
>   util/oslib-win32.c        | 20 --------------------
>   3 files changed, 29 deletions(-)
>
> diff --git a/include/sysemu/os-posix.h b/include/sysemu/os-posix.h
> index 2edf33658a44..c9b1d63fedda 100644
> --- a/include/sysemu/os-posix.h
> +++ b/include/sysemu/os-posix.h
> @@ -52,9 +52,6 @@ int os_mlock(void);
>   #define closesocket(s) close(s)
>   #define ioctlsocket(s, r, v) ioctl(s, r, v)
>   
> -typedef struct timeval qemu_timeval;
> -#define qemu_gettimeofday(tp) gettimeofday(tp, NULL)
> -
>   bool is_daemonized(void);
>   
>   /**
> diff --git a/include/sysemu/os-win32.h b/include/sysemu/os-win32.h
> index 43f569b5c216..4d4be826f48c 100644
> --- a/include/sysemu/os-win32.h
> +++ b/include/sysemu/os-win32.h
> @@ -71,12 +71,6 @@ int getpagesize(void);
>   # define EPROTONOSUPPORT EINVAL
>   #endif
>   
> -typedef struct {
> -    long tv_sec;
> -    long tv_usec;
> -} qemu_timeval;
> -int qemu_gettimeofday(qemu_timeval *tp);
> -
>   static inline bool is_daemonized(void)
>   {
>       return false;
> diff --git a/util/oslib-win32.c b/util/oslib-win32.c
> index af559ef3398d..7faf59e9aaea 100644
> --- a/util/oslib-win32.c
> +++ b/util/oslib-win32.c
> @@ -265,26 +265,6 @@ void qemu_set_cloexec(int fd)
>   {
>   }
>   
> -/* Offset between 1/1/1601 and 1/1/1970 in 100 nanosec units */
> -#define _W32_FT_OFFSET (116444736000000000ULL)
> -
> -int qemu_gettimeofday(qemu_timeval *tp)
> -{
> -  union {
> -    unsigned long long ns100; /*time since 1 Jan 1601 in 100ns units */
> -    FILETIME ft;
> -  }  _now;
> -
> -  if(tp) {
> -      GetSystemTimeAsFileTime (&_now.ft);
> -      tp->tv_usec=(long)((_now.ns100 / 10ULL) % 1000000ULL );
> -      tp->tv_sec= (long)((_now.ns100 - _W32_FT_OFFSET) / 10000000ULL);
> -  }
> -  /* Always return 0 as per Open Group Base Specifications Issue 6.
> -     Do not set errno on error.  */
> -  return 0;
> -}
> -
>   int qemu_get_thread_id(void)
>   {
>       return GetCurrentThreadId();


Reviewed-by: Stefan Weil <sw@weilnetz.de>
Richard Henderson March 4, 2022, 8:58 p.m. UTC | #3
On 3/4/22 05:27, marcandre.lureau@redhat.com wrote:
> From: Marc-André Lureau <marcandre.lureau@redhat.com>
> 
> No longer used after the previous patches.
> 
> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> ---
>   include/sysemu/os-posix.h |  3 ---
>   include/sysemu/os-win32.h |  6 ------
>   util/oslib-win32.c        | 20 --------------------
>   3 files changed, 29 deletions(-)

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>


r~
diff mbox series

Patch

diff --git a/include/sysemu/os-posix.h b/include/sysemu/os-posix.h
index 2edf33658a44..c9b1d63fedda 100644
--- a/include/sysemu/os-posix.h
+++ b/include/sysemu/os-posix.h
@@ -52,9 +52,6 @@  int os_mlock(void);
 #define closesocket(s) close(s)
 #define ioctlsocket(s, r, v) ioctl(s, r, v)
 
-typedef struct timeval qemu_timeval;
-#define qemu_gettimeofday(tp) gettimeofday(tp, NULL)
-
 bool is_daemonized(void);
 
 /**
diff --git a/include/sysemu/os-win32.h b/include/sysemu/os-win32.h
index 43f569b5c216..4d4be826f48c 100644
--- a/include/sysemu/os-win32.h
+++ b/include/sysemu/os-win32.h
@@ -71,12 +71,6 @@  int getpagesize(void);
 # define EPROTONOSUPPORT EINVAL
 #endif
 
-typedef struct {
-    long tv_sec;
-    long tv_usec;
-} qemu_timeval;
-int qemu_gettimeofday(qemu_timeval *tp);
-
 static inline bool is_daemonized(void)
 {
     return false;
diff --git a/util/oslib-win32.c b/util/oslib-win32.c
index af559ef3398d..7faf59e9aaea 100644
--- a/util/oslib-win32.c
+++ b/util/oslib-win32.c
@@ -265,26 +265,6 @@  void qemu_set_cloexec(int fd)
 {
 }
 
-/* Offset between 1/1/1601 and 1/1/1970 in 100 nanosec units */
-#define _W32_FT_OFFSET (116444736000000000ULL)
-
-int qemu_gettimeofday(qemu_timeval *tp)
-{
-  union {
-    unsigned long long ns100; /*time since 1 Jan 1601 in 100ns units */
-    FILETIME ft;
-  }  _now;
-
-  if(tp) {
-      GetSystemTimeAsFileTime (&_now.ft);
-      tp->tv_usec=(long)((_now.ns100 / 10ULL) % 1000000ULL );
-      tp->tv_sec= (long)((_now.ns100 - _W32_FT_OFFSET) / 10000000ULL);
-  }
-  /* Always return 0 as per Open Group Base Specifications Issue 6.
-     Do not set errno on error.  */
-  return 0;
-}
-
 int qemu_get_thread_id(void)
 {
     return GetCurrentThreadId();