Date: Tue, 26 Sep 2000 06:45:18 +1100 (EST) From: Bruce Evans <bde@zeta.org.au> To: John Baldwin <jhb@FreeBSD.org> Cc: cvs-all@FreeBSD.org, cvs-committers@FreeBSD.org, Jason Evans <jasone@FreeBSD.org> Subject: Re: cvs commit: src/sys/i386/include mutex.h src/sys/alpha/inclu Message-ID: <Pine.BSF.4.21.0009260537200.12520-100000@besplex.bde.org> In-Reply-To: <XFMail.000923154240.jhb@FreeBSD.org>
next in thread | previous in thread | raw e-mail | index | archive | help
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 <sys/proc.h> 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 <machine/globals.h>. 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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.4.21.0009260537200.12520-100000>