svn commit: r261017 - in stable/10: share/man/man4 sys/netinet

Gleb Smirnoff glebius at FreeBSD.org
Wed Jan 22 10:08:34 UTC 2014


Author: glebius
Date: Wed Jan 22 10:08:33 2014
New Revision: 261017
URL: http://svnweb.freebsd.org/changeset/base/261017

Log:
  Merge r257846:
    Make TCP_KEEP* socket options readable. At least PostgreSQL wants
    to read the values.

Modified:
  stable/10/share/man/man4/tcp.4
  stable/10/sys/netinet/tcp_usrreq.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/share/man/man4/tcp.4
==============================================================================
--- stable/10/share/man/man4/tcp.4	Wed Jan 22 10:01:13 2014	(r261016)
+++ stable/10/share/man/man4/tcp.4	Wed Jan 22 10:08:33 2014	(r261017)
@@ -38,7 +38,7 @@
 .\"     From: @(#)tcp.4	8.1 (Berkeley) 6/5/93
 .\" $FreeBSD$
 .\"
-.Dd March 7, 2012
+.Dd November 8, 2013
 .Dt TCP 4
 .Os
 .Sh NAME
@@ -48,6 +48,7 @@
 .In sys/types.h
 .In sys/socket.h
 .In netinet/in.h
+.In netinet/tcp.h
 .Ft int
 .Fn socket AF_INET SOCK_STREAM 0
 .Sh DESCRIPTION
@@ -147,7 +148,7 @@ See
 .Xr mod_cc 4
 for details.
 .It Dv TCP_KEEPINIT
-This write-only
+This
 .Xr setsockopt 2
 option accepts a per-socket timeout argument of
 .Vt "u_int"
@@ -160,7 +161,7 @@ in the
 .Sx MIB Variables
 section further down.
 .It Dv TCP_KEEPIDLE
-This write-only
+This
 .Xr setsockopt 2
 option accepts an argument of
 .Vt "u_int"
@@ -176,7 +177,7 @@ in the
 .Sx MIB Variables
 section further down.
 .It Dv TCP_KEEPINTVL
-This write-only
+This
 .Xr setsockopt 2
 option accepts an argument of
 .Vt "u_int"
@@ -191,7 +192,7 @@ in the
 .Sx MIB Variables
 section further down.
 .It Dv TCP_KEEPCNT
-This write-only
+This
 .Xr setsockopt 2
 option accepts an argument of
 .Vt "u_int"

Modified: stable/10/sys/netinet/tcp_usrreq.c
==============================================================================
--- stable/10/sys/netinet/tcp_usrreq.c	Wed Jan 22 10:01:13 2014	(r261016)
+++ stable/10/sys/netinet/tcp_usrreq.c	Wed Jan 22 10:08:33 2014	(r261017)
@@ -1584,6 +1584,27 @@ unlock_and_done:
 			INP_WUNLOCK(inp);
 			error = sooptcopyout(sopt, buf, TCP_CA_NAME_MAX);
 			break;
+		case TCP_KEEPIDLE:
+		case TCP_KEEPINTVL:
+		case TCP_KEEPINIT:
+		case TCP_KEEPCNT:
+			switch (sopt->sopt_name) {
+			case TCP_KEEPIDLE:
+				ui = tp->t_keepidle / hz;
+				break;
+			case TCP_KEEPINTVL:
+				ui = tp->t_keepintvl / hz;
+				break;
+			case TCP_KEEPINIT:
+				ui = tp->t_keepinit / hz;
+				break;
+			case TCP_KEEPCNT:
+				ui = tp->t_keepcnt;
+				break;
+			}
+			INP_WUNLOCK(inp);
+			error = sooptcopyout(sopt, &ui, sizeof(ui));
+			break;
 		default:
 			INP_WUNLOCK(inp);
 			error = ENOPROTOOPT;


More information about the svn-src-all mailing list