All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@osdl.org>
To: Matt Mackall <mpm@selenic.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] clean up kernel messages
Date: Fri, 1 Apr 2005 12:26:41 -0800	[thread overview]
Message-ID: <20050401122641.7c52eaab.akpm@osdl.org> (raw)
In-Reply-To: <20050401200851.GG15453@waste.org>

Matt Mackall <mpm@selenic.com> wrote:
>
> This patch tidies up those annoying kernel messages. A typical kernel
>  boot now looks like this:
> 
>  Loading Linux... Uncompressing kernel...
>  #
> 
>  See? Much nicer. This patch saves about 375k on my laptop config and
>  nearly 100k on minimal configs.
> 

heh.  Please take a look at
http://www.uwsg.iu.edu/hypermail/linux/kernel/0004.2/0709.html, see if
Graham did anything which you missed.

One problem was that

	printk("foo");

will still cause the string "foo\0" to appear in the kernel image.  That
was fixed in later gcc's, but it would be interesting to know which
compilers get it right.

> 
>  Index: af/include/linux/kernel.h
>  ===================================================================
>  --- af.orig/include/linux/kernel.h	2005-04-01 00:32:18.000000000 -0800
>  +++ af/include/linux/kernel.h	2005-04-01 10:38:43.000000000 -0800
>  @@ -115,10 +115,19 @@ extern int __kernel_text_address(unsigne
>   extern int kernel_text_address(unsigned long addr);
>   extern int session_of_pgrp(int pgrp);
>   
>  +#ifdef CONFIG_PRINTK
>   asmlinkage int vprintk(const char *fmt, va_list args)
>   	__attribute__ ((format (printf, 1, 0)));
>   asmlinkage int printk(const char * fmt, ...)
>   	__attribute__ ((format (printf, 1, 2)));
>  +#else
>  +static inline int vprintk(const char *s, va_list args)
>  +	__attribute__ ((format (printf, 1, 0)));
>  +static inline int vprintk(const char *s, va_list args) { return 0; }
>  +static inline int printk(const char *s, ...)
>  +	__attribute__ ((format (printf, 1, 2)));
>  +static inline int printk(const char *s, ...) { return 0; }
>  +#endif

Actually printk() is supposed to return the number of chars which it
printed.  So if someone is doing:

	while (len < 40)
		len += printk("something");

you've gone and made them lock up.

But I think the number of places where we examine the printk return value
is near zero.


  reply	other threads:[~2005-04-01 20:30 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-04-01 20:08 [PATCH] clean up kernel messages Matt Mackall
2005-04-01 20:26 ` Andrew Morton [this message]
2005-04-01 20:46   ` Matt Mackall
2005-04-01 21:18     ` Steven Rostedt
2005-04-01 21:26       ` Steven Rostedt
2005-04-01 22:08         ` Richard B. Johnson
2005-04-02 10:35           ` Denis Vlasenko
2005-04-01 21:32       ` Matt Mackall
2005-04-01 20:27 ` Jan-Benedict Glaw

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=20050401122641.7c52eaab.akpm@osdl.org \
    --to=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mpm@selenic.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.