From owner-freebsd-arch@FreeBSD.ORG Fri Mar 9 22:01:26 2012 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 4F982106566C; Fri, 9 Mar 2012 22:01:26 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: from mail-pz0-f54.google.com (mail-pz0-f54.google.com [209.85.210.54]) by mx1.freebsd.org (Postfix) with ESMTP id D760B8FC12; Fri, 9 Mar 2012 22:01:25 +0000 (UTC) Received: by dald2 with SMTP id d2so2149418dal.13 for ; Fri, 09 Mar 2012 14:01:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=CRbO6Xgv53Z4LVR6eZFYPRkbWbWPPpagtOTMpNPs2Z8=; b=W5k3YkX+V9k21RUjshs4h6yx8/vu1lRlO2N5o+QdHEhyLzHZS8m9IyLtrvCI3mHRxn c3NixirvuxtoYGaVQt5F8aSNT95NXtJiTeyHFPRGdZqGvdlcuF/8hK46HJwiomn5hgjw D5Q60ZLSuAe5SgIx8J9Q3F9ZSPTX00FF2S6jKRSxeLiinoz007y/FkhlAk9Gqir9dA6n 0EOBgOoKXBbT5KOIL2M3VYhmZ5aXxPvgLPc69zztgjG5WMWOiJ9MuVXW4+3834XxBW/3 81JWM0HqmlLotM+K91NlZL0esspuVp3hS0P4V21suAfw9PtAdjYi7BqDk6aLbOOL9iJe g+Tg== MIME-Version: 1.0 Received: by 10.68.233.65 with SMTP id tu1mr6873865pbc.18.1331330485712; Fri, 09 Mar 2012 14:01:25 -0800 (PST) Sender: adrian.chadd@gmail.com Received: by 10.143.33.5 with HTTP; Fri, 9 Mar 2012 14:01:25 -0800 (PST) In-Reply-To: References: Date: Fri, 9 Mar 2012 14:01:25 -0800 X-Google-Sender-Auth: sA4oZn2zluphuWgsoRDPVZZ_tws Message-ID: From: Adrian Chadd To: Robert Millan Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: freebsd-arch@freebsd.org Subject: Re: [PATCH] Add compatibility 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, 09 Mar 2012 22:01:26 -0000 I really, really don't like the idea of having the same function have different argument orders based on the include file you're using. That will lead to all kinds of weird ass debugging issues later on. Why is it that we can't fix the upstream code? Adrian On 9 March 2012 13:36, Robert Millan wrote: > This patch adds a compatibility that would make it easier > to build on FreeBSD software that has been written for glibc (see > example1.c). > > The functionality in is more or less equivalent to > but provides some declarations which are > incompatible with those in . One of these cases is > very unfortunate because it alters I/O semantics, it applies to > outb(), outw() and outl(): > > =A0FreeBSD code: outw(port, data); > =A0Glibc code: outw(data, port); > > The undefined I/O behaviour that could potentially result from this is > very scary. Because of this I've written a few checks to prevent both > headers from being used at the same time. Overall, aside from the > portability benefit, my proposed addition has some less obvious > side-effects: > > =A0 =A0 Desireable side-effect: Adding would break > buildability of code that attempts to use both headers at the same > time _WITHOUT_ changing the outw() call semantics (see example2.c). > > =A0 =A0 Undesireable side-effect: Adding would break > buildability of code that attempts to use both headers at the same > time, and was otherwise fine due to conditionalized outw() calls (see > example3.c [1]). > > [1] I found a real case where this happens, in > sane-backends-1.0.22/backend/umax_pp_low.c. In case my patch is > accepted, I commit to provide a fix for sane-backends and also to > adjust Debian GNU/kFreeBSD headers to follow the same route [2]. > > [2] This means: reenable outb(), outw() and outl() in > . Currently we provide both headers, but outb(), > outw() and outl() are entirely disabled. I think it's better for both > projects to provide since the majority of code out there is > written with GNU/Linux in mind. > > Attached patch is tested against HEAD with "make universe". > > -- > Robert Millan > > _______________________________________________ > freebsd-arch@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-arch > To unsubscribe, send any mail to "freebsd-arch-unsubscribe@freebsd.org"