Date: Tue, 17 Dec 2013 21:07:55 +1100 (EST) From: Bruce Evans <brde@optusnet.com.au> To: Adrian Chadd <adrian@FreeBSD.org> Cc: "freebsd-arch@freebsd.org" <freebsd-arch@FreeBSD.org> Subject: Re: Using sys/types.h types in sys/socket.h Message-ID: <20131217204732.D2024@besplex.bde.org> In-Reply-To: <CAJ-Vmo=MWPQWfP9duWPPwaKee5Zp9Gemj3GKqE8=bxkjn_1YYA@mail.gmail.com> References: <CAJ-Vmo=MWPQWfP9duWPPwaKee5Zp9Gemj3GKqE8=bxkjn_1YYA@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20131217204732.D2024>