Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 21 Jan 2003 15:08:28 -0700 (MST)
From:      "M. Warner Losh" <imp@bsdimp.com>
To:        bmilekic@unixdaemons.com
Cc:        arch@freebsd.org
Subject:   Re: Alfre's malloc changes: the next step
Message-ID:  <20030121.150828.121894335.imp@bsdimp.com>
In-Reply-To: <20030121170319.B74210@unixdaemons.com>
References:  <20030121.144243.52206100.imp@bsdimp.com> <20030121170319.B74210@unixdaemons.com>

next in thread | previous in thread | raw e-mail | index | archive | help
In message: <20030121170319.B74210@unixdaemons.com>
            Bosko Milekic <bmilekic@unixdaemons.com> writes:
: > 1) Make M_WAITOK and M_NOWAIT mandatory and exclusive in malloc.c.
: >    You must specify one or the other, but not both.
: > 2) We assign both M_WAITOK and M_NOWAIT values that aren't 0, let's
: >    say 0x10 and 0x20.
: > 3) We assign both M_DONTWAIT and M_TRYWAIT from mbuf.h values 0x40
: >    and 0x80.
: > 4) We back out the bulk of the changes made, except where they were
: >    real bugs.
: > 5) Hack the mbuf routines to reject M_DONTWAIT and M_TRYWAIT that
: >    aren't the right value in flags.
: 
:    I'm not sure I understand point (5) here.  What do you mean "that
:    aren't the right value in flags?"

if (flags & ~(M_DONTWAIT | M_TRYWAIT))
   panic("you used the interface wrong");
if ((flags & (M_DONTWAIT | M_TRYWAIT)) == 0)
   panic("you used the interface wrong");
if ((flags & (M_DONTWAIT | M_TRYWAIT)) == (M_DONTWAIT | M_TRYWAIT))
   panic("you used the interface wrong");

Maybe ifdef's INVARIANT or some such.

Similarly in malloc and M_WAITOK and M_NOWAIT

Warner

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-arch" in the body of the message




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