1 .\"
   2 .\" This file and its contents are supplied under the terms of the
   3 .\" Common Development and Distribution License ("CDDL"), version 1.0.
   4 .\" You may only use this file in accordance with the terms of version
   5 .\" 1.0 of the CDDL.
   6 .\"
   7 .\" A full copy of the text of the CDDL should have accompanied this
   8 .\" source.  A copy of the CDDL is also available via the Internet at
   9 .\" http://www.illumos.org/license/CDDL.
  10 .\"
  11 .\"
  12 .\" Copyright 2014 Ryan Zezeski
  13 .\"
  14 .Dd Nov 20, 2014
  15 .Dt DATAFILT 7M
  16 .Os
  17 .Sh NAME
  18 .Nm datafilt
  19 .Nd socket filter module for deferred TCP connections
  20 .Sh DESCRIPTION
  21 The
  22 .Nm datafilt
  23 socket filter provides deferment of
  24 .Xr accept 3SOCKET
  25 for TCP connections. The accept call will not return until at least
  26 one byte has been buffered by the kernel. Deferment assures the
  27 application that the first call to
  28 .Xr read 2 or
  29 .Xr recv 3SOCKET
  30 will not block. It reduces unnecessary switching between user and
  31 kernel.
  32 .Sh EXAMPLES
  33 .Ss Example 1
  34 Enable deferment on the listening socket.
  35 .Bd -literal
  36     setsockopt(lsock, SOL_FILTER, FIL_ATTACH, "datafilt", 8);
  37 .Ed
  38 .Ss Example 2
  39 Disable deferment on the listening socket.
  40 .Bd -literal
  41     char filt[] = "datafilt";
  42     setsockopt(lsock, SOL_FILTER, FIL_DETACH, filt, strlen(filt) + 1);
  43 .Ed
  44 .Sh SEE ALSO
  45 .Xr setsockopt 3SOCKET ,
  46 .Xr httpfilt 7M