From owner-freebsd-arch Tue Jan 21 14:10:21 2003 Delivered-To: freebsd-arch@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 7283237B407 for ; Tue, 21 Jan 2003 14:10:15 -0800 (PST) Received: from harmony.village.org (rover.bsdimp.com [204.144.255.66]) by mx1.FreeBSD.org (Postfix) with ESMTP id 6F2D743F18 for ; Tue, 21 Jan 2003 14:10:14 -0800 (PST) (envelope-from imp@bsdimp.com) Received: from localhost (warner@rover2.village.org [10.0.0.1]) by harmony.village.org (8.12.6/8.12.3) with ESMTP id h0LMAC1e086994; Tue, 21 Jan 2003 15:10:12 -0700 (MST) (envelope-from imp@bsdimp.com) Date: Tue, 21 Jan 2003 15:08:28 -0700 (MST) Message-Id: <20030121.150828.121894335.imp@bsdimp.com> To: bmilekic@unixdaemons.com Cc: arch@freebsd.org Subject: Re: Alfre's malloc changes: the next step From: "M. Warner Losh" In-Reply-To: <20030121170319.B74210@unixdaemons.com> References: <20030121.144243.52206100.imp@bsdimp.com> <20030121170319.B74210@unixdaemons.com> X-Mailer: Mew version 2.1 on Emacs 21.2 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-freebsd-arch@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG In message: <20030121170319.B74210@unixdaemons.com> Bosko Milekic 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