Commit a94874ee authored by Artur Bergman's avatar Artur Bergman

Merge solaris bugfix in from r4161

git-svn-id: http://www.varnish-cache.org/svn/branches/2.0@4162 d4fa192b-c00b-0410-8231-f00ffab90ce4
parent 6d87f66b
......@@ -56,6 +56,11 @@
#include "libvarnish.h"
/* Solaris can't use the ioctl" */
#ifdef __sun
#include <fcntl.h>
#endif
/*--------------------------------------------------------------------*/
void
......@@ -126,6 +131,9 @@ TCP_filter_http(int sock)
* 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 @@ TCP_blocking(int sock)
{
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 @@ TCP_nonblocking(int sock)
{
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
}
/*--------------------------------------------------------------------
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment