summaryrefslogtreecommitdiff
path: root/libmysqld/lib_vio.c
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 /libmysqld/lib_vio.c
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 'libmysqld/lib_vio.c')
-rw-r--r--libmysqld/lib_vio.c35
1 files changed, 6 insertions, 29 deletions
diff --git a/libmysqld/lib_vio.c b/libmysqld/lib_vio.c
index 37f77eaaad5..270b08ef51d 100644
--- a/libmysqld/lib_vio.c
+++ b/libmysqld/lib_vio.c
@@ -26,7 +26,7 @@
#include "mysql_embed.h"
#include "mysql.h"
-#ifndef HAVE_VIO /* is Vio suppored by the Vio lib ? */
+#ifndef HAVE_VIO /* is Vio enabled */
#include <errno.h>
#include <my_sys.h>
@@ -37,27 +37,6 @@
#include <dbug.h>
#include <assert.h>
-#if defined(__EMX__)
-#include <sys/ioctl.h>
-#define ioctlsocket(A,B,C) ioctl((A),(B),(void *)(C),sizeof(*(C)))
-#undef HAVE_FCNTL
-#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 *
#endif
@@ -72,14 +51,11 @@ struct st_vio
struct sockaddr_in remote; /* Remote internet address */
enum enum_vio_type type; /* Type of connection */
char desc[30]; /* String description */
- /* #ifdef EMBEDDED_LIBRARY */
- /* void *dest_net; */
void *dest_thd;
char *packets, **last_packet;
char *where_in_packet, *end_of_packet;
my_bool reading;
MEM_ROOT root;
- /* #endif */
};
/* Initialize the communication buffer */
@@ -90,7 +66,7 @@ Vio *vio_new(my_socket sd, enum enum_vio_type type, my_bool localhost)
vio = (Vio *) my_malloc (sizeof(*vio),MYF(MY_WME|MY_ZEROFILL));
if (vio)
{
- init_alloc_root(&vio->root, 8192, 1024);
+ init_alloc_root(&vio->root, 8192, 8192);
vio->root.min_malloc = sizeof(char *) + 4;
vio->last_packet = &vio->packets;
}
@@ -126,7 +102,7 @@ void vio_reset(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() */
}
int vio_read(Vio * vio, gptr buf, int size)
@@ -198,8 +174,9 @@ 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);
}