summaryrefslogtreecommitdiff
path: root/libmysqld
diff options
context:
space:
mode:
authormonty@hundin.mysql.fi <>2001-10-09 03:35:29 +0300
committermonty@hundin.mysql.fi <>2001-10-09 03:35:29 +0300
commitd5fe1db868a8786bad901a632631c2d94eadfbe6 (patch)
tree07f2a0acc005ba2b7fb714ce60cb6f8417c6f60e /libmysqld
parent196f620e9024b12e33125c4be03c867b0fabbfcc (diff)
downloadmariadb-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 'libmysqld')
-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);
}