diff options
author | monty@hundin.mysql.fi <> | 2001-10-08 23:20:19 +0300 |
---|---|---|
committer | monty@hundin.mysql.fi <> | 2001-10-08 23:20:19 +0300 |
commit | 196f620e9024b12e33125c4be03c867b0fabbfcc (patch) | |
tree | e7d13849a1d92edeaacd31753856f5a8cb389781 /vio | |
parent | 46a660f450cfb78785838f4dc923eaf6b75c5961 (diff) | |
download | mariadb-git-196f620e9024b12e33125c4be03c867b0fabbfcc.tar.gz |
Portability fixes + a couple of bug fixes introduced by last push.
Diffstat (limited to 'vio')
-rw-r--r-- | vio/vio.c | 18 | ||||
-rw-r--r-- | vio/viosocket.c | 32 |
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); |