svn commit: r260804 - head/sys/sys

Adrian Chadd adrian at FreeBSD.org
Fri Jan 17 05:13:09 UTC 2014


Author: adrian
Date: Fri Jan 17 05:13:08 2014
New Revision: 260804
URL: http://svnweb.freebsd.org/changeset/base/260804

Log:
  Implement the extension api for sendfile to allow for kqueue notifications.
  
  This is still under a bit of flux, as the final API hasn't been nailed
  down.  It's also unclear whether we should define the two new types in the
  header or not - it may allow bad code to compile that shouldn't (ie,
  since uintX's are defined, the developer may not include sys/types.h.)
  
  Reviewed by:	peter, imp, bde
  Sponsored by:	Netflix, Inc.

Modified:
  head/sys/sys/socket.h

Modified: head/sys/sys/socket.h
==============================================================================
--- head/sys/sys/socket.h	Fri Jan 17 04:38:58 2014	(r260803)
+++ head/sys/sys/socket.h	Fri Jan 17 05:13:08 2014	(r260804)
@@ -84,6 +84,16 @@ typedef	__uid_t		uid_t;
 #endif
 #endif
 
+#ifndef _UINT32_T_DECLARED
+typedef	__uint32_t	uint32_t;
+#define	_UINT32_T_DECLARED
+#endif
+
+#ifndef _UINTPTR_T_DECLARED
+typedef	__uintptr_t	uintptr_t;
+#define	_UINTPTR_T_DECLARED
+#endif
+
 /*
  * Types
  */
@@ -577,11 +587,27 @@ struct sf_hdtr {
 };
 
 /*
+ * sendfile(2) kqueue information
+ */
+struct sf_hdtr_kq {
+	uintptr_t kq_ident;	/* ident (from userland?) */
+	void	*kq_udata;	/* user data pointer */
+	uint32_t kq_flags;	/* extra flags to pass in */
+	int	kq_fd;	/* kq fd to post completion events on */
+};
+
+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


More information about the svn-src-all mailing list