From owner-freebsd-arch@FreeBSD.ORG Thu Mar 10 20:11:01 2011 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 742AD1065678; Thu, 10 Mar 2011 20:11:01 +0000 (UTC) (envelope-from mdf356@gmail.com) Received: from mail-ww0-f50.google.com (mail-ww0-f50.google.com [74.125.82.50]) by mx1.freebsd.org (Postfix) with ESMTP id CD8798FC16; Thu, 10 Mar 2011 20:11:00 +0000 (UTC) Received: by wwc33 with SMTP id 33so2495940wwc.31 for ; Thu, 10 Mar 2011 12:10:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=NS1VLriqxlWP9WmJUwlLz5Uf4ZzCEnb9pWnKSDRdDFs=; b=DrNAi36Ml9EoITPq/STbfW64lTBo6LTuf98u0QXSeQ9zV2GfINRZ0BL+qhWPTHXxSq TyYf+Mu7/R0L5ziNpuIjMb7aoA2x15pRmg0CfDvMulLXdW05oUFgO/uXDON3IZdIeGWG BUtjEMmJakRCZdntqYkzZBPOABbE0T54/wMmg= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; b=dXR3QioJ8yQX5wYykULyk7fipCxMnATKKqnbtqMJazP+HVSimg0J+PO0wWMKLNv/tW ho2IILQ9lUz6dERHYnzfZSxeTrdtCvTRFZq4scl7gd3yhdK1ukWs1bTTyYCaNtboVfvj MW37j7Up/7HG0y0FL57XTxoxnWdjPV0vH1NP0= MIME-Version: 1.0 Received: by 10.216.141.225 with SMTP id g75mr3878223wej.10.1299787858811; Thu, 10 Mar 2011 12:10:58 -0800 (PST) Sender: mdf356@gmail.com Received: by 10.216.62.130 with HTTP; Thu, 10 Mar 2011 12:10:58 -0800 (PST) In-Reply-To: <201103101446.37589.jhb@freebsd.org> References: <201103101446.37589.jhb@freebsd.org> Date: Thu, 10 Mar 2011 12:10:58 -0800 X-Google-Sender-Auth: NjaLT1_E1sU-xgoswljWf1KZjaU Message-ID: From: mdf@FreeBSD.org To: John Baldwin Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: freebsd-arch@freebsd.org Subject: Re: style(9) rules for nested includes X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 Mar 2011 20:11:01 -0000 On Thu, Mar 10, 2011 at 11:46 AM, John Baldwin wrote: > On Thursday, March 10, 2011 12:17:28 pm mdf@freebsd.org wrote: >> I recall a recent discussion/PR about nested includes in the context >> of and being a few of the only ones >> allowed. =A0However, I don't see anything in style(9) about this. > > bde@ is probably the most authoritative. =A0My understanding is that the = only > nested includes allowed in sys/sys/*.h are the two listed above and any h= eader > that starts with an underscore (sys/_mutex.h, etc.). =A0The underscore va= riants > were added to allow nested includes when absolutely necessary, but those > includes are the bare minimum required to define structures, etc. > >> Now we come to the reason I ask. =A0I'm working on a patch to change the >> static sysctl code to use the standard SYSININT/SYSUNINIT code rather >> than have special treatment in kern_linker.c, but to do this I need to >> either change quite a few places that include , or >> include instead of in sysctl.h, as >> the SI_SUB_SYSCTLS value isn't visible otherwise. > > Hmm, what is the reason to use SYSINIT's instead of a dedicated linker se= t? Mostly for consistency. The DB_COMMAND linker set was changed to use SYSINITs for version 8, and AFIAK SYSCTL is the only global kernel thing using a separate linker set. There's also a minor bug in initialization ordering where a static SYSCTL_PROC could use a lock initialized by SX_SYSINIT or MTX_SYSINIT, but at runtime module load the sysctl is exposed before the SI_SUB_LOCK stage has run, so in theory someone doing sysctl -a would crash the kernel on an attempt to lock an uninitialized mtx/sx. We saw this happen once at Isilon. Thanks, matthew