From: Robert Brown Date: Fri, 8 Jul 2011 18:40:31 +0000 (-0400) Subject: sb-bsd-sockets: add support for Linux TCP keep alive options X-Git-Url: http://repo.macrolet.net/gitweb/?a=commitdiff_plain;h=3de7cda498fbbabee0de9f6bd0925f2b6dc608a3;p=sbcl.git sb-bsd-sockets: add support for Linux TCP keep alive options --- diff --git a/NEWS b/NEWS index 44a2f04..61e48f0 100644 --- a/NEWS +++ b/NEWS @@ -1,5 +1,7 @@ ;;;; -*- coding: utf-8; fill-column: 78 -*- changes relative to sbcl-1.0.50: + * enhancement: added support for socket keepalive timeout intervals + and probe counts on Linux. * enhancement: building 32-bit SBCL on Linux/x86-64 now works without a chroot. (Use "SBCL_ARCH=x86 sh make.sh" to build.) * bug fix: correct RIP offset calculation in SSE comparison and shuffle diff --git a/contrib/sb-bsd-sockets/constants.lisp b/contrib/sb-bsd-sockets/constants.lisp index efd65ba..eeabd11 100644 --- a/contrib/sb-bsd-sockets/constants.lisp +++ b/contrib/sb-bsd-sockets/constants.lisp @@ -44,7 +44,12 @@ #+linux (:integer so-passcred "SO_PASSCRED") (:integer so-rcvbuf "SO_RCVBUF") (:integer so-keepalive "SO_KEEPALIVE" - "Send periodic keepalives: if peer does not respond, we get SIGPIPE") + "Send periodic keepalives. If peer does not respond, we get SIGPIPE.") + #+linux (:integer tcp-keepcnt "TCP_KEEPCNT" + "Number of unacknowledged probes before the connection is considered dead.") + #+linux (:integer tcp-keepidle "TCP_KEEPIDLE" + "Seconds between the last data packet sent and the first keepalive probe.") + #+linux (:integer tcp-keepintvl "TCP_KEEPINTVL" "Seconds between keepalive probes.") (:integer so-oobinline "SO_OOBINLINE" "Put out-of-band data into the normal input queue when received") #+linux diff --git a/contrib/sb-bsd-sockets/sockopt.lisp b/contrib/sb-bsd-sockets/sockopt.lisp index 22a1816..fb438f1 100644 --- a/contrib/sb-bsd-sockets/sockopt.lisp +++ b/contrib/sb-bsd-sockets/sockopt.lisp @@ -102,6 +102,13 @@ Code for options that not every system has should be conditionalised: sockopt-priority sockint::sol-socket sockint::so-priority :linux "Available only on Linux.") +(define-socket-option-int + sockopt-tcp-keepcnt :tcp sockint::tcp-keepcnt :linux "Available only on Linux.") +(define-socket-option-int + sockopt-tcp-keepidle :tcp sockint::tcp-keepidle :linux "Available only on Linux.") +(define-socket-option-int + sockopt-tcp-keepintvl :tcp sockint::tcp-keepintvl :linux "Available only on Linux.") + ;;; boolean options are integers really (defun foreign-int-to-bool (x size)