Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 17 Dec 2013 00:23:33 -0800
From:      Adrian Chadd <adrian@freebsd.org>
To:        "freebsd-arch@freebsd.org" <freebsd-arch@freebsd.org>, Bruce Evans <bde@freebsd.org>
Subject:   Using sys/types.h types in sys/socket.h
Message-ID:  <CAJ-Vmo=MWPQWfP9duWPPwaKee5Zp9Gemj3GKqE8=bxkjn_1YYA@mail.gmail.com>

next in thread | raw e-mail | index | archive | help
Hi,

I have a patch to implement some new sendfile functionality, but this
involves adding stuff to 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?) */
+};
+
+struct sf_hdtr_all {
+ struct sf_hdtr hdtr;
+ struct sf_hdtr_kq kq;
+};
+
+/*
  * Sendfile-specific flag(s)
  */
 #define SF_NODISKIO     0x00000001
 #define SF_MNOWAIT 0x00000002
 #define SF_SYNC 0x00000004
+#define SF_KQUEUE 0x00000008

 #ifdef _KERNEL
 #define SFK_COMPAT 0x00000001


... 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.

Thanks!


-a



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAJ-Vmo=MWPQWfP9duWPPwaKee5Zp9Gemj3GKqE8=bxkjn_1YYA>