Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp549215imm; Wed, 1 Aug 2018 00:58:53 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdjHtC1wrR3BEWrFl6GpIcq/qqJEhrJOAZims+sPIURz71oavcU8+7TpSlzHGXoAv9suiGo X-Received: by 2002:a17:902:8b86:: with SMTP id ay6-v6mr22984234plb.25.1533110333865; Wed, 01 Aug 2018 00:58:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533110333; cv=none; d=google.com; s=arc-20160816; b=HBwAZMCJo8wK8bvPoMhG/A6ycc2uz1/+bpKa6uBIBDvzSRV18jfbiN0lpj4D+4ob1+ MvYDZh8bJtZVHlBoInXu9brDn4z3O5AHsAfDdlQ54wjlqhNCTC3fSEewmSUX7qzopngE jEC1Q4IsXNUSC5lZpmCTLxIw2lKCbqbf9G3y9qMl4WxVq8xPjtWRcAnFV5Jvxp/n2506 ayFAc37wdD7CaPKMKGm4L3w8kOBAfxsPXKu3I3y+ysnysltd0zK0dY8aYU89o27zu1Ua R6bzkVq1SGT/4BRNqfp22ssBTpqNQ8QVp+1Z/3cnywbaF/PlpWcxGYXK+b8jV2/hMYhW bSKw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date :arc-authentication-results; bh=6S6KDREDz0VPOTOyJzkVnMehzoTT+cjAs6Fsg3zq/ws=; b=X3vybmiYSsVwQYC4d/Sh3esj6ppYkpX7qpnyYlwvvjWtwe8zztLoiczPVoYmCIiwZ/ KZi4wRKLpYx9qwGB/Na9y+USvlfNVUdVhQrzz2baMif9qbXWUTdLCYCEdH2q4w0JJuSA dX4MM52aYrMEjW+BM68qhNOmtTM0EU5twL06Zr3BB4UxVGS8kcEtP2tsaa0eHHxc+I7E 7ofEX7kmI9iqLJ+N5x4Otalj/qN1IESJ5TA6ZmhwXJccAu1bMCmkUqYwCmvN/du/d4Uz 47zhB81azFHvYuuJRh1JxGMqRVdUAWLZAK/9iqrpY8AdEsBZ8FcF9VWt4gpA7zEyAM6w lpxw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y4-v6si1497844pfg.246.2018.08.01.00.58.39; Wed, 01 Aug 2018 00:58:53 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387698AbeHAJmR (ORCPT + 99 others); Wed, 1 Aug 2018 05:42:17 -0400 Received: from gate.crashing.org ([63.228.1.57]:56441 "EHLO gate.crashing.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732300AbeHAJmQ (ORCPT ); Wed, 1 Aug 2018 05:42:16 -0400 Received: from gate.crashing.org (localhost.localdomain [127.0.0.1]) by gate.crashing.org (8.14.1/8.14.1) with ESMTP id w717n7Pp018776; Wed, 1 Aug 2018 02:49:07 -0500 Received: (from segher@localhost) by gate.crashing.org (8.14.1/8.14.1/Submit) id w717n3CI018764; Wed, 1 Aug 2018 02:49:03 -0500 Date: Wed, 1 Aug 2018 02:49:03 -0500 From: Segher Boessenkool To: Joe Perches Cc: Christophe LEROY , Murilo Opsfelder Araujo , linux-kernel@vger.kernel.org, Michael Neuling , Simon Guo , Nicholas Piggin , Paul Mackerras , "Eric W . Biederman" , Andrew Donnellan , "Alastair D'Silva" , Sukadev Bhattiprolu , linuxppc-dev@lists.ozlabs.org, Cyril Bur , "Tobin C . Harding" Subject: Re: [PATCH v3 5/9] powerpc/traps: Print signal name for unhandled signals Message-ID: <20180801074903.GG16221@gate.crashing.org> References: <20180731145020.14009-1-muriloo@linux.ibm.com> <20180731145020.14009-6-muriloo@linux.ibm.com> <631e9a9b-dbbe-ede7-eb81-81520cc36ad5@c-s.fr> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.4.2.3i Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Aug 01, 2018 at 12:03:50AM -0700, Joe Perches wrote: > On Wed, 2018-08-01 at 08:37 +0200, Christophe LEROY wrote: > > Le 31/07/2018 ? 16:50, Murilo Opsfelder Araujo a ?crit : > > I would suggest to instead use a function like this: > > > > static const char *signame(int signr) > > { > > if (signr == SIGBUS) > > return "bus error"; > > if (signr == SIGFPE) > > return "floating point exception"; > > if (signr == SIGILL) > > return "illegal instruction"; > > if (signr == SIGILL) > > return "segfault"; > > if (signr == SIGTRAP) > > return "unhandled trap"; > > return "unknown signal"; > > } > > trivia: > > Unless the if tests are ordered most to least likely, > perhaps it would be better to use a switch/case and > let the compiler decide. That would also show there are two entries for SIGILL (here and in the original patch), one of them very wrong. Check the table with psignal or something? Segher