]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
CONTRIB: tcploop: make it build on FreeBSD
authorWilly Tarreau <w@1wt.eu>
Tue, 14 Mar 2017 13:36:26 +0000 (14:36 +0100)
committerWilly Tarreau <w@1wt.eu>
Wed, 15 Mar 2017 10:48:46 +0000 (11:48 +0100)
A few changes :
- SOL_TCP must be replaced with IPPROTO_TCP
- TCP_NOQUICKACK is not defined
- MSG_MORE can be ignored and replaced with 0

contrib/tcploop/tcploop.c

index 033481150f6f84fec3acbc423273ed13d90dc6ec..2b1735b6389a841b419216aebff6412d53b516db 100644 (file)
 #include <time.h>
 #include <unistd.h>
 
+#ifndef SOL_TCP
+#define SOL_TCP IPPROTO_TCP
+#endif
+
+#ifndef MSG_MORE
+#define MSG_MORE 0
+#endif
 
 struct err_msg {
        int size;
@@ -309,8 +316,12 @@ int tcp_set_nolinger(int sock, const char *arg)
 
 int tcp_set_noquickack(int sock, const char *arg)
 {
+#ifdef TCP_QUICKACK
        /* warning: do not use during connect if nothing is to be sent! */
        return setsockopt(sock, SOL_TCP, TCP_QUICKACK, &zero, sizeof(zero));
+#else
+       return 0;
+#endif
 }
 
 /* Try to listen to address <sa>. Return the fd or -1 in case of error */