mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: danielfsantos@att.net
To: linux-kbuild <linux-kbuild@vger.kernel.org>,
	LKML <linux-kernel@vger.kernel.org>,
	Michal Marek <mmarek@suse.cz>,
	Andrew Morton <akpm@linux-foundation.org>,
	"Paul E. McKenney" <paulmck@linux.vnet.ibm.com>,
	David Howells <dhowells@redhat.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Michael Kerrisk <mtk.manpages@gmail.com>,
	Dave Hansen <dave.hansen@linux.intel.com>,
	George Spelvin <linux@horizon.com>
Cc: Daniel Santos <daniel.santos@pobox.com>
Subject: [PATCH 2/5] lib: Add .config options for error strings in printks
Date: Tue, 17 Sep 2013 18:08:34 -0500	[thread overview]
Message-ID: <1379459317-13046-3-git-send-email-daniel.santos@pobox.com> (raw)
In-Reply-To: <1379459317-13046-1-git-send-email-daniel.santos@pobox.com>

This adds to lib/Kconfig.debug the options for printk messages to
display either error number only (the current behavior), number and
error name or number, name and description. These options in turn select
STRERROR_NAME and STRERROR as needed, so I'm not adding any direct
options to enable those, although it can be added later if somebody
needs strerror() or strerror_name() when not enabled in printks.

kconfg

Signed-off-by: Daniel Santos <daniel.santos@pobox.com>
---
 lib/Kconfig.debug | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 53 insertions(+)

diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
index c9eef36..919f371 100644
--- a/lib/Kconfig.debug
+++ b/lib/Kconfig.debug
@@ -58,6 +58,7 @@ config DYNAMIC_DEBUG
 	  implicitly compiles in all pr_debug() and dev_dbg() calls, which
 	  enlarges the kernel text size by about 2%.
 
+
 	  If a source file is compiled with DEBUG flag set, any
 	  pr_debug() calls in it are enabled by default, but can be
 	  disabled at runtime as below.  Note that DEBUG flag is
@@ -113,6 +114,58 @@ config DYNAMIC_DEBUG
 
 	  See Documentation/dynamic-debug-howto.txt for additional information.
 
+choice
+	prompt "Display errors in printk as"
+	default PRINTK_ERROR_CODES_ONLY
+	depends on PRINTK
+	help
+	  This option tells printk how to display error codes when
+	  formatted with the %de format code (a Linux printk extension).
+	  Error codes are most commonly passed to userspace when syscalls
+	  return where they are then translated into localized descrptions
+	  via libc's strerror(), perror(), etc.  However, many error
+	  conditions (for drivers and such) are only reported via printks
+	  where there is no such userspace mechanism to reliably translate
+	  error numbers into something a little more human.
+
+	  This option allows you to perform that translation in the kernel,
+	  at the cost of a slightly larger kernel. Note that no native
+	  language support is currently, or may ever be provided.
+
+	  If unsure, choose "Error codes only".
+
+config PRINTK_ERROR_CODES_ONLY
+	bool "Error codes only"
+	help
+	  Just display the error number.
+
+config PRINTK_ERROR_NAMES
+	bool "Error names"
+	select STRERROR_NAME
+	help
+	  This option causes printk messages containing an error code to
+	  print the name of the error in addition to the error number.
+	  Enabling this adds about 2k. Example: -22 (EINVAL)
+
+config PRINTK_ERROR_DESCS
+	bool "Full descrptions"
+	select STRERROR
+	select STRERROR_NAME
+	help
+	  This option causes printk messages containing an error code to
+	  print the description of errors (in addition to the name and
+	  number) and can be helpful for those with aversions to search
+	  engines. Enabling this adds about 6k over error codes alone.
+	  Example: -90 (EMSGSIZE: Message too long)
+
+endchoice
+
+config STRERROR
+	bool
+
+config STRERROR_NAME
+	bool
+
 endmenu # "printk and dmesg options"
 
 menu "Compile-time checks and compiler options"
-- 
1.8.1.5


  parent reply	other threads:[~2013-09-17 23:08 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-17 23:08 [PATCH 0/5] Preliminary: Add error names & descrptions to printks danielfsantos
2013-09-17 23:08 ` [PATCH 1/5] scripts: Add mkstrerror.sh danielfsantos
2013-09-17 23:08 ` danielfsantos [this message]
2013-09-17 23:18   ` [PATCH 2/5] lib: Add .config options for error strings in printks Daniel Santos
2013-09-17 23:08 ` [PATCH 3/5] Makefile: Generate error_strings.h danielfsantos
2013-09-17 23:08 ` [PATCH 4/5] lib: Add strerror and strerror_name functions danielfsantos
2013-09-17 23:08 ` [PATCH 5/5] lib: Add error string support to printks danielfsantos
2013-09-18  5:36   ` Joe Perches
2013-09-18 11:04   ` David Howells
2013-09-19  1:27     ` Daniel Santos
2013-09-20  1:07       ` Joe Perches
2013-09-20  5:21         ` Daniel Santos
2013-09-20 11:45           ` Joe Perches
2013-09-23 19:40             ` Daniel Santos
2013-09-20 13:07           ` David Howells
2013-09-23 20:17             ` Daniel Santos
2013-09-18 11:08 ` [PATCH 0/5] Preliminary: Add error names & descrptions " David Howells
2013-09-18 22:47   ` Daniel Santos
2013-09-18 11:38 ` [PATCH 1/5] scripts: Add mkstrerror.sh David Howells
2013-09-18 22:43   ` Daniel Santos
2013-09-19 22:35   ` Daniel Santos
2013-09-19 22:53     ` Daniel Santos
2013-09-18 11:55 ` David Howells
2013-09-18 22:27   ` Daniel Santos

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=1379459317-13046-3-git-send-email-daniel.santos@pobox.com \
    --to=danielfsantos@att.net \
    --cc=akpm@linux-foundation.org \
    --cc=daniel.santos@pobox.com \
    --cc=dave.hansen@linux.intel.com \
    --cc=dhowells@redhat.com \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@horizon.com \
    --cc=mmarek@suse.cz \
    --cc=mtk.manpages@gmail.com \
    --cc=paulmck@linux.vnet.ibm.com \
    --cc=tglx@linutronix.de \
    /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

all inboxes | Powered by JetHome®