From patchwork Mon Jun 6 18:58:18 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 9159027 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id BA3D060573 for ; Mon, 6 Jun 2016 19:02:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A883928352 for ; Mon, 6 Jun 2016 19:02:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9BD9E2835A; Mon, 6 Jun 2016 19:02:57 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 3104F28352 for ; Mon, 6 Jun 2016 19:02:57 +0000 (UTC) Received: from localhost ([::1]:44598 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b9znb-0003aS-3Y for patchwork-qemu-devel@patchwork.kernel.org; Mon, 06 Jun 2016 15:02:55 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59566) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b9zjM-0000Cq-NH for qemu-devel@nongnu.org; Mon, 06 Jun 2016 14:58:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b9zjK-0003oV-Lh for qemu-devel@nongnu.org; Mon, 06 Jun 2016 14:58:31 -0400 Received: from orth.archaic.org.uk ([2001:8b0:1d0::2]:57568) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b9zjK-0003oH-EZ for qemu-devel@nongnu.org; Mon, 06 Jun 2016 14:58:30 -0400 Received: from pm215 by orth.archaic.org.uk with local (Exim 4.84_2) (envelope-from ) id 1b9zjJ-0008TC-PZ; Mon, 06 Jun 2016 19:58:29 +0100 From: Peter Maydell To: qemu-devel@nongnu.org Date: Mon, 6 Jun 2016 19:58:18 +0100 Message-Id: <1465239499-5048-18-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1465239499-5048-1-git-send-email-peter.maydell@linaro.org> References: <1465239499-5048-1-git-send-email-peter.maydell@linaro.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:8b0:1d0::2 Subject: [Qemu-devel] [PATCH 17/18] linux-user: Make target_strerror() return 'const char *' X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Riku Voipio , Laurent Vivier , patches@linaro.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Make target_strerror() return 'const char *' rather than just 'char *'; this will allow us to return constant strings from it for some special cases. Signed-off-by: Peter Maydell Reviewed-by: Laurent Vivier --- linux-user/qemu.h | 2 +- linux-user/strace.c | 4 ++-- linux-user/syscall.c | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/linux-user/qemu.h b/linux-user/qemu.h index 6bd7b32..56f29c3 100644 --- a/linux-user/qemu.h +++ b/linux-user/qemu.h @@ -195,7 +195,7 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1, void gemu_log(const char *fmt, ...) GCC_FMT_ATTR(1, 2); extern THREAD CPUState *thread_cpu; void cpu_loop(CPUArchState *env); -char *target_strerror(int err); +const char *target_strerror(int err); int get_osversion(void); void init_qemu_uname_release(void); void fork_start(void); diff --git a/linux-user/strace.c b/linux-user/strace.c index 0810c85..c5980a1 100644 --- a/linux-user/strace.c +++ b/linux-user/strace.c @@ -281,7 +281,7 @@ print_ipc(const struct syscallname *name, static void print_syscall_ret_addr(const struct syscallname *name, abi_long ret) { - char *errstr = NULL; + const char *errstr = NULL; if (ret < 0) { errstr = target_strerror(-ret); @@ -1594,7 +1594,7 @@ void print_syscall_ret(int num, abi_long ret) { int i; - char *errstr = NULL; + const char *errstr = NULL; for(i=0;i= (abi_ulong)(-4096); } -char *target_strerror(int err) +const char *target_strerror(int err) { if ((err >= ERRNO_TABLE_SIZE) || (err < 0)) { return NULL;