diff options
author | monty@hundin.mysql.fi <> | 2001-10-09 03:35:29 +0300 |
---|---|---|
committer | monty@hundin.mysql.fi <> | 2001-10-09 03:35:29 +0300 |
commit | d5fe1db868a8786bad901a632631c2d94eadfbe6 (patch) | |
tree | 07f2a0acc005ba2b7fb714ce60cb6f8417c6f60e /vio | |
parent | 196f620e9024b12e33125c4be03c867b0fabbfcc (diff) | |
download | mariadb-git-d5fe1db868a8786bad901a632631c2d94eadfbe6.tar.gz |
One should not only have to include my_net.h to work with sockets.
This wrapper noew will include all the necessary, system specific files,
which makes all normal source files much easier to write and maintain.
Portability fixes.
Diffstat (limited to 'vio')
-rw-r--r-- | vio/vio.c | 12 | ||||
-rw-r--r-- | vio/viosocket.c | 29 | ||||
-rw-r--r-- | vio/viossl.c | 38 |
3 files changed, 9 insertions, 70 deletions
diff --git a/vio/vio.c b/vio/vio.c index 95d318ba118..759f9416ddf 100644 --- a/vio/vio.c +++ b/vio/vio.c @@ -25,22 +25,10 @@ #include <my_global.h> #include <mysql_com.h> #include <violite.h> - #include <errno.h> -#include <assert.h> #include <my_sys.h> #include <my_net.h> #include <m_string.h> -#ifdef HAVE_POLL -#include <sys/poll.h> -#endif -#ifdef HAVE_SYS_IOCTL_H -#include <sys/ioctl.h> -#endif - -#if defined(__EMX__) || defined(OS2) -#define ioctlsocket ioctl -#endif /* defined(__EMX__) */ /* * Helper to fill most of the Vio* with defaults. diff --git a/vio/viosocket.c b/vio/viosocket.c index aacfab42810..f6f62924b00 100644 --- a/vio/viosocket.c +++ b/vio/viosocket.c @@ -27,36 +27,10 @@ #include <mysql_com.h> #include <errno.h> -#include <assert.h> #include <violite.h> #include <my_sys.h> #include <my_net.h> #include <m_string.h> -#ifdef HAVE_POLL -#include <sys/poll.h> -#endif -#ifdef HAVE_SYS_IOCTL_H -#include <sys/ioctl.h> -#endif - - -#if !defined(MSDOS) && !defined(__WIN__) && !defined(HAVE_BROKEN_NETINET_INCLUDES) && !defined(__BEOS__) -#include <netinet/ip.h> -#if !defined(alpha_linux_port) -#include <netinet/tcp.h> -#endif -#endif - -#if defined(__EMX__) || defined(OS2) -#define ioctlsocket ioctl -#endif /* defined(__EMX__) */ - -#if defined(MSDOS) || defined(__WIN__) -#define O_NONBLOCK 1 /* For emulation of fcntl() */ -#endif -#ifndef EWOULDBLOCK -#define SOCKET_EWOULDBLOCK SOCKET_EAGAIN -#endif #ifndef __WIN__ #define HANDLE void * @@ -243,7 +217,8 @@ my_bool vio_should_retry(Vio * vio __attribute__((unused))) { int en = socket_errno; - return en == SOCKET_EAGAIN || en == SOCKET_EINTR || en == SOCKET_EWOULDBLOCK; + return (en == SOCKET_EAGAIN || en == SOCKET_EINTR || + en == SOCKET_EWOULDBLOCK); } diff --git a/vio/viossl.c b/vio/viossl.c index e80dc0ce807..e4f2d0a5c9f 100644 --- a/vio/viossl.c +++ b/vio/viossl.c @@ -34,31 +34,6 @@ #include <my_sys.h> #include <my_net.h> #include <m_string.h> -#ifdef HAVE_POLL -#include <sys/poll.h> -#endif -#ifdef HAVE_SYS_IOCTL_H -#include <sys/ioctl.h> -#endif - -#if defined(__EMX__) -#define ioctlsocket ioctl -#endif /* defined(__EMX__) */ - -#if defined(MSDOS) || defined(__WIN__) -#ifdef __WIN__ -#undef errno -#undef EINTR -#undef EAGAIN -#define errno WSAGetLastError() -#define EINTR WSAEINTR -#define EAGAIN WSAEINPROGRESS -#endif /* __WIN__ */ -#define O_NONBLOCK 1 /* For emulation of fcntl() */ -#endif -#ifndef EWOULDBLOCK -#define EWOULDBLOCK EAGAIN -#endif #ifndef __WIN__ #define HANDLE void * @@ -83,7 +58,7 @@ report_errors() if (!any_ssl_error) { DBUG_PRINT("info", ("No OpenSSL errors.")); } - DBUG_PRINT("info", ("BTW, errno=%d", errno)); + DBUG_PRINT("info", ("BTW, errno=%d", scoket_errno)); DBUG_VOID_RETURN; } @@ -102,7 +77,7 @@ void vio_ssl_delete(Vio * vio) int vio_ssl_errno(Vio *vio __attribute__((unused))) { - return errno; /* On Win32 this mapped to WSAGetLastError() */ + return socket_errno; /* On Win32 this mapped to WSAGetLastError() */ } @@ -195,8 +170,9 @@ int vio_ssl_keepalive(Vio* vio, my_bool set_keep_alive) my_bool vio_ssl_should_retry(Vio * vio __attribute__((unused))) { - int en = errno; - return en == EAGAIN || en == EINTR || en == EWOULDBLOCK; + int en = socket_errno; + return (en == SOCKET_EAGAIN || en == SOCKET_EINTR || + en == SOCKET_EWOULDBLOCK); } @@ -217,7 +193,7 @@ int vio_ssl_close(Vio * vio) r= -1; if (r) { - DBUG_PRINT("error", ("close() failed, error: %d",errno)); + DBUG_PRINT("error", ("close() failed, error: %d",socket_errno)); report_errors(); /* FIXME: error handling (not critical for MySQL) */ } @@ -257,7 +233,7 @@ my_bool vio_ssl_peer_addr(Vio * vio, char *buf) if (getpeername(vio->sd, (struct sockaddr *) (& (vio->remote)), &addrLen) != 0) { - DBUG_PRINT("exit", ("getpeername, error: %d", errno)); + DBUG_PRINT("exit", ("getpeername, error: %d", socket_errno)); DBUG_RETURN(1); } /* FIXME */ |