From owner-freebsd-arch@FreeBSD.ORG Tue Dec 17 10:08:36 2013 Return-Path: Delivered-To: freebsd-arch@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 3CD4E87F; Tue, 17 Dec 2013 10:08:36 +0000 (UTC) Received: from mail110.syd.optusnet.com.au (mail110.syd.optusnet.com.au [211.29.132.97]) by mx1.freebsd.org (Postfix) with ESMTP id F0997115B; Tue, 17 Dec 2013 10:08:35 +0000 (UTC) Received: from c122-106-144-87.carlnfd1.nsw.optusnet.com.au (c122-106-144-87.carlnfd1.nsw.optusnet.com.au [122.106.144.87]) by mail110.syd.optusnet.com.au (Postfix) with ESMTPS id 04BAB7815C2; Tue, 17 Dec 2013 21:08:26 +1100 (EST) Date: Tue, 17 Dec 2013 21:07:55 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Adrian Chadd Subject: Re: Using sys/types.h types in sys/socket.h In-Reply-To: Message-ID: <20131217204732.D2024@besplex.bde.org> References: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.1 cv=YYGEuWhf c=1 sm=1 tr=0 a=p/w0leo876FR0WNmYI1KeA==:117 a=PO7r1zJSAAAA:8 a=n4PiHyf99_4A:10 a=kj9zAlcOel0A:10 a=JzwRw_2MAAAA:8 a=zprIhm_aaxwA:10 a=uZvujYp8AAAA:8 a=qJQZ6vFn4QtbnErC1EUA:9 a=CjuIK1q_8ugA:10 a=jdbVF-fcCCEA:10 Cc: "freebsd-arch@freebsd.org" X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 17 Dec 2013 10:08:36 -0000 On Tue, 17 Dec 2013, Adrian Chadd wrote: > I have a patch to implement some new sendfile functionality, but this > involves adding stuff to sys/socket.h: This would undo FreeBSD's de-pollution of sys/socket.h. > Index: sys/sys/socket.h > =================================================================== > --- sys/sys/socket.h (revision 258883) > +++ sys/sys/socket.h (working copy) > @@ -577,11 +577,27 @@ > }; > > /* > + * sendfile(2) kqueue information > + */ > +struct sf_hdtr_kq { > + int kq_fd; /* kq fd to post completion events on */ > + uint32_t kq_flags; /* extra flags to pass in */ > + void *kq_udata; /* user data pointer */ > + uintptr_t kq_ident; /* ident (from userland?) */ > +}; POSIX is bad enough to allow all the symbols in sys/type.h to be declared here, but it doesn't allow sf_* or kq_*. So this would have to be under __BSD_VISIBLE, and POSIX is irrelevant for the uintptr_t and uint32_t pollution. In fact, this section is already under __BSD_VISIBLE. It doesn't have so many style bugs as this. All tabs seem to have been corrupted by mail programs, except in struct sf_hdtr where they are missing in the committed version. > ... now, uintptr_t upsets things, because we don't include sys/types.h > before sys/socket.h. > > The POSIX spec for sys/socket.h doesn't mention a dependency on > sys/types.h and in fact says it should define a couple of types > itself. > > http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_socket.h.html > > .. so, what suggestions do people have? I'd like to do this right and > not cause header pollution. Either use __uintptr_t, or declare only uintptr_t as is done for 7 other types near the beginning of the file, depending on whether the uintptr_t field needs to be accessed from userland. Bruce