Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 17 Jan 2014 05:13:08 +0000 (UTC)
From:      Adrian Chadd <adrian@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r260804 - head/sys/sys
Message-ID:  <201401170513.s0H5D8RH092967@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201401170513.s0H5D8RH092967>