Subject: Re: CVS commit: src/sys/kern
To: None <>
From: Pavel Cahyna <>
List: tech-kern
Date: 10/23/2006 09:49:49
On Sun, Oct 22, 2006 at 09:13:50PM -0400, der Mouse wrote:
> >>> pool_get(): use PR_WAITOK, not M_WAITOK (which happens to be PR_NOWAIT ..)
> >>> XXX: not the first time this mistake has been made
> >> find /usr/src/sys -name *.[ch"]" -exec grep -l pool_.*M_ "{"} ";"
> >> I think we should use different values for the constants and, if
> >> DIAGNOSTIC, assert that the constant is in fact in the correct
> >> range.
> > Could the compiler help here?  For example, if we used enums instead
> > of plain int and macros?
> No; C enums are too weakly typed. (...)

I see, but lint -e helps. Unfortunately, it also complains about bitwise
operation on enums, but for M_WAIT/M_DONTWAIT it is not a problem. For
values which are used as flags (such as M_WAITOK/M_NOWAIT, lint would have
to be taught to not complain about bitwise operations.