kern/99979: Get Ready for Kernel Module in C++

Jan Grant jan.grant at
Wed Jul 12 08:10:53 UTC 2006

On Tue, 11 Jul 2006, Attilio Rao wrote:

> Even if I have no proof-of-concepts (so maybe somebody can show that
> this is not fair), if we have setjmp/longjmp in the kernel we can have
> a correct exception handling mechanism without not great problems.

You'd think that, but at least one issue is that not all kernel 
resources are manageable via RAII*. So whilst you might be able 
to stack unwind, you're still left with a really hairy resource 
management problem - potentially at every frame - which often doesn't 
improve on the error checking and throwing idioms as expressed in C.

I think it'd be interesting to try to address this but "I don't think 
you want to start from here".


* for the non-C++ buffs, "Resource Acquisition Is Initialisation": using 
automatic variables of types with destructors that clean up the 
underlying resources when they go out of scope.

jan grant, ISYS, University of Bristol.
Tel +44 (0)117 3317661
YKYBPTMRogueW... you try to move diagonally in vi.

More information about the freebsd-hackers mailing list