From patchwork Thu Oct 20 09:32:27 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tsukasa OI X-Patchwork-Id: 59157 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 1977138E9D1C for ; Thu, 20 Oct 2022 09:38:48 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1977138E9D1C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1666258728; bh=lhPrc6ldQVn5MVnn3m7xcurdBduYWL9K2YcNIO/MAEU=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=bKzE+uWnBkOeMOUWxiZDauWskSOYs0QIlGwfixwsWeYH7MMFAZd3fb34jgYn7qlk+ FKqiygAmrinDKs7yIZUhFPvwcQAlD7hlU7lQDQre8BqK+DSyxXpYSWd7GYIo8JyY2O nW1zaISvwpihNQPfb9QSB84c7zrYCthF/Axu2nSk= X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org 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) To: Tsukasa OI , Andrew Burgess , Mike Frysinger , Nick Clifton 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 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-Patchwork-Original-From: Tsukasa OI via Gdb-patches From: Tsukasa OI Reply-To: Tsukasa OI Cc: gdb-patches@sourceware.org Errors-To: gdb-patches-bounces+patchwork=sourceware.org@sourceware.org Sender: "Gdb-patches" 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;