From owner-freebsd-arch@FreeBSD.ORG Fri Jan 7 23:13:37 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 9DB44106566B for ; Fri, 7 Jan 2011 23:13:37 +0000 (UTC) (envelope-from mdf356@gmail.com) Received: from mail-iw0-f182.google.com (mail-iw0-f182.google.com [209.85.214.182]) by mx1.freebsd.org (Postfix) with ESMTP id 6888D8FC14 for ; Fri, 7 Jan 2011 23:13:37 +0000 (UTC) Received: by iwn39 with SMTP id 39so17922977iwn.13 for ; Fri, 07 Jan 2011 15:13:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:sender:received:date :x-google-sender-auth:message-id:subject:from:to:content-type; bh=OpP1j5oObTUo5Nf+ET+lCgItdgje5CQr5Vp4T8IzbKA=; b=pGSwCTvfYK8Fzqpteey+uRtz+nT17G1mmzFKE7dMWqoF7AulqkOvgvQzktfHod6D2H y6hb06udsmLqYE9AdiH/Wbml3T6XG95NyPyGCVXYaeERA+zLGYcjT5VoO+OczNbvLbId RcwOXje1xiSjjPiF7fAA4PWzVddZELIP5JSGU= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:date:x-google-sender-auth:message-id:subject :from:to:content-type; b=iYQw/V0SInTCLCXBqbpDMl/ECbXypDQ1rzhBX5KkHB/C1N5p5eVpeXXb+KTwAxlzFw yflKhYFIXtfUFQiHMDndn4E1zY7JUGr8At4t894V8YdTzMAiFN5TJXo4i331ZA+u+Rvq ia24fHAsdQoN6MTc0N485RAcKgecSnpbgpjjo= MIME-Version: 1.0 Received: by 10.231.40.3 with SMTP id i3mr24902711ibe.129.1294442016904; Fri, 07 Jan 2011 15:13:36 -0800 (PST) Sender: mdf356@gmail.com Received: by 10.231.160.147 with HTTP; Fri, 7 Jan 2011 15:13:36 -0800 (PST) Date: Fri, 7 Jan 2011 15:13:36 -0800 X-Google-Sender-Auth: WhYX7KJBD0CWk3XxYySpdmDS19Y Message-ID: From: mdf@FreeBSD.org To: FreeBSD Arch Content-Type: text/plain; charset=ISO-8859-1 Subject: SYSCTL type safety 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: Fri, 07 Jan 2011 23:13:37 -0000 Long ago at Isilon we ran into a problem with some sysctls in the stock FreeBSD tree using the wrong type, like SYSCTL_ULONG on an int, or just mixing unsigned/signed. We have a patch that uses transparent unions to cause a compile-time error with a type mismatch. For a while I was hesitant to push this since I wasn't sure about the use of a gcc extension, but the SYSCTL fixes and the way to keep them sane came up again when we started building a new driver locally, and the build failed until we fixed some SYSCTL stuff. Anyways, the patch to sys/sysctl.h is at http://people.freebsd.org/~mdf/bsd-sysctl-type-safety.diff Please chime in if you think this is a bad thing to add to the tree. I will of course ensure a make universe passes locally before committing this part. The plan is to change the SYSCTL use, not the base type of the variable, for any conflicts found. Thanks, matthew