Commit 5f49c7d6 authored by Davi Arnaut's avatar Davi Arnaut

FIONREAD is located in sys/filio.h on Solaris.

parent 4eebae08
...@@ -125,6 +125,7 @@ ...@@ -125,6 +125,7 @@
#cmakedefine FIONREAD_IN_SYS_IOCTL 1 #cmakedefine FIONREAD_IN_SYS_IOCTL 1
#cmakedefine GWINSZ_IN_SYS_IOCTL 1 #cmakedefine GWINSZ_IN_SYS_IOCTL 1
#cmakedefine TIOCSTAT_IN_SYS_IOCTL 1 #cmakedefine TIOCSTAT_IN_SYS_IOCTL 1
#cmakedefine FIONREAD_IN_SYS_FILIO 1
/* Functions we may want to use. */ /* Functions we may want to use. */
#cmakedefine HAVE_AIOWAIT 1 #cmakedefine HAVE_AIOWAIT 1
......
...@@ -487,6 +487,7 @@ CHECK_SYMBOL_EXISTS(getpagesize "unistd.h" HAVE_GETPAGESIZE) ...@@ -487,6 +487,7 @@ CHECK_SYMBOL_EXISTS(getpagesize "unistd.h" HAVE_GETPAGESIZE)
CHECK_SYMBOL_EXISTS(TIOCGWINSZ "sys/ioctl.h" GWINSZ_IN_SYS_IOCTL) CHECK_SYMBOL_EXISTS(TIOCGWINSZ "sys/ioctl.h" GWINSZ_IN_SYS_IOCTL)
CHECK_SYMBOL_EXISTS(FIONREAD "sys/ioctl.h" FIONREAD_IN_SYS_IOCTL) CHECK_SYMBOL_EXISTS(FIONREAD "sys/ioctl.h" FIONREAD_IN_SYS_IOCTL)
CHECK_SYMBOL_EXISTS(TIOCSTAT "sys/ioctl.h" TIOCSTAT_IN_SYS_IOCTL) CHECK_SYMBOL_EXISTS(TIOCSTAT "sys/ioctl.h" TIOCSTAT_IN_SYS_IOCTL)
CHECK_SYMBOL_EXISTS(FIONREAD "sys/filio.h" FIONREAD_IN_SYS_FILIO)
CHECK_SYMBOL_EXISTS(gettimeofday "sys/time.h" HAVE_GETTIMEOFDAY) CHECK_SYMBOL_EXISTS(gettimeofday "sys/time.h" HAVE_GETTIMEOFDAY)
CHECK_SYMBOL_EXISTS(finite "math.h" HAVE_FINITE_IN_MATH_H) CHECK_SYMBOL_EXISTS(finite "math.h" HAVE_FINITE_IN_MATH_H)
......
...@@ -22,6 +22,10 @@ ...@@ -22,6 +22,10 @@
#include "vio_priv.h" #include "vio_priv.h"
#ifdef FIONREAD_IN_SYS_FILIO
# include <sys/filio.h>
#endif
int vio_errno(Vio *vio __attribute__((unused))) int vio_errno(Vio *vio __attribute__((unused)))
{ {
return socket_errno; /* On Win32 this mapped to WSAGetLastError() */ return socket_errno; /* On Win32 this mapped to WSAGetLastError() */
...@@ -583,13 +587,13 @@ static my_bool socket_poll_read(my_socket sd, uint timeout) ...@@ -583,13 +587,13 @@ static my_bool socket_poll_read(my_socket sd, uint timeout)
static my_bool socket_peek_read(Vio *vio, uint *bytes) static my_bool socket_peek_read(Vio *vio, uint *bytes)
{ {
#ifdef __WIN__ #if defined(_WIN32)
int len; int len;
if (ioctlsocket(vio->sd, FIONREAD, &len)) if (ioctlsocket(vio->sd, FIONREAD, &len))
return TRUE; return TRUE;
*bytes= len; *bytes= len;
return FALSE; return FALSE;
#elif FIONREAD_IN_SYS_IOCTL #elif defined(FIONREAD_IN_SYS_IOCTL) || defined(FIONREAD_IN_SYS_FILIO)
int len; int len;
if (ioctl(vio->sd, FIONREAD, &len) < 0) if (ioctl(vio->sd, FIONREAD, &len) < 0)
return TRUE; return TRUE;
......
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