Subject: Re: kernel panic messages
To: Wolfgang Solfrank <ws@tools.de>
From: Ian Piumarta <ian.piumarta@inria.fr>
List: tech-kern
Date: 05/06/2003 19:00:27
On Tue, 6 May 2003, Wolfgang Solfrank wrote:

> Hi,

Hi,

>  > #define panic	(_panic_file= __FILE__, _panic_line= __LINE__, _panic)
> 
> Why not use this comma expression trick with a call to another function
> within the parens, i.e. something like:
> 
> #define	panic	(_panic_pos(__FILE__, __LINE__), _panic)
> 
> with an appropriate definition for the function _panic_pos?

On PPC the two versions both cost the same (24 bytes per panic).  On 386
the global store version costs 32 bytes vs. the _panic_pos version which
costs 28 bytes (with _panic_pos itself eating 24 bytes of text).

So if there are more than 6 panic()s in the kernel (;-) _panic_pos wins on
the 386.  OTOH it loses overall (by 20 bytes, for the size of _panic_pos
itself) on the PPC.

Being primarily a PPC hacker I think I'm sticking with the global vars
version for my own programs.  (I consider myself sufficiently disciplined
to avoid ever declaring locals called __error_file or __error_line, so I
don't consider global namespace pollution really to be an issue -- and
besides, '-Wall -Wshadow -Werror' keeps me a rather honest hacker. ;)

Regards,

Ian