Commit f50b95d2 authored by unknown's avatar unknown

Merge work.mysql.com:/home/bk/mysql

into mysql.sashanet.com:/home/sasha/src/bk/mysql


sql/mysql_priv.h:
  Auto merged
sql/mysqld.cc:
  Auto merged
sql/sql_base.cc:
  Auto merged
sql/sql_class.cc:
  Auto merged
sql/sql_class.h:
  Auto merged
sql/sql_parse.cc:
  Auto merged
sql/sql_table.cc:
  Auto merged
parents c5a80386 2e3896ec
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -39,6 +39,8 @@ ...@@ -39,6 +39,8 @@
#include "my_readline.h" #include "my_readline.h"
#include <signal.h> #include <signal.h>
const char *VER="11.8";
gptr sql_alloc(unsigned size); // Don't use mysqld alloc for these gptr sql_alloc(unsigned size); // Don't use mysqld alloc for these
void sql_element_free(void *ptr); void sql_element_free(void *ptr);
#include "sql_string.h" #include "sql_string.h"
...@@ -109,8 +111,6 @@ static HashTable ht; ...@@ -109,8 +111,6 @@ static HashTable ht;
enum enum_info_type { INFO_INFO,INFO_ERROR,INFO_RESULT}; enum enum_info_type { INFO_INFO,INFO_ERROR,INFO_RESULT};
typedef enum enum_info_type INFO_TYPE; typedef enum enum_info_type INFO_TYPE;
const char *VER="11.7";
static MYSQL mysql; /* The connection */ static MYSQL mysql; /* The connection */
static bool info_flag=0,ignore_errors=0,wait_flag=0,quick=0, static bool info_flag=0,ignore_errors=0,wait_flag=0,quick=0,
connected=0,opt_raw_data=0,unbuffered=0,output_tables=0, connected=0,opt_raw_data=0,unbuffered=0,output_tables=0,
...@@ -2156,10 +2156,7 @@ com_status(String *buffer __attribute__((unused)), ...@@ -2156,10 +2156,7 @@ com_status(String *buffer __attribute__((unused)),
} }
#ifndef __WIN__ #ifndef __WIN__
tee_fprintf(stdout, "Current pager:\t\t%s\n", pager); tee_fprintf(stdout, "Current pager:\t\t%s\n", pager);
if (opt_outfile) tee_fprintf(stdout, "Using outfile:\t\t'%s'\n", opt_outfile ? outfile : "");
tee_fprintf(stdout, "Using outfile:\t\tYes: '%s'\n", outfile);
else
printf("Using outfile:\t\tNo\n");
#endif #endif
tee_fprintf(stdout, "Server version:\t\t%s\n", mysql_get_server_info(&mysql)); tee_fprintf(stdout, "Server version:\t\t%s\n", mysql_get_server_info(&mysql));
tee_fprintf(stdout, "Protocol version:\t%d\n", mysql_get_proto_info(&mysql)); tee_fprintf(stdout, "Protocol version:\t%d\n", mysql_get_proto_info(&mysql));
...@@ -2169,6 +2166,9 @@ com_status(String *buffer __attribute__((unused)), ...@@ -2169,6 +2166,9 @@ com_status(String *buffer __attribute__((unused)),
tee_fprintf(stdout, "TCP port:\t\t%d\n", mysql.port); tee_fprintf(stdout, "TCP port:\t\t%d\n", mysql.port);
else else
tee_fprintf(stdout, "UNIX socket:\t\t%s\n", mysql.unix_socket); tee_fprintf(stdout, "UNIX socket:\t\t%s\n", mysql.unix_socket);
if (mysql.net.compress)
tee_fprintf(stdout, "Protocol:\t\tCompressed\n");
if ((status=mysql_stat(&mysql)) && !mysql_error(&mysql)[0]) if ((status=mysql_stat(&mysql)) && !mysql_error(&mysql)[0])
{ {
char *pos,buff[40]; char *pos,buff[40];
......
...@@ -99,7 +99,9 @@ struct option ...@@ -99,7 +99,9 @@ struct option
#define optional_argument 2 #define optional_argument 2
#if ( defined (__STDC__) && __STDC__ ) || defined(__cplusplus) || defined(MSDOS) #if ( defined (__STDC__) && __STDC__ ) || defined(__cplusplus) || defined(MSDOS)
#ifdef __GNU_LIBRARY__ #ifdef __EMX__
int getopt (int, char **, __const__ char *);
#elif defined( __GNU_LIBRARY__)
/* Many other libraries have conflicting prototypes for getopt, with /* Many other libraries have conflicting prototypes for getopt, with
differences in the consts, in stdlib.h. To avoid compilation differences in the consts, in stdlib.h. To avoid compilation
errors, only prototype getopt for the GNU C library. */ errors, only prototype getopt for the GNU C library. */
......
...@@ -21,6 +21,13 @@ ...@@ -21,6 +21,13 @@
#ifndef _global_h #ifndef _global_h
#define _global_h #define _global_h
#if defined( __EMX__) && !defined( MYSQL_SERVER)
// moved here to use below VOID macro redefinition
#define INCL_BASE
#define INCL_NOPMAPI
#include <os2.h>
#endif // __EMX__
#if defined(_WIN32) || defined(_WIN64) || defined(__WIN32__) || defined(WIN32) #if defined(_WIN32) || defined(_WIN64) || defined(__WIN32__) || defined(WIN32)
#include <config-win.h> #include <config-win.h>
#else #else
...@@ -381,8 +388,13 @@ typedef SOCKET_SIZE_TYPE size_socket; ...@@ -381,8 +388,13 @@ typedef SOCKET_SIZE_TYPE size_socket;
#define FN_DEVCHAR ':' #define FN_DEVCHAR ':'
#ifndef FN_LIBCHAR #ifndef FN_LIBCHAR
#ifdef __EMX__
#define FN_LIBCHAR '\\'
#define FN_ROOTDIR "\\"
#else
#define FN_LIBCHAR '/' #define FN_LIBCHAR '/'
#define FN_ROOTDIR "/" #define FN_ROOTDIR "/"
#endif
#define MY_NFILE 1024 /* This is only used to save filenames */ #define MY_NFILE 1024 /* This is only used to save filenames */
#endif #endif
......
...@@ -41,6 +41,13 @@ extern int NEAR my_errno; /* Last error in mysys */ ...@@ -41,6 +41,13 @@ extern int NEAR my_errno; /* Last error in mysys */
#include <stdarg.h> #include <stdarg.h>
#ifdef __EMX__
/* record loging flags (F_GETLK, F_SETLK, F_SETLKW) */
#define F_RDLCK 1 /* FreeBSD: shared or read lock */
#define F_UNLCK 2 /* FreeBSD: unlock */
#define F_WRLCK 3 /* FreeBSD: exclusive or write lock */
#endif
#define MYSYS_PROGRAM_USES_CURSES() { error_handler_hook = my_message_curses; mysys_uses_curses=1; } #define MYSYS_PROGRAM_USES_CURSES() { error_handler_hook = my_message_curses; mysys_uses_curses=1; }
#define MYSYS_PROGRAM_DONT_USE_CURSES() { error_handler_hook = my_message_no_curses; mysys_uses_curses=0;} #define MYSYS_PROGRAM_DONT_USE_CURSES() { error_handler_hook = my_message_no_curses; mysys_uses_curses=0;}
#define MY_INIT(name); { my_progname= name; my_init(); } #define MY_INIT(name); { my_progname= name; my_init(); }
......
...@@ -30,11 +30,6 @@ ...@@ -30,11 +30,6 @@
#define LOCAL_HOST "localhost" #define LOCAL_HOST "localhost"
#define LOCAL_HOST_NAMEDPIPE "." #define LOCAL_HOST_NAMEDPIPE "."
#if defined(__EMX__) || defined(__OS2__)
#undef MYSQL_UNIX_ADDR
#define MYSQL_OS2_ADDR "\\socket\\MySQL"
#define MYSQL_UNIX_ADDR MYSQL_OS2_ADDR
#endif
#if defined(__WIN__) && !defined( _CUSTOMCONFIG_) #if defined(__WIN__) && !defined( _CUSTOMCONFIG_)
#define MYSQL_NAMEDPIPE "MySQL" #define MYSQL_NAMEDPIPE "MySQL"
#define MYSQL_SERVICENAME "MySql" #define MYSQL_SERVICENAME "MySql"
......
...@@ -23,13 +23,6 @@ ...@@ -23,13 +23,6 @@
extern "C" { extern "C" {
#endif #endif
typedef struct st_alarm {
ulong expire_time;
int alarmed; /* 1 when alarm is due */
pthread_t thread;
my_bool malloced;
} ALARM;
#ifndef USE_ALARM_THREAD #ifndef USE_ALARM_THREAD
#define USE_ONE_SIGNAL_HAND /* One must call process_alarm */ #define USE_ONE_SIGNAL_HAND /* One must call process_alarm */
#endif #endif
...@@ -46,55 +39,74 @@ typedef struct st_alarm { ...@@ -46,55 +39,74 @@ typedef struct st_alarm {
#define THR_SERVER_ALARM SIGALRM #define THR_SERVER_ALARM SIGALRM
#endif #endif
#ifdef DONT_USE_THR_ALARM #if defined(DONT_USE_THR_ALARM)
#define USE_ALARM_THREAD #define USE_ALARM_THREAD
#undef USE_ONE_SIGNAL_HAND #undef USE_ONE_SIGNAL_HAND
typedef struct st_win_timer typedef struct st_thr_alarm_entry
{ {
uint crono; uint crono;
} thr_alarm_t; } thr_alarm_entry;
#define thr_alarm_init(A) (A)->crono=0 #define thr_alarm_init(A) (A)->crono=0
#define thr_alarm_in_use(A) (A).crono #define thr_alarm_in_use(A) (A)->crono
#define init_thr_alarm(A) #define init_thr_alarm(A)
#define thr_alarm_kill(A) #define thr_alarm_kill(A)
#define end_thr_alarm() #define end_thr_alarm()
#define thr_alarm(A,B) (((A)->crono=1)-1) #define thr_alarm(A,B) (((A)->crono=1)-1)
#define thr_got_alarm(A) (A).crono #define thr_got_alarm(A) (A)->crono
#define thr_end_alarm(A) #define thr_end_alarm(A)
#else #else
#if defined(__WIN__)
#ifdef __WIN__ typedef struct st_thr_alarm_entry
typedef struct st_win_timer
{ {
rf_SetTimer crono; rf_SetTimer crono;
} thr_alarm_t; } thr_alarm_entry;
bool thr_got_alarm(thr_alarm_t *alrm); #elif defined(__EMX__)
#define thr_alarm_init(A) (A)->crono=0
#define thr_alarm_in_use(A) (A)->crono typedef struct st_thr_alarm_entry
#define init_thr_alarm(A) {
#define thr_alarm_kill(A) uint crono;
#else uint event;
} thr_alarm_entry;
#else /* System with posix threads */
typedef int thr_alarm_entry;
#define thr_got_alarm(thr_alarm) (**(thr_alarm))
typedef int* thr_alarm_t;
#define thr_got_alarm(thr_alarm) (*thr_alarm)
#define thr_alarm_init(A) (*A)=0
#define thr_alarm_in_use(A) ((A) != 0)
void init_thr_alarm(uint max_alarm);
void thr_alarm_kill(pthread_t thread_id);
sig_handler process_alarm(int);
#endif /* __WIN__ */ #endif /* __WIN__ */
bool thr_alarm(thr_alarm_t *alarmed,uint sec, ALARM *buff); typedef thr_alarm_entry* thr_alarm_t;
typedef struct st_alarm {
ulong expire_time;
thr_alarm_entry alarmed; /* set when alarm is due */
pthread_t thread;
my_bool malloced;
} ALARM;
#define thr_alarm_init(A) (*(A))=0
#define thr_alarm_in_use(A) (*(A)!= 0)
void init_thr_alarm(uint max_alarm);
bool thr_alarm(thr_alarm_t *alarmed, uint sec, ALARM *buff);
void thr_alarm_kill(pthread_t thread_id);
void thr_end_alarm(thr_alarm_t *alarmed); void thr_end_alarm(thr_alarm_t *alarmed);
void end_thr_alarm(void); void end_thr_alarm(void);
sig_handler process_alarm(int);
#ifndef thr_got_alarm
bool thr_got_alarm(thr_alarm_t *alrm);
#endif
#endif /* DONT_USE_THR_ALARM */ #endif /* DONT_USE_THR_ALARM */
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif /* __cplusplus */
#endif #endif /* _thr_alarm_h */
...@@ -193,6 +193,10 @@ char **argv; ...@@ -193,6 +193,10 @@ char **argv;
int error; int error;
MY_INIT(argv[0]); MY_INIT(argv[0]);
#ifdef __EMX__
_wildcard (&argc, &argv);
#endif
get_options(&argc,(char***) &argv); get_options(&argc,(char***) &argv);
nisam_quick_table_bits=(uint) decode_bits; nisam_quick_table_bits=(uint) decode_bits;
error=0; error=0;
......
...@@ -1465,8 +1465,8 @@ mysql_real_connect(MYSQL *mysql,const char *host, const char *user, ...@@ -1465,8 +1465,8 @@ mysql_real_connect(MYSQL *mysql,const char *host, const char *user,
if (db) if (db)
client_flag|=CLIENT_CONNECT_WITH_DB; client_flag|=CLIENT_CONNECT_WITH_DB;
#ifdef HAVE_COMPRESS #ifdef HAVE_COMPRESS
if (mysql->server_capabilities & CLIENT_COMPRESS && if ((mysql->server_capabilities & CLIENT_COMPRESS) &&
(mysql->options.compress || client_flag & CLIENT_COMPRESS)) (mysql->options.compress || (client_flag & CLIENT_COMPRESS)))
client_flag|=CLIENT_COMPRESS; /* We will use compression */ client_flag|=CLIENT_COMPRESS; /* We will use compression */
else else
#endif #endif
......
...@@ -71,7 +71,7 @@ extern ulong mysqld_net_retry_count; ...@@ -71,7 +71,7 @@ extern ulong mysqld_net_retry_count;
typedef my_bool thr_alarm_t; typedef my_bool thr_alarm_t;
typedef my_bool ALARM; typedef my_bool ALARM;
#define thr_alarm_init(A) (*A)=0 #define thr_alarm_init(A) (*A)=0
#define thr_alarm_in_use(A) (A) #define thr_alarm_in_use(A) (*(A))
#define thr_end_alarm(A) #define thr_end_alarm(A)
#define thr_alarm(A,B,C) local_thr_alarm((A),(B),(C)) #define thr_alarm(A,B,C) local_thr_alarm((A),(B),(C))
static inline int local_thr_alarm(my_bool *A,int B __attribute__((unused)),ALARM *C __attribute__((unused))) static inline int local_thr_alarm(my_bool *A,int B __attribute__((unused)),ALARM *C __attribute__((unused)))
...@@ -330,7 +330,7 @@ net_real_write(NET *net,const char *packet,ulong len) ...@@ -330,7 +330,7 @@ net_real_write(NET *net,const char *packet,ulong len)
{ {
my_bool interrupted = vio_should_retry(net->vio); my_bool interrupted = vio_should_retry(net->vio);
#if (!defined(__WIN__) && !defined(__EMX__)) #if (!defined(__WIN__) && !defined(__EMX__))
if ((interrupted || length==0) && !thr_alarm_in_use(alarmed)) if ((interrupted || length==0) && !thr_alarm_in_use(&alarmed))
{ {
if (!thr_alarm(&alarmed,(uint) net_write_timeout,&alarm_buff)) if (!thr_alarm(&alarmed,(uint) net_write_timeout,&alarm_buff))
{ /* Always true for client */ { /* Always true for client */
...@@ -355,7 +355,7 @@ net_real_write(NET *net,const char *packet,ulong len) ...@@ -355,7 +355,7 @@ net_real_write(NET *net,const char *packet,ulong len)
} }
else else
#endif /* (!defined(__WIN__) && !defined(__EMX__)) */ #endif /* (!defined(__WIN__) && !defined(__EMX__)) */
if (thr_alarm_in_use(alarmed) && !thr_got_alarm(alarmed) && if (thr_alarm_in_use(&alarmed) && !thr_got_alarm(&alarmed) &&
interrupted) interrupted)
{ {
if (retry_count++ < RETRY_COUNT) if (retry_count++ < RETRY_COUNT)
...@@ -389,7 +389,7 @@ net_real_write(NET *net,const char *packet,ulong len) ...@@ -389,7 +389,7 @@ net_real_write(NET *net,const char *packet,ulong len)
if (net->compress) if (net->compress)
my_free((char*) packet,MYF(0)); my_free((char*) packet,MYF(0));
#endif #endif
if (thr_alarm_in_use(alarmed)) if (thr_alarm_in_use(&alarmed))
{ {
thr_end_alarm(&alarmed); thr_end_alarm(&alarmed);
vio_blocking(net->vio, net_blocking); vio_blocking(net->vio, net_blocking);
...@@ -412,10 +412,9 @@ net_real_write(NET *net,const char *packet,ulong len) ...@@ -412,10 +412,9 @@ net_real_write(NET *net,const char *packet,ulong len)
static void my_net_skip_rest(NET *net, ulong remain, thr_alarm_t *alarmed) static void my_net_skip_rest(NET *net, ulong remain, thr_alarm_t *alarmed)
{ {
char buff[1024];
ALARM alarm_buff; ALARM alarm_buff;
uint retry_count=0; uint retry_count=0;
if (!thr_alarm_in_use(alarmed)) if (!thr_alarm_in_use(&alarmed))
{ {
if (!thr_alarm(alarmed,net->timeout,&alarm_buff) || if (!thr_alarm(alarmed,net->timeout,&alarm_buff) ||
(!vio_is_blocking(net->vio) && vio_blocking(net->vio,TRUE) < 0)) (!vio_is_blocking(net->vio) && vio_blocking(net->vio,TRUE) < 0))
...@@ -427,7 +426,7 @@ static void my_net_skip_rest(NET *net, ulong remain, thr_alarm_t *alarmed) ...@@ -427,7 +426,7 @@ static void my_net_skip_rest(NET *net, ulong remain, thr_alarm_t *alarmed)
if ((int) (length=vio_read(net->vio,(char*) net->buff,remain)) <= 0L) if ((int) (length=vio_read(net->vio,(char*) net->buff,remain)) <= 0L)
{ {
my_bool interrupted = vio_should_retry(net->vio); my_bool interrupted = vio_should_retry(net->vio);
if (!thr_got_alarm(alarmed) && interrupted) if (!thr_got_alarm(&alarmed) && interrupted)
{ /* Probably in MIT threads */ { /* Probably in MIT threads */
if (retry_count++ < RETRY_COUNT) if (retry_count++ < RETRY_COUNT)
continue; continue;
...@@ -482,7 +481,7 @@ my_real_read(NET *net, ulong *complen) ...@@ -482,7 +481,7 @@ my_real_read(NET *net, ulong *complen)
an alarm to not 'read forever', change the socket to non blocking an alarm to not 'read forever', change the socket to non blocking
mode and try again mode and try again
*/ */
if ((interrupted || length == 0) && !thr_alarm_in_use(alarmed)) if ((interrupted || length == 0) && !thr_alarm_in_use(&alarmed))
{ {
if (!thr_alarm(&alarmed,net->timeout,&alarm_buff)) /* Don't wait too long */ if (!thr_alarm(&alarmed,net->timeout,&alarm_buff)) /* Don't wait too long */
{ {
...@@ -514,7 +513,7 @@ my_real_read(NET *net, ulong *complen) ...@@ -514,7 +513,7 @@ my_real_read(NET *net, ulong *complen)
} }
} }
#endif /* (!defined(__WIN__) && !defined(__EMX__)) || defined(MYSQL_SERVER) */ #endif /* (!defined(__WIN__) && !defined(__EMX__)) || defined(MYSQL_SERVER) */
if (thr_alarm_in_use(alarmed) && !thr_got_alarm(alarmed) && if (thr_alarm_in_use(&alarmed) && !thr_got_alarm(&alarmed) &&
interrupted) interrupted)
{ /* Probably in MIT threads */ { /* Probably in MIT threads */
if (retry_count++ < RETRY_COUNT) if (retry_count++ < RETRY_COUNT)
...@@ -598,7 +597,7 @@ my_real_read(NET *net, ulong *complen) ...@@ -598,7 +597,7 @@ my_real_read(NET *net, ulong *complen)
} }
end: end:
if (thr_alarm_in_use(alarmed)) if (thr_alarm_in_use(&alarmed))
{ {
thr_end_alarm(&alarmed); thr_end_alarm(&alarmed);
vio_blocking(net->vio, net_blocking); vio_blocking(net->vio, net_blocking);
......
...@@ -38,8 +38,7 @@ ...@@ -38,8 +38,7 @@
#if defined(__EMX__) #if defined(__EMX__)
#include <sys/ioctl.h> #include <sys/ioctl.h>
#define ioctlsocket(A,B,C) ioctl((A),(B),(void *)(C),sizeof(*(C))) #define ioctlsocket ioctl
#undef HAVE_FCNTL
#endif /* defined(__EMX__) */ #endif /* defined(__EMX__) */
#if defined(MSDOS) || defined(__WIN__) #if defined(MSDOS) || defined(__WIN__)
...@@ -111,7 +110,7 @@ Vio *vio_new(my_socket sd, enum enum_vio_type type, my_bool localhost) ...@@ -111,7 +110,7 @@ Vio *vio_new(my_socket sd, enum enum_vio_type type, my_bool localhost)
#else /* !defined(__WIN__) && !defined(__EMX__) */ #else /* !defined(__WIN__) && !defined(__EMX__) */
{ {
/* set to blocking mode by default */ /* set to blocking mode by default */
ulong arg=0; ulong arg=0, r;
r = ioctlsocket(vio->sd,FIONBIO,(void*) &arg, sizeof(arg)); r = ioctlsocket(vio->sd,FIONBIO,(void*) &arg, sizeof(arg));
} }
#endif #endif
......
2000-11-27 Michael Widenius <monty@mysql.com>
* Changed mi_create.c to use less stack.
2000-08-23 Michael Widenius <monty@mysql.com> 2000-08-23 Michael Widenius <monty@mysql.com>
* Fixed bug when comparing DECIMAL/NUMERIC key parts. * Fixed bug when comparing DECIMAL/NUMERIC key parts.
......
...@@ -43,7 +43,7 @@ int mi_create(const char *name,uint keys,MI_KEYDEF *keydefs, ...@@ -43,7 +43,7 @@ int mi_create(const char *name,uint keys,MI_KEYDEF *keydefs,
base_pos,varchar_count,long_varchar_count,varchar_length, base_pos,varchar_count,long_varchar_count,varchar_length,
max_key_block_length,unique_key_parts,offset; max_key_block_length,unique_key_parts,offset;
ulong reclength, real_reclength,min_pack_length; ulong reclength, real_reclength,min_pack_length;
char buff[max(FN_REFLEN,2048)]; char buff[FN_REFLEN];
ulong pack_reclength; ulong pack_reclength;
ulonglong tot_length,max_rows; ulonglong tot_length,max_rows;
enum en_fieldtype type; enum en_fieldtype type;
...@@ -52,7 +52,7 @@ int mi_create(const char *name,uint keys,MI_KEYDEF *keydefs, ...@@ -52,7 +52,7 @@ int mi_create(const char *name,uint keys,MI_KEYDEF *keydefs,
MI_UNIQUEDEF *uniquedef; MI_UNIQUEDEF *uniquedef;
MI_KEYSEG *keyseg,tmp_keyseg; MI_KEYSEG *keyseg,tmp_keyseg;
MI_COLUMNDEF *rec; MI_COLUMNDEF *rec;
ulong rec_per_key_part[MI_MAX_POSSIBLE_KEY*MI_MAX_KEY_SEG]; ulong *rec_per_key_part;
my_off_t key_root[MI_MAX_POSSIBLE_KEY],key_del[MI_MAX_KEY_BLOCK_SIZE]; my_off_t key_root[MI_MAX_POSSIBLE_KEY],key_del[MI_MAX_KEY_BLOCK_SIZE];
MI_CREATE_INFO tmp_create_info; MI_CREATE_INFO tmp_create_info;
DBUG_ENTER("mi_create"); DBUG_ENTER("mi_create");
...@@ -87,7 +87,12 @@ int mi_create(const char *name,uint keys,MI_KEYDEF *keydefs, ...@@ -87,7 +87,12 @@ int mi_create(const char *name,uint keys,MI_KEYDEF *keydefs,
} }
if (ci->reloc_rows > ci->max_rows) if (ci->reloc_rows > ci->max_rows)
ci->reloc_rows=ci->max_rows; /* Check if wrong parameter */ ci->reloc_rows=ci->max_rows; /* Check if wrong parameter */
if (!(rec_per_key_part=
(ulong*) my_malloc((keys + uniques)*MI_MAX_KEY_SEG*sizeof(long),
MYF(MY_WME | MY_ZEROFILL))))
DBUG_RETURN(my_errno);
/* Start by checking fields and field-types used */ /* Start by checking fields and field-types used */
...@@ -214,7 +219,6 @@ int mi_create(const char *name,uint keys,MI_KEYDEF *keydefs, ...@@ -214,7 +219,6 @@ int mi_create(const char *name,uint keys,MI_KEYDEF *keydefs,
max_key_length=0; tot_length=0 ; key_segs=0; max_key_length=0; tot_length=0 ; key_segs=0;
max_key_block_length=0; max_key_block_length=0;
share.state.rec_per_key_part=rec_per_key_part; share.state.rec_per_key_part=rec_per_key_part;
bzero((char*) rec_per_key_part,sizeof(rec_per_key_part));
share.state.key_root=key_root; share.state.key_root=key_root;
share.state.key_del=key_del; share.state.key_del=key_del;
if (uniques) if (uniques)
...@@ -581,6 +585,7 @@ int mi_create(const char *name,uint keys,MI_KEYDEF *keydefs, ...@@ -581,6 +585,7 @@ int mi_create(const char *name,uint keys,MI_KEYDEF *keydefs,
pthread_mutex_unlock(&THR_LOCK_myisam); pthread_mutex_unlock(&THR_LOCK_myisam);
if (my_close(file,MYF(0))) if (my_close(file,MYF(0)))
goto err; goto err;
my_free((char*) rec_per_key_part,MYF(0));
DBUG_RETURN(0); DBUG_RETURN(0);
err: err:
...@@ -606,6 +611,7 @@ int mi_create(const char *name,uint keys,MI_KEYDEF *keydefs, ...@@ -606,6 +611,7 @@ int mi_create(const char *name,uint keys,MI_KEYDEF *keydefs,
my_delete(buff,MYF(0)); my_delete(buff,MYF(0));
} }
} }
my_free((char*) rec_per_key_part, MYF(0));
DBUG_RETURN(my_errno=save_errno); /* return the fatal errno */ DBUG_RETURN(my_errno=save_errno); /* return the fatal errno */
} }
......
...@@ -84,6 +84,10 @@ int main(int argc, char **argv) ...@@ -84,6 +84,10 @@ int main(int argc, char **argv)
int error; int error;
MY_INIT(argv[0]); MY_INIT(argv[0]);
#ifdef __EMX__
_wildcard (&argc, &argv);
#endif
myisamchk_init(&check_param); myisamchk_init(&check_param);
check_param.opt_lock_memory=1; /* Lock memory if possible */ check_param.opt_lock_memory=1; /* Lock memory if possible */
check_param.using_global_keycache = 0; check_param.using_global_keycache = 0;
......
...@@ -145,6 +145,12 @@ void load_defaults(const char *conf_file, const char **groups, ...@@ -145,6 +145,12 @@ void load_defaults(const char *conf_file, const char **groups,
if (search_default_file(&args, &alloc, system_dir, conf_file, windows_ext, if (search_default_file(&args, &alloc, system_dir, conf_file, windows_ext,
&group)) &group))
goto err; goto err;
#endif
#ifdef __EMX__
if (getenv("ETC") &&
search_default_file(&args, &alloc, getenv("ETC"), conf_file,
default_ext, &group))
goto err;
#endif #endif
for (dirs=default_directories ; *dirs; dirs++) for (dirs=default_directories ; *dirs; dirs++)
{ {
...@@ -356,6 +362,10 @@ void print_defaults(const char *conf_file, const char **groups) ...@@ -356,6 +362,10 @@ void print_defaults(const char *conf_file, const char **groups)
#ifdef __WIN__ #ifdef __WIN__
GetWindowsDirectory(name,sizeof(name)); GetWindowsDirectory(name,sizeof(name));
printf("%s\\%s%s ",name,conf_file,have_ext ? "" : windows_ext); printf("%s\\%s%s ",name,conf_file,have_ext ? "" : windows_ext);
#endif
#ifdef __EMX__
if (getenv("ETC"))
printf("%s\\%s%s ", getenv("ETC"), conf_file, default_ext);
#endif #endif
for (dirs=default_directories ; *dirs; dirs++) for (dirs=default_directories ; *dirs; dirs++)
{ {
......
...@@ -660,8 +660,12 @@ _getopt_internal (int argc, char *const *argv, const char *optstring, const stru ...@@ -660,8 +660,12 @@ _getopt_internal (int argc, char *const *argv, const char *optstring, const stru
} }
} }
#ifdef __EMX__
int getopt (int argc, char **argv, __const__ char *optstring)
#else
int int
getopt (int argc, char *const *argv, const char *optstring) getopt (int argc, char *const *argv, const char *optstring)
#endif
{ {
return _getopt_internal (argc, argv, optstring, return _getopt_internal (argc, argv, optstring,
(const struct option *) 0, (const struct option *) 0,
......
...@@ -117,7 +117,7 @@ my_string fn_format(my_string to, const char *name, const char *dsk, ...@@ -117,7 +117,7 @@ my_string fn_format(my_string to, const char *name, const char *dsk,
if (flag & 32 || (!lstat(to,&stat_buff) && S_ISLNK(stat_buff.st_mode))) if (flag & 32 || (!lstat(to,&stat_buff) && S_ISLNK(stat_buff.st_mode)))
{ {
if (realpath(to,buff)) if (realpath(to,buff))
strmov(to,buff); strnmov(to,buff,FN_REFLEN-1);
} }
} }
#endif #endif
......
...@@ -74,7 +74,7 @@ my_string my_path(my_string to, const char *progname, ...@@ -74,7 +74,7 @@ my_string my_path(my_string to, const char *progname,
/* test if file without filename is found in path */ /* test if file without filename is found in path */
/* Returns to if found and to has dirpart if found, else NullS */ /* Returns to if found and to has dirpart if found, else NullS */
#if defined(MSDOS) || defined(__WIN__) #if defined(MSDOS) || defined(__WIN__) || defined(__EMX__)
#define F_OK 0 #define F_OK 0
#define PATH_SEP ';' #define PATH_SEP ';'
#define PROGRAM_EXTENSION ".exe" #define PROGRAM_EXTENSION ".exe"
......
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
#include <my_dir.h> #include <my_dir.h>
#include "mysys_err.h" #include "mysys_err.h"
#include <errno.h> #include <errno.h>
#if defined(MSDOS) || defined(__WIN__) #if defined(MSDOS) || defined(__WIN__) || defined(__EMX__)
#include <share.h> #include <share.h>
#endif #endif
...@@ -42,13 +42,13 @@ File my_create(const char *FileName, int CreateFlags, int access_flags, ...@@ -42,13 +42,13 @@ File my_create(const char *FileName, int CreateFlags, int access_flags,
DBUG_PRINT("my",("Name: '%s' CreateFlags: %d AccessFlags: %d MyFlags: %d", DBUG_PRINT("my",("Name: '%s' CreateFlags: %d AccessFlags: %d MyFlags: %d",
FileName, CreateFlags, access_flags, MyFlags)); FileName, CreateFlags, access_flags, MyFlags));
#if !defined(NO_OPEN_3) #if !defined(NO_OPEN_3) && !defined(__EMX__)
fd = open((my_string) FileName, access_flags | O_CREAT, fd = open((my_string) FileName, access_flags | O_CREAT,
CreateFlags ? CreateFlags : my_umask); CreateFlags ? CreateFlags : my_umask);
#elif defined(VMS) #elif defined(VMS)
fd = open((my_string) FileName, access_flags | O_CREAT, 0, fd = open((my_string) FileName, access_flags | O_CREAT, 0,
"ctx=stm","ctx=bin"); "ctx=stm","ctx=bin");
#elif defined(MSDOS) || defined(__WIN__) #elif defined(MSDOS) || defined(__WIN__) || defined(__EMX__)
if (access_flags & O_SHARE) if (access_flags & O_SHARE)
fd = sopen((my_string) FileName, access_flags | O_CREAT | O_BINARY, fd = sopen((my_string) FileName, access_flags | O_CREAT | O_BINARY,
SH_DENYNO, MY_S_IREAD | MY_S_IWRITE); SH_DENYNO, MY_S_IREAD | MY_S_IWRITE);
......
...@@ -33,8 +33,10 @@ ...@@ -33,8 +33,10 @@
#include <os2emx.h> #include <os2emx.h>
#endif #endif
#ifndef __EMX__
#ifdef HAVE_FCNTL #ifdef HAVE_FCNTL
static struct flock lock; /* Must be static for sun-sparc */ static struct flock lock; /* Must be static for sun-sparc */
#endif
#endif #endif
/* Lock a part of a file */ /* Lock a part of a file */
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
#include "mysys_priv.h" #include "mysys_priv.h"
#include "mysys_err.h" #include "mysys_err.h"
#include <errno.h> #include <errno.h>
#if defined(MSDOS) || defined(__WIN__) #if defined(MSDOS) || defined(__WIN__) || defined(__EMX__)
#include <share.h> #include <share.h>
#endif #endif
...@@ -34,7 +34,7 @@ File my_open(const char *FileName, int Flags, myf MyFlags) ...@@ -34,7 +34,7 @@ File my_open(const char *FileName, int Flags, myf MyFlags)
DBUG_ENTER("my_open"); DBUG_ENTER("my_open");
DBUG_PRINT("my",("Name: '%s' Flags: %d MyFlags: %d", DBUG_PRINT("my",("Name: '%s' Flags: %d MyFlags: %d",
FileName, Flags, MyFlags)); FileName, Flags, MyFlags));
#if defined(MSDOS) || defined(__WIN__) #if defined(MSDOS) || defined(__WIN__) || defined(__EMX__)
if (Flags & O_SHARE) if (Flags & O_SHARE)
fd = sopen((my_string) FileName, (Flags & ~O_SHARE) | O_BINARY, SH_DENYNO); fd = sopen((my_string) FileName, (Flags & ~O_SHARE) | O_BINARY, SH_DENYNO);
else else
......
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
static my_bool alarm_aborted=1; static my_bool alarm_aborted=1;
my_bool thr_alarm_inited=0; my_bool thr_alarm_inited=0;
#if !defined(__WIN__) && !defined(__OS2__) #if !defined(__WIN__) && !defined(__EMX__)
static pthread_mutex_t LOCK_alarm; static pthread_mutex_t LOCK_alarm;
static sigset_t full_signal_set; static sigset_t full_signal_set;
...@@ -460,42 +460,91 @@ static void *alarm_handler(void *arg __attribute__((unused))) ...@@ -460,42 +460,91 @@ static void *alarm_handler(void *arg __attribute__((unused)))
** thr_alarm for OS/2 ** thr_alarm for OS/2
*****************************************************************************/ *****************************************************************************/
#elif defined(__OS2__) #elif defined(__EMX__)
#define INCL_BASE #define INCL_BASE
#define INCL_NOPMAPI #define INCL_NOPMAPI
#include <os2.h> #include <os2.h>
static pthread_mutex_t LOCK_alarm;
static sigset_t full_signal_set;
static QUEUE alarm_queue;
pthread_t alarm_thread;
#ifdef USE_ALARM_THREAD
static pthread_cond_t COND_alarm;
static void *alarm_handler(void *arg);
#define reschedule_alarms() pthread_cond_signal(&COND_alarm)
#else
#define reschedule_alarms() pthread_kill(alarm_thread,THR_SERVER_ALARM)
#endif
sig_handler process_alarm(int sig __attribute__((unused)))
{
sigset_t old_mask;
ALARM *alarm_data;
DBUG_PRINT("info",("sig: %d active alarms: %d",sig,alarm_queue.elements));
}
/*
** Remove another thread from the alarm
*/
void thr_alarm_kill(pthread_t thread_id)
{
uint i;
pthread_mutex_lock(&LOCK_alarm);
for (i=0 ; i < alarm_queue.elements ; i++)
{
if (pthread_equal(((ALARM*) queue_element(&alarm_queue,i))->thread,
thread_id))
{
ALARM *tmp=(ALARM*) queue_remove(&alarm_queue,i);
tmp->expire_time=0;
queue_insert(&alarm_queue,(byte*) tmp);
reschedule_alarms();
break;
}
}
pthread_mutex_unlock(&LOCK_alarm);
}
bool thr_alarm(thr_alarm_t *alrm, uint sec, ALARM *alarm) bool thr_alarm(thr_alarm_t *alrm, uint sec, ALARM *alarm)
{ {
APIRET rc; APIRET rc;
if (alarm_aborted) if (alarm_aborted)
{ {
alrm->crono=0; alarm->alarmed.crono=0;
alrm->event=0; alarm->alarmed.event=0;
return 1; return 1;
} }
if (!(rc = DosCreateEventSem(NULL,(HEV *)&alrm->event,DC_SEM_SHARED,FALSE))) if (rc = DosCreateEventSem(NULL,(HEV *) &alarm->alarmed.event,
DC_SEM_SHARED,FALSE))
{ {
printf("Error creating event semaphore! [%d] \n",rc); printf("Error creating event semaphore! [%d] \n",rc);
alrm->crono=0; alarm->alarmed.crono=0;
alrm->event=0; alarm->alarmed.event=0;
return 1; return 1;
} }
if (!(rc = DosAsyncTimer((long) sec*1000L, (HSEM) alrm->event,(HTIMER *) &alrm->crono))) { if (rc = DosAsyncTimer((long) sec*1000L, (HSEM) alarm->alarmed.event,
(HTIMER *) &alarm->alarmed.crono))
{
printf("Error starting async timer! [%d] \n",rc); printf("Error starting async timer! [%d] \n",rc);
DosCloseEventSem((HEV) alrm->event); DosCloseEventSem((HEV) alarm->alarmed.event);
alrm->crono=0; alarm->alarmed.crono=0;
alrm->event=0; alarm->alarmed.event=0;
return 1; return 1;
} /* endif */ } /* endif */
(*alrm)= &alarm->alarmed;
return 1; return 1;
} }
bool thr_got_alarm(thr_alarm_t *alrm) bool thr_got_alarm(thr_alarm_t *alrm_ptr)
{ {
thr_alarm_t alrm= *alrm_ptr;
APIRET rc; APIRET rc;
if (alrm->crono) if (alrm->crono)
...@@ -511,8 +560,9 @@ bool thr_got_alarm(thr_alarm_t *alrm) ...@@ -511,8 +560,9 @@ bool thr_got_alarm(thr_alarm_t *alrm)
} }
void thr_end_alarm(thr_alarm_t *alrm) void thr_end_alarm(thr_alarm_t *alrm_ptr)
{ {
thr_alarm_t alrm= *alrm_ptr;
if (alrm->crono) if (alrm->crono)
{ {
DosStopTimer((HTIMER) alrm->crono); DosStopTimer((HTIMER) alrm->crono);
...@@ -542,21 +592,35 @@ void init_thr_alarm(uint max_alarm) ...@@ -542,21 +592,35 @@ void init_thr_alarm(uint max_alarm)
#else /* __WIN__ */ #else /* __WIN__ */
void thr_alarm_kill(pthread_t thread_id)
{
/* Can't do this yet */
}
sig_handler process_alarm(int sig __attribute__((unused)))
{
/* Can't do this yet */
}
bool thr_alarm(thr_alarm_t *alrm, uint sec, ALARM *alarm) bool thr_alarm(thr_alarm_t *alrm, uint sec, ALARM *alarm)
{ {
if (alarm_aborted) if (alarm_aborted)
{ {
alrm->crono=0; alarm->alarmed.crono=0;
return 1; return 1;
} }
if (!(alrm->crono=SetTimer((HWND) NULL,0, sec*1000,(TIMERPROC) NULL))) if (!(alarm->alarmed.crono=SetTimer((HWND) NULL,0, sec*1000,
(TIMERPROC) NULL)))
return 1; return 1;
(*alrm)= &alarm->alarmed;
return 0; return 0;
} }
bool thr_got_alarm(thr_alarm_t *alrm) bool thr_got_alarm(thr_alarm_t *alrm_ptr)
{ {
thr_alarm_t alrm= *alrm_ptr;
MSG msg; MSG msg;
if (alrm->crono) if (alrm->crono)
{ {
...@@ -571,8 +635,9 @@ bool thr_got_alarm(thr_alarm_t *alrm) ...@@ -571,8 +635,9 @@ bool thr_got_alarm(thr_alarm_t *alrm)
} }
void thr_end_alarm(thr_alarm_t *alrm) void thr_end_alarm(thr_alarm_t *alrm_ptr)
{ {
thr_alarm_t alrm= *alrm_ptr;
if (alrm->crono) if (alrm->crono)
{ {
KillTimer(NULL, alrm->crono); KillTimer(NULL, alrm->crono);
...@@ -587,6 +652,13 @@ void end_thr_alarm(void) ...@@ -587,6 +652,13 @@ void end_thr_alarm(void)
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
} }
void init_thr_alarm(uint max_alarm)
{
DBUG_ENTER("init_thr_alarm");
alarm_aborted=0; /* Yes, Gimmie alarms */
DBUG_VOID_RETURN;
}
#endif /* __WIN__ */ #endif /* __WIN__ */
#endif /* THREAD */ #endif /* THREAD */
...@@ -634,12 +706,12 @@ static void *test_thread(void *arg) ...@@ -634,12 +706,12 @@ static void *test_thread(void *arg)
} }
else else
{ {
for (retry=0 ; !thr_got_alarm(got_alarm) && retry < 10 ; retry++) for (retry=0 ; !thr_got_alarm(&got_alarm) && retry < 10 ; retry++)
{ {
printf("Thread: %s Waiting %d sec\n",my_thread_name(),wait_time); printf("Thread: %s Waiting %d sec\n",my_thread_name(),wait_time);
select(0,(fd_set_ptr) &fd,0,0,0); select(0,(fd_set_ptr) &fd,0,0,0);
} }
if (!thr_got_alarm(got_alarm)) if (!thr_got_alarm(&got_alarm))
{ {
printf("Thread: %s didn't get an alarm. Aborting!\n", printf("Thread: %s didn't get an alarm. Aborting!\n",
my_thread_name()); my_thread_name());
......
...@@ -171,12 +171,23 @@ rl_unget_char (key) ...@@ -171,12 +171,23 @@ rl_unget_char (key)
return (0); return (0);
} }
#if defined(__EMX__)
int waiting_char = -1;
#endif
/* If a character is available to be read, then read it /* If a character is available to be read, then read it
and stuff it into IBUFFER. Otherwise, just return. */ and stuff it into IBUFFER. Otherwise, just return. */
static void static void
rl_gather_tyi () rl_gather_tyi ()
{ {
#if defined (__GO32__) #if defined (__EMX__)
if (isatty (0) && (waiting_char = _read_kbd(0, 0, 0)) != -1 && ibuffer_space ())
{
int i;
i = (*rl_getc_function) (rl_instream);
rl_stuff_char (i);
}
#elif defined (__GO32__)
char input; char input;
if (isatty (0) && kbhit () && ibuffer_space ()) if (isatty (0) && kbhit () && ibuffer_space ())
...@@ -263,6 +274,10 @@ rl_gather_tyi () ...@@ -263,6 +274,10 @@ rl_gather_tyi ()
int int
_rl_input_available () _rl_input_available ()
{ {
#if defined (__EMX__)
if (isatty (0) && (waiting_char = _read_kbd(0, 0, 0)) != -1)
return 1;
#else /* __EMX__ */
#if defined(HAVE_SELECT) #if defined(HAVE_SELECT)
fd_set readfds, exceptfds; fd_set readfds, exceptfds;
struct timeval timeout; struct timeval timeout;
...@@ -288,6 +303,7 @@ _rl_input_available () ...@@ -288,6 +303,7 @@ _rl_input_available ()
if (ioctl (tty, FIONREAD, &chars_avail) == 0) if (ioctl (tty, FIONREAD, &chars_avail) == 0)
return (chars_avail); return (chars_avail);
#endif #endif
#endif /* !__EMX__ */
return 0; return 0;
} }
...@@ -397,6 +413,88 @@ rl_getc (stream) ...@@ -397,6 +413,88 @@ rl_getc (stream)
int result, flags; int result, flags;
unsigned char c; unsigned char c;
#if defined (__EMX__)
if (isatty (0))
{
int key;
if (waiting_char != -1)
{
key = waiting_char;
waiting_char = -1;
}
else
{
#ifdef __RSXNT__
pc_flush();
#endif
key = _read_kbd(0, 1, 0);
}
while (key == 0)
{
key |= (_read_kbd(0, 1, 0) << 8);
/* printf("<%04X> ", key);
fflush(stdout); */
switch (key)
{
case 0x4B00: /* left arrow */
key = 'B' - 64;
break;
case 0x4D00: /* right arrow */
key = 'F' - 64;
break;
case 0x7300: /* ctrl left arrow */
key = 27;
waiting_char = 'B';
break;
case 0x7400: /* ctrl right arrow */
key = 27;
waiting_char = 'F';
break;
case 0x4800: /* up arrow */
key = 'P' - 64;
break;
case 0x5000: /* down arrow */
key = 'N' - 64;
break;
case 0x8D00: /* ctrl up arrow */
key = 'R' - 64;
break;
case 0x9100: /* ctrl down arrow */
key = 'S' - 64;
break;
case 0x4700: /* home key */
key = 'A' - 64;
break;
case 0x4F00: /* end key */
key = 'E' - 64;
break;
case 0x7700: /* ctrl home key */
key = 27;
waiting_char = '<';
break;
case 0x7500: /* ctrl end key */
key = 27;
waiting_char = '>';
break;
case 0x5300: /* delete key */
key = 'D' - 64;
break;
case 0x5200: /* insert key */
key = 'V' - 64;
break;
default: /* ignore all other special keys, read next */
key = _read_kbd(0, 1, 0);
break;
}
}
return (key & 0xFF);
}
#endif /* __EMX__ */
#if defined (__GO32__) #if defined (__GO32__)
if (isatty (0)) if (isatty (0))
return (getkey () & 0x7F); return (getkey () & 0x7F);
......
...@@ -156,6 +156,13 @@ set_winsize (tty) ...@@ -156,6 +156,13 @@ set_winsize (tty)
if (ioctl (tty, TIOCGWINSZ, &w) == 0) if (ioctl (tty, TIOCGWINSZ, &w) == 0)
(void) ioctl (tty, TIOCSWINSZ, &w); (void) ioctl (tty, TIOCSWINSZ, &w);
} }
#else
static void
set_winsize (tty)
int tty;
{
// dummy function, required by other code. What should be doing?
}
#endif /* TIOCGWINSZ */ #endif /* TIOCGWINSZ */
#if defined (NEW_TTY_DRIVER) #if defined (NEW_TTY_DRIVER)
......
...@@ -199,11 +199,11 @@ int ha_myisam::dump(THD* thd, int fd) ...@@ -199,11 +199,11 @@ int ha_myisam::dump(THD* thd, int fd)
return error; return error;
} }
/* Name is here without an extension */
int ha_myisam::open(const char *name, int mode, uint test_if_locked) int ha_myisam::open(const char *name, int mode, uint test_if_locked)
{ {
char name_buff[FN_REFLEN]; if (!(file=mi_open(name, mode, test_if_locked)))
if (!(file=mi_open(fn_format(name_buff,name,"","",2 | 4), mode,
test_if_locked)))
return (my_errno ? my_errno : -1); return (my_errno ? my_errno : -1);
if (test_if_locked & (HA_OPEN_IGNORE_IF_LOCKED | HA_OPEN_TMP_TABLE)) if (test_if_locked & (HA_OPEN_IGNORE_IF_LOCKED | HA_OPEN_TMP_TABLE))
......
...@@ -54,7 +54,7 @@ int my_lock(File fd,int locktype,my_off_t start,my_off_t length,myf MyFlags) ...@@ -54,7 +54,7 @@ int my_lock(File fd,int locktype,my_off_t start,my_off_t length,myf MyFlags)
if (!thr_alarm(&alarmed,wait_for_alarm,&alarm_buff)) if (!thr_alarm(&alarmed,wait_for_alarm,&alarm_buff))
{ {
int value; int value;
while ((value=fcntl(fd,F_SETLKW,&lock)) && !thr_got_alarm(alarmed) && while ((value=fcntl(fd,F_SETLKW,&lock)) && !thr_got_alarm(&alarmed) &&
errno == EINTR) ; errno == EINTR) ;
thr_end_alarm(&alarmed); thr_end_alarm(&alarmed);
if (value != -1) if (value != -1)
......
...@@ -27,6 +27,8 @@ ...@@ -27,6 +27,8 @@
#include <my_base.h> /* Needed by field.h */ #include <my_base.h> /* Needed by field.h */
#include <violite.h> #include <violite.h>
#undef write // remove pthread.h macro definition for EMX
typedef ulong table_map; /* Used for table bits in join */ typedef ulong table_map; /* Used for table bits in join */
typedef ulong key_map; /* Used for finding keys */ typedef ulong key_map; /* Used for finding keys */
typedef ulong key_part_map; /* Used for finding key parts */ typedef ulong key_part_map; /* Used for finding key parts */
...@@ -223,7 +225,7 @@ bool mysql_change_db(THD *thd,const char *name); ...@@ -223,7 +225,7 @@ bool mysql_change_db(THD *thd,const char *name);
void mysql_parse(THD *thd,char *inBuf,uint length); void mysql_parse(THD *thd,char *inBuf,uint length);
void mysql_init_select(LEX *lex); void mysql_init_select(LEX *lex);
pthread_handler_decl(handle_one_connection,arg); pthread_handler_decl(handle_one_connection,arg);
int handle_bootstrap(THD *thd,FILE *file); pthread_handler_decl(handle_bootstrap,arg);
sig_handler end_thread_signal(int sig); sig_handler end_thread_signal(int sig);
void end_thread(THD *thd,bool put_in_cache); void end_thread(THD *thd,bool put_in_cache);
void flush_thread_cache(); void flush_thread_cache();
...@@ -405,7 +407,8 @@ bool rename_temporary_table(THD* thd, TABLE *table, const char *new_db, ...@@ -405,7 +407,8 @@ bool rename_temporary_table(THD* thd, TABLE *table, const char *new_db,
const char *table_name); const char *table_name);
void remove_db_from_cache(const my_string db); void remove_db_from_cache(const my_string db);
void flush_tables(); void flush_tables();
bool remove_table_from_cache(THD *thd, const char *db, const char *table); bool remove_table_from_cache(THD *thd, const char *db, const char *table,
bool return_if_owned_by_thd=0);
bool close_cached_tables(THD *thd, bool wait_for_refresh, TABLE_LIST *tables); bool close_cached_tables(THD *thd, bool wait_for_refresh, TABLE_LIST *tables);
void copy_field_from_tmp_record(Field *field,int offset); void copy_field_from_tmp_record(Field *field,int offset);
int fill_record(List<Item> &fields,List<Item> &values); int fill_record(List<Item> &fields,List<Item> &values);
...@@ -463,6 +466,7 @@ extern time_t start_time; ...@@ -463,6 +466,7 @@ extern time_t start_time;
extern const char *command_name[]; extern const char *command_name[];
extern I_List<THD> threads; extern I_List<THD> threads;
extern MYSQL_LOG mysql_log,mysql_update_log,mysql_slow_log,mysql_bin_log; extern MYSQL_LOG mysql_log,mysql_update_log,mysql_slow_log,mysql_bin_log;
extern FILE *bootstrap_file;
extern pthread_key(MEM_ROOT*,THR_MALLOC); extern pthread_key(MEM_ROOT*,THR_MALLOC);
extern pthread_key(NET*, THR_NET); extern pthread_key(NET*, THR_NET);
extern pthread_mutex_t LOCK_mysql_create_db,LOCK_Acl,LOCK_open, extern pthread_mutex_t LOCK_mysql_create_db,LOCK_Acl,LOCK_open,
......
...@@ -159,6 +159,7 @@ static bool opt_log,opt_update_log,opt_bin_log,opt_slow_log,opt_noacl, ...@@ -159,6 +159,7 @@ static bool opt_log,opt_update_log,opt_bin_log,opt_slow_log,opt_noacl,
opt_disable_networking=0, opt_bootstrap=0,opt_skip_show_db=0, opt_disable_networking=0, opt_bootstrap=0,opt_skip_show_db=0,
opt_ansi_mode=0,opt_myisam_log=0, opt_large_files=sizeof(my_off_t) > 4; opt_ansi_mode=0,opt_myisam_log=0, opt_large_files=sizeof(my_off_t) > 4;
bool opt_sql_bin_update = 0, opt_log_slave_updates = 0; bool opt_sql_bin_update = 0, opt_log_slave_updates = 0;
FILE *bootstrap_file=0;
extern MASTER_INFO glob_mi; extern MASTER_INFO glob_mi;
extern int init_master_info(MASTER_INFO* mi); extern int init_master_info(MASTER_INFO* mi);
...@@ -1001,7 +1002,8 @@ static void init_signals(void) ...@@ -1001,7 +1002,8 @@ static void init_signals(void)
#elif defined(__EMX__) #elif defined(__EMX__)
static void sig_reload(int signo) static void sig_reload(int signo)
{ {
reload_acl_and_cache(~0); // Flush everything //reload_acl_and_cache(~0); // Flush everything
reload_acl_and_cache((THD*) 0,~0, (TABLE_LIST*) 0); // Flush everything
signal(signo, SIG_ACK); signal(signo, SIG_ACK);
} }
...@@ -1327,7 +1329,7 @@ int main(int argc, char **argv) ...@@ -1327,7 +1329,7 @@ int main(int argc, char **argv)
{ {
struct tm *start_tm; struct tm *start_tm;
start_tm=localtime(&start_time); start_tm=localtime(&start_time);
strmov(time_zone=tzname[start_tm->tm_isdst == 1 ? 1 : 0]); strmov(time_zone,tzname[start_tm->tm_isdst == 1 ? 1 : 0]);
} }
#endif #endif
#endif #endif
...@@ -1780,9 +1782,25 @@ static int bootstrap(FILE *file) ...@@ -1780,9 +1782,25 @@ static int bootstrap(FILE *file)
my_net_init(&thd->net,(Vio*) 0); my_net_init(&thd->net,(Vio*) 0);
thd->max_packet_length=thd->net.max_packet; thd->max_packet_length=thd->net.max_packet;
thd->master_access= ~0; thd->master_access= ~0;
thd->thread_id=thread_id++;
thread_count++; thread_count++;
thd->real_id=pthread_self();
error=handle_bootstrap(thd,file); bootstrap_file=file;
if (pthread_create(&thd->real_id,&connection_attrib,handle_bootstrap,
(void*) thd))
{
sql_print_error("Warning: Can't create thread to handle bootstrap");
return -1;
}
/* Wait for thread to die */
(void) pthread_mutex_lock(&LOCK_thread_count);
while (thread_count)
{
(void) pthread_cond_wait(&COND_thread_count,&LOCK_thread_count);
DBUG_PRINT("quit",("One thread died (count=%u)",thread_count));
}
(void) pthread_mutex_unlock(&LOCK_thread_count);
error= thd->fatal_error;
net_end(&thd->net); net_end(&thd->net);
delete thd; delete thd;
return error; return error;
......
...@@ -71,7 +71,7 @@ extern ulong mysqld_net_retry_count; ...@@ -71,7 +71,7 @@ extern ulong mysqld_net_retry_count;
typedef my_bool thr_alarm_t; typedef my_bool thr_alarm_t;
typedef my_bool ALARM; typedef my_bool ALARM;
#define thr_alarm_init(A) (*A)=0 #define thr_alarm_init(A) (*A)=0
#define thr_alarm_in_use(A) (A) #define thr_alarm_in_use(A) (*(A))
#define thr_end_alarm(A) #define thr_end_alarm(A)
#define thr_alarm(A,B,C) local_thr_alarm((A),(B),(C)) #define thr_alarm(A,B,C) local_thr_alarm((A),(B),(C))
static inline int local_thr_alarm(my_bool *A,int B __attribute__((unused)),ALARM *C __attribute__((unused))) static inline int local_thr_alarm(my_bool *A,int B __attribute__((unused)),ALARM *C __attribute__((unused)))
...@@ -271,7 +271,7 @@ net_real_write(NET *net,const char *packet,ulong len) ...@@ -271,7 +271,7 @@ net_real_write(NET *net,const char *packet,ulong len)
int length; int length;
char *pos,*end; char *pos,*end;
thr_alarm_t alarmed; thr_alarm_t alarmed;
#if (!defined(__WIN__) && !defined(__EMX__)) #if !defined(__WIN__)
ALARM alarm_buff; ALARM alarm_buff;
#endif #endif
uint retry_count=0; uint retry_count=0;
...@@ -330,7 +330,7 @@ net_real_write(NET *net,const char *packet,ulong len) ...@@ -330,7 +330,7 @@ net_real_write(NET *net,const char *packet,ulong len)
{ {
my_bool interrupted = vio_should_retry(net->vio); my_bool interrupted = vio_should_retry(net->vio);
#if (!defined(__WIN__) && !defined(__EMX__)) #if (!defined(__WIN__) && !defined(__EMX__))
if ((interrupted || length==0) && !thr_alarm_in_use(alarmed)) if ((interrupted || length==0) && !thr_alarm_in_use(&alarmed))
{ {
if (!thr_alarm(&alarmed,(uint) net_write_timeout,&alarm_buff)) if (!thr_alarm(&alarmed,(uint) net_write_timeout,&alarm_buff))
{ /* Always true for client */ { /* Always true for client */
...@@ -355,7 +355,7 @@ net_real_write(NET *net,const char *packet,ulong len) ...@@ -355,7 +355,7 @@ net_real_write(NET *net,const char *packet,ulong len)
} }
else else
#endif /* (!defined(__WIN__) && !defined(__EMX__)) */ #endif /* (!defined(__WIN__) && !defined(__EMX__)) */
if (thr_alarm_in_use(alarmed) && !thr_got_alarm(alarmed) && if (thr_alarm_in_use(&alarmed) && !thr_got_alarm(&alarmed) &&
interrupted) interrupted)
{ {
if (retry_count++ < RETRY_COUNT) if (retry_count++ < RETRY_COUNT)
...@@ -389,7 +389,7 @@ net_real_write(NET *net,const char *packet,ulong len) ...@@ -389,7 +389,7 @@ net_real_write(NET *net,const char *packet,ulong len)
if (net->compress) if (net->compress)
my_free((char*) packet,MYF(0)); my_free((char*) packet,MYF(0));
#endif #endif
if (thr_alarm_in_use(alarmed)) if (thr_alarm_in_use(&alarmed))
{ {
thr_end_alarm(&alarmed); thr_end_alarm(&alarmed);
vio_blocking(net->vio, net_blocking); vio_blocking(net->vio, net_blocking);
...@@ -414,7 +414,7 @@ static void my_net_skip_rest(NET *net, ulong remain, thr_alarm_t *alarmed) ...@@ -414,7 +414,7 @@ static void my_net_skip_rest(NET *net, ulong remain, thr_alarm_t *alarmed)
{ {
ALARM alarm_buff; ALARM alarm_buff;
uint retry_count=0; uint retry_count=0;
if (!thr_alarm_in_use(alarmed)) if (!thr_alarm_in_use(&alarmed))
{ {
if (!thr_alarm(alarmed,net->timeout,&alarm_buff) || if (!thr_alarm(alarmed,net->timeout,&alarm_buff) ||
(!vio_is_blocking(net->vio) && vio_blocking(net->vio,TRUE) < 0)) (!vio_is_blocking(net->vio) && vio_blocking(net->vio,TRUE) < 0))
...@@ -426,7 +426,7 @@ static void my_net_skip_rest(NET *net, ulong remain, thr_alarm_t *alarmed) ...@@ -426,7 +426,7 @@ static void my_net_skip_rest(NET *net, ulong remain, thr_alarm_t *alarmed)
if ((int) (length=vio_read(net->vio,(char*) net->buff,remain)) <= 0L) if ((int) (length=vio_read(net->vio,(char*) net->buff,remain)) <= 0L)
{ {
my_bool interrupted = vio_should_retry(net->vio); my_bool interrupted = vio_should_retry(net->vio);
if (!thr_got_alarm(alarmed) && interrupted) if (!thr_got_alarm(&alarmed) && interrupted)
{ /* Probably in MIT threads */ { /* Probably in MIT threads */
if (retry_count++ < RETRY_COUNT) if (retry_count++ < RETRY_COUNT)
continue; continue;
...@@ -481,7 +481,7 @@ my_real_read(NET *net, ulong *complen) ...@@ -481,7 +481,7 @@ my_real_read(NET *net, ulong *complen)
an alarm to not 'read forever', change the socket to non blocking an alarm to not 'read forever', change the socket to non blocking
mode and try again mode and try again
*/ */
if ((interrupted || length == 0) && !thr_alarm_in_use(alarmed)) if ((interrupted || length == 0) && !thr_alarm_in_use(&alarmed))
{ {
if (!thr_alarm(&alarmed,net->timeout,&alarm_buff)) /* Don't wait too long */ if (!thr_alarm(&alarmed,net->timeout,&alarm_buff)) /* Don't wait too long */
{ {
...@@ -513,7 +513,7 @@ my_real_read(NET *net, ulong *complen) ...@@ -513,7 +513,7 @@ my_real_read(NET *net, ulong *complen)
} }
} }
#endif /* (!defined(__WIN__) && !defined(__EMX__)) || defined(MYSQL_SERVER) */ #endif /* (!defined(__WIN__) && !defined(__EMX__)) || defined(MYSQL_SERVER) */
if (thr_alarm_in_use(alarmed) && !thr_got_alarm(alarmed) && if (thr_alarm_in_use(&alarmed) && !thr_got_alarm(&alarmed) &&
interrupted) interrupted)
{ /* Probably in MIT threads */ { /* Probably in MIT threads */
if (retry_count++ < RETRY_COUNT) if (retry_count++ < RETRY_COUNT)
...@@ -597,7 +597,7 @@ my_real_read(NET *net, ulong *complen) ...@@ -597,7 +597,7 @@ my_real_read(NET *net, ulong *complen)
} }
end: end:
if (thr_alarm_in_use(alarmed)) if (thr_alarm_in_use(&alarmed))
{ {
thr_end_alarm(&alarmed); thr_end_alarm(&alarmed);
vio_blocking(net->vio, net_blocking); vio_blocking(net->vio, net_blocking);
......
...@@ -275,7 +275,7 @@ bool close_cached_tables(THD *thd, bool if_wait_for_refresh, ...@@ -275,7 +275,7 @@ bool close_cached_tables(THD *thd, bool if_wait_for_refresh,
bool found=0; bool found=0;
for (TABLE_LIST *table=tables ; table ; table=table->next) for (TABLE_LIST *table=tables ; table ; table=table->next)
{ {
if (remove_table_from_cache(thd, table->db, table->name)) if (remove_table_from_cache(thd, table->db, table->name, 1))
found=1; found=1;
} }
if (!found) if (!found)
...@@ -2029,7 +2029,8 @@ void flush_tables() ...@@ -2029,7 +2029,8 @@ void flush_tables()
** Returns true if the table is in use by another thread ** Returns true if the table is in use by another thread
*/ */
bool remove_table_from_cache(THD *thd, const char *db,const char *table_name) bool remove_table_from_cache(THD *thd, const char *db, const char *table_name,
bool return_if_owned_by_thd)
{ {
char key[MAX_DBKEY_LENGTH]; char key[MAX_DBKEY_LENGTH];
uint key_length; uint key_length;
...@@ -2042,13 +2043,12 @@ bool remove_table_from_cache(THD *thd, const char *db,const char *table_name) ...@@ -2042,13 +2043,12 @@ bool remove_table_from_cache(THD *thd, const char *db,const char *table_name)
table; table;
table = (TABLE*) hash_next(&open_cache,(byte*) key,key_length)) table = (TABLE*) hash_next(&open_cache,(byte*) key,key_length))
{ {
THD *in_use;
table->version=0L; /* Free when thread is ready */ table->version=0L; /* Free when thread is ready */
if (!table->in_use) if (!(in_use=table->in_use))
relink_unused(table); relink_unused(table);
else if (table->in_use != thd) else if (in_use != thd)
{ {
THD *in_use=table->in_use;
in_use->some_tables_deleted=1; in_use->some_tables_deleted=1;
if (table->db_stat) if (table->db_stat)
result=1; result=1;
...@@ -2066,6 +2066,8 @@ bool remove_table_from_cache(THD *thd, const char *db,const char *table_name) ...@@ -2066,6 +2066,8 @@ bool remove_table_from_cache(THD *thd, const char *db,const char *table_name)
pthread_mutex_unlock(&in_use->mysys_var->mutex); pthread_mutex_unlock(&in_use->mysys_var->mutex);
} }
} }
else
result= result || return_if_owned_by_thd;
} }
while (unused_tables && !unused_tables->version) while (unused_tables && !unused_tables->version)
VOID(hash_delete(&open_cache,(byte*) unused_tables)); VOID(hash_delete(&open_cache,(byte*) unused_tables));
......
...@@ -80,7 +80,7 @@ THD::THD():user_time(0),fatal_error(0),last_insert_id_used(0), ...@@ -80,7 +80,7 @@ THD::THD():user_time(0),fatal_error(0),last_insert_id_used(0),
global_read_lock(0) global_read_lock(0)
{ {
proc_info="login"; proc_info="login";
host=user=db=query=ip=0; host=user=priv_user=db=query=ip=0;
locked=killed=count_cuted_fields=some_tables_deleted=no_errors=password= locked=killed=count_cuted_fields=some_tables_deleted=no_errors=password=
query_start_used=0; query_start_used=0;
query_length=col_access=0; query_length=col_access=0;
......
...@@ -21,7 +21,6 @@ ...@@ -21,7 +21,6 @@
#pragma interface /* gcc class implementation */ #pragma interface /* gcc class implementation */
#endif #endif
class Query_log_event; class Query_log_event;
class Load_log_event; class Load_log_event;
......
...@@ -24,8 +24,7 @@ ...@@ -24,8 +24,7 @@
This will work even if the .ISM and .ISD tables are destroyed This will work even if the .ISM and .ISD tables are destroyed
*/ */
int generate_table(THD *thd, TABLE_LIST *table_list, int generate_table(THD *thd, TABLE_LIST *table_list, TABLE *locked_table)
TABLE *locked_table)
{ {
char path[FN_REFLEN]; char path[FN_REFLEN];
int error; int error;
......
...@@ -163,7 +163,9 @@ int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list, ...@@ -163,7 +163,9 @@ int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list,
// the file must be: // the file must be:
if (!((stat_info.st_mode & S_IROTH) == S_IROTH && // readable by others if (!((stat_info.st_mode & S_IROTH) == S_IROTH && // readable by others
#ifndef __EMX__
(stat_info.st_mode & S_IFLNK) != S_IFLNK && // and not a symlink (stat_info.st_mode & S_IFLNK) != S_IFLNK && // and not a symlink
#endif
((stat_info.st_mode & S_IFREG) == S_IFREG || ((stat_info.st_mode & S_IFREG) == S_IFREG ||
(stat_info.st_mode & S_IFIFO) == S_IFIFO))) (stat_info.st_mode & S_IFIFO) == S_IFIFO)))
{ {
......
...@@ -428,19 +428,26 @@ pthread_handler_decl(handle_one_connection,arg) ...@@ -428,19 +428,26 @@ pthread_handler_decl(handle_one_connection,arg)
return(0); /* purecov: deadcode */ return(0); /* purecov: deadcode */
} }
/*
Execute commands from bootstrap_file.
Used when creating the initial grant tables
*/
int handle_bootstrap(THD *thd,FILE *file) pthread_handler_decl(handle_bootstrap,arg)
{ {
THD *thd=(THD*) arg;
FILE *file=bootstrap_file;
char *buff;
DBUG_ENTER("handle_bootstrap"); DBUG_ENTER("handle_bootstrap");
pthread_detach_this_thread();
thd->thread_stack= (char*) &thd; thd->thread_stack= (char*) &thd;
if (init_thr_lock() || if (my_thread_init() || thd->store_globals())
my_pthread_setspecific_ptr(THR_THD, thd) ||
my_pthread_setspecific_ptr(THR_MALLOC, &thd->mem_root) ||
my_pthread_setspecific_ptr(THR_NET, &thd->net))
{ {
close_connection(&thd->net,ER_OUT_OF_RESOURCES); close_connection(&thd->net,ER_OUT_OF_RESOURCES);
DBUG_RETURN(-1); thd->fatal_error=1;
goto end;
} }
thd->mysys_var=my_thread_var; thd->mysys_var=my_thread_var;
thd->dbug_thread_id=my_thread_id(); thd->dbug_thread_id=my_thread_id();
...@@ -455,8 +462,9 @@ int handle_bootstrap(THD *thd,FILE *file) ...@@ -455,8 +462,9 @@ int handle_bootstrap(THD *thd,FILE *file)
thd->proc_info=0; thd->proc_info=0;
thd->version=refresh_version; thd->version=refresh_version;
thd->priv_user=thd->user="boot";
char *buff= (char*) thd->net.buff; buff= (char*) thd->net.buff;
init_sql_alloc(&thd->mem_root,8192,8192); init_sql_alloc(&thd->mem_root,8192,8192);
while (fgets(buff, thd->net.max_packet, file)) while (fgets(buff, thd->net.max_packet, file))
{ {
...@@ -470,13 +478,20 @@ int handle_bootstrap(THD *thd,FILE *file) ...@@ -470,13 +478,20 @@ int handle_bootstrap(THD *thd,FILE *file)
mysql_parse(thd,thd->query,length); mysql_parse(thd,thd->query,length);
close_thread_tables(thd); // Free tables close_thread_tables(thd); // Free tables
if (thd->fatal_error) if (thd->fatal_error)
{ break;
DBUG_RETURN(-1);
}
free_root(&thd->mem_root,MYF(MY_KEEP_PREALLOC)); free_root(&thd->mem_root,MYF(MY_KEEP_PREALLOC));
} }
free_root(&thd->mem_root,MYF(0)); thd->priv_user=thd->user=0;
DBUG_RETURN(0);
/* thd->fatal_error should be set in case something went wrong */
end:
(void) pthread_mutex_lock(&LOCK_thread_count);
thread_count--;
(void) pthread_cond_broadcast(&COND_thread_count);
(void) pthread_mutex_unlock(&LOCK_thread_count);
my_thread_end();
pthread_exit(0);
DBUG_RETURN(0); // Never reached
} }
......
...@@ -3520,6 +3520,7 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List<Item> &fields, ...@@ -3520,6 +3520,7 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List<Item> &fields,
{ {
Field *field=(*group->item)->tmp_table_field(); Field *field=(*group->item)->tmp_table_field();
bool maybe_null=(*group->item)->maybe_null; bool maybe_null=(*group->item)->maybe_null;
key_part_info->null_bit=0;
key_part_info->field= field; key_part_info->field= field;
key_part_info->offset= field->offset(); key_part_info->offset= field->offset();
key_part_info->length= (uint16) field->pack_length(); key_part_info->length= (uint16) field->pack_length();
...@@ -3581,6 +3582,7 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List<Item> &fields, ...@@ -3581,6 +3582,7 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List<Item> &fields,
keyinfo->name=(char*) "tmp"; keyinfo->name=(char*) "tmp";
if (null_count) if (null_count)
{ {
key_part_info->null_bit=0;
key_part_info->offset=0; key_part_info->offset=0;
key_part_info->length=(null_count+7)/8; key_part_info->length=(null_count+7)/8;
key_part_info->field=new Field_string((char*) table->record[0], key_part_info->field=new Field_string((char*) table->record[0],
...@@ -3596,6 +3598,7 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List<Item> &fields, ...@@ -3596,6 +3598,7 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List<Item> &fields,
for (i=0,reg_field=table->field; i < field_count; for (i=0,reg_field=table->field; i < field_count;
i++, reg_field++, key_part_info++) i++, reg_field++, key_part_info++)
{ {
key_part_info->null_bit=0;
key_part_info->field= *reg_field; key_part_info->field= *reg_field;
key_part_info->offset= (*reg_field)->offset(); key_part_info->offset= (*reg_field)->offset();
key_part_info->length= (uint16) (*reg_field)->pack_length(); key_part_info->length= (uint16) (*reg_field)->pack_length();
......
...@@ -1482,7 +1482,7 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name, ...@@ -1482,7 +1482,7 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name,
} }
} }
#ifdef __WIN__ #if defined( __WIN__) || defined( __EMX__)
// Win32 can't rename an open table, so we must close the org table! // Win32 can't rename an open table, so we must close the org table!
table_name=thd->strdup(table_name); // must be saved table_name=thd->strdup(table_name); // must be saved
if (close_cached_table(thd,table)) if (close_cached_table(thd,table))
......
...@@ -38,8 +38,7 @@ ...@@ -38,8 +38,7 @@
#if defined(__EMX__) #if defined(__EMX__)
#include <sys/ioctl.h> #include <sys/ioctl.h>
#define ioctlsocket(A,B,C) ioctl((A),(B),(void *)(C),sizeof(*(C))) #define ioctlsocket ioctl
#undef HAVE_FCNTL
#endif /* defined(__EMX__) */ #endif /* defined(__EMX__) */
#if defined(MSDOS) || defined(__WIN__) #if defined(MSDOS) || defined(__WIN__)
...@@ -111,7 +110,7 @@ Vio *vio_new(my_socket sd, enum enum_vio_type type, my_bool localhost) ...@@ -111,7 +110,7 @@ Vio *vio_new(my_socket sd, enum enum_vio_type type, my_bool localhost)
#else /* !defined(__WIN__) && !defined(__EMX__) */ #else /* !defined(__WIN__) && !defined(__EMX__) */
{ {
/* set to blocking mode by default */ /* set to blocking mode by default */
ulong arg=0; ulong arg=0, r;
r = ioctlsocket(vio->sd,FIONBIO,(void*) &arg, sizeof(arg)); r = ioctlsocket(vio->sd,FIONBIO,(void*) &arg, sizeof(arg));
} }
#endif #endif
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment