From owner-freebsd-current Wed Feb 19 13:29:42 2003 Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 8114F37B401 for ; Wed, 19 Feb 2003 13:29:41 -0800 (PST) Received: from mailsrv.otenet.gr (mailsrv.otenet.gr [195.170.0.5]) by mx1.FreeBSD.org (Postfix) with ESMTP id 3572343F3F for ; Wed, 19 Feb 2003 13:29:40 -0800 (PST) (envelope-from keramida@ceid.upatras.gr) Received: from gothmog.gr (patr530-b032.otenet.gr [195.167.121.160]) by mailsrv.otenet.gr (8.12.6/8.12.6) with ESMTP id h1JLTbFw019296 for ; Wed, 19 Feb 2003 23:29:38 +0200 (EET) Received: from gothmog.gr (gothmog [127.0.0.1]) by gothmog.gr (8.12.7/8.12.7) with ESMTP id h1JLT19p027319 for ; Wed, 19 Feb 2003 23:29:01 +0200 (EET) (envelope-from keramida@ceid.upatras.gr) Received: (from giorgos@localhost) by gothmog.gr (8.12.7/8.12.7/Submit) id h1JLT1Tr027318 for current@FreeBSD.ORG; Wed, 19 Feb 2003 23:29:01 +0200 (EET) (envelope-from keramida@ceid.upatras.gr) Date: Wed, 19 Feb 2003 23:29:01 +0200 From: Giorgos Keramidas To: current@FreeBSD.ORG Subject: Re: cvs commit: src/sys/alpha/alpha busdma_machdep.c src/sys/alpha/osf1 imgact_osf1.c osf1_misc.c src/sys/cam cam_periph.c cam_sim.c cam_xpt.c src/sys/cam/scsi scsi_cd.c scsi_ch.c scsi_da.c scsi_low.c scsi_sa.c scsi_target.c src/sys/coda cnode.h ... Message-ID: <20030219212901.GA27148@gothmog.gr> References: <200302190547.h1J5ll1J064169@repoman.freebsd.org> <76449.1045642469@critter.freebsd.dk> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <76449.1045642469@critter.freebsd.dk> Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On 2003-02-19 09:14, phk@phk.freebsd.dk wrote: > The attached patch will print a backtrace if any calls to malloc > fail to have either M_WAITOK or M_NOWAIT. [...] > --- kern/kern_malloc.c 19 Feb 2003 05:47:25 -0000 1.116 > +++ kern/kern_malloc.c 19 Feb 2003 07:55:19 -0000 > @@ -167,11 +167,21 @@ > #endif > register struct malloc_type *ksp = type; > > + indx = flags & (M_WAITOK | M_NOWAIT); > + if (indx == M_NOWAIT) { > + /* OK */ > + } else if (indx == M_WAITOK) { > + /* OK */ > + } else { Or, a simpler version: /* Either M_NOWAIT or M_WAITOK must be set. */ if (indx != M_NOWAIT && indx != M_WAITOK) { printf("Missing M_WAITOK flag\n"); backtrace(); flags |= M_WAITOK; } :=) To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message