Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Mike Frysinger via Gdb-patches <gdb-patches@sourceware.org>
To: gdb-patches@sourceware.org
Subject: [PATCH 5/6] sim: callback: convert time interface to 64-bit
Date: Sat, 24 Apr 2021 14:41:43 -0400	[thread overview]
Message-ID: <20210424184144.23736-5-vapier@gentoo.org> (raw)
In-Reply-To: <20210424184144.23736-1-vapier@gentoo.org>

Rather than rely on time_t being the right size between the host &
target, have the interface always be 64-bit.  We can figure out if
we need to truncate when actually outputting it to the right target.
---
 include/gdb/callback.h |  3 ++-
 sim/common/callback.c  | 11 +++++++----
 2 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/include/gdb/callback.h b/include/gdb/callback.h
index 11a941259f64..f86fe7e4c548 100644
--- a/include/gdb/callback.h
+++ b/include/gdb/callback.h
@@ -47,6 +47,7 @@
 
 #include <ansidecl.h>
 #include <stdarg.h>
+#include <stdint.h>
 /* Needed for enum bfd_endian.  */
 #include "bfd.h"
 \f
@@ -78,7 +79,7 @@ struct host_callback_struct
   int (*read_stdin) ( host_callback *, char *, int);
   int (*rename) (host_callback *, const char *, const char *);
   int (*system) (host_callback *, const char *);
-  long (*time) (host_callback *, long *);
+  int64_t (*time) (host_callback *, int64_t *);
   int (*unlink) (host_callback *, const char *);
   int (*write) (host_callback *,int, const char *, int);
   int (*write_stdout) (host_callback *, const char *, int);
diff --git a/sim/common/callback.c b/sim/common/callback.c
index 2b27226f0060..da8ea3e2f10c 100644
--- a/sim/common/callback.c
+++ b/sim/common/callback.c
@@ -420,12 +420,15 @@ os_system (host_callback *p, const char *s)
   return result;
 }
 
-static long
-os_time (host_callback *p, long *t)
+static int64_t
+os_time (host_callback *p, int64_t *t64)
 {
-  long result;
+  int64_t result;
+  time_t t;
 
-  result = time (t);
+  result = time (&t);
+  if (t64)
+    *t64 = t;
   p->last_errno = errno;
   return result;
 }
-- 
2.30.2


  parent reply	other threads:[~2021-04-24 18:41 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-24 18:41 [PATCH 1/6] gdb: callback: always include necessary headers Mike Frysinger via Gdb-patches
2021-04-24 18:41 ` [PATCH 2/6] gdb: callback: use ATTRIBUTE_NORETURN Mike Frysinger via Gdb-patches
2021-04-24 18:41 ` [PATCH 3/6] gdb: callback: inline PTR define Mike Frysinger via Gdb-patches
2021-04-24 18:41 ` [PATCH 4/6] sim: callback: inline wrap helper Mike Frysinger via Gdb-patches
2021-04-24 18:41 ` Mike Frysinger via Gdb-patches [this message]
2021-04-24 21:11   ` [PATCH 5/6] sim: callback: convert time interface to 64-bit Tom Tromey
2021-04-24 22:36     ` Mike Frysinger via Gdb-patches
2021-05-14  5:39   ` [PATCH 5/6 v2] " Mike Frysinger via Gdb-patches
2021-05-14 14:00     ` Tom Tromey
2021-04-24 18:41 ` [PATCH 6/6] sim: callback: convert FS interfaces " Mike Frysinger via Gdb-patches

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=20210424184144.23736-5-vapier@gentoo.org \
    --to=gdb-patches@sourceware.org \
    --cc=vapier@gentoo.org \
    /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