lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <2735.46f3c72e.5c662@altium.nl>
Date:	Fri, 21 Sep 2007 13:29:18 -0000
From:	dick.streefland@...ium.nl (Dick Streefland)
To:	linux-kernel@...r.kernel.org
Subject: Re: [Announce] Linux-tiny project revival

Rob Landley <rob@...dley.net> wrote:
| I'm proposing allowing an ignore_loglevel to remove the unused messages at 
| compile time so they don't take up space.  Doing that requires the levels to 
| be integers so they can be compared with < or >, and the remaining changes 
| follow logically.  (To me, anyway...)

Gcc seems to be smart enough to do contant folding on string
subscripts, so you don't need to change any of the printk()s.
Here is what I mean:

#include <stdio.h>

#define	actual_printk	printf

#define KERN_ERR        "<3>"   /* error conditions                     */
#define KERN_WARNING    "<4>"   /* warning conditions                   */
#define KERN_NOTICE     "<5>"   /* normal but significant condition     */

#define printk(str, ...) \
  do { \
    if ((str)[0] != '<' || (str)[1] < '5') \
      actual_printk((str), __VA_ARGS__); \
  } while(0);

int main(void)
{
	printk(KERN_ERR "error %d\n", 1);
	printk(KERN_WARNING "warning %d\n", 2);
	printk(KERN_NOTICE "notice %d\n", 3);
	printk("no level %d\n", 4);
	return 0;
}

-- 
Dick Streefland                      ////                      Altium BV
dick.streefland@...ium.nl           (@ @)          http://www.altium.com
--------------------------------oOO--(_)--OOo---------------------------

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ