From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56152) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bAOba-0002Hm-KB for qemu-devel@nongnu.org; Tue, 07 Jun 2016 17:32:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bAObY-0003sZ-HF for qemu-devel@nongnu.org; Tue, 07 Jun 2016 17:32:09 -0400 Received: from mail-vk0-x22e.google.com ([2607:f8b0:400c:c05::22e]:34700) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bAObY-0003sV-Co for qemu-devel@nongnu.org; Tue, 07 Jun 2016 17:32:08 -0400 Received: by mail-vk0-x22e.google.com with SMTP id e4so125050030vkb.1 for ; Tue, 07 Jun 2016 14:32:08 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: <8d955a22-5b2c-d176-1568-c1b9847dba8c@vivier.eu> References: <1465239499-5048-1-git-send-email-peter.maydell@linaro.org> <1465239499-5048-19-git-send-email-peter.maydell@linaro.org> <8d955a22-5b2c-d176-1568-c1b9847dba8c@vivier.eu> From: Peter Maydell Date: Tue, 7 Jun 2016 22:31:45 +0100 Message-ID: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH 18/18] linux-user: Special-case ERESTARTSYS in target_strerror() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Laurent Vivier Cc: QEMU Developers , Patch Tracking , Riku Voipio On 7 June 2016 at 20:53, Laurent Vivier wrote: > > > Le 06/06/2016 =C3=A0 20:58, Peter Maydell a =C3=A9crit : >> Since TARGET_ERESTARTSYS and TARGET_ESIGRETURN are internal-to-QEMU >> error numbers, handle them specially in target_strerror(), to avoid >> confusing strace output like: >> >> 9521 rt_sigreturn(14,8,274886297808,8,0,268435456) =3D -1 errno=3D513 (U= nknown error 513) >> >> Signed-off-by: Peter Maydell >> --- >> linux-user/syscall.c | 7 +++++++ >> 1 file changed, 7 insertions(+) >> >> diff --git a/linux-user/syscall.c b/linux-user/syscall.c >> index bcee02d..782d475 100644 >> --- a/linux-user/syscall.c >> +++ b/linux-user/syscall.c >> @@ -619,6 +619,13 @@ static inline int is_error(abi_long ret) >> >> const char *target_strerror(int err) >> { >> + if (err =3D=3D TARGET_ERESTARTSYS) { >> + return "To be restarted"; >> + } >> + if (err =3D=3D TARGET_QEMU_ESIGRETURN) { >> + return "Successful exit from sigreturn"; >> + } >> + >> if ((err >=3D ERRNO_TABLE_SIZE) || (err < 0)) { >> return NULL; >> } > > This is not the aim of this patch, but target_to_host_errno() has now > these checks, perhaps we can remove this while we are here... I think that would break the callers, which assume they can pass in any number as a potential errno, and get back NULL if it wasn't actually an errno. If we passed them through to target_to_host_errno() it would pass them on unchanged and the host strerror() would generate a string "Unknown errno 134134234" or whatever. thanks -- PMM