tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]


On 08.09.2011 03:00, Mouse wrote:
>> And I am not aware of a solution where you can have two "..." in a C
>> function.
> You can't actually _write_ something like
> void foo(const char *, ..., int, const char *, const char *, ...);
> but, except for -Wformat issues, you can get that effect with suitable
> use of va_* calls within the implementation of foo().  (If you expect
> to use vprintf or relatives to consume the first ... list, this
> involves unwarranted chumminess with the stdarg implementation.  But if
> you walk the first ... list yourself, it's no problem at all.)

Good point; there's still one piece I am missing there: panic(9) will
set panicstr to the fmt string passed as argument.

So if I want KASSERTMSG() to be like described in its man page, I have
to find a way to concatenate the msg from KASSERTMSG() with the real fmt
panic string, and make those continuous. panicstr being a char *, that
involves copying or moving things around.

I can't expect the kernel to be in a good shape when it calls panic(9)
so allocating/copying strings is not possible. So it has to be done at
compile time, or the use of panicstr has to be changed.

IMHO, the panicstr isn't used right with KASSERT/KASSERTMSG, let alone
for a lot of panic(9) callers. It should contain enough information to
pinpoint to the problem, however it cannot do this with the current
code; it contains a format string but not the real panic message:

"kernel %sassertion %s failed: file %s, line %d"

not very helpful.

Jean-Yves Migeon

Home | Main Index | Thread Index | Old Index