cvs commit: src/sys/fs/pseudofs pseudofs_vnops.c src/sys/compat/linux linux_misc.c src/sys/compat/linprocfs linprocfs.c

Alexander Leidinger netchild at FreeBSD.org
Sat Jul 15 12:03:09 UTC 2006


Quoting Robert Watson <rwatson at FreeBSD.org> (Sat, 15 Jul 2006 10:23:28 +0100 (BST)):

> 
> On Fri, 14 Jul 2006, Alfred Perlstein wrote:
> 
> > Could the KASSERT here be changed to a warning log message instead?
> >
> > I don't like the idea of kernel modules failing catastrophically
> > when they could fail gracefully by just emitting an error.
> >
> > Is that OK?
> >
> > +	KASSERT(kp.ki_stat <= sizeof(linux_state),
> > +		("linprocfs: don't know how to handle unknown FreeBSD state"));
> 
> Or, if this is really just a structure size thing, we should pick it up at 
> compile-time with CTASSERT?

ki_stat contains a value which corresponds to the states like idle,
diskwait, ... And linux_state is a static array (ki_stat is an index
into it). We don't have a "this value is an upper bound to the possible
state values"-value, so I can't use an CTASSERT.

This will only panic when someone adds another state to the existing
ones but doesn't extend the array.

Suggestions how to handle this in a way which satisfies everyone is
welcome (is a warning enough?).

Bye,
Alexander.

-- 
      ...and that is how we know the Earth to be banana-shaped.
http://www.Leidinger.net  Alexander @ Leidinger.net: PGP ID = B0063FE7
http://www.FreeBSD.org     netchild @ FreeBSD.org  : PGP ID = 72077137


More information about the cvs-all mailing list