summaryrefslogtreecommitdiff
path: root/vio
diff options
context:
space:
mode:
authorunknown <monty@hundin.mysql.fi>2001-10-09 03:35:29 +0300
committerunknown <monty@hundin.mysql.fi>2001-10-09 03:35:29 +0300
commit1c64f355b4e0bb7a709dd850857a9bb41b11d09c (patch)
tree07f2a0acc005ba2b7fb714ce60cb6f8417c6f60e /vio
parent9417dc5c17bc0c35d04e20e600ce7804ec20e736 (diff)
downloadmariadb-git-1c64f355b4e0bb7a709dd850857a9bb41b11d09c.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. Docs/manual.texi: Updated upgrading from 3.23 -> 4.0 client/mysqladmin.c: Portability fixes client/mysqlshow.c: Portability fixes extra/resolveip.c: Portability fixes include/my_global.h: Portability fixes include/my_net.h: 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. include/mysql_com.h: Portability fixes libmysql/net.c: Portability fixes libmysqld/lib_vio.c: Portability fixes mysql-test/r/drop.result: Fix crashed tests mysql-test/r/err000001.result: Fix crashed tests mysql-test/r/innodb.result: Fix crashed tests mysql-test/r/overflow.result: Fix crashed tests sql/net_serv.cc: Use new my_net.h vio/vio.c: Use new my_net.h vio/viosocket.c: Use new my_net.h vio/viossl.c: Use new my_net.h
Diffstat (limited to 'vio')
-rw-r--r--vio/vio.c12
-rw-r--r--vio/viosocket.c29
-rw-r--r--vio/viossl.c38
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 */