From owner-cvs-all Mon Sep 25 12:45:35 2000 Delivered-To: cvs-all@freebsd.org Received: from gidora.zeta.org.au (gidora.zeta.org.au [203.26.10.25]) by hub.freebsd.org (Postfix) with SMTP id 06D1337B42C for ; Mon, 25 Sep 2000 12:45:28 -0700 (PDT) Received: (qmail 11148 invoked from network); 25 Sep 2000 19:45:24 -0000 Received: from unknown (HELO bde.zeta.org.au) (203.2.228.102) by gidora.zeta.org.au with SMTP; 25 Sep 2000 19:45:24 -0000 Date: Tue, 26 Sep 2000 06:45:18 +1100 (EST) From: Bruce Evans X-Sender: bde@besplex.bde.org To: John Baldwin Cc: cvs-all@FreeBSD.org, cvs-committers@FreeBSD.org, Jason Evans Subject: Re: cvs commit: src/sys/i386/include mutex.h src/sys/alpha/inclu In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-cvs-all@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On Sat, 23 Sep 2000, John Baldwin wrote: > On 23-Sep-00 Bruce Evans wrote: > > On Fri, 22 Sep 2000, Jason Evans wrote: > > > >> jasone 2000/09/22 17:00:50 PDT > >> > >> Modified files: > >> sys/i386/include mutex.h > >> sys/alpha/include mutex.h > >> Log: > >> #include in order to get curproc. This seems to be the > >> #lesser > >> of two evils; the greater evil is requiring sys/proc.h to be included > >> before including machine/mutex.h. > > > > The correct implementation is none of the above: > > > >#ifndef SMP > > extern struct proc *curproc; > >#endif > > curproc is no longer a variable like that. But it is, in the UP case. That's why I used "#ifndef SMP". > It is now a #define to > a function to extract per-cpu data. On UP systems, this is simplfied > by having it just reference gd_curproc. If it were a #define, then there wouldn't have been problems using it. It is actually only a #define in the SMP case on i386's, and the simplifications for the UP case are only at runtime, i.e., they are actually complications/ optimisations. Details: curproc is a #define in the SMP case only on i386's and in all cases on alphas. For the UP case on i386's, curproc is a normal variable everywhere except in globals.s, where curproc is implemented in an unusual way by aliasing it to globaldata + GD_CURPROC. > This change would be a bug. > Especially if you #include both proc.h and mutex.h in some other header. Repeated declarations aren't bugs; they just cause warnings with -Wredundant-decls. This is easy to fix, e.g., by moving the declaration to . However, #defining curproc in all cases is better. Similarly for all the other global variables. Bruce To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe cvs-all" in the body of the message