r4162 - branches/2.0/varnish-cache/lib/libvarnish
sky at projects.linpro.no
sky at projects.linpro.no
Wed Jul 29 14:55:44 CEST 2009
Author: sky
Date: 2009-07-29 14:55:43 +0200 (Wed, 29 Jul 2009)
New Revision: 4162
Modified:
branches/2.0/varnish-cache/lib/libvarnish/tcp.c
Log:
Merge solaris bugfix in from r4161
Modified: branches/2.0/varnish-cache/lib/libvarnish/tcp.c
===================================================================
--- branches/2.0/varnish-cache/lib/libvarnish/tcp.c 2009-07-29 12:43:33 UTC (rev 4161)
+++ branches/2.0/varnish-cache/lib/libvarnish/tcp.c 2009-07-29 12:55:43 UTC (rev 4162)
@@ -56,6 +56,11 @@
#include "libvarnish.h"
+/* Solaris can't use the ioctl" */
+#ifdef __sun
+#include <fcntl.h>
+#endif
+
/*--------------------------------------------------------------------*/
void
@@ -126,6 +131,9 @@
* us to do two syscalls, one to get and one to set, the latter of
* which mucks about a bit before it ends up calling ioctl(FIONBIO),
* at least on FreeBSD.
+ *
+ * On some platforms we need to use fcntl because the ioctl is unreliable
+ * The one that we know this is the case for is solaris.
*/
void
@@ -133,8 +141,13 @@
{
int i;
+#ifdef __sun
+ i = fcntl (sock, F_GETFL,0);
+ fcntl(sock, F_SETFL, i & ~O_NONBLOCK);
+#else
i = 0;
AZ(ioctl(sock, FIONBIO, &i));
+#endif
}
void
@@ -142,8 +155,13 @@
{
int i;
+#ifdef __sun
+ i = fcntl (sock, F_GETFL,0);
+ fcntl(sock, F_SETFL, i | O_NONBLOCK);
+#else
i = 1;
AZ(ioctl(sock, FIONBIO, &i));
+#endif
}
/*--------------------------------------------------------------------
More information about the varnish-commit
mailing list