Using sys/types.h types in sys/socket.h
Adrian Chadd
adrian at freebsd.org
Tue Dec 17 08:23:34 UTC 2013
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
More information about the freebsd-arch
mailing list