Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 15 Jul 2006 14:03:47 +0200
From:      Alexander Leidinger <netchild@FreeBSD.org>
To:        Robert Watson <rwatson@FreeBSD.org>
Cc:        cvs-src@FreeBSD.org, Alfred Perlstein <alfred@FreeBSD.org>, cvs-all@FreeBSD.org, src-committers@FreeBSD.org
Subject:   Re: cvs commit: src/sys/fs/pseudofs pseudofs_vnops.c src/sys/compat/linux linux_misc.c src/sys/compat/linprocfs linprocfs.c
Message-ID:  <20060715140347.4333991f@Magellan.Leidinger.net>
In-Reply-To: <20060715102243.X61840@fledge.watson.org>
References:  <200607081406.k68E6u3w049339@repoman.freebsd.org> <20060714193538.GN25976@elvis.mu.org> <20060715102243.X61840@fledge.watson.org>

next in thread | previous in thread | raw e-mail | index | archive | help
Quoting Robert Watson <rwatson@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



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