From owner-freebsd-arch@FreeBSD.ORG Mon Jan 10 20:03:23 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 6E332106564A; Mon, 10 Jan 2011 20:03:23 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id 3F3B18FC15; Mon, 10 Jan 2011 20:03:23 +0000 (UTC) Received: from bigwig.baldwin.cx (66.111.2.69.static.nyinternet.net [66.111.2.69]) by cyrus.watson.org (Postfix) with ESMTPSA id CAA8746B0D; Mon, 10 Jan 2011 15:03:22 -0500 (EST) Received: from jhbbsd.localnet (smtp.hudson-trading.com [209.249.190.9]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id E9DE08A009; Mon, 10 Jan 2011 15:03:21 -0500 (EST) From: John Baldwin To: freebsd-arch@freebsd.org Date: Mon, 10 Jan 2011 14:09:42 -0500 User-Agent: KMail/1.13.5 (FreeBSD/7.4-CBSD-20110107; KDE/4.4.5; amd64; ; ) References: In-Reply-To: MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201101101409.42157.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.6 (bigwig.baldwin.cx); Mon, 10 Jan 2011 15:03:22 -0500 (EST) X-Virus-Scanned: clamav-milter 0.96.3 at bigwig.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-1.9 required=4.2 tests=BAYES_00 autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on bigwig.baldwin.cx Cc: mdf@freebsd.org Subject: Re: 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: Mon, 10 Jan 2011 20:03:23 -0000 On Friday, January 07, 2011 6:13:36 pm mdf@freebsd.org wrote: > 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 You can't use time_t for INT and size_t for LONG. If we have sysctl's exporting raw time_t and size_t types then we likely need to add some SYSCTL_TIME and SYSCTL_SIZE wrappers? -- John Baldwin