From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id BANcK3NmhGAkLgAAWB0awg (envelope-from ) for ; Sat, 24 Apr 2021 14:41:55 -0400 Received: by simark.ca (Postfix, from userid 112) id AC3831F11E; Sat, 24 Apr 2021 14:41:55 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-1.1 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,MAILING_LIST_MULTI,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id E28B81E54D for ; Sat, 24 Apr 2021 14:41:54 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 23B3B396901F; Sat, 24 Apr 2021 18:41:54 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 23B3B396901F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1619289714; bh=YDzCNGXgqWHoFq0ZbV6WiIoICP6s9zhk8bgRiCZofM8=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=CMEw2JsReoRG2jRGtsvIPJokd9hUGwVjPmihTsci/CHbr+ic0oDTUBbFZhQHI7MAG G6TtL5Biy/bEBra2tFXj95WruoON7+w6dAqM2nbstVR51sI7+earwu3OA69rjH4jpD +9LA2NcGg+IRMaUWGLg/zQTLGZHOC2SqBOvzfVf0= Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by sourceware.org (Postfix) with ESMTP id 2A2A939450D3 for ; Sat, 24 Apr 2021 18:41:50 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 2A2A939450D3 Received: from vapier.lan (localhost [127.0.0.1]) by smtp.gentoo.org (Postfix) with ESMTP id 59D453413BB for ; Sat, 24 Apr 2021 18:41:49 +0000 (UTC) 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 Message-Id: <20210424184144.23736-5-vapier@gentoo.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210424184144.23736-1-vapier@gentoo.org> References: <20210424184144.23736-1-vapier@gentoo.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Mike Frysinger via Gdb-patches Reply-To: Mike Frysinger Errors-To: gdb-patches-bounces@sourceware.org Sender: "Gdb-patches" 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 #include +#include /* Needed for enum bfd_endian. */ #include "bfd.h" @@ -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