dont try set per socket keepalive timing on bsds

As per http://libwebsockets.org/trac/ticket/10
BSD doesn't support setting keepalive info per-socket

Signed-off-by: Andy Green <andy.green@linaro.org>
diff --git a/README.coding b/README.coding
index 7c9d631..4f4c27a 100644
--- a/README.coding
+++ b/README.coding
@@ -184,3 +184,7 @@
 response is not coming, the socket will announce an error at poll() forcing
 a close.
 
+Note that BSDs don't support keepalive time / probes / inteveral per-socket
+like Linux does.  On those systems you can enable keepalive by a nonzero
+value in ka_time, but the systemwide kernel settings for the time / probes/
+interval are used, regardless of what nonzero value is in ka_time.
diff --git a/changelog b/changelog
index fcf091d..77d7f8b 100644
--- a/changelog
+++ b/changelog
@@ -10,10 +10,13 @@
  	 "1.1 9e7f737", representing the library version from configure.ac
 	 and the git HEAD hash the library was built from
 
- - TCP Keepalive can now optionally be applied to all lws sockets, with
-	controllable timeout, number of probes and probe interval.  This
-	enables detection of idle connections which are logically okay, but
-	are in fact dead, due to network connectivity issues at the server,
+ - TCP Keepalive can now optionally be applied to all lws sockets, on Linux
+ 	also with controllable timeout, number of probes and probe interval.
+	(On BSD type OS, you can only use system default settings for the
+	timing and retries, although enabling it is supported by setting
+	ka_time to nonzero, the exact value has no meaning.)
+	This enables detection of idle connections which are logically okay,
+	but are in fact dead, due to network connectivity issues at the server,
 	client, or any intermediary.  By default it's not enabled, but you
 	can enable it by setting a non-zero timeout (in seconds) at the new
 	ka_time member at context creation time.
diff --git a/lib/libwebsockets.c b/lib/libwebsockets.c
index dd58ff1..f5dfceb 100644
--- a/lib/libwebsockets.c
+++ b/lib/libwebsockets.c
@@ -537,6 +537,14 @@
 					     (const void *)&optval, optlen) < 0)
 			return 1;
 
+#if defined(__APPLE__) || defined(__FreeBSD__) || defined(__NetBSD__)
+
+		/*
+		 * didn't find a way to set these per-socket, need to
+		 * tune kernel systemwide values
+		 */
+
+#else
 		/* set the keepalive conditions we want on it too */
 		optval = context->ka_time;
 		if (setsockopt(fd, IPPROTO_IP, TCP_KEEPIDLE,
@@ -552,6 +560,7 @@
 		if (setsockopt(fd, IPPROTO_IP, TCP_KEEPCNT,
 					     (const void *)&optval, optlen) < 0)
 			return 1;
+#endif
 	}
 
 	/* Disable Nagle */