From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-sender-0.a4lg.com (mail-sender.a4lg.com [153.120.152.154]) by sourceware.org (Postfix) with ESMTPS id 01B5B3898397 for ; Thu, 20 Oct 2022 09:36:46 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 01B5B3898397 Received: from [127.0.0.1] (localhost [127.0.0.1]) by mail-sender-0.a4lg.com (Postfix) with ESMTPSA id 549A6300089; Thu, 20 Oct 2022 09:36:45 +0000 (UTC) From: Tsukasa OI To: Tsukasa OI , Andrew Burgess , Mike Frysinger , Nick Clifton Cc: gdb-patches@sourceware.org Subject: [PATCH 22/40] sim/m32r: Fixes to Linux emulator Date: Thu, 20 Oct 2022 09:32:27 +0000 Message-Id: In-Reply-To: References: Mime-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-12.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, GIT_PATCH_0, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org 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: , X-List-Received-Date: Thu, 20 Oct 2022 09:36:48 -0000 This commit fixes various M32R Linux emulator issues. 1. Some header files were missing a. for ioctl b. for setfsuid/setfsgid (Linux 1.2 or later) c. for flock (a syscall on Linux 2.0 or later) d. for sendfile (Linux 2.2 or later) 2. syslog function must be called as a syscall rather than POSIX syslog because we are emulating Linux system calls on the Linux host. 3. ftime function is deprecated but used intentionally. We have to disable deprecated function warning. --- sim/m32r/traps.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/sim/m32r/traps.c b/sim/m32r/traps.c index f0fb218a11d..de275b06a40 100644 --- a/sim/m32r/traps.c +++ b/sim/m32r/traps.c @@ -20,6 +20,7 @@ /* This must come before any other includes. */ #include "defs.h" +#include "diagnostics.h" #include "portability.h" #include "sim-main.h" #include "sim-signal.h" @@ -38,9 +39,14 @@ NB: The emulation is also missing argument conversion (endian & bitsize) even on Linux hosts. */ #ifdef __linux__ +#include +#include +#include #include #include #include +#include +#include #include #include #include @@ -397,7 +403,10 @@ m32r_trap (SIM_CPU *current_cpu, PCADDR pc, int num) { struct timeb t; +DIAGNOSTIC_PUSH +DIAGNOSTIC_IGNORE_DEPRECATED_DECLARATIONS result = ftime (&t); +DIAGNOSTIC_POP errcode = errno; if (result != 0) @@ -851,7 +860,7 @@ m32r_trap (SIM_CPU *current_cpu, PCADDR pc, int num) break; case TARGET_LINUX_SYS_syslog: - result = syslog (arg1, (char *) t2h_addr (cb, &s, arg2)); + result = syscall (SYS_syslog, arg1, (char *) t2h_addr (cb, &s, arg2), arg3); errcode = errno; break; -- 2.34.1