Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp383681ybe; Mon, 2 Sep 2019 03:14:01 -0700 (PDT) X-Google-Smtp-Source: APXvYqx90XoAUW4I280tmZ+u46NIKJKRTmADXM7KqrdKemBM6Xy6xS3Zvx3EwtxrfGkUkmkUR47O X-Received: by 2002:a17:90a:3187:: with SMTP id j7mr6913680pjb.69.1567419241545; Mon, 02 Sep 2019 03:14:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567419241; cv=none; d=google.com; s=arc-20160816; b=JPGZMhuznWhfLqsjE6Ake1ntUVusNaPY1JBg/vf0gOj+RCaGtc/N+YfjhGqv3tg+9d FFhIMaU5BZC3dkuSzyWCKjXS60iPuVHtgq0XT6RLlhz3TiHTp8iu5JvcP8JmSTRZaZVY 5r1OrYNOtMHIdtqRuwyoKozTu1UaTYbIMdM1Jqz947JK7rraiHJYfJ4mq7Ls1KdBv4pX MVjBKXI3PrssokxSoKHHLbcxdESIj0KgWo7wtSTxjlN3mUO3gA3c9fndI86YvMn0EVFV nyHszy4udGUfr9JKyHx7uNZNC1lF4JQSpm98A4XYUDOmDDV4Hi27bbHUcyI8DNk/wL0a r9mw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :content-language:accept-language:in-reply-to:references:message-id :date:thread-index:thread-topic:subject:cc:to:from; bh=19X81HbN5hssf/rMLaSFiPIsJfc6WDQiOg5iYQ+ceFo=; b=KS8HqmMiRfO4+ABn0OGmiryuobaeYqFzsTGCOK9MYDHoFgdSy6DVnOpYe7FP/VRBQ0 k2mrKFB4wKBRmfRHv73y3BVNkQ1Wqmsy9wUdDoFydQi+t1Bcr6qSNfjs8JS5Hw4s5UnN 9KnN7OGfL0phbDOZAWufj6PEW8JJb7X/H4xmaSOdjR/PQPJD2vK++TIm92xLaG1GskJh 2coUpqfBrPJFu9JCv30gofrIu2eWoWAQkh8tlGCWyX411CC4nghDcdalfRaqgooV73Ul aUzQf5N5Ixrp2LO5kHbJZU32gT8m8d8pxzb0Z93VPwTPjITeX4VIyBZv8WoRebIvJigG S4yQ== 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 a190si10872287pge.4.2019.09.02.03.13.45; Mon, 02 Sep 2019 03:14:01 -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 S1730903AbfIBJH6 convert rfc822-to-8bit (ORCPT + 99 others); Mon, 2 Sep 2019 05:07:58 -0400 Received: from eu-smtp-delivery-151.mimecast.com ([146.101.78.151]:37068 "EHLO eu-smtp-delivery-151.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730663AbfIBJH6 (ORCPT ); Mon, 2 Sep 2019 05:07:58 -0400 Received: from AcuMS.aculab.com (156.67.243.126 [156.67.243.126]) (Using TLS) by relay.mimecast.com with ESMTP id uk-mta-45-pWetoKX2MVuDKeOGTbmj9Q-1; Mon, 02 Sep 2019 10:07:53 +0100 Received: from AcuMS.Aculab.com (fd9f:af1c:a25b:0:43c:695e:880f:8750) by AcuMS.aculab.com (fd9f:af1c:a25b:0:43c:695e:880f:8750) with Microsoft SMTP Server (TLS) id 15.0.1347.2; Mon, 2 Sep 2019 10:07:53 +0100 Received: from AcuMS.Aculab.com ([fe80::43c:695e:880f:8750]) by AcuMS.aculab.com ([fe80::43c:695e:880f:8750%12]) with mapi id 15.00.1347.000; Mon, 2 Sep 2019 10:07:53 +0100 From: David Laight To: 'Rasmus Villemoes' , Joe Perches , Sergey Senozhatsky , =?iso-8859-1?Q?Uwe_Kleine-K=F6nig?= , Petr Mladek CC: Andrew Morton , Jani Nikula , Juergen Gross , "linux-kernel@vger.kernel.org" Subject: RE: [PATCH] printf: add support for printing symbolic error codes Thread-Topic: [PATCH] printf: add support for printing symbolic error codes Thread-Index: AQHVX4Vhxwh8/eMOVEunFKpvvE2RyacYHAyQ Date: Mon, 2 Sep 2019 09:07:53 +0000 Message-ID: References: <20190830214655.6625-1-linux@rasmusvillemoes.dk> <64a000cc3b0fcd7c99b5cd41b0db7f1b5e9e6db7.camel@perches.com> <9fecd3a9-e1ae-a1f9-a0c5-f5db3430c81d@rasmusvillemoes.dk> <92108c09c37a9355566b579db152a05e19f54ccf.camel@perches.com> <516ab378-e79a-4e1c-8099-ccb22dfd5508@rasmusvillemoes.dk> In-Reply-To: <516ab378-e79a-4e1c-8099-ccb22dfd5508@rasmusvillemoes.dk> Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [10.202.205.107] MIME-Version: 1.0 X-MC-Unique: pWetoKX2MVuDKeOGTbmj9Q-1 X-Mimecast-Spam-Score: 0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Rasmus Villemoes > Sent: 30 August 2019 23:51 ... > > But why not just extend check_pointer_msg? > > Partly because that would rely on all %p actually eventually > passing ptr through to that (notably plain %p does not), partly because > the way check_pointer_msg works means that it has to return a string for > its caller to print - which is ok when the errcode is found, but breaks > if it needs to format a decimal. It can't even snprintf() to a stack > buffer and return that, because, well, you can't do that, and it would > be a silly recursive snprintf anyway. Perhaps you could use NULL or "" to mean 'just print the value'. Then you might manage to use the test for NULL to print the errno strings. David - Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK Registration No: 1397386 (Wales)