summaryrefslogtreecommitdiff
path: root/vio
diff options
context:
space:
mode:
authorunknown <monty@hundin.mysql.fi>2001-10-08 23:20:19 +0300
committerunknown <monty@hundin.mysql.fi>2001-10-08 23:20:19 +0300
commit9417dc5c17bc0c35d04e20e600ce7804ec20e736 (patch)
treee7d13849a1d92edeaacd31753856f5a8cb389781 /vio
parent4c52928bc84a503fed81ebd7cf934a7857491aa5 (diff)
downloadmariadb-git-9417dc5c17bc0c35d04e20e600ce7804ec20e736.tar.gz
Portability fixes + a couple of bug fixes introduced by last push.
Docs/manual.texi: Removed wrong web links include/mysql_com.h: Portability fix libmysqld/Makefile.am: Fix 'make dist' mysys/mf_dirname.c: Bugfix for last push scripts/explain_log.sh: Nicer output scripts/mysql_install_db.sh: Removed warnings when using 'mysql_install_db' sql/sql_parse.cc: Ensure that thd->query_length is always set sql/sql_show.cc: cleanup sql/sql_yacc.yy: Fix bug in last push vio/vio.c: Merge with violite.cc vio/viosocket.c: Merge with violite.cc
Diffstat (limited to 'vio')
-rw-r--r--vio/vio.c18
-rw-r--r--vio/viosocket.c32
2 files changed, 17 insertions, 33 deletions
diff --git a/vio/vio.c b/vio/vio.c
index 15a12bb958d..95d318ba118 100644
--- a/vio/vio.c
+++ b/vio/vio.c
@@ -38,26 +38,10 @@
#include <sys/ioctl.h>
#endif
-#if defined(__EMX__)
+#if defined(__EMX__) || defined(OS2)
#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
-
-
/*
* Helper to fill most of the Vio* with defaults.
*/
diff --git a/vio/viosocket.c b/vio/viosocket.c
index 60272db3171..aacfab42810 100644
--- a/vio/viosocket.c
+++ b/vio/viosocket.c
@@ -39,23 +39,23 @@
#include <sys/ioctl.h>
#endif
-#if defined(__EMX__)
+
+#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__)
-#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
+#define SOCKET_EWOULDBLOCK SOCKET_EAGAIN
#endif
#ifndef __WIN__
@@ -76,7 +76,7 @@ void vio_delete(Vio* vio)
int vio_errno(Vio *vio __attribute__((unused)))
{
- return errno; /* On Win32 this mapped to WSAGetLastError() */
+ return socket_errno; /* On Win32 this mapped to WSAGetLastError() */
}
@@ -129,7 +129,7 @@ int vio_write(Vio * vio, const gptr buf, int size)
#ifndef DBUG_OFF
if (r < 0)
{
- DBUG_PRINT("vio_error", ("Got error on write: %d",errno));
+ DBUG_PRINT("vio_error", ("Got error on write: %d",socket_errno));
}
#endif /* DBUG_OFF */
DBUG_PRINT("exit", ("%d", r));
@@ -242,8 +242,8 @@ int vio_keepalive(Vio* vio, my_bool set_keep_alive)
my_bool
vio_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;
}
@@ -271,7 +271,7 @@ int vio_close(Vio * vio)
}
if (r)
{
- DBUG_PRINT("vio_error", ("close() failed, error: %d",errno));
+ DBUG_PRINT("vio_error", ("close() failed, error: %d",socket_errno));
/* FIXME: error handling (not critical for MySQL) */
}
vio->type= VIO_CLOSED;
@@ -310,7 +310,7 @@ my_bool vio_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);
}
my_inet_ntoa(vio->remote.sin_addr,buf);