public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: wdebruij@dds.nl
To: linux-kernel@vger.kernel.org
Subject: missing vprintf in kernel.api. Interest in patch?
Date: Tue, 10 Feb 2004 11:22:59 +0100	[thread overview]
Message-ID: <1076408579.4028b1036a8ae@webmail.dds.nl> (raw)

Hi,

  while writing a new kernel module I needed vprintf behaviour to send
additional info to printk (e.g. __LINE__ and __FUNCTION__ preprocessor macros).
While the kernel API contains vsnprintf and vsprintf functions, it does not
contain a vprintf and since we have no access to the printk_buf structure it is
therefore impossible to directly write a formatted argument using a va_list to
the log. 

As a quick fix I wrote my own function using vsnprintf and printk, but this is
far from ideal when more people need such functionality.

Indeed, doing a quick grep on the (2.6.1) tree I noticed that I am not the only
one creating my own vprintf. In arch/um/kernel/tt/tracer.c, drivers/acpi/osl.c
and drivers/acpi/utilities/utdebug.c others have also written similar functions.
Not to mention all the DPRINTF, YYDPRINTF, etc. macros declared everywhere

Therefore my question is this: is there any interest in 

(1) a small patch that extracts the vsnprintf(printk_buf,...) from printk and
thus creates a vprintf function (trivial change, perhaps +5 lines of code).
and/or
(2) a kernel wide DPRINTK (or something) macro that adds the __FILE__,
__FUNCTION__ and __LINE__ macros to the output.
and/or
(3) an extension of 2 that also prints out clockcycles or timing statistics.

IMHO, everyone debugging and optimizing his code needs these features. It might
help clean up the codebase if everyone uses the same helper functions.
And since I already have such code laying around, sending in a patch is a
trivial task right now.

Please share your views, I don't want to create a patch if it'll be rejected
instantaneously because of some unspoken rule I haven't heard of.

cheers,

  Willem de Bruijn



             reply	other threads:[~2004-02-10 10:23 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-02-10 10:22 wdebruij [this message]
2004-02-11  2:06 ` [patch] Re: missing vprintf in kernel.api. Interest in patch? Matt Mackall

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1076408579.4028b1036a8ae@webmail.dds.nl \
    --to=wdebruij@dds.nl \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox