Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 07 Feb 2013 23:31:30 +0100
From:      Christoph Mallon <christoph.mallon@gmx.de>
To:        Hans Petter Selasky <hselasky@c2i.net>
Cc:        Kirk McKusick <mckusick@mckusick.com>, freebsd-arch@freebsd.org
Subject:   Re: Proposal: Unify printing the function name in panic messages()
Message-ID:  <51142B42.4020909@gmx.de>
In-Reply-To: <201302072247.26167.hselasky@c2i.net>
References:  <51141E33.4080103@gmx.de> <201302072247.26167.hselasky@c2i.net>

next in thread | previous in thread | raw e-mail | index | archive | help
On 07.02.2013 22:47, Hans Petter Selasky wrote:
> On Thursday 07 February 2013 22:35:47 Christoph Mallon wrote:
>> /*
>>  * Panic and automatically prepend the name of the function to the panic
>>  * message.  If NAMED_PANIC is not set, the name is omitted.
>>  */
>> #ifdef NAMED_PANIC
>> #	define PANIC(fmt, ...) panic("%s: " fmt, __func__, ##__VA_ARGS__)
>> #else
>> #	define PANIC(fmt) panic(__VA_ARGS__)
>> #endif
>>
> 
> You mean:
> 
> #define PANIC(...) panic(__VA_ARGS__)

Yes, stupid typo.

>> Do you have suggestions to improve this proposal?
> 
> Why not make two variants to avoid the #ifdef ?
> 
> PANIC_NAMED(fmt, ...)
> 
> and
> 
> PANIC(...)

NAMED_PANIC is intended to be a global option (think WITNESS or INVARIANTS), not to be set at before including systm.h.
All panics should either show the function name or not.
This way you can shrink the kernel a bit at the flip of a switch.

	Christoph



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?51142B42.4020909>