summaryrefslogtreecommitdiff
path: root/lib/libc
diff options
context:
space:
mode:
authorMike Belopuhov <mikeb@cvs.openbsd.org>2011-07-04 00:34:44 +0000
committerMike Belopuhov <mikeb@cvs.openbsd.org>2011-07-04 00:34:44 +0000
commit855af2106ce187c17278ed5079e054176f9cdfeb (patch)
treea5138b5fce64e9252aa38f807ff767e76afb0415 /lib/libc
parent8b015e49e180729ea6153e828699ceaccb172ed1 (diff)
Implement an idle timeout for the socket splicing. A new `sp_idle'
field of the `splice' structure can be used to specify a period of inactivity after which splicing will be dissolved. ETIMEDOUT error retrieved with a SO_ERROR indicates the idle timeout expiration. With comments from and OK bluhm.
Diffstat (limited to 'lib/libc')
-rw-r--r--lib/libc/sys/getsockopt.221
1 files changed, 15 insertions, 6 deletions
diff --git a/lib/libc/sys/getsockopt.2 b/lib/libc/sys/getsockopt.2
index ecf38e1e6bd..9de91b68e69 100644
--- a/lib/libc/sys/getsockopt.2
+++ b/lib/libc/sys/getsockopt.2
@@ -1,4 +1,4 @@
-.\" $OpenBSD: getsockopt.2,v 1.32 2011/05/02 20:18:17 jmc Exp $
+.\" $OpenBSD: getsockopt.2,v 1.33 2011/07/04 00:34:43 mikeb Exp $
.\" $NetBSD: getsockopt.2,v 1.7 1995/02/27 12:33:29 cgd Exp $
.\"
.\" Copyright (c) 1983, 1991, 1993
@@ -30,7 +30,7 @@
.\"
.\" @(#)getsockopt.2 8.3 (Berkeley) 4/19/94
.\"
-.Dd $Mdocdate: May 2 2011 $
+.Dd $Mdocdate: July 4 2011 $
.Dt GETSOCKOPT 2
.Os
.Sh NAME
@@ -362,15 +362,19 @@ In the second form,
is a
.Vt struct splice
with the drain socket in
-.Va sp_fd
-and a positive maximum number of bytes or 0 in
-.Va sp_max .
+.Va sp_fd ,
+a positive maximum number of bytes or 0 in
+.Va sp_max
+and an idle timeout
+.Va sp_idle
+in a form of a
+.Vt struct timeval .
If \-1 is given as drain socket, the source socket
.Fa s
gets unspliced.
Otherwise the spliced data transfer continues within the kernel
until the optional maximum is reached, one of the connections
-terminates or an error occurs.
+terminates, idle timeout expires or an error occurs.
A successful
.Xr select 2 ,
.Xr poll 2 ,
@@ -383,6 +387,11 @@ is available.
The error status can be examined with
.Dv SO_ERROR
at the source socket.
+.Er ETIMEDOUT
+error is set if there was no data transfered between two sockets
+during the
+.Va sp_idle
+period of time.
Note that if a maximum is given, it is only guaranteed that no more
bytes are transferred.
A short splice can happen but then a second call to splice will