[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <1498561379.9962.3.camel@petrovitsch.priv.at>
Date: Tue, 27 Jun 2017 13:02:59 +0200
From: Bernd Petrovitsch <bernd@...rovitsch.priv.at>
To: Randy Dunlap <rdunlap@...radead.org>,
"Enrico Weigelt, metux IT consult" <enrico.weigelt@...3.net>,
Joe Perches <joe@...ches.com>, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] lib: vsprintf: add printf format conversion %M for
errno strings
Hi all!
On Sun, 2017-06-25 at 15:47 -0700, Randy Dunlap wrote:
> On 06/25/2017 02:18 PM, Enrico Weigelt, metux IT consult wrote:
> > On 25.06.2017 22:10, Joe Perches wrote:
> >
> > > > Yeah, that's still an open problem. Actually, I still haven't found out,
> > > > how it's done w/ all the other kernel-internal conversions.
That is hard-coded in gcc ATM TTBOMK (AFAIK BSDs ship patched gcc's for
their in-kernel extensions of format strings).
> > > Everything else uses "%p<foo>", <object reference>
> >
> > hmm, but errno's aren't pointers. Isn't %p checked for pointer
> > values ?
Yup, and gcc will also generate a format string warning/error.
> > > > Already was about to do so. Shall I call it strerror() ?
> > >
> > > I presume kstrerror
> > >
> > > So use something like
> > > "%d: (%s)", errno, kstrerror(errno)
> >
> > Okay, sounds good.
>
> but why not just do that in userspace. Sure, you can keep that as your
> internal kernel patch, but there's not really much need for it to be in the
> mainline kernel. So when your driver prints "blah: foo bar error 49",
> just run a little program that converts 49 to <whatever>.
Userspace can just guess if a given "49" is an errno or not ...
MfG,
Bernd
--
Bernd Petrovitsch Email : bernd@...rovitsch.priv.at
LUGA : http://www.luga.at
Powered by blists - more mailing lists