include/my_sys.h:
  Auto merged
sql/item_create.cc:
  Auto merged
sql/log.cc:
  Auto merged
sql/mysql_priv.h:
  Auto merged
sql/set_var.cc:
  Auto merged
sql/sql_parse.cc:
  Auto merged
innobase/btr/btr0cur.c:
  Use local file
scripts/make_binary_distribution.sh:
  Add mysql_waitpid
sql/mysqld.cc:
  Simple cleanup
This commit is contained in:
unknown 2003-01-28 09:02:51 +02:00
commit c97ddd06f4
121 changed files with 7065 additions and 64246 deletions

View File

@ -3,7 +3,7 @@
path=`dirname $0` path=`dirname $0`
. "$path/SETUP.sh" . "$path/SETUP.sh"
extra_flags="$pentium_cflags $debug_cflags -DHAVE_purify" extra_flags="$pentium_cflags $debug_cflags -USAFEMALLOC -DHAVE_purify"
c_warnings="$c_warnings $debug_extra_warnings" c_warnings="$c_warnings $debug_extra_warnings"
cxx_warnings="$cxx_warnings $debug_extra_warnings" cxx_warnings="$cxx_warnings $debug_extra_warnings"
extra_configs="$pentium_configs $debug_configs" extra_configs="$pentium_configs $debug_configs"

View File

@ -27,7 +27,7 @@ EXTRA_DIST = $(noinst_SCRIPTS) $(BUILT_SOURCES) mysqld_error.txt \
all: $(targets) txt_files all: $(targets) txt_files
txt_files: ../INSTALL-SOURCE ../COPYING ../COPYING.LIB \ txt_files: ../INSTALL-SOURCE ../COPYING ../COPYING.LIB \
INSTALL-BINARY # ../MIRRORS INSTALL-BINARY
CLEAN_FILES: $(BUILD_SOURCES) CLEAN_FILES: $(BUILD_SOURCES)
touch $(BUILD_SOURCES) touch $(BUILD_SOURCES)
@ -254,8 +254,5 @@ INSTALL-BINARY: mysql.info $(GT)
../COPYING.LIB: mysql.info $(GT) ../COPYING.LIB: mysql.info $(GT)
perl -w $(GT) mysql.info "LGPL license" "Function Index" > $@ perl -w $(GT) mysql.info "LGPL license" "Function Index" > $@
#../MIRRORS: manual.texi $(srcdir)/Support/generate-mirror-listing.pl
# perl -w $(srcdir)/Support/generate-mirror-listing.pl manual.texi > $@
# Don't update the files from bitkeeper # Don't update the files from bitkeeper
%::SCCS/s.% %::SCCS/s.%

File diff suppressed because it is too large Load Diff

14
Docs/reservedwords.texi Normal file
View File

@ -0,0 +1,14 @@
@c This is a placeholder file for the autogenerated MySQL reserved
@c word list "reservedwords.texi", which is being included in
@c manual.texi when building the manual.
@c
@c This file will be replaced with the actual reserved word list
@c from the "mysqldoc" BK source tree when building the official
@c source distribution.
@c
@c Please note, that the manual is now maintained in a separate
@c "mysqldoc" BitKeeper tree! See
@c
@c http://www.mysql.com/doc/en/Installing_source_tree.html
@c
@c for more info on how to work with the MySQL BK source trees.

View File

@ -24,8 +24,9 @@ EXTRA_DIST = INSTALL-SOURCE README \
SUBDIRS = . include @docs_dirs@ @readline_dir@ \ SUBDIRS = . include @docs_dirs@ @readline_dir@ \
@thread_dirs@ pstack @sql_client_dirs@ \ @thread_dirs@ pstack @sql_client_dirs@ \
@sql_server_dirs@ scripts man tests \ @sql_server_dirs@ scripts man tests \
BUILD os2 libmysql_r @libmysqld_dirs@ \ BUILD os2 @libmysqld_dirs@ \
@bench_dirs@ support-files @fs_dirs@ @tools_dirs@ @bench_dirs@ support-files @fs_dirs@ @tools_dirs@ \
@platform_dir@
# Relink after clean # Relink after clean
linked_sources = linked_client_sources linked_server_sources \ linked_sources = linked_client_sources linked_server_sources \

View File

@ -121,7 +121,7 @@ __os_openhandle(dbenv, name, flags, mode, fhp)
} else { } else {
#if defined(HAVE_FCNTL_F_SETFD) #if defined(HAVE_FCNTL_F_SETFD)
/* Deny file descriptor access to any child process. */ /* Deny file descriptor access to any child process. */
if (fcntl(fhp->fd, F_SETFD, 1) == -1) { if (fcntl(fhp->fd, F_SETFD, FD_CLOEXEC) == -1) {
ret = __os_get_errno(); ret = __os_get_errno();
__db_err(dbenv, "fcntl(F_SETFD): %s", __db_err(dbenv, "fcntl(F_SETFD): %s",
strerror(ret)); strerror(ret));

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2000-2002 MySQL AB /* Copyright (C) 2000-2003 MySQL AB
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@ -40,7 +40,7 @@
#include <signal.h> #include <signal.h>
#include <violite.h> #include <violite.h>
const char *VER= "12.16"; const char *VER= "12.17";
/* Don't try to make a nice table if the data is too big */ /* Don't try to make a nice table if the data is too big */
#define MAX_COLUMN_LENGTH 1024 #define MAX_COLUMN_LENGTH 1024
@ -79,7 +79,7 @@ extern "C" {
#undef bcmp // Fix problem with new readline #undef bcmp // Fix problem with new readline
#if defined( __WIN__) || defined(OS2) #if defined( __WIN__) || defined(OS2)
#include <conio.h> #include <conio.h>
#else #elif !defined(__NETWARE__)
#include <readline/readline.h> #include <readline/readline.h>
#define HAVE_READLINE #define HAVE_READLINE
#endif #endif
@ -91,12 +91,16 @@ extern "C" {
#define vidattr(A) {} // Can't get this to work #define vidattr(A) {} // Can't get this to work
#endif #endif
#ifdef __WIN__ #ifdef FN_NO_CASE_SENCE
#define cmp_database(A,B) my_strcasecmp((A),(B)) #define cmp_database(A,B) my_strcasecmp((A),(B))
#else #else
#define cmp_database(A,B) strcmp((A),(B)) #define cmp_database(A,B) strcmp((A),(B))
#endif #endif
#if !defined( __WIN__) && !defined( OS2) && !defined(__NETWARE__) && (!defined(HAVE_mit_thread) || !defined(THREAD))
#define USE_POPEN
#endif
#include "completion_hash.h" #include "completion_hash.h"
#define PROMPT_CHAR '\\' #define PROMPT_CHAR '\\'
@ -171,12 +175,12 @@ static int com_quit(String *str,char*),
com_connect(String *str,char*), com_status(String *str,char*), com_connect(String *str,char*), com_status(String *str,char*),
com_use(String *str,char*), com_source(String *str, char*), com_use(String *str,char*), com_source(String *str, char*),
com_rehash(String *str, char*), com_tee(String *str, char*), com_rehash(String *str, char*), com_tee(String *str, char*),
com_notee(String *str, char*), com_shell(String *str, char *), com_notee(String *str, char*),
com_prompt(String *str, char*); com_prompt(String *str, char*);
#ifndef __WIN__ #ifdef USE_POPEN
static int com_nopager(String *str, char*), com_pager(String *str, char*), static int com_nopager(String *str, char*), com_pager(String *str, char*),
com_edit(String *str,char*); com_edit(String *str,char*), com_shell(String *str, char *);
#endif #endif
static int read_lines(bool execute_commands); static int read_lines(bool execute_commands);
@ -187,7 +191,7 @@ static void safe_put_field(const char *pos,ulong length);
static void xmlencode_print(const char *src, uint length); static void xmlencode_print(const char *src, uint length);
static void init_pager(); static void init_pager();
static void end_pager(); static void end_pager();
static int init_tee(char *); static void init_tee(const char *);
static void end_tee(); static void end_tee();
static const char* construct_prompt(); static const char* construct_prompt();
static void init_username(); static void init_username();
@ -210,18 +214,18 @@ static COMMANDS commands[] = {
{ "clear", 'c', com_clear, 0, "Clear command."}, { "clear", 'c', com_clear, 0, "Clear command."},
{ "connect",'r', com_connect,1, { "connect",'r', com_connect,1,
"Reconnect to the server. Optional arguments are db and host." }, "Reconnect to the server. Optional arguments are db and host." },
#ifndef __WIN__ #ifdef USE_POPEN
{ "edit", 'e', com_edit, 0, "Edit command with $EDITOR."}, { "edit", 'e', com_edit, 0, "Edit command with $EDITOR."},
#endif #endif
{ "ego", 'G', com_ego, 0, { "ego", 'G', com_ego, 0,
"Send command to mysql server, display result vertically."}, "Send command to mysql server, display result vertically."},
{ "exit", 'q', com_quit, 0, "Exit mysql. Same as quit."}, { "exit", 'q', com_quit, 0, "Exit mysql. Same as quit."},
{ "go", 'g', com_go, 0, "Send command to mysql server." }, { "go", 'g', com_go, 0, "Send command to mysql server." },
#ifndef __WIN__ #ifdef USE_POPEN
{ "nopager",'n', com_nopager,0, "Disable pager, print to stdout." }, { "nopager",'n', com_nopager,0, "Disable pager, print to stdout." },
#endif #endif
{ "notee", 't', com_notee, 0, "Don't write into outfile." }, { "notee", 't', com_notee, 0, "Don't write into outfile." },
#ifndef __WIN__ #ifdef USE_POPEN
{ "pager", 'P', com_pager, 1, { "pager", 'P', com_pager, 1,
"Set PAGER [to_pager]. Print the query results via PAGER." }, "Set PAGER [to_pager]. Print the query results via PAGER." },
#endif #endif
@ -232,7 +236,7 @@ static COMMANDS commands[] = {
{ "source", '.', com_source, 1, { "source", '.', com_source, 1,
"Execute a SQL script file. Takes a file name as an argument."}, "Execute a SQL script file. Takes a file name as an argument."},
{ "status", 's', com_status, 0, "Get status information from the server."}, { "status", 's', com_status, 0, "Get status information from the server."},
#ifndef __WIN__ #ifdef USE_POPEN
{ "system", '!', com_shell, 1, "Execute a system shell command."}, { "system", '!', com_shell, 1, "Execute a system shell command."},
#endif #endif
{ "tee", 'T', com_tee, 1, { "tee", 'T', com_tee, 1,
@ -302,8 +306,8 @@ int main(int argc,char *argv[])
current_prompt = my_strdup(default_prompt,MYF(MY_WME)); current_prompt = my_strdup(default_prompt,MYF(MY_WME));
prompt_counter=0; prompt_counter=0;
strmov(outfile, "\0"); // no (default) outfile, unless given at least once outfile[0]=0; // no (default) outfile
strmov(pager, "stdout"); // the default, if --pager wasn't given strmov(pager, "stdout"); // the default, if --pager wasn't given
{ {
char *tmp=getenv("PAGER"); char *tmp=getenv("PAGER");
if (tmp) if (tmp)
@ -491,7 +495,7 @@ static struct my_option my_long_options[] =
NO_ARG, 1, 0, 0, 0, 0, 0}, NO_ARG, 1, 0, 0, 0, 0, 0},
{"skip-line-numbers", 'L', "Don't write line number for errors. WARNING: -L is deprecated, use long version of this option instead.", 0, 0, 0, GET_NO_ARG, {"skip-line-numbers", 'L', "Don't write line number for errors. WARNING: -L is deprecated, use long version of this option instead.", 0, 0, 0, GET_NO_ARG,
NO_ARG, 0, 0, 0, 0, 0, 0}, NO_ARG, 0, 0, 0, 0, 0, 0},
#ifndef __WIN__ #ifdef USE_POPEN
{"no-pager", OPT_NOPAGER, {"no-pager", OPT_NOPAGER,
"Disable pager and print to stdout. See interactive help (\\h) also. WARNING: option deprecated; use --disable-pager instead.", "Disable pager and print to stdout. See interactive help (\\h) also. WARNING: option deprecated; use --disable-pager instead.",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
@ -512,7 +516,7 @@ static struct my_option my_long_options[] =
{"one-database", 'o', {"one-database", 'o',
"Only update the default database. This is useful for skipping updates to other database in the update log.", "Only update the default database. This is useful for skipping updates to other database in the update log.",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
#ifndef __WIN__ #ifdef USE_POPEN
{"pager", OPT_PAGER, {"pager", OPT_PAGER,
"Pager to use to display results. If you don't supply an option the default pager is taken from your ENV variable PAGER. Valid pagers are less, more, cat [> filename], etc. See interactive help (\\h) also. This option does not work in batch mode.", "Pager to use to display results. If you don't supply an option the default pager is taken from your ENV variable PAGER. Valid pagers are less, more, cat [> filename], etc. See interactive help (\\h) also. This option does not work in batch mode.",
0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0}, 0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
@ -619,7 +623,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
end_tee(); end_tee();
} }
else else
opt_outfile= init_tee(argument); init_tee(argument);
break; break;
case OPT_NOTEE: case OPT_NOTEE:
printf("WARNING: option deprecated; use --disable-tee instead.\n"); printf("WARNING: option deprecated; use --disable-tee instead.\n");
@ -772,7 +776,7 @@ static int get_options(int argc, char **argv)
static int read_lines(bool execute_commands) static int read_lines(bool execute_commands)
{ {
#if defined( __WIN__) || defined(OS2) #if defined( __WIN__) || defined(OS2) || defined(__NETWARE__)
char linebuffer[254]; char linebuffer[254];
#endif #endif
char *line; char *line;
@ -792,30 +796,33 @@ static int read_lines(bool execute_commands)
} }
else else
{ {
#if defined( __WIN__) || defined(OS2) char *prompt= (char*) (glob_buffer.is_empty() ? construct_prompt() :
if (opt_outfile && glob_buffer.is_empty())
fflush(OUTFILE);
tee_fputs(glob_buffer.is_empty() ? construct_prompt() :
!in_string ? " -> " :
in_string == '\'' ?
" '> " : " \"> ",stdout);
linebuffer[0]=(char) sizeof(linebuffer);
line=_cgets(linebuffer);
#else
if (opt_outfile)
{
if (glob_buffer.is_empty())
fflush(OUTFILE);
fputs(glob_buffer.is_empty() ? construct_prompt() :
!in_string ? " -> " :
in_string == '\'' ?
" '> " : " \"> ", OUTFILE);
}
line=readline((char*) (glob_buffer.is_empty() ? construct_prompt() :
!in_string ? " -> " : !in_string ? " -> " :
in_string == '\'' ? in_string == '\'' ?
" '> " : " \"> ")); " '> " : " \"> ");
#endif if (opt_outfile && glob_buffer.is_empty())
fflush(OUTFILE);
#if defined( __WIN__) || defined(OS2) || defined(__NETWARE__)
tee_fputs(prompt, stdout);
#ifdef __NETWARE__
line=fgets(linebuffer, sizeof(linebuffer)-1, stdin);
/* Remove the '\n' */
{
char *p = strrchr(line, '\n');
if (p != NULL)
*p = '\0';
}
#else
linebuffer[0]= (char) sizeof(linebuffer);
line= _cgets(linebuffer);
#endif /* __NETWARE__ */
#else
if (opt_outfile)
fputs(prompt, OUTFILE);
line= readline(prompt);
#endif /* defined( __WIN__) || defined(OS2) || defined(__NETWARE__) */
if (opt_outfile) if (opt_outfile)
fprintf(OUTFILE, "%s\n", line); fprintf(OUTFILE, "%s\n", line);
} }
@ -1497,7 +1504,7 @@ com_go(String *buffer,char *line __attribute__((unused)))
static void init_pager() static void init_pager()
{ {
#if !defined( __WIN__) && !defined( OS2) && (!defined(HAVE_mit_thread) || !defined(THREAD)) #ifdef USE_POPEN
if (!opt_nopager) if (!opt_nopager)
{ {
if (!(PAGER= popen(pager, "w"))) if (!(PAGER= popen(pager, "w")))
@ -1513,30 +1520,35 @@ static void init_pager()
static void end_pager() static void end_pager()
{ {
#if !defined( __WIN__) && !defined( OS2) && !(defined(HAVE_mit_thread) && defined(THREAD)) #ifdef USE_POPEN
if (!opt_nopager) if (!opt_nopager)
pclose(PAGER); pclose(PAGER);
#endif #endif
} }
static int init_tee(char* newfile) static void init_tee(const char *file_name)
{ {
FILE* new_outfile; FILE* new_outfile;
if (!(new_outfile= my_fopen(newfile, O_APPEND | O_WRONLY, MYF(MY_WME))))
return 0;
if (opt_outfile) if (opt_outfile)
end_tee(); end_tee();
if (!(new_outfile= my_fopen(file_name, O_APPEND | O_WRONLY, MYF(MY_WME))))
{
tee_fprintf(stdout, "Error logging to file '%s'\n", file_name);
return;
}
OUTFILE = new_outfile; OUTFILE = new_outfile;
strmake(outfile,newfile,FN_REFLEN-1); strmake(outfile, file_name, FN_REFLEN-1);
tee_fprintf(stdout, "Logging to file '%s'\n", outfile); tee_fprintf(stdout, "Logging to file '%s'\n", file_name);
return 1; opt_outfile= 1;
return;
} }
static void end_tee() static void end_tee()
{ {
my_fclose(OUTFILE, MYF(0)); my_fclose(OUTFILE, MYF(0));
OUTFILE= 0;
opt_outfile= 0; opt_outfile= 0;
return; return;
} }
@ -1576,6 +1588,9 @@ print_table_data(MYSQL_RES *result)
MYSQL_ROW cur; MYSQL_ROW cur;
MYSQL_FIELD *field; MYSQL_FIELD *field;
bool *num_flag; bool *num_flag;
#ifdef __NETWARE__
uint lines= 0;
#endif
num_flag=(bool*) my_alloca(sizeof(bool)*mysql_num_fields(result)); num_flag=(bool*) my_alloca(sizeof(bool)*mysql_num_fields(result));
if (info_flag) if (info_flag)
@ -1631,16 +1646,24 @@ print_table_data(MYSQL_RES *result)
length, str); length, str);
} }
(void) tee_fputs("\n", PAGER); (void) tee_fputs("\n", PAGER);
#ifdef __NETWARE__
// on a long result the screen could hog the cpu
if ((lines++ & 1023) == 0) pthread_yield();
#endif
} }
tee_puts(separator.c_ptr(), PAGER); tee_puts(separator.c_ptr(), PAGER);
my_afree((gptr) num_flag); my_afree((gptr) num_flag);
} }
static void static void
print_table_data_html(MYSQL_RES *result) print_table_data_html(MYSQL_RES *result)
{ {
MYSQL_ROW cur; MYSQL_ROW cur;
MYSQL_FIELD *field; MYSQL_FIELD *field;
#ifdef __NETWARE__
uint lines= 0;
#endif
mysql_field_seek(result,0); mysql_field_seek(result,0);
(void) tee_fputs("<TABLE BORDER=1><TR>", PAGER); (void) tee_fputs("<TABLE BORDER=1><TR>", PAGER);
@ -1665,6 +1688,10 @@ print_table_data_html(MYSQL_RES *result)
(void) tee_fputs("</TD>", PAGER); (void) tee_fputs("</TD>", PAGER);
} }
(void) tee_fputs("</TR>", PAGER); (void) tee_fputs("</TR>", PAGER);
#ifdef __NETWARE__
// on a long result the screen could hog the cpu
if ((lines++ & 1023) == 0) pthread_yield();
#endif
} }
(void) tee_fputs("</TABLE>", PAGER); (void) tee_fputs("</TABLE>", PAGER);
} }
@ -1698,6 +1725,10 @@ print_table_data_xml(MYSQL_RES *result)
" &nbsp; ") : "NULL")); " &nbsp; ") : "NULL"));
} }
(void) tee_fputs(" </row>\n", PAGER); (void) tee_fputs(" </row>\n", PAGER);
#ifdef __NETWARE__
// on a long result the screen could hog the cpu
if ((lines++ & 1023) == 0) pthread_yield();
#endif
} }
(void) tee_fputs("</resultset>\n", PAGER); (void) tee_fputs("</resultset>\n", PAGER);
} }
@ -1730,6 +1761,10 @@ print_table_data_vertically(MYSQL_RES *result)
tee_fprintf(PAGER, "%*s: ",(int) max_length,field->name); tee_fprintf(PAGER, "%*s: ",(int) max_length,field->name);
tee_fprintf(PAGER, "%s\n",cur[off] ? (char*) cur[off] : "NULL"); tee_fprintf(PAGER, "%s\n",cur[off] ? (char*) cur[off] : "NULL");
} }
#ifdef __NETWARE__
// on a long result the screen could hog the cpu
if ((row_count & 1023) == 0) pthread_yield();
#endif
} }
} }
@ -1869,11 +1904,7 @@ com_tee(String *buffer, char *line __attribute__((unused)))
printf("No outfile specified!\n"); printf("No outfile specified!\n");
return 0; return 0;
} }
opt_outfile= init_tee(file_name); init_tee(file_name);
if (opt_outfile)
tee_fprintf(stdout, "Logging to file '%s'\n", outfile);
else
tee_fprintf(stdout, "Error logging to file '%s'\n",file_name);
return 0; return 0;
} }
@ -1892,7 +1923,7 @@ com_notee(String *buffer __attribute__((unused)),
Sorry, this command is not available in Windows. Sorry, this command is not available in Windows.
*/ */
#ifndef __WIN__ #ifdef USE_POPEN
static int static int
com_pager(String *buffer, char *line __attribute__((unused))) com_pager(String *buffer, char *line __attribute__((unused)))
{ {
@ -1903,9 +1934,9 @@ com_pager(String *buffer, char *line __attribute__((unused)))
/* Skip space from file name */ /* Skip space from file name */
while (isspace(*line)) while (isspace(*line))
line++; line++;
if (!(param = strchr(line, ' '))) // if pager was not given, use the default if (!(param= strchr(line, ' '))) // if pager was not given, use the default
{ {
if (!strlen(default_pager)) if (!default_pager[0])
{ {
tee_fprintf(stdout, "Default pager wasn't set, using stdout.\n"); tee_fprintf(stdout, "Default pager wasn't set, using stdout.\n");
opt_nopager=1; opt_nopager=1;
@ -1948,7 +1979,7 @@ com_nopager(String *buffer __attribute__((unused)),
Sorry, you can't send the result to an editor in Win32 Sorry, you can't send the result to an editor in Win32
*/ */
#ifndef __WIN__ #ifdef USE_POPEN
static int static int
com_edit(String *buffer,char *line __attribute__((unused))) com_edit(String *buffer,char *line __attribute__((unused)))
{ {
@ -1996,6 +2027,10 @@ static int
com_quit(String *buffer __attribute__((unused)), com_quit(String *buffer __attribute__((unused)),
char *line __attribute__((unused))) char *line __attribute__((unused)))
{ {
#ifdef __NETWARE__
// let the screen auto close on a normal shutdown
setscreenmode(SCR_AUTOCLOSE_ON_EXIT);
#endif
status.exit_status=0; status.exit_status=0;
return 1; return 1;
} }
@ -2011,7 +2046,7 @@ com_rehash(String *buffer __attribute__((unused)),
} }
#ifndef __WIN__ #ifdef USE_POPEN
static int static int
com_shell(String *buffer, char *line __attribute__((unused))) com_shell(String *buffer, char *line __attribute__((unused)))
{ {
@ -2327,7 +2362,7 @@ com_status(String *buffer __attribute__((unused)),
tee_fprintf(stdout, "\nAll updates ignored to this database\n"); tee_fprintf(stdout, "\nAll updates ignored to this database\n");
vidattr(A_NORMAL); vidattr(A_NORMAL);
} }
#ifndef __WIN__ #ifdef USE_POPEN
tee_fprintf(stdout, "Current pager:\t\t%s\n", pager); tee_fprintf(stdout, "Current pager:\t\t%s\n", pager);
tee_fprintf(stdout, "Using outfile:\t\t'%s'\n", opt_outfile ? outfile : ""); tee_fprintf(stdout, "Using outfile:\t\t'%s'\n", opt_outfile ? outfile : "");
#endif #endif
@ -2500,7 +2535,7 @@ void tee_putc(int c, FILE *file)
putc(c, OUTFILE); putc(c, OUTFILE);
} }
#if defined( __WIN__) || defined( OS2) #if defined( __WIN__) || defined( OS2) || defined(__NETWARE__)
#include <time.h> #include <time.h>
#else #else
#include <sys/times.h> #include <sys/times.h>
@ -2512,7 +2547,7 @@ void tee_putc(int c, FILE *file)
static ulong start_timer(void) static ulong start_timer(void)
{ {
#if defined( __WIN__) || defined( OS2) #if defined( __WIN__) || defined( OS2) || defined(__NETWARE__)
return clock(); return clock();
#else #else
struct tms tms_tmp; struct tms tms_tmp;

View File

@ -24,8 +24,8 @@
#endif #endif
#include <sys/stat.h> #include <sys/stat.h>
#define ADMIN_VERSION "8.39" #define ADMIN_VERSION "8.40"
#define MAX_MYSQL_VAR 128 #define MAX_MYSQL_VAR 256
#define SHUTDOWN_DEF_TIMEOUT 3600 /* Wait for shutdown */ #define SHUTDOWN_DEF_TIMEOUT 3600 /* Wait for shutdown */
#define MAX_TRUNC_LENGTH 3 #define MAX_TRUNC_LENGTH 3
@ -976,7 +976,7 @@ static void print_relative_row(MYSQL_RES *result, MYSQL_ROW cur, uint row)
printf("| %-*s|", (int) field->max_length + 1, cur[0]); printf("| %-*s|", (int) field->max_length + 1, cur[0]);
field = mysql_fetch_field(result); field = mysql_fetch_field(result);
tmp = cur[1] ? strtoull(cur[1], NULL, 0) : (ulonglong) 0; tmp = cur[1] ? strtoull(cur[1], NULL, 10) : (ulonglong) 0;
printf(" %-*s|\n", (int) field->max_length + 1, printf(" %-*s|\n", (int) field->max_length + 1,
llstr((tmp - last_values[row]), buff)); llstr((tmp - last_values[row]), buff));
last_values[row] = tmp; last_values[row] = tmp;
@ -994,7 +994,7 @@ static void print_relative_row_vert(MYSQL_RES *result __attribute__((unused)),
if (!row) if (!row)
putchar('|'); putchar('|');
tmp = cur[1] ? strtoull(cur[1], NULL, 0) : (ulonglong) 0; tmp = cur[1] ? strtoull(cur[1], NULL, 10) : (ulonglong) 0;
printf(" %-*s|", ex_val_max_len[row] + 1, printf(" %-*s|", ex_val_max_len[row] + 1,
llstr((tmp - last_values[row]), buff)); llstr((tmp - last_values[row]), buff));

View File

@ -341,7 +341,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
tty_password=1; tty_password=1;
break; break;
case 'r': case 'r':
if (!(md_result_file = my_fopen(argument, O_WRONLY | O_BINARY, if (!(md_result_file = my_fopen(argument, O_WRONLY | FILE_BINARY,
MYF(MY_WME)))) MYF(MY_WME))))
exit(1); exit(1);
break; break;

View File

@ -677,7 +677,7 @@ int open_file(const char* name)
if (*cur_file && cur_file == file_stack_end) if (*cur_file && cur_file == file_stack_end)
die("Source directives are nesting too deep"); die("Source directives are nesting too deep");
if (!(*(cur_file+1) = my_fopen(buff, O_RDONLY | O_BINARY, MYF(MY_WME)))) if (!(*(cur_file+1) = my_fopen(buff, O_RDONLY | FILE_BINARY, MYF(MY_WME))))
die(NullS); die(NullS);
cur_file++; cur_file++;
*++lineno=1; *++lineno=1;
@ -685,18 +685,6 @@ int open_file(const char* name)
return 0; return 0;
} }
static void my_sleep(ulong m_seconds)
{
#ifndef OS2
struct timeval t;
t.tv_sec= m_seconds / 1000000L;
t.tv_usec= m_seconds % 1000000L;
select(0,0,0,0,&t); /* sleep */
#else
DosSleep(m_seconds/1000+1);
#endif
}
/* ugly long name, but we are following the convention */ /* ugly long name, but we are following the convention */
int do_wait_for_slave_to_stop(struct st_query* q __attribute__((unused))) int do_wait_for_slave_to_stop(struct st_query* q __attribute__((unused)))
@ -1912,7 +1900,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
argument= buff; argument= buff;
} }
fn_format(buff, argument, "", "", 4); fn_format(buff, argument, "", "", 4);
if (!(*++cur_file = my_fopen(buff, O_RDONLY | O_BINARY, MYF(MY_WME)))) if (!(*++cur_file = my_fopen(buff, O_RDONLY | FILE_BINARY, MYF(MY_WME))))
die("Could not open %s: errno = %d", argument, errno); die("Could not open %s: errno = %d", argument, errno);
break; break;
} }
@ -2561,7 +2549,7 @@ static int read_server_arguments(const char* name)
embedded_server_arg_count=1; embedded_server_arg_count=1;
embedded_server_args[0]= (char*) ""; /* Progname */ embedded_server_args[0]= (char*) ""; /* Progname */
} }
if (!(file=my_fopen(buff, O_RDONLY | O_BINARY, MYF(MY_WME)))) if (!(file=my_fopen(buff, O_RDONLY | FILE_BINARY, MYF(MY_WME))))
return 1; return 1;
while (embedded_server_arg_count < MAX_SERVER_ARGS && while (embedded_server_arg_count < MAX_SERVER_ARGS &&
(str=fgets(argument,sizeof(argument), file))) (str=fgets(argument,sizeof(argument), file)))

View File

@ -38,9 +38,18 @@ rm -f $AVAILABLE_LANGUAGES_ERRORS_RULES
for i in $AVAILABLE_LANGUAGES for i in $AVAILABLE_LANGUAGES
do do
AVAILABLE_LANGUAGES_ERRORS="$AVAILABLE_LANGUAGES_ERRORS $i/errmsg.sys" AVAILABLE_LANGUAGES_ERRORS="$AVAILABLE_LANGUAGES_ERRORS $i/errmsg.sys"
case $SYSTEM_TYPE in
*netware* | *modesto*)
echo "$i/errmsg.sys: $i/errmsg.txt
\$(top_builddir)/extra/comp_err.cyg \$^ $i/errmsg.sys" \
>> $AVAILABLE_LANGUAGES_ERRORS_RULES
;;
*)
echo "$i/errmsg.sys: $i/errmsg.txt echo "$i/errmsg.sys: $i/errmsg.txt
\$(top_builddir)/extra/comp_err \$^ $i/errmsg.sys" \ \$(top_builddir)/extra/comp_err \$^ $i/errmsg.sys" \
>> $AVAILABLE_LANGUAGES_ERRORS_RULES >> $AVAILABLE_LANGUAGES_ERRORS_RULES
;;
esac
done done
##### #####
@ -130,7 +139,14 @@ AC_PROG_CXX
AC_PROG_CPP AC_PROG_CPP
# Print version of CC and CXX compiler (if they support --version) # Print version of CC and CXX compiler (if they support --version)
case $SYSTEM_TYPE in
*netware*)
CC_VERSION=`$CC -version | grep -i version`
;;
*)
CC_VERSION=`$CC --version | sed 1q` CC_VERSION=`$CC --version | sed 1q`
;;
esac
if test $? -eq "0" if test $? -eq "0"
then then
AC_MSG_CHECKING("C Compiler version"); AC_MSG_CHECKING("C Compiler version");
@ -138,7 +154,14 @@ then
else else
CC_VERSION="" CC_VERSION=""
fi fi
case $SYSTEM_TYPE in
*netware*)
CXX_VERSION=`$CXX -version | grep -i version`
;;
*)
CXX_VERSION=`$CXX --version | sed 1q` CXX_VERSION=`$CXX --version | sed 1q`
;;
esac
if test $? -eq "0" if test $? -eq "0"
then then
AC_MSG_CHECKING("C++ compiler version"); AC_MSG_CHECKING("C++ compiler version");
@ -186,6 +209,11 @@ AC_CHECK_PROG(DVIS, tex, manual.dvi)
AC_MSG_CHECKING("return type of sprintf") AC_MSG_CHECKING("return type of sprintf")
#check the return type of sprintf #check the return type of sprintf
case $SYSTEM_TYPE in
*netware*)
AC_DEFINE(SPRINTF_RETURNS_INT) AC_MSG_RESULT("int")
;;
*)
AC_TRY_RUN([ AC_TRY_RUN([
int main() int main()
{ {
@ -205,11 +233,13 @@ AC_DEFINE(SPRINTF_RETURNS_INT) AC_MSG_RESULT("int"),
char buf[6]; char buf[6];
if((char*)sprintf(buf,s) == buf + strlen(s)) if((char*)sprintf(buf,s) == buf + strlen(s))
return 0; return 0;
return -1; return -1;
} }
], AC_DEFINE(SPRINTF_RETURNS_PTR) AC_MSG_RESULT("ptr"), ], AC_DEFINE(SPRINTF_RETURNS_PTR) AC_MSG_RESULT("ptr"),
AC_DEFINE(SPRINTF_RETURNS_GARBAGE) AC_MSG_RESULT("garbage"))) AC_DEFINE(SPRINTF_RETURNS_GARBAGE) AC_MSG_RESULT("garbage")))
;;
esac
# option, cache_name, variable, # option, cache_name, variable,
# code to execute if yes, code to exectute if fail # code to execute if yes, code to exectute if fail
@ -361,10 +391,12 @@ dnl Find paths to some shell programs
AC_PATH_PROG(LN, ln, ln) AC_PATH_PROG(LN, ln, ln)
# This must be able to take a -f flag like normal unix ln. # This must be able to take a -f flag like normal unix ln.
AC_PATH_PROG(LN_CP_F, ln, ln) AC_PATH_PROG(LN_CP_F, ln, ln)
if ! ( expr "$SYSTEM_TYPE" : ".*netware.*" > /dev/null ); then
# If ln -f does not exists use -s (AFS systems) # If ln -f does not exists use -s (AFS systems)
if test -n "$LN_CP_F"; then if test -n "$LN_CP_F"; then
LN_CP_F="$LN_CP_F -s" LN_CP_F="$LN_CP_F -s"
fi fi
fi
AC_PATH_PROG(MV, mv, mv) AC_PATH_PROG(MV, mv, mv)
AC_PATH_PROG(RM, rm, rm) AC_PATH_PROG(RM, rm, rm)
@ -429,6 +461,9 @@ else
*cygwin*) *cygwin*)
FIND_PROC="$PS -e | grep mysqld | grep \" \$\$PID \" > /dev/null" FIND_PROC="$PS -e | grep mysqld | grep \" \$\$PID \" > /dev/null"
;; ;;
*netware* | *modesto*)
FIND_PROC=
;;
*) *)
AC_MSG_ERROR([Could not find the right ps switches. Which OS is this ?. See the Installation chapter in the Reference Manual.]) AC_MSG_ERROR([Could not find the right ps switches. Which OS is this ?. See the Installation chapter in the Reference Manual.])
esac esac
@ -853,6 +888,11 @@ fi
NON_THREADED_CLIENT_LIBS="$LIBS" NON_THREADED_CLIENT_LIBS="$LIBS"
AC_MSG_CHECKING([for int8]) AC_MSG_CHECKING([for int8])
case $SYSTEM_TYPE in
*netware)
AC_MSG_RESULT([no])
;;
*)
AC_TRY_RUN([ AC_TRY_RUN([
#ifdef HAVE_STDLIB_H #ifdef HAVE_STDLIB_H
#include <stdlib.h> #include <stdlib.h>
@ -873,6 +913,8 @@ int main()
} }
], AC_DEFINE(HAVE_INT_8_16_32) AC_MSG_RESULT([yes]), AC_MSG_RESULT([no]) ], AC_DEFINE(HAVE_INT_8_16_32) AC_MSG_RESULT([yes]), AC_MSG_RESULT([no])
) )
;;
esac
# #
# Some system specific hacks # Some system specific hacks
@ -1022,6 +1064,107 @@ dnl Is this the right match for DEC OSF on alpha?
CFLAGS="$CFLAGS -DUNDEF_HAVE_GETHOSTBYNAME_R" CFLAGS="$CFLAGS -DUNDEF_HAVE_GETHOSTBYNAME_R"
CXXFLAGS="$CXXFLAGS -DUNDEF_HAVE_GETHOSTBYNAME_R" CXXFLAGS="$CXXFLAGS -DUNDEF_HAVE_GETHOSTBYNAME_R"
;; ;;
*netware*)
# No need for curses library so set it to null
with_named_curses=""
#
# Edit Makefile.in files.
#
echo -n "configuring Makefile.in files for NetWare... "
for file in sql/Makefile.in libmysql/Makefile.in libmysql_r/Makefile.in sql/share/Makefile.in strings/Makefile.in client/Makefile.in
do
# echo "#### $file ####"
filedir="`dirname $file`"
filebase="`basename $file`"
filesed=$filedir/$filebase.sed
#
# Backup and always use original file
#
if test -f $file.bk
then
cp -fp $file.bk $file
else
cp -fp $file $file.bk
fi
case $file in
sql/Makefile.in)
# Use gen_lex_hash.cyg instead of gen_lex_hash
# Add library dependencies to mysqld_DEPENDENCIES
lib_DEPENDENCIES="\$(bdb_libs_with_path) \$(innodb_libs) \$(pstack_libs) \$(innodb_system_libs) \$(openssl_libs)"
cat > $filesed << EOF
s,\(^.*\$(MAKE) gen_lex_hash\),#\1,
s,\(\./gen_lex_hash\),\1.cyg,
s%\(mysqld_DEPENDENCIES = \) %\1$lib_DEPENDENCIES %
EOF
;;
sql/share/Makefile.in)
cat > $filesed << EOF
s,\(extra/comp_err\),\1.cyg,
EOF
;;
libmysql/Makefile.in)
cat > $filesed << EOF
s,\(\./conf_to_src\)\( \$(top_srcdir)\),\1.cyg\2,
s,\(: conf_to_src\),\1.cyg,
EOF
;;
libmysql_r/Makefile.in)
cat > $filesed << EOF
s,\(\./conf_to_src\)\( \$(top_srcdir)\),\1.cyg\2,
s,\(: conf_to_src\),\1.cyg,
EOF
;;
strings/Makefile.in)
cat > $filesed << EOF
s,\(\./conf_to_src\)\( \$(top_srcdir)\),\1.cyg\2,
s,\(: conf_to_src\),\1.cyg,
EOF
;;
client/Makefile.in)
#
cat > $filesed << EOF
s,libmysqlclient.la,.libs/libmysqlclient.a,
EOF
;;
esac
if `sed -f $filesed $file > $file.nw`;\
then
mv -f $file.nw $file
rm -f $filesed
else
exit 1
fi
# wait for file system changes to complete
sleep 1
done
echo "done"
#
# Make sure the following files are writable.
#
# When the files are retrieved from some source code control systems they are read-only.
#
echo -n "making sure specific build files are writable... "
for file in \
Docs/include.texi \
Docs/mysql.info \
Docs/manual.txt \
Docs/manual_toc.html \
Docs/manual.html \
Docs/INSTALL-BINARY \
INSTALL-SOURCE \
COPYING \
COPYING.LIB \
MIRRORS
do
if test -e $file; then
chmod +w $file
fi
done
echo "done"
;;
esac esac
@ -1389,7 +1532,12 @@ LIBS="$my_save_LIBS"
AC_SUBST(LIBDL) AC_SUBST(LIBDL)
# System characteristics # System characteristics
case $SYSTEM_TYPE in
*netware* | *modesto*) ;;
*)
AC_SYS_RESTARTABLE_SYSCALLS AC_SYS_RESTARTABLE_SYSCALLS
;;
esac
# Build optimized or debug version ? # Build optimized or debug version ?
# First check for gcc and g++ # First check for gcc and g++
@ -1414,6 +1562,13 @@ else
OPTIMIZE_CXXFLAGS="-O" OPTIMIZE_CXXFLAGS="-O"
fi fi
if expr "$SYSTEM_TYPE" : ".*netware.*" > /dev/null; then
DEBUG_CFLAGS="$DEBUG_CFLAGS -DDEBUG -sym internal,codeview4"
DEBUG_CXXFLAGS="$DEBUG_CXXFLAGS -DDEBUG -sym internal,codeview4"
OPTIMIZE_CFLAGS="$OPTIMIZE_CFLAGS -DNDEBUG"
OPTIMIZE_CXXFLAGS="$OPTIMIZE_CXXFLAGS -DNDEBUG"
fi
AC_ARG_WITH(debug, AC_ARG_WITH(debug,
[ --without-debug Build a production version without debugging code], [ --without-debug Build a production version without debugging code],
[with_debug=$withval], [with_debug=$withval],
@ -1561,6 +1716,7 @@ MYSQL_CHECK_FP_EXCEPT
# Do the c++ compiler have a bool type # Do the c++ compiler have a bool type
MYSQL_CXX_BOOL MYSQL_CXX_BOOL
# Check some common bugs with gcc 2.8.# on sparc # Check some common bugs with gcc 2.8.# on sparc
if ! ( expr "$SYSTEM_TYPE" : ".*netware.*" > /dev/null ); then
MYSQL_CHECK_LONGLONG_TO_FLOAT MYSQL_CHECK_LONGLONG_TO_FLOAT
if test "$ac_cv_conv_longlong_to_float" != "yes" if test "$ac_cv_conv_longlong_to_float" != "yes"
then then
@ -1568,6 +1724,7 @@ then
If you are using gcc 2.8.# you should upgrade to egcs 1.0.3 or newer and try If you are using gcc 2.8.# you should upgrade to egcs 1.0.3 or newer and try
again]); again]);
fi fi
fi
MYSQL_PTHREAD_YIELD MYSQL_PTHREAD_YIELD
###################################################################### ######################################################################
@ -1988,6 +2145,11 @@ AC_ARG_WITH(readline,
[ with_readline=$withval ], [ with_readline=$withval ],
[ with_readline=yes ] [ with_readline=yes ]
) )
if expr "$SYSTEM_TYPE" : ".*netware.*" > /dev/null; then
# For NetWare, do not need readline
readline_dir=""
readline_link=""
else
if test "$with_readline" = "yes" if test "$with_readline" = "yes"
then then
readline_dir="readline" readline_dir="readline"
@ -1998,6 +2160,7 @@ else
readline_dir="" readline_dir=""
readline_link="-lreadline" readline_link="-lreadline"
fi fi
fi
AC_SUBST(readline_dir) AC_SUBST(readline_dir)
AC_SUBST(readline_link) AC_SUBST(readline_link)
@ -2031,6 +2194,13 @@ AC_ARG_WITH(extra-charsets,
[extra_charsets="$withval"], [extra_charsets="$withval"],
[extra_charsets="none"]) [extra_charsets="none"])
AC_ARG_WITH(platform-dir,
[ --with-platform-dir=DIR
Add specified directory to list of SUBDIRS to build.],
[ with_platform_dir=$withval ],
[ with_platform_dir=no ]
)
AC_MSG_CHECKING("character sets") AC_MSG_CHECKING("character sets")
if test "$extra_charsets" = none; then if test "$extra_charsets" = none; then
@ -2269,11 +2439,18 @@ AC_SUBST(CLIENT_LIBS)
AC_SUBST(sql_client_dirs) AC_SUBST(sql_client_dirs)
AC_SUBST(linked_client_targets) AC_SUBST(linked_client_targets)
platform_dir=
if test "$with_platform_dir" != "no"
then
platform_dir="$with_platform_dir"
fi
AC_SUBST(platform_dir)
if test "$with_server" = "yes" -o "$THREAD_SAFE_CLIENT" != "no" if test "$with_server" = "yes" -o "$THREAD_SAFE_CLIENT" != "no"
then then
AC_DEFINE(THREAD) AC_DEFINE(THREAD)
# Avoid _PROGRAMS names # Avoid _PROGRAMS names
THREAD_LPROGRAMS="test_thr_alarm test_thr_lock" THREAD_LPROGRAMS="test_thr_alarm\$(EXEEXT) test_thr_lock\$(EXEEXT)"
AC_SUBST(THREAD_LPROGRAMS) AC_SUBST(THREAD_LPROGRAMS)
THREAD_LOBJECTS="thr_alarm.o thr_lock.o thr_mutex.o thr_rwlock.o my_pthread.o my_thr_init.o" THREAD_LOBJECTS="thr_alarm.o thr_lock.o thr_mutex.o thr_rwlock.o my_pthread.o my_thr_init.o"
AC_SUBST(THREAD_LOBJECTS) AC_SUBST(THREAD_LOBJECTS)
@ -2377,7 +2554,7 @@ EOF
then then
innodb_conf_flags=--disable-dependency-tracking innodb_conf_flags=--disable-dependency-tracking
fi fi
(cd innobase && sh $rel_srcdir/innobase/configure $innodb_conf_flags) \ (cd innobase && sh $rel_srcdir/innobase/configure --host=$host $innodb_conf_flags) \
|| AC_MSG_ERROR([could not configure INNODB]) || AC_MSG_ERROR([could not configure INNODB])
echo "END OF INNODB CONFIGURATION" echo "END OF INNODB CONFIGURATION"
@ -2435,20 +2612,21 @@ AC_SUBST(GXX)
#AC_SUBST(TOOLS_LIBS) #AC_SUBST(TOOLS_LIBS)
# Output results # Output results
AC_OUTPUT(Makefile extra/Makefile mysys/Makefile isam/Makefile \ AC_OUTPUT(Makefile extra/Makefile mysys/Makefile isam/Makefile dnl
strings/Makefile regex/Makefile heap/Makefile \ strings/Makefile regex/Makefile heap/Makefile dnl
bdb/Makefile \ bdb/Makefile dnl
myisam/Makefile myisammrg/Makefile \ myisam/Makefile myisammrg/Makefile dnl
os2/Makefile os2/include/Makefile os2/include/sys/Makefile \ os2/Makefile os2/include/Makefile os2/include/sys/Makefile dnl
man/Makefile BUILD/Makefile readline/Makefile vio/Makefile \ man/Makefile BUILD/Makefile readline/Makefile vio/Makefile dnl
libmysql_r/Makefile libmysqld/Makefile libmysqld/examples/Makefile \ libmysql_r/Makefile libmysqld/Makefile libmysqld/examples/Makefile dnl
libmysql/Makefile client/Makefile \ libmysql/Makefile client/Makefile dnl
pstack/Makefile pstack/aout/Makefile sql/Makefile sql/share/Makefile \ pstack/Makefile pstack/aout/Makefile sql/Makefile sql/share/Makefile dnl
merge/Makefile dbug/Makefile scripts/Makefile \ merge/Makefile dbug/Makefile scripts/Makefile dnl
include/Makefile sql-bench/Makefile tools/Makefile \ include/Makefile sql-bench/Makefile tools/Makefile dnl
tests/Makefile Docs/Makefile support-files/Makefile \ tests/Makefile Docs/Makefile support-files/Makefile dnl
mysql-test/Makefile \ mysql-test/Makefile dnl
include/mysql_version.h netware/Makefile dnl
include/mysql_version.h dnl
, , [ , , [
test -z "$CONFIG_HEADERS" || echo timestamp > stamp-h test -z "$CONFIG_HEADERS" || echo timestamp > stamp-h
]) ])

View File

@ -16,7 +16,7 @@
/* Resolves IP's to hostname and hostnames to IP's */ /* Resolves IP's to hostname and hostnames to IP's */
#define RESOLVE_VERSION "2.2" #define RESOLVE_VERSION "2.3"
#include <my_global.h> #include <my_global.h>
#include <m_ctype.h> #include <m_ctype.h>
@ -147,8 +147,11 @@ int main(int argc, char **argv)
else else
{ {
printf ("Host name of %s is %s", ip,hpaddr->h_name); printf ("Host name of %s is %s", ip,hpaddr->h_name);
#ifndef __NETWARE__
/* this information is not available on NetWare */
for (q = hpaddr->h_aliases; *q != 0; q++) for (q = hpaddr->h_aliases; *q != 0; q++)
(void) printf(", %s", *q); (void) printf(", %s", *q);
#endif /* __NETWARE__ */
puts(""); puts("");
} }
} }

View File

@ -22,7 +22,7 @@ pkginclude_HEADERS = dbug.h m_string.h my_sys.h my_list.h \
errmsg.h my_global.h my_net.h my_alloc.h \ errmsg.h my_global.h my_net.h my_alloc.h \
my_getopt.h sslopt-longopts.h \ my_getopt.h sslopt-longopts.h \
sslopt-vars.h sslopt-case.h $(BUILT_SOURCES) sslopt-vars.h sslopt-case.h $(BUILT_SOURCES)
noinst_HEADERS = config-win.h config-os2.h \ noinst_HEADERS = config-win.h config-os2.h config-netware.h \
nisam.h heap.h merge.h my_bitmap.h\ nisam.h heap.h merge.h my_bitmap.h\
myisam.h myisampack.h myisammrg.h ft_global.h\ myisam.h myisampack.h myisammrg.h ft_global.h\
my_dir.h mysys_err.h my_base.h \ my_dir.h mysys_err.h my_base.h \

86
include/config-netware.h Normal file
View File

@ -0,0 +1,86 @@
/* Copyright (C) 2000 MySQL AB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
/* Defines for netware compatible with MySQL */
/* required headers */
#include <unistd.h>
#include <stdio.h>
#include <errno.h>
#include <screen.h>
#include <limits.h>
#include <nks/synch.h>
#include <nks/thread.h>
#include <signal.h>
#include <errno.h>
#include <stdbool.h>
#include <stdlib.h>
#include <nks/errno.h>
#include <sys/types.h>
#include <time.h>
#include <sys/time.h>
#include <nks/time.h>
#include <pthread.h>
#include <termios.h>
/* required adjustments */
#undef HAVE_READDIR_R
#undef HAVE_RWLOCK_INIT
#undef HAVE_SCHED_H
#undef HAVE_SYS_MMAN_H
#undef HAVE_SYNCH_H
#undef HAVE_CRYPT
#define HAVE_PTHREAD_ATTR_SETSTACKSIZE 1
#define HAVE_PTHREAD_SIGMASK 1
#define HAVE_PTHREAD_YIELD_ZERO_ARG 1
#define HAVE_BROKEN_REALPATH 1
/* no case sensitivity */
#define FN_NO_CASE_SENCE 1
/* the thread alarm is not used */
#define DONT_USE_THR_ALARM 1
/* signals do not interrupt sockets */
#define SIGNALS_DONT_BREAK_READ 1
/* signal by closing the sockets */
#define SIGNAL_WITH_VIO_CLOSE 1
/* default directory information */
#define DEFAULT_MYSQL_HOME "sys:/mysql"
#define PACKAGE "mysql"
#define DEFAULT_BASEDIR "sys:/"
#define SHAREDIR "share/"
#define DEFAULT_CHARSET_HOME "sys:/mysql/"
#define DATADIR "data/"
/* 64-bit file system calls */
#define SIZEOF_OFF_T 8
#define off_t off64_t
#define chsize chsize64
#define ftruncate ftruncate64
#define lseek lseek64
#define pread pread64
#define pwrite pwrite64
#define tell tell64
/* do not use the extended time in LibC sys\stat.h */
#define _POSIX_SOURCE
/* Some macros for portability */
#define set_timespec(ABSTIME,SEC) { (ABSTIME).tv_sec=(SEC); (ABSTIME).tv_nsec=0; }

View File

@ -182,6 +182,8 @@ inline double ulonglong2double(ulonglong value)
#define tell(A) _telli64(A) #define tell(A) _telli64(A)
#endif #endif
#define set_timespec(ABSTIME,SEC) { (ABSTIME).tv_sec=time((time_t*)0) + (time_t) (SEC); (ABSTIME).tv_nsec=0; }
#define STACK_DIRECTION -1 #define STACK_DIRECTION -1
/* Optimized store functions for Intel x86 */ /* Optimized store functions for Intel x86 */
@ -276,6 +278,7 @@ inline double ulonglong2double(ulonglong value)
#define my_reinterpret_cast(A) reinterpret_cast <A> #define my_reinterpret_cast(A) reinterpret_cast <A>
#define my_const_cast(A) const_cast<A> #define my_const_cast(A) const_cast<A>
/* MYSQL OPTIONS */ /* MYSQL OPTIONS */
#ifdef _CUSTOMCONFIG_ #ifdef _CUSTOMCONFIG_

View File

@ -51,6 +51,12 @@
#include <config-win.h> #include <config-win.h>
#elif defined(OS2) #elif defined(OS2)
#include <config-os2.h> #include <config-os2.h>
#elif defined(__NETWARE__)
#include <my_config.h>
#include <config-netware.h>
#if defined(__cplusplus) && defined(inline)
#undef inline /* fix configure problem */
#endif
#else #else
#include <my_config.h> #include <my_config.h>
#if defined(__cplusplus) && defined(inline) #if defined(__cplusplus) && defined(inline)
@ -442,17 +448,20 @@ typedef SOCKET_SIZE_TYPE size_socket;
/* file create flags */ /* file create flags */
#ifndef O_SHARE #ifndef O_SHARE /* Probably not windows */
#define O_SHARE 0 /* Flag to my_open for shared files */ #define O_SHARE 0 /* Flag to my_open for shared files */
#ifndef O_BINARY #ifndef O_BINARY
#define O_BINARY 0 /* Flag to my_open for binary files */ #define O_BINARY 0 /* Flag to my_open for binary files */
#endif #endif
#define FILE_BINARY 0 /* Flag to my_fopen for binary streams */ #ifndef FILE_BINARY
#define FILE_BINARY O_BINARY /* Flag to my_fopen for binary streams */
#endif
#ifdef HAVE_FCNTL #ifdef HAVE_FCNTL
#define HAVE_FCNTL_LOCK #define HAVE_FCNTL_LOCK
#define F_TO_EOF 0L /* Param to lockf() to lock rest of file */ #define F_TO_EOF 0L /* Param to lockf() to lock rest of file */
#endif #endif
#endif /* O_SHARE */ #endif /* O_SHARE */
#ifndef O_TEMPORARY #ifndef O_TEMPORARY
#define O_TEMPORARY 0 #define O_TEMPORARY 0
#endif #endif
@ -795,10 +804,9 @@ typedef char bool; /* Ordinary boolean values 0 1 */
#define MY_HOW_OFTEN_TO_ALARM 2 /* How often we want info on screen */ #define MY_HOW_OFTEN_TO_ALARM 2 /* How often we want info on screen */
#define MY_HOW_OFTEN_TO_WRITE 1000 /* How often we want info on screen */ #define MY_HOW_OFTEN_TO_WRITE 1000 /* How often we want info on screen */
#ifndef set_timespec
#ifdef HAVE_TIMESPEC_TS_SEC #ifdef HAVE_TIMESPEC_TS_SEC
#define set_timespec(ABSTIME,SEC) { (ABSTIME).ts_sec=time(0) + (time_t) (SEC); (ABSTIME).ts_nsec=0; } #define set_timespec(ABSTIME,SEC) { (ABSTIME).ts_sec=time(0) + (time_t) (SEC); (ABSTIME).ts_nsec=0; }
#elif defined(__WIN__)
#define set_timespec(ABSTIME,SEC) { (ABSTIME).tv_sec=time((time_t*)0) + (time_t) (SEC); (ABSTIME).tv_nsec=0; }
#else #else
#define set_timespec(ABSTIME,SEC) \ #define set_timespec(ABSTIME,SEC) \
{\ {\
@ -807,7 +815,8 @@ typedef char bool; /* Ordinary boolean values 0 1 */
(ABSTIME).tv_sec=tv.tv_sec+(time_t) (SEC);\ (ABSTIME).tv_sec=tv.tv_sec+(time_t) (SEC);\
(ABSTIME).tv_nsec=tv.tv_usec*1000;\ (ABSTIME).tv_nsec=tv.tv_usec*1000;\
} }
#endif #endif /* HAVE_TIMESPEC_TS_SEC */
#endif /* set_timespec */
/* /*
Define-funktions for reading and storing in machine independent format Define-funktions for reading and storing in machine independent format

View File

@ -44,7 +44,7 @@ C_MODE_START
#include <sys/ioctl.h> #include <sys/ioctl.h>
#endif #endif
#if !defined(MSDOS) && !defined(__WIN__) && !defined(HAVE_BROKEN_NETINET_INCLUDES) && !defined(__BEOS__) #if !defined(MSDOS) && !defined(__WIN__) && !defined(HAVE_BROKEN_NETINET_INCLUDES) && !defined(__BEOS__) && !defined(__NETWARE__)
#include <netinet/in_systm.h> #include <netinet/in_systm.h>
#include <netinet/in.h> #include <netinet/in.h>
#include <netinet/ip.h> #include <netinet/ip.h>

View File

@ -356,6 +356,14 @@ extern int my_pthread_cond_timedwait(pthread_cond_t *cond,
#define pthread_cond_timedwait(A,B,C) my_pthread_cond_timedwait((A),(B),(C)) #define pthread_cond_timedwait(A,B,C) my_pthread_cond_timedwait((A),(B),(C))
#endif #endif
#ifdef __NETWARE__
extern int my_pthread_cond_timedwait(pthread_cond_t *cond,
pthread_mutex_t *mutex,
struct timespec *abstime);
#define pthread_cond_timedwait(A,B,C) my_pthread_cond_timedwait((A),(B),(C))
#endif /* __NETWARE__ */
#if defined(OS2) #if defined(OS2)
#define my_pthread_getspecific(T,A) ((T) &(A)) #define my_pthread_getspecific(T,A) ((T) &(A))
#define pthread_setspecific(A,B) win_pthread_setspecific(&(A),(B),sizeof(A)) #define pthread_setspecific(A,B) win_pthread_setspecific(&(A),(B),sizeof(A))
@ -443,15 +451,39 @@ int my_pthread_mutex_trylock(pthread_mutex_t *mutex);
/* safe_mutex adds checking to mutex for easier debugging */ /* safe_mutex adds checking to mutex for easier debugging */
#if defined(__NETWARE__) && !defined(SAFE_MUTEX_DETECT_DESTROY)
#define SAFE_MUTEX_DETECT_DESTROY
#endif
typedef struct st_safe_mutex_t typedef struct st_safe_mutex_t
{ {
pthread_mutex_t global,mutex; pthread_mutex_t global,mutex;
char *file; char *file;
uint line,count; uint line,count;
pthread_t thread; pthread_t thread;
#ifdef SAFE_MUTEX_DETECT_DESTROY
struct st_safe_mutex_info_t *info; /* to track destroying of mutexes */
#endif
} safe_mutex_t; } safe_mutex_t;
int safe_mutex_init(safe_mutex_t *mp, const pthread_mutexattr_t *attr); #ifdef SAFE_MUTEX_DETECT_DESTROY
/*
Used to track the destroying of mutexes. This needs to be a seperate
structure because the safe_mutex_t structure could be freed before
the mutexes are destroyed.
*/
typedef struct st_safe_mutex_info_t
{
struct st_safe_mutex_info_t *next;
struct st_safe_mutex_info_t *prev;
char *init_file;
uint32 init_line;
} safe_mutex_info_t;
#endif /* SAFE_MUTEX_DETECT_DESTROY */
int safe_mutex_init(safe_mutex_t *mp, const pthread_mutexattr_t *attr,
const char *file, uint line);
int safe_mutex_lock(safe_mutex_t *mp,const char *file, uint line); int safe_mutex_lock(safe_mutex_t *mp,const char *file, uint line);
int safe_mutex_unlock(safe_mutex_t *mp,const char *file, uint line); int safe_mutex_unlock(safe_mutex_t *mp,const char *file, uint line);
int safe_mutex_destroy(safe_mutex_t *mp,const char *file, uint line); int safe_mutex_destroy(safe_mutex_t *mp,const char *file, uint line);
@ -459,6 +491,8 @@ int safe_cond_wait(pthread_cond_t *cond, safe_mutex_t *mp,const char *file,
uint line); uint line);
int safe_cond_timedwait(pthread_cond_t *cond, safe_mutex_t *mp, int safe_cond_timedwait(pthread_cond_t *cond, safe_mutex_t *mp,
struct timespec *abstime, const char *file, uint line); struct timespec *abstime, const char *file, uint line);
void safe_mutex_global_init(void);
void safe_mutex_end(FILE *file);
/* Wrappers if safe mutex is actually used */ /* Wrappers if safe mutex is actually used */
#ifdef SAFE_MUTEX #ifdef SAFE_MUTEX
@ -472,7 +506,7 @@ int safe_cond_timedwait(pthread_cond_t *cond, safe_mutex_t *mp,
#undef pthread_cond_wait #undef pthread_cond_wait
#undef pthread_cond_timedwait #undef pthread_cond_timedwait
#undef pthread_mutex_trylock #undef pthread_mutex_trylock
#define pthread_mutex_init(A,B) safe_mutex_init((A),(B)) #define pthread_mutex_init(A,B) safe_mutex_init((A),(B),__FILE__,__LINE__)
#define pthread_mutex_lock(A) safe_mutex_lock((A),__FILE__,__LINE__) #define pthread_mutex_lock(A) safe_mutex_lock((A),__FILE__,__LINE__)
#define pthread_mutex_unlock(A) safe_mutex_unlock((A),__FILE__,__LINE__) #define pthread_mutex_unlock(A) safe_mutex_unlock((A),__FILE__,__LINE__)
#define pthread_mutex_destroy(A) safe_mutex_destroy((A),__FILE__,__LINE__) #define pthread_mutex_destroy(A) safe_mutex_destroy((A),__FILE__,__LINE__)

View File

@ -731,29 +731,32 @@ extern void my_free_lock(byte *ptr,myf flags);
#define my_free_lock(A,B) my_free((A),(B)) #define my_free_lock(A,B) my_free((A),(B))
#endif #endif
#define alloc_root_inited(A) ((A)->min_malloc != 0) #define alloc_root_inited(A) ((A)->min_malloc != 0)
void init_alloc_root(MEM_ROOT *mem_root, uint block_size, uint pre_alloc_size); extern void init_alloc_root(MEM_ROOT *mem_root, uint block_size,
gptr alloc_root(MEM_ROOT *mem_root,unsigned int Size); uint pre_alloc_size);
void free_root(MEM_ROOT *root, myf MyFLAGS); extern gptr alloc_root(MEM_ROOT *mem_root,unsigned int Size);
void set_prealloc_root(MEM_ROOT *root, char *ptr); extern void free_root(MEM_ROOT *root, myf MyFLAGS);
char *strdup_root(MEM_ROOT *root,const char *str); extern void set_prealloc_root(MEM_ROOT *root, char *ptr);
char *strmake_root(MEM_ROOT *root,const char *str,uint len); extern char *strdup_root(MEM_ROOT *root,const char *str);
char *memdup_root(MEM_ROOT *root,const char *str,uint len); extern char *strmake_root(MEM_ROOT *root,const char *str,uint len);
void load_defaults(const char *conf_file, const char **groups, extern char *memdup_root(MEM_ROOT *root,const char *str,uint len);
int *argc, char ***argv); extern void load_defaults(const char *conf_file, const char **groups,
void free_defaults(char **argv); int *argc, char ***argv);
void print_defaults(const char *conf_file, const char **groups); extern void free_defaults(char **argv);
my_bool my_compress(byte *, ulong *, ulong *); extern void print_defaults(const char *conf_file, const char **groups);
my_bool my_uncompress(byte *, ulong *, ulong *); extern my_bool my_compress(byte *, ulong *, ulong *);
byte *my_compress_alloc(const byte *packet, ulong *len, ulong *complen); extern my_bool my_uncompress(byte *, ulong *, ulong *);
ulong checksum(const byte *mem, uint count); extern byte *my_compress_alloc(const byte *packet, ulong *len, ulong *complen);
uint my_bit_log2(ulong value); extern ulong checksum(const byte *mem, uint count);
extern uint my_bit_log2(ulong value);
extern void my_sleep(ulong m_seconds);
#if defined(_MSC_VER) && !defined(__WIN__)
extern void sleep(int sec);
#endif
#ifdef __WIN__ #ifdef __WIN__
extern my_bool have_tcpip; /* Is set if tcpip is used */ extern my_bool have_tcpip; /* Is set if tcpip is used */
#endif #endif
#ifdef __NETWARE__
void netware_reg_user(const char *ip, const char *user,
const char *application);
#endif
C_MODE_END C_MODE_END
#include "raid.h" #include "raid.h"

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2000 MySQL AB /* Copyright (C) 2000-2003 MySQL AB
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@ -60,6 +60,10 @@ typedef int my_socket;
extern unsigned int mysql_port; extern unsigned int mysql_port;
extern char *mysql_unix_port; extern char *mysql_unix_port;
#ifdef __NETWARE__
#pragma pack(push, 8) /* 8 byte alignment */
#endif
#define IS_PRI_KEY(n) ((n) & PRI_KEY_FLAG) #define IS_PRI_KEY(n) ((n) & PRI_KEY_FLAG)
#define IS_NOT_NULL(n) ((n) & NOT_NULL_FLAG) #define IS_NOT_NULL(n) ((n) & NOT_NULL_FLAG)
#define IS_BLOB(n) ((n) & BLOB_FLAG) #define IS_BLOB(n) ((n) & BLOB_FLAG)
@ -418,6 +422,11 @@ int STDCALL mysql_drop_db(MYSQL *mysql, const char *DB);
int simple_command(MYSQL *mysql,enum enum_server_command command, int simple_command(MYSQL *mysql,enum enum_server_command command,
const char *arg, unsigned long length, my_bool skipp_check); const char *arg, unsigned long length, my_bool skipp_check);
unsigned long net_safe_read(MYSQL* mysql); unsigned long net_safe_read(MYSQL* mysql);
void STDCALL mysql_once_init(void);
#ifdef __NETWARE__
#pragma pack(pop) /* restore alignment */
#endif
#ifdef __cplusplus #ifdef __cplusplus
} }

View File

@ -608,7 +608,7 @@ btr_cur_open_at_index_side(
if (estimate) { if (estimate) {
btr_cur_add_path_info(cursor, height, btr_cur_add_path_info(cursor, height,
root_height); root_height);
} }
break; break;
} }
@ -622,8 +622,8 @@ btr_cur_open_at_index_side(
} }
if (estimate) { if (estimate) {
btr_cur_add_path_info(cursor, height, root_height); btr_cur_add_path_info(cursor, height, root_height);
} }
height--; height--;

View File

@ -110,14 +110,14 @@ case "$target" in
CFLAGS="$CFLAGS -DUNIV_INTEL_X86";; CFLAGS="$CFLAGS -DUNIV_INTEL_X86";;
esac esac
AC_OUTPUT(Makefile os/Makefile ut/Makefile btr/Makefile AC_OUTPUT(Makefile os/Makefile ut/Makefile btr/Makefile dnl
buf/Makefile com/Makefile data/Makefile buf/Makefile com/Makefile data/Makefile dnl
dict/Makefile dyn/Makefile dict/Makefile dyn/Makefile dnl
eval/Makefile fil/Makefile fsp/Makefile fut/Makefile eval/Makefile fil/Makefile fsp/Makefile fut/Makefile dnl
ha/Makefile ibuf/Makefile include/Makefile ha/Makefile ibuf/Makefile include/Makefile dnl
lock/Makefile log/Makefile lock/Makefile log/Makefile dnl
mach/Makefile mem/Makefile mtr/Makefile odbc/Makefile mach/Makefile mem/Makefile mtr/Makefile odbc/Makefile dnl
page/Makefile pars/Makefile que/Makefile page/Makefile pars/Makefile que/Makefile dnl
read/Makefile rem/Makefile row/Makefile read/Makefile rem/Makefile row/Makefile dnl
srv/Makefile sync/Makefile thr/Makefile trx/Makefile srv/Makefile sync/Makefile thr/Makefile trx/Makefile dnl
usr/Makefile) usr/Makefile)

View File

@ -15,9 +15,10 @@ Created 9/8/1995 Heikki Tuuri
/* Maximum number of threads which can be created in the program; /* Maximum number of threads which can be created in the program;
this is also the size of the wait slot array for MySQL threads which this is also the size of the wait slot array for MySQL threads which
can wait inside InnoDB */ can wait inside InnoDB */
#ifdef __WIN__ #if defined(__WIN__) || defined(__NETWARE__)
/* Create less event semaphores because Win 98/ME had difficult creating /* Create less event semaphores because Win 98/ME had difficult creating
40000 event semaphores */ 40000 event semaphores */
/* TODO: these just take a lot of memory on NetWare. should netware move up? */
#define OS_THREAD_MAX_N 1000 #define OS_THREAD_MAX_N 1000
#else #else
#define OS_THREAD_MAX_N 10000 #define OS_THREAD_MAX_N 10000

View File

@ -8,6 +8,7 @@ Created 10/21/1995 Heikki Tuuri
#include "os0file.h" #include "os0file.h"
#include "os0sync.h" #include "os0sync.h"
#include "os0thread.h"
#include "ut0mem.h" #include "ut0mem.h"
#include "srv0srv.h" #include "srv0srv.h"
#include "fil0fil.h" #include "fil0fil.h"
@ -1093,6 +1094,7 @@ os_file_write(
DWORD low; DWORD low;
DWORD high; DWORD high;
ulint i; ulint i;
ulint n_retries = 0;
ut_a((offset & 0xFFFFFFFF) == offset); ut_a((offset & 0xFFFFFFFF) == offset);
@ -1101,7 +1103,7 @@ os_file_write(
ut_ad(file); ut_ad(file);
ut_ad(buf); ut_ad(buf);
ut_ad(n > 0); ut_ad(n > 0);
retry:
low = offset; low = offset;
high = offset_high; high = offset_high;
@ -1145,6 +1147,19 @@ os_file_write(
return(TRUE); return(TRUE);
} }
/* If some background file system backup tool is running, then, at
least in Windows 2000, we may get here a specific error. Let us
retry the operation 100 times, with 1 second waits. */
if (GetLastError() == ERROR_LOCK_VIOLATION && n_retries < 100) {
os_thread_sleep(1000000);
n_retries++;
goto retry;
}
if (!os_has_said_disk_full) { if (!os_has_said_disk_full) {
ut_print_timestamp(stderr); ut_print_timestamp(stderr);
@ -1157,7 +1172,7 @@ os_file_write(
"InnoDB: what the error number means.\n" "InnoDB: what the error number means.\n"
"InnoDB: Check that your OS and file system support files of this size.\n" "InnoDB: Check that your OS and file system support files of this size.\n"
"InnoDB: Check also that the disk is not full or a disk quota exceeded.\n", "InnoDB: Check also that the disk is not full or a disk quota exceeded.\n",
name, offset_high, offset, n, len, name, offset_high, offset, n, (ulint)len,
(ulint)GetLastError()); (ulint)GetLastError());
os_has_said_disk_full = TRUE; os_has_said_disk_full = TRUE;
@ -1180,13 +1195,13 @@ os_file_write(
fprintf(stderr, fprintf(stderr,
" InnoDB: Error: Write to file %s failed at offset %lu %lu.\n" " InnoDB: Error: Write to file %s failed at offset %lu %lu.\n"
"InnoDB: %lu bytes should have been written, only %lu were written.\n" "InnoDB: %lu bytes should have been written, only %ld were written.\n"
"InnoDB: Operating system error number %lu.\n" "InnoDB: Operating system error number %lu.\n"
"InnoDB: Look from section 13.2 at http://www.innodb.com/ibman.html\n" "InnoDB: Look from section 13.2 at http://www.innodb.com/ibman.html\n"
"InnoDB: what the error number means or use the perror program of MySQL.\n" "InnoDB: what the error number means or use the perror program of MySQL.\n"
"InnoDB: Check that your OS and file system support files of this size.\n" "InnoDB: Check that your OS and file system support files of this size.\n"
"InnoDB: Check also that the disk is not full or a disk quota exceeded.\n", "InnoDB: Check also that the disk is not full or a disk quota exceeded.\n",
name, offset_high, offset, n, (ulint)ret, name, offset_high, offset, n, (long int)ret,
(ulint)errno); (ulint)errno);
os_has_said_disk_full = TRUE; os_has_said_disk_full = TRUE;
} }

View File

@ -495,6 +495,8 @@ os_fast_mutex_free(
ut_a(fast_mutex); ut_a(fast_mutex);
DeleteCriticalSection((LPCRITICAL_SECTION) fast_mutex); DeleteCriticalSection((LPCRITICAL_SECTION) fast_mutex);
#elif defined(__NETWARE__) || defined(SAFE_MUTEX_DETECT_DESTROY)
pthread_mutex_destroy(fast_mutex);
#else #else
UT_NOT_USED(fast_mutex); UT_NOT_USED(fast_mutex);

View File

@ -214,6 +214,8 @@ os_thread_sleep(
{ {
#ifdef __WIN__ #ifdef __WIN__
Sleep(tm / 1000); Sleep(tm / 1000);
#elif defined(__NETWARE__)
delay(tm / 1000);
#else #else
struct timeval t; struct timeval t;

View File

@ -1700,8 +1700,63 @@ srv_general_init(void)
thr_local_init(); thr_local_init();
} }
#if defined(__NETWARE__) || defined(SAFE_MUTEX_DETECT_DESTROY)
/* NetWare requires some cleanup of mutexes */
/*************************************************************************
Deinitializes the synchronization primitives, memory system, and the thread
local storage. */
void
srv_general_free(void)
/*==================*/
{
sync_close();
}
#endif /* __NETWARE__ */
/*======================= InnoDB Server FIFO queue =======================*/ /*======================= InnoDB Server FIFO queue =======================*/
#if defined(__NETWARE__) || defined(SAFE_MUTEX_DETECT_DESTROY)
/* NetWare requires some cleanup of mutexes */
/*************************************************************************
Deinitializes the server. */
void
srv_free(void)
/*==========*/
{
srv_conc_slot_t* conc_slot;
srv_slot_t* slot;
ulint i;
for (i = 0; i < OS_THREAD_MAX_N; i++)
{
slot = srv_table_get_nth_slot(i);
os_event_free(slot->event);
}
/* TODO: free(srv_sys->threads); */
for (i = 0; i < OS_THREAD_MAX_N; i++)
{
slot = srv_mysql_table + i;
os_event_free(slot->event);
}
/* TODO: free(srv_mysql_table); */
for (i = 0; i < OS_THREAD_MAX_N; i++)
{
conc_slot = srv_conc_slots + i;
os_event_free(conc_slot->event);
}
}
#endif /* __NETWARE__ */
/************************************************************************* /*************************************************************************
Puts an OS thread to wait if there are too many concurrent threads Puts an OS thread to wait if there are too many concurrent threads
(>= srv_thread_concurrency) inside InnoDB. The threads wait in a FIFO queue. */ (>= srv_thread_concurrency) inside InnoDB. The threads wait in a FIFO queue. */

View File

@ -1415,6 +1415,10 @@ innobase_start_or_create_for_mysql(void)
os_fast_mutex_unlock(&srv_os_test_mutex); os_fast_mutex_unlock(&srv_os_test_mutex);
#if defined(__NETWARE__) || defined(SAFE_MUTEX_DETECT_DESTROY)
os_fast_mutex_free(&srv_os_test_mutex); /* all platforms? */
#endif /* __NETWARE__ */
if (srv_print_verbose_log) { if (srv_print_verbose_log) {
ut_print_timestamp(stderr); ut_print_timestamp(stderr);
fprintf(stderr, " InnoDB: Started\n"); fprintf(stderr, " InnoDB: Started\n");
@ -1461,12 +1465,28 @@ innobase_shutdown_for_mysql(void)
srv_conc_n_threads); srv_conc_n_threads);
} }
#if defined(__NETWARE__) || defined(SAFE_MUTEX_DETECT_DESTROY)
/*
TODO: Fix this temporary solution
We are having a race condition occure with io_handler_thread threads.
When they yield in os_aio_simulated_handle during shutdown, this
thread was able to free the memory early.
*/
os_thread_yield();
/* TODO: Where should this be called? */
srv_free();
/* TODO: Where should this be called? */
srv_general_free();
#endif
/* /*
TODO: We should exit the i/o-handler and other utility threads TODO: We should exit the i/o-handler and other utility threads
before freeing all memory. Now this can potentially cause a seg before freeing all memory. Now this can potentially cause a seg
fault! fault!
*/ */
#ifdef NOT_WORKING_YET #if defined(NOT_WORKING_YET) || defined(__NETWARE__) || defined(SAFE_MUTEX_DETECT_DESTROY)
/* NetWare requires this free */
ut_free_all_mem(); ut_free_all_mem();
#endif #endif

View File

@ -220,7 +220,7 @@ mutex_create_func(
char* cfile_name, /* in: file name where created */ char* cfile_name, /* in: file name where created */
ulint cline) /* in: file line where created */ ulint cline) /* in: file line where created */
{ {
#if defined(_WIN32) && defined(UNIV_CAN_USE_X86_ASSEMBLER) #if defined(_WIN32) && defined(UNIV_CAN_USE_X86_ASSEMBLER) && !defined(__NETWARE)
mutex_reset_lock_word(mutex); mutex_reset_lock_word(mutex);
#else #else
os_fast_mutex_init(&(mutex->os_fast_mutex)); os_fast_mutex_init(&(mutex->os_fast_mutex));

View File

@ -16,6 +16,8 @@
/* Test av locking */ /* Test av locking */
#ifndef __NETWARE__
#include "nisam.h" #include "nisam.h"
#include <sys/types.h> #include <sys/types.h>
#ifdef HAVE_SYS_WAIT_H #ifdef HAVE_SYS_WAIT_H
@ -477,3 +479,15 @@ int test_update(N_INFO *file,int id,int lock_type)
printf("%2d: update: %5d\n",id,update); fflush(stdout); printf("%2d: update: %5d\n",id,update); fflush(stdout);
return 0; return 0;
} }
#else /* __NETWARE__ */
#include <stdio.h>
main()
{
fprintf(stderr,"this test has not been ported to NetWare\n");
return 0;
}
#endif /* __NETWARE__ */

View File

@ -58,7 +58,7 @@ mysysobjects1 = my_init.lo my_static.lo my_malloc.lo my_realloc.lo \
thr_mutex.lo mulalloc.lo string.lo default.lo \ thr_mutex.lo mulalloc.lo string.lo default.lo \
my_compress.lo array.lo my_once.lo list.lo my_net.lo \ my_compress.lo array.lo my_once.lo list.lo my_net.lo \
charset.lo hash.lo mf_iocache.lo \ charset.lo hash.lo mf_iocache.lo \
mf_iocache2.lo my_seek.lo \ mf_iocache2.lo my_seek.lo my_sleep.lo \
my_pread.lo mf_cache.lo my_vsnprintf.lo md5.lo \ my_pread.lo mf_cache.lo my_vsnprintf.lo md5.lo \
my_getopt.lo my_gethostbyname.lo my_port.lo my_getopt.lo my_gethostbyname.lo my_port.lo
sqlobjects = net.lo sqlobjects = net.lo

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2000 MySQL AB /* Copyright (C) 2000-2003 MySQL AB
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@ -34,7 +34,7 @@
#include <pwd.h> #include <pwd.h>
#endif /* HAVE_PWD_H */ #endif /* HAVE_PWD_H */
#else /* ! HAVE_GETPASS */ #else /* ! HAVE_GETPASS */
#if !defined( __WIN__) && !defined(OS2) #if !defined(__WIN__) && !defined(OS2) && !defined(__NETWARE__)
#include <sys/ioctl.h> #include <sys/ioctl.h>
#ifdef HAVE_TERMIOS_H /* For tty-password */ #ifdef HAVE_TERMIOS_H /* For tty-password */
#include <termios.h> #include <termios.h>
@ -53,7 +53,9 @@
#include <asm/termiobits.h> #include <asm/termiobits.h>
#endif #endif
#else #else
#ifndef __NETWARE__
#include <conio.h> #include <conio.h>
#endif /* __NETWARE__ */
#endif /* __WIN__ */ #endif /* __WIN__ */
#endif /* HAVE_GETPASS */ #endif /* HAVE_GETPASS */
@ -61,9 +63,16 @@
#define getpass(A) getpassphrase(A) #define getpass(A) getpassphrase(A)
#endif #endif
#if defined( __WIN__) || defined(OS2) #if defined( __WIN__) || defined(OS2) || defined(__NETWARE__)
/* were just going to fake it here and get input from the keyboard */ /* were just going to fake it here and get input from the keyboard */
#ifdef __NETWARE__
#undef _getch
#undef _cputs
#define _getch getcharacter
#define _cputs(A) putstring(A)
#endif
char *get_tty_password(char *opt_message) char *get_tty_password(char *opt_message)
{ {
char to[80]; char to[80];
@ -100,12 +109,11 @@ char *get_tty_password(char *opt_message)
#else #else
#ifndef HAVE_GETPASS #ifndef HAVE_GETPASS
/* /*
** Can't use fgets, because readline will get confused Can't use fgets, because readline will get confused
** length is max number of chars in to, not counting \0 length is max number of chars in to, not counting \0
* to will not include the eol characters. to will not include the eol characters.
*/ */
static void get_password(char *to,uint length,int fd,bool echo) static void get_password(char *to,uint length,int fd,bool echo)

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2000 MySQL AB /* Copyright (C) 2000-2003 MySQL AB
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@ -73,14 +73,13 @@ ulong net_write_timeout= NET_WRITE_TIMEOUT;
#endif #endif
#if defined(MSDOS) || defined(__WIN__) #if defined(MSDOS) || defined(__WIN__)
// socket_errno is defined in my_global.h for all platforms /* socket_errno is defined in my_global.h for all platforms */
#define perror(A) #define perror(A)
#else #else
#include <errno.h> #include <errno.h>
#define SOCKET_ERROR -1 #define SOCKET_ERROR -1
#endif /* __WIN__ */ #endif /* __WIN__ */
static void mysql_once_init(void);
static MYSQL_DATA *read_rows (MYSQL *mysql,MYSQL_FIELD *fields, static MYSQL_DATA *read_rows (MYSQL *mysql,MYSQL_FIELD *fields,
uint field_count); uint field_count);
static int read_one_row(MYSQL *mysql,uint fields,MYSQL_ROW row, static int read_one_row(MYSQL *mysql,uint fields,MYSQL_ROW row,
@ -100,6 +99,7 @@ int STDCALL mysql_server_init(int argc __attribute__((unused)),
char **argv __attribute__((unused)), char **argv __attribute__((unused)),
char **groups __attribute__((unused))) char **groups __attribute__((unused)))
{ {
mysql_once_init();
return 0; return 0;
} }
@ -108,6 +108,8 @@ void STDCALL mysql_server_end()
/* If library called my_init(), free memory allocated by it */ /* If library called my_init(), free memory allocated by it */
if (!org_my_init_done) if (!org_my_init_done)
my_end(0); my_end(0);
else
mysql_thread_end();
} }
my_bool STDCALL mysql_thread_init() my_bool STDCALL mysql_thread_init()
@ -159,7 +161,7 @@ static MYSQL* spawn_init(MYSQL* parent, const char* host,
int my_connect(my_socket s, const struct sockaddr *name, uint namelen, int my_connect(my_socket s, const struct sockaddr *name, uint namelen,
uint timeout) uint timeout)
{ {
#if defined(__WIN__) || defined(OS2) #if defined(__WIN__) || defined(OS2) || defined(__NETWARE__)
return connect(s, (struct sockaddr*) name, namelen); return connect(s, (struct sockaddr*) name, namelen);
#else #else
int flags, res, s_err; int flags, res, s_err;
@ -484,7 +486,14 @@ simple_command(MYSQL *mysql,enum enum_server_command command, const char *arg,
if (net_write_command(net,(uchar) command,arg, if (net_write_command(net,(uchar) command,arg,
length ? length : (ulong) strlen(arg))) length ? length : (ulong) strlen(arg)))
{ {
DBUG_PRINT("error",("Can't send command to server. Error: %d",socket_errno)); DBUG_PRINT("error",("Can't send command to server. Error: %d",
socket_errno));
if (net->last_errno == ER_NET_PACKET_TOO_LARGE)
{
net->last_errno=CR_NET_PACKET_TOO_LARGE;
strmov(net->last_error,ER(net->last_errno));
goto end;
}
end_server(mysql); end_server(mysql);
if (mysql_reconnect(mysql)) if (mysql_reconnect(mysql))
goto end; goto end;
@ -522,7 +531,16 @@ struct passwd *getpwuid(uid_t);
char* getlogin(void); char* getlogin(void);
#endif #endif
#if !defined(MSDOS) && ! defined(VMS) && !defined(__WIN__) && !defined(OS2)
#if defined(__NETWARE__)
/* default to "root" on NetWare */
static void read_user_name(char *name)
{
(void)strmake(name,"root", USERNAME_LENGTH);
}
#elif !defined(MSDOS) && ! defined(VMS) && !defined(__WIN__) && !defined(OS2)
static void read_user_name(char *name) static void read_user_name(char *name)
{ {
DBUG_ENTER("read_user_name"); DBUG_ENTER("read_user_name");
@ -1396,7 +1414,20 @@ mysql_init(MYSQL *mysql)
} }
static void mysql_once_init() /*
Initialize the MySQL library
SYNOPSIS
mysql_once_init()
NOTES
Can't be static on NetWare
This function is called by mysql_init() and indirectly called
by mysql_query(), so one should never have to call this from an
outside program.
*/
void STDCALL mysql_once_init(void)
{ {
if (!mysql_client_init) if (!mysql_client_init)
{ {

View File

@ -34,6 +34,10 @@
#if defined(OS2) #if defined(OS2)
# include <sys/un.h> # include <sys/un.h>
#elif defined(__NETWARE__)
#include <netdb.h>
#include <sys/select.h>
#include <sys/utsname.h>
#elif !defined( __WIN__) #elif !defined( __WIN__)
#include <sys/resource.h> #include <sys/resource.h>
#ifdef HAVE_SYS_UN_H #ifdef HAVE_SYS_UN_H

View File

@ -3013,7 +3013,7 @@ hardcode_libdir_flag_spec=$hardcode_libdir_flag_spec
# the DEB_BUILD_ARCH variable should be of non-zero length, indicating # the DEB_BUILD_ARCH variable should be of non-zero length, indicating
# that we are in the middle of a Debian package build (assuming the # that we are in the middle of a Debian package build (assuming the
# user isn't doing anything strange with environment variables). # user isn't doing anything strange with environment variables).
if test -n "`dpkg-architecture -qDEB_BUILD_ARCH`" && ps | grep debuild | grep -v grep > /dev/null; then if test -n "`dpkg-architecture -qDEB_BUILD_ARCH 2>/dev/null`" && ps | grep debuild | grep -v grep > /dev/null; then
# Debian policy mandates that rpaths should not be encoded into a binary # Debian policy mandates that rpaths should not be encoded into a binary
# so it is overridden. # so it is overridden.
hardcode_libdir_flag_spec=" -D_DEBIAN_PATCHED_LIBTOOL_ " hardcode_libdir_flag_spec=" -D_DEBIAN_PATCHED_LIBTOOL_ "

View File

@ -16,6 +16,8 @@
/* Test av locking */ /* Test av locking */
#ifndef __NETWARE__
#include "myisam.h" #include "myisam.h"
#include <sys/types.h> #include <sys/types.h>
#ifdef HAVE_SYS_WAIT_H #ifdef HAVE_SYS_WAIT_H
@ -483,3 +485,15 @@ int test_update(MI_INFO *file,int id,int lock_type)
printf("%2d: update: %5d\n",id,update); fflush(stdout); printf("%2d: update: %5d\n",id,update); fflush(stdout);
return 0; return 0;
} }
#else /* __NETWARE__ */
#include <stdio.h>
main()
{
fprintf(stderr,"this test has not been ported to NetWare\n");
return 0;
}
#endif /* __NETWARE__ */

View File

@ -0,0 +1,4 @@
-- require r/have_crypt.require
disable_query_log;
show variables like "have_crypt";
enable_query_log;

View File

@ -106,6 +106,7 @@ TAIL=tail
ECHO=echo # use internal echo if possible ECHO=echo # use internal echo if possible
EXPR=expr # use internal if possible EXPR=expr # use internal if possible
FIND=find FIND=find
GREP=grep
if test $? != 0; then exit 1; fi if test $? != 0; then exit 1; fi
PRINTF=printf PRINTF=printf
RM=rm RM=rm
@ -605,6 +606,30 @@ report_stats () {
$ECHO "If you want to report this error, please read first the documentation at" $ECHO "If you want to report this error, please read first the documentation at"
$ECHO "http://www.mysql.com/doc/M/y/MySQL_test_suite.html" $ECHO "http://www.mysql.com/doc/M/y/MySQL_test_suite.html"
fi fi
#
# Report if there was any fatal warnings/errors in the log files
#
$RM -f $MY_LOG_DIR/warnings $MY_LOG_DIR/warnings.tmp
# Remove some non fatal warnings from the log files
$SED -e 's!Warning: Table:.* on delete!!g' \
$MY_LOG_DIR/*.err > $MY_LOG_DIR/warnings.tmp
found_error=0
# Find errors
for i in "^Warning:" "^Error:" "^==.* at 0x"
do
if `$GREP "$i" $MY_LOG_DIR/warnings.tmp >> $MY_LOG_DIR/warnings`
then
found_error=1
fi
done
$RM -f $MY_LOG_DIR/warnings.tmp
if [ $found_error = "1" ]
then
echo "WARNING: Got errors/warnings while running tests. Please examine"
echo "$MY_LOG_DIR/warnings for details."
fi
} }
mysql_install_db () { mysql_install_db () {

View File

@ -36,6 +36,10 @@ select t2.isbn,city,t1.libname,count(distinct t1.libname) as a from t3 left join
isbn city libname a isbn city libname a
007 Berkeley Berkeley Public1 2 007 Berkeley Berkeley Public1 2
000 New York New York Public Libra 2 000 New York New York Public Libra 2
select t2.isbn,city,t1.libname,count(distinct t1.libname) as a from t3 left join t1 on t3.libname=t1.libname left join t2 on t3.isbn=t2.isbn group by city having count(distinct concat(t1.libname,'a')) > 1;
isbn city libname a
007 Berkeley Berkeley Public1 2
000 New York New York Public Libra 2
drop table t1, t2, t3; drop table t1, t2, t3;
create table t1 (f1 int); create table t1 (f1 int);
insert into t1 values (1); insert into t1 values (1);

View File

@ -32,6 +32,11 @@ userid MIN(t1.score)
1 1 1 1
2 2 2 2
3 3 3 3
SELECT t2.userid, MIN(t1.score) FROM t1, t2 WHERE t1.userID=t2.userID GROUP BY t2.userid ORDER BY NULL;
userid MIN(t1.score)
1 1
2 2
3 3
SELECT t2.userid, MIN(t1.score) FROM t1, t2 WHERE t1.userID=t2.userID AND t1.spID=2 GROUP BY t2.userid; SELECT t2.userid, MIN(t1.score) FROM t1, t2 WHERE t1.userID=t2.userID AND t1.spID=2 GROUP BY t2.userid;
userid MIN(t1.score) userid MIN(t1.score)
1 1 1 1
@ -40,6 +45,10 @@ SELECT t2.userid, MIN(t1.score+0.0) FROM t1, t2 WHERE t1.userID=t2.userID AND t1
userid MIN(t1.score+0.0) userid MIN(t1.score+0.0)
1 1.0 1 1.0
2 2.0 2 2.0
SELECT t2.userid, MIN(t1.score+0.0) FROM t1, t2 WHERE t1.userID=t2.userID AND t1.spID=2 GROUP BY t2.userid ORDER BY NULL;
userid MIN(t1.score+0.0)
1 1.0
2 2.0
drop table test.t1,test.t2; drop table test.t1,test.t2;
CREATE TABLE t1 ( CREATE TABLE t1 (
PID int(10) unsigned DEFAULT '0' NOT NULL auto_increment, PID int(10) unsigned DEFAULT '0' NOT NULL auto_increment,
@ -86,6 +95,8 @@ INSERT INTO t2 VALUES (91,2);
INSERT INTO t2 VALUES (92,2); INSERT INTO t2 VALUES (92,2);
SELECT cid, CONCAT(firstname, ' ', surname), COUNT(call_id) FROM t1 LEFT JOIN t2 ON cid=contact_id WHERE firstname like '%foo%' GROUP BY cid; SELECT cid, CONCAT(firstname, ' ', surname), COUNT(call_id) FROM t1 LEFT JOIN t2 ON cid=contact_id WHERE firstname like '%foo%' GROUP BY cid;
cid CONCAT(firstname, ' ', surname) COUNT(call_id) cid CONCAT(firstname, ' ', surname) COUNT(call_id)
SELECT cid, CONCAT(firstname, ' ', surname), COUNT(call_id) FROM t1 LEFT JOIN t2 ON cid=contact_id WHERE firstname like '%foo%' GROUP BY cid ORDER BY NULL;
cid CONCAT(firstname, ' ', surname) COUNT(call_id)
SELECT HIGH_PRIORITY cid, CONCAT(firstname, ' ', surname), COUNT(call_id) FROM t1 LEFT JOIN t2 ON cid=contact_id WHERE firstname like '%foo%' GROUP BY cid ORDER BY surname, firstname; SELECT HIGH_PRIORITY cid, CONCAT(firstname, ' ', surname), COUNT(call_id) FROM t1 LEFT JOIN t2 ON cid=contact_id WHERE firstname like '%foo%' GROUP BY cid ORDER BY surname, firstname;
cid CONCAT(firstname, ' ', surname) COUNT(call_id) cid CONCAT(firstname, ' ', surname) COUNT(call_id)
drop table t1,t2; drop table t1,t2;
@ -235,6 +246,9 @@ INSERT INTO t1 VALUES (1,1,1),(2,2,2),(2,1,1),(3,3,3),(4,3,3),(5,3,3);
explain select userid,count(*) from t1 group by userid desc; explain select userid,count(*) from t1 group by userid desc;
table type possible_keys key key_len ref rows Extra table type possible_keys key key_len ref rows Extra
t1 ALL NULL NULL NULL NULL 6 Using temporary; Using filesort t1 ALL NULL NULL NULL NULL 6 Using temporary; Using filesort
explain select userid,count(*) from t1 group by userid desc order by null;
table type possible_keys key key_len ref rows Extra
t1 ALL NULL NULL NULL NULL 6 Using temporary
select userid,count(*) from t1 group by userid desc; select userid,count(*) from t1 group by userid desc;
userid count(*) userid count(*)
3 3 3 3
@ -253,6 +267,9 @@ t1 range spID spID 5 NULL 2 Using where; Using index
explain select spid,count(*) from t1 where spid between 1 and 2 group by spid; explain select spid,count(*) from t1 where spid between 1 and 2 group by spid;
table type possible_keys key key_len ref rows Extra table type possible_keys key key_len ref rows Extra
t1 range spID spID 5 NULL 2 Using where; Using index t1 range spID spID 5 NULL 2 Using where; Using index
explain select spid,count(*) from t1 where spid between 1 and 2 group by spid order by null;
table type possible_keys key key_len ref rows Extra
t1 range spID spID 5 NULL 2 Using where; Using index
select spid,count(*) from t1 where spid between 1 and 2 group by spid; select spid,count(*) from t1 where spid between 1 and 2 group by spid;
spid count(*) spid count(*)
1 1 1 1
@ -264,6 +281,9 @@ spid count(*)
explain select sql_big_result spid,sum(userid) from t1 group by spid desc; explain select sql_big_result spid,sum(userid) from t1 group by spid desc;
table type possible_keys key key_len ref rows Extra table type possible_keys key key_len ref rows Extra
t1 ALL NULL NULL NULL NULL 6 Using filesort t1 ALL NULL NULL NULL NULL 6 Using filesort
explain select sql_big_result spid,sum(userid) from t1 group by spid desc order by null;
table type possible_keys key key_len ref rows Extra
t1 ALL NULL NULL NULL NULL 6
select sql_big_result spid,sum(userid) from t1 group by spid desc; select sql_big_result spid,sum(userid) from t1 group by spid desc;
spid sum(userid) spid sum(userid)
5 3 5 3
@ -274,6 +294,9 @@ spid sum(userid)
explain select sql_big_result score,count(*) from t1 group by score desc; explain select sql_big_result score,count(*) from t1 group by score desc;
table type possible_keys key key_len ref rows Extra table type possible_keys key key_len ref rows Extra
t1 index NULL score 3 NULL 6 Using index t1 index NULL score 3 NULL 6 Using index
explain select sql_big_result score,count(*) from t1 group by score desc order by null;
table type possible_keys key key_len ref rows Extra
t1 index NULL score 3 NULL 6 Using index
select sql_big_result score,count(*) from t1 group by score desc; select sql_big_result score,count(*) from t1 group by score desc;
score count(*) score count(*)
3 3 3 3
@ -481,3 +504,28 @@ NULL 9
3 3
b 1 b 1
drop table t1; drop table t1;
create table t1 (a int not null, b int not null);
insert into t1 values (1,1),(1,2),(3,1),(3,2),(2,2),(2,1);
create table t2 (a int not null, b int not null, key(a));
insert into t2 values (1,3),(3,1),(2,2),(1,1);
select t1.a,t2.b from t1,t2 where t1.a=t2.a group by t1.a,t2.b;
a b
1 1
1 3
2 2
3 1
select t1.a,t2.b from t1,t2 where t1.a=t2.a group by t1.a,t2.b ORDER BY NULL;
a b
1 3
3 1
2 2
1 1
explain select t1.a,t2.b from t1,t2 where t1.a=t2.a group by t1.a,t2.b;
table type possible_keys key key_len ref rows Extra
t1 ALL NULL NULL NULL NULL 6 Using temporary; Using filesort
t2 ALL a NULL NULL NULL 4 Using where
explain select t1.a,t2.b from t1,t2 where t1.a=t2.a group by t1.a,t2.b ORDER BY NULL;
table type possible_keys key key_len ref rows Extra
t1 ALL NULL NULL NULL NULL 6 Using temporary
t2 ALL a NULL NULL NULL 4 Using where
drop table t1,t2;

View File

@ -0,0 +1,2 @@
Variable_name Value
have_crypt YES

View File

@ -8,6 +8,7 @@ drop database if exists foo;
create database foo; create database foo;
drop database if exists bar; drop database if exists bar;
create database bar; create database bar;
create database foo;
drop table if exists foo.foo; drop table if exists foo.foo;
create table foo.foo (n int); create table foo.foo (n int);
insert into foo.foo values(4); insert into foo.foo values(4);
@ -20,10 +21,11 @@ insert into bar.bar values(15);
select foo.foo.n,bar.bar.m from foo.foo,bar.bar; select foo.foo.n,bar.bar.m from foo.foo,bar.bar;
n m n m
4 15 4 15
drop database if exists bar; drop database bar;
drop database if exists foo;
drop database if exists bar;
drop database if exists foo; drop database if exists foo;
drop database bar;
Can't drop database 'bar'. Database doesn't exist
drop database foo;
set sql_log_bin = 0; set sql_log_bin = 0;
create database foo; create database foo;
create database bar; create database bar;

View File

@ -0,0 +1,15 @@
a
1
2
3
4
b c
1 4
a
10
11
12
13
b c
5 0
6 11

View File

@ -0,0 +1,9 @@
slave stop;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
slave start;
select master_pos_wait('master-bin.999999',0,10);
master_pos_wait('master-bin.999999',0,10)
-1

View File

@ -4,7 +4,7 @@ connection con1;
set SQL_LOG_BIN=0; set SQL_LOG_BIN=0;
drop table if exists t1; drop table if exists t1;
create table t1(n int); create table t1(n int);
--replace_result "errno = 2" "errno = X" "errno = 22" "errno = X" "errno = 23" "errno = X" --replace_result "errno = 1" "errno = X" "errno = 2" "errno = X" "errno = 22" "errno = X" "errno = 23" "errno = X"
backup table t1 to '../bogus'; backup table t1 to '../bogus';
backup table t1 to '../tmp'; backup table t1 to '../tmp';
drop table t1; drop table t1;

View File

@ -31,6 +31,7 @@ insert into t1 values ('Berkeley Public2','Berkeley');
insert into t1 values ('NYC Lib','New York'); insert into t1 values ('NYC Lib','New York');
select t2.isbn,city,t1.libname,count(t1.libname) as a from t3 left join t1 on t3.libname=t1.libname left join t2 on t3.isbn=t2.isbn group by city,t1.libname; select t2.isbn,city,t1.libname,count(t1.libname) as a from t3 left join t1 on t3.libname=t1.libname left join t2 on t3.isbn=t2.isbn group by city,t1.libname;
select t2.isbn,city,t1.libname,count(distinct t1.libname) as a from t3 left join t1 on t3.libname=t1.libname left join t2 on t3.isbn=t2.isbn group by city having count(distinct t1.libname) > 1; select t2.isbn,city,t1.libname,count(distinct t1.libname) as a from t3 left join t1 on t3.libname=t1.libname left join t2 on t3.isbn=t2.isbn group by city having count(distinct t1.libname) > 1;
select t2.isbn,city,t1.libname,count(distinct t1.libname) as a from t3 left join t1 on t3.libname=t1.libname left join t2 on t3.isbn=t2.isbn group by city having count(distinct concat(t1.libname,'a')) > 1;
drop table t1, t2, t3; drop table t1, t2, t3;
# #

View File

@ -1,3 +1,5 @@
-- source include/have_crypt.inc
select length(encrypt('foo', 'ff')) <> 0; select length(encrypt('foo', 'ff')) <> 0;
--replace_result $1$aa$4OSUA5cjdx0RUQ08opV27/ aaqPiZY5xR5l. --replace_result $1$aa$4OSUA5cjdx0RUQ08opV27/ aaqPiZY5xR5l.
select password('test'),length(encrypt('test')),encrypt('test','aa'); select password('test'),length(encrypt('test')),encrypt('test','aa');

View File

@ -6,7 +6,7 @@
drop table if exists test.t1,mysqltest.t1,mysqltest.t2; drop table if exists test.t1,mysqltest.t1,mysqltest.t2;
reset query cache; reset query cache;
flush status; flush status;
connect (root,localhost,root,,test,0,master.sock); connect (root,localhost,root,,test,$MASTER_MYPORT,master.sock);
connection root; connection root;
create database if not exists mysqltest; create database if not exists mysqltest;
@ -17,7 +17,7 @@ insert into mysqltest.t2 values (3,3,3);
create table test.t1 (a char (10)); create table test.t1 (a char (10));
insert into test.t1 values ("test.t1"); insert into test.t1 values ("test.t1");
select * from t1; select * from t1;
connect (root2,localhost,root,,mysqltest,0,master.sock); connect (root2,localhost,root,,mysqltest,$MASTER_MYPORT,master.sock);
connection root2; connection root2;
# put queries in cache # put queries in cache
select * from t1; select * from t1;
@ -35,7 +35,7 @@ grant SELECT on test.t1 to mysqltest_2@localhost;
grant SELECT(a) on mysqltest.t1 to mysqltest_3@localhost; grant SELECT(a) on mysqltest.t1 to mysqltest_3@localhost;
# The following queries should be fetched from cache # The following queries should be fetched from cache
connect (user1,localhost,mysqltest_1,,mysqltest,0,master.sock); connect (user1,localhost,mysqltest_1,,mysqltest,$MASTER_MYPORT,master.sock);
connection user1; connection user1;
select "user1"; select "user1";
select * from t1; select * from t1;
@ -47,13 +47,14 @@ show status like "Qcache_hits";
show status like "Qcache_not_cached"; show status like "Qcache_not_cached";
# The following queries should be fetched from cache # The following queries should be fetched from cache
connect (user2,localhost,mysqltest_2,,mysqltest,0,master.sock); connect (user2,localhost,mysqltest_2,,mysqltest,$MASTER_MYPORT,master.sock);
connection user2; connection user2;
select "user2"; select "user2";
select * from t1; select * from t1;
select a from t1; select a from t1;
select c from t1; select c from t1;
select * from mysqltest.t1,test.t1; select * from mysqltest.t1,test.t1;
--replace_result 127.0.0.1 localhost
--error 1142 --error 1142
select * from t2; select * from t2;
show status like "Qcache_queries_in_cache"; show status like "Qcache_queries_in_cache";
@ -61,16 +62,20 @@ show status like "Qcache_hits";
show status like "Qcache_not_cached"; show status like "Qcache_not_cached";
# The following queries should not be fetched from cache # The following queries should not be fetched from cache
connect (user3,localhost,mysqltest_3,,mysqltest,0,master.sock); connect (user3,localhost,mysqltest_3,,mysqltest,$MASTER_MYPORT,master.sock);
connection user3; connection user3;
select "user3"; select "user3";
--replace_result 127.0.0.1 localhost
--error 1143 --error 1143
select * from t1; select * from t1;
select a from t1; select a from t1;
--replace_result 127.0.0.1 localhost
--error 1143 --error 1143
select c from t1; select c from t1;
--replace_result 127.0.0.1 localhost
--error 1142 --error 1142
select * from t2; select * from t2;
--replace_result 127.0.0.1 localhost
--error 1143 --error 1143
select mysqltest.t1.c from test.t1,mysqltest.t1; select mysqltest.t1.c from test.t1,mysqltest.t1;
show status like "Qcache_queries_in_cache"; show status like "Qcache_queries_in_cache";
@ -78,7 +83,7 @@ show status like "Qcache_hits";
show status like "Qcache_not_cached"; show status like "Qcache_not_cached";
# Connect without a database # Connect without a database
connect (user4,localhost,mysqltest_1,,*NO-ONE*,0,master.sock); connect (user4,localhost,mysqltest_1,,*NO-ONE*,$MASTER_MYPORT,master.sock);
connection user4; connection user4;
select "user4"; select "user4";
--error 1046 --error 1046

View File

@ -36,8 +36,10 @@ INSERT INTO t2 VALUES (2,'name','pass','mail','Y','v','n','adr','1','1','1');
INSERT INTO t2 VALUES (3,'name','pass','mail','Y','v','n','adr','1','1','1'); INSERT INTO t2 VALUES (3,'name','pass','mail','Y','v','n','adr','1','1','1');
SELECT t2.userid, MIN(t1.score) FROM t1, t2 WHERE t1.userID=t2.userID GROUP BY t2.userid; SELECT t2.userid, MIN(t1.score) FROM t1, t2 WHERE t1.userID=t2.userID GROUP BY t2.userid;
SELECT t2.userid, MIN(t1.score) FROM t1, t2 WHERE t1.userID=t2.userID GROUP BY t2.userid ORDER BY NULL;
SELECT t2.userid, MIN(t1.score) FROM t1, t2 WHERE t1.userID=t2.userID AND t1.spID=2 GROUP BY t2.userid; SELECT t2.userid, MIN(t1.score) FROM t1, t2 WHERE t1.userID=t2.userID AND t1.spID=2 GROUP BY t2.userid;
SELECT t2.userid, MIN(t1.score+0.0) FROM t1, t2 WHERE t1.userID=t2.userID AND t1.spID=2 GROUP BY t2.userid; SELECT t2.userid, MIN(t1.score+0.0) FROM t1, t2 WHERE t1.userID=t2.userID AND t1.spID=2 GROUP BY t2.userid;
SELECT t2.userid, MIN(t1.score+0.0) FROM t1, t2 WHERE t1.userID=t2.userID AND t1.spID=2 GROUP BY t2.userid ORDER BY NULL;
drop table test.t1,test.t2; drop table test.t1,test.t2;
# #
@ -100,6 +102,7 @@ INSERT INTO t2 VALUES (91,2);
INSERT INTO t2 VALUES (92,2); INSERT INTO t2 VALUES (92,2);
SELECT cid, CONCAT(firstname, ' ', surname), COUNT(call_id) FROM t1 LEFT JOIN t2 ON cid=contact_id WHERE firstname like '%foo%' GROUP BY cid; SELECT cid, CONCAT(firstname, ' ', surname), COUNT(call_id) FROM t1 LEFT JOIN t2 ON cid=contact_id WHERE firstname like '%foo%' GROUP BY cid;
SELECT cid, CONCAT(firstname, ' ', surname), COUNT(call_id) FROM t1 LEFT JOIN t2 ON cid=contact_id WHERE firstname like '%foo%' GROUP BY cid ORDER BY NULL;
SELECT HIGH_PRIORITY cid, CONCAT(firstname, ' ', surname), COUNT(call_id) FROM t1 LEFT JOIN t2 ON cid=contact_id WHERE firstname like '%foo%' GROUP BY cid ORDER BY surname, firstname; SELECT HIGH_PRIORITY cid, CONCAT(firstname, ' ', surname), COUNT(call_id) FROM t1 LEFT JOIN t2 ON cid=contact_id WHERE firstname like '%foo%' GROUP BY cid ORDER BY surname, firstname;
drop table t1,t2; drop table t1,t2;
@ -234,16 +237,20 @@ CREATE TABLE t1 (
INSERT INTO t1 VALUES (1,1,1),(2,2,2),(2,1,1),(3,3,3),(4,3,3),(5,3,3); INSERT INTO t1 VALUES (1,1,1),(2,2,2),(2,1,1),(3,3,3),(4,3,3),(5,3,3);
explain select userid,count(*) from t1 group by userid desc; explain select userid,count(*) from t1 group by userid desc;
explain select userid,count(*) from t1 group by userid desc order by null;
select userid,count(*) from t1 group by userid desc; select userid,count(*) from t1 group by userid desc;
select userid,count(*) from t1 group by userid desc having (count(*)+1) IN (4,3); select userid,count(*) from t1 group by userid desc having (count(*)+1) IN (4,3);
select userid,count(*) from t1 group by userid desc having 3 IN (1,COUNT(*)); select userid,count(*) from t1 group by userid desc having 3 IN (1,COUNT(*));
explain select spid,count(*) from t1 where spid between 1 and 2 group by spid desc; explain select spid,count(*) from t1 where spid between 1 and 2 group by spid desc;
explain select spid,count(*) from t1 where spid between 1 and 2 group by spid; explain select spid,count(*) from t1 where spid between 1 and 2 group by spid;
explain select spid,count(*) from t1 where spid between 1 and 2 group by spid order by null;
select spid,count(*) from t1 where spid between 1 and 2 group by spid; select spid,count(*) from t1 where spid between 1 and 2 group by spid;
select spid,count(*) from t1 where spid between 1 and 2 group by spid desc; select spid,count(*) from t1 where spid between 1 and 2 group by spid desc;
explain select sql_big_result spid,sum(userid) from t1 group by spid desc; explain select sql_big_result spid,sum(userid) from t1 group by spid desc;
explain select sql_big_result spid,sum(userid) from t1 group by spid desc order by null;
select sql_big_result spid,sum(userid) from t1 group by spid desc; select sql_big_result spid,sum(userid) from t1 group by spid desc;
explain select sql_big_result score,count(*) from t1 group by score desc; explain select sql_big_result score,count(*) from t1 group by score desc;
explain select sql_big_result score,count(*) from t1 group by score desc order by null;
select sql_big_result score,count(*) from t1 group by score desc; select sql_big_result score,count(*) from t1 group by score desc;
drop table t1; drop table t1;
@ -365,3 +372,17 @@ select a,count(*) from t1 group by a;
set option sql_big_tables=1; set option sql_big_tables=1;
select a,count(*) from t1 group by a; select a,count(*) from t1 group by a;
drop table t1; drop table t1;
#
# Test of GROUP BY ... ORDER BY NULL optimization
#
create table t1 (a int not null, b int not null);
insert into t1 values (1,1),(1,2),(3,1),(3,2),(2,2),(2,1);
create table t2 (a int not null, b int not null, key(a));
insert into t2 values (1,3),(3,1),(2,2),(1,1);
select t1.a,t2.b from t1,t2 where t1.a=t2.a group by t1.a,t2.b;
select t1.a,t2.b from t1,t2 where t1.a=t2.a group by t1.a,t2.b ORDER BY NULL;
explain select t1.a,t2.b from t1,t2 where t1.a=t2.a group by t1.a,t2.b;
explain select t1.a,t2.b from t1,t2 where t1.a=t2.a group by t1.a,t2.b ORDER BY NULL;
drop table t1,t2;

View File

@ -9,6 +9,7 @@ create database bar;
save_master_pos; save_master_pos;
connection slave; connection slave;
sync_with_master; sync_with_master;
create database foo;
drop table if exists foo.foo; drop table if exists foo.foo;
create table foo.foo (n int); create table foo.foo (n int);
insert into foo.foo values(4); insert into foo.foo values(4);
@ -24,13 +25,14 @@ connection slave;
sync_with_master; sync_with_master;
select foo.foo.n,bar.bar.m from foo.foo,bar.bar; select foo.foo.n,bar.bar.m from foo.foo,bar.bar;
connection master; connection master;
drop database if exists bar; drop database bar;
drop database if exists foo; drop database if exists foo;
save_master_pos; save_master_pos;
connection slave; connection slave;
sync_with_master; sync_with_master;
drop database if exists bar; --error 1008
drop database if exists foo; drop database bar;
drop database foo;
# Now let's test load data from master # Now let's test load data from master

View File

@ -1,5 +1,5 @@
connect (master,localhost,root,,test,0,master.sock); connect (master,localhost,root,,test,$MASTER_MYPORT,master.sock);
connect (slave,localhost,root,,test,0, slave.sock); connect (slave,localhost,root,,test,$SLAVE_MYPORT,slave.sock);
connection master; connection master;
reset master; reset master;
show master status; show master status;

View File

@ -1,5 +1,5 @@
connect (master,localhost,root,,test,0,master.sock); connect (master,localhost,root,,test,$MASTER_MYPORT,master.sock);
connect (slave,localhost,root,,test,0,slave.sock); connect (slave,localhost,root,,test,$SLAVE_MYPORT,slave.sock);
connection master; connection master;
reset master; reset master;
grant replication slave on *.* to replicate@localhost identified by 'aaaaaaaaaaaaaaab'; grant replication slave on *.* to replicate@localhost identified by 'aaaaaaaaaaaaaaab';

View File

@ -0,0 +1,39 @@
#see if queries that use both
#auto_increment and LAST_INSERT_ID()
#are replicated well
source include/master-slave.inc;
connection master;
drop table if exists t1;
create table t1(a int auto_increment, key(a));
create table t2(b int auto_increment, c int, key(b));
insert into t1 values (1),(2),(3);
insert into t1 values (null);
insert into t2 values (null,last_insert_id());
save_master_pos;
connection slave;
sync_with_master;
select * from t1;
select * from t2;
connection master;
#check if multi-line inserts,
#which set last_insert_id to the first id inserted,
#are replicated the same way
drop table t1;
drop table t2;
create table t1(a int auto_increment, key(a));
create table t2(b int auto_increment, c int, key(b));
insert into t1 values (10);
insert into t1 values (null),(null),(null);
insert into t2 values (5,0);
insert into t2 values (null,last_insert_id());
save_master_pos;
connection slave;
sync_with_master;
select * from t1;
select * from t2;
connection master;
drop table t1;
drop table t2;
save_master_pos;
connection slave;
sync_with_master;

View File

@ -0,0 +1,9 @@
# See if master_pos_wait(,,timeout)
# Terminates with "timeout expired" (-1)
source include/master-slave.inc;
save_master_pos;
connection slave;
sync_with_master;
# Ask for a master log that has certainly not been reached yet
# timeout= 10 seconds
select master_pos_wait('master-bin.999999',0,10);

View File

@ -9,9 +9,9 @@
# changes # changes
# - Test creating a duplicate key error and recover from it # - Test creating a duplicate key error and recover from it
# #
connect (master,localhost,root,,test,0,master.sock); connect (master,localhost,root,,test,$MASTER_MYPORT,master.sock);
drop table if exists t1, t2, t3, t4; drop table if exists t1, t2, t3, t4;
connect (slave,localhost,root,,test,0,slave.sock); connect (slave,localhost,root,,test,$SLAVE_MYPORT,slave.sock);
system cat /dev/null > var/slave-data/master.info; system cat /dev/null > var/slave-data/master.info;
system chmod 000 var/slave-data/master.info; system chmod 000 var/slave-data/master.info;
connection slave; connection slave;

View File

@ -49,9 +49,10 @@ libmysys_a_SOURCES = my_init.c my_getwd.c mf_getdate.c\
my_quick.c my_lockmem.c my_static.c \ my_quick.c my_lockmem.c my_static.c \
my_getopt.c my_mkdir.c \ my_getopt.c my_mkdir.c \
default.c my_compress.c checksum.c raid.cc \ default.c my_compress.c checksum.c raid.cc \
my_net.c my_semaphore.c my_port.c \ my_net.c my_semaphore.c my_port.c my_sleep.c \
my_vsnprintf.c charset.c my_bitmap.c my_bit.c md5.c \ my_vsnprintf.c charset.c my_bitmap.c my_bit.c md5.c \
my_gethostbyname.c rijndael.c my_aes.c sha1.c my_gethostbyname.c rijndael.c my_aes.c sha1.c \
my_netware.c
EXTRA_DIST = thr_alarm.c thr_lock.c my_pthread.c my_thr_init.c \ EXTRA_DIST = thr_alarm.c thr_lock.c my_pthread.c my_thr_init.c \
thr_mutex.c thr_rwlock.c thr_mutex.c thr_rwlock.c
libmysys_a_LIBADD = @THREAD_LOBJECTS@ libmysys_a_LIBADD = @THREAD_LOBJECTS@
@ -77,32 +78,32 @@ FLAGS=$(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) @NOINST_LDFLAGS@
# which automaticly removes the object files you use to compile a final program # which automaticly removes the object files you use to compile a final program
# #
test_thr_alarm: thr_alarm.c $(LIBRARIES) test_thr_alarm$(EXEEXT): thr_alarm.c $(LIBRARIES)
$(CP) $(srcdir)/thr_alarm.c ./test_thr_alarm.c $(CP) $(srcdir)/thr_alarm.c ./test_thr_alarm.c
$(LINK) $(FLAGS) -DMAIN ./test_thr_alarm.c $(LDADD) $(LIBS) $(LINK) $(FLAGS) -DMAIN ./test_thr_alarm.c $(LDADD) $(LIBS)
$(RM) -f ./test_thr_alarm.* $(RM) -f ./test_thr_alarm.c
test_thr_lock: thr_lock.c $(LIBRARIES) test_thr_lock$(EXEEXT): thr_lock.c $(LIBRARIES)
$(CP) $(srcdir)/thr_lock.c test_thr_lock.c $(CP) $(srcdir)/thr_lock.c test_thr_lock.c
$(LINK) $(FLAGS) -DMAIN ./test_thr_lock.c $(LDADD) $(LIBS) $(LINK) $(FLAGS) -DMAIN ./test_thr_lock.c $(LDADD) $(LIBS)
$(RM) -f ./test_thr_lock.* $(RM) -f ./test_thr_lock.c
test_vsnprintf: my_vsnprintf.c $(LIBRARIES) test_vsnprintf$(EXEEXT): my_vsnprintf.c $(LIBRARIES)
$(CP) $(srcdir)/my_vsnprintf.c test_vsnprintf.c $(CP) $(srcdir)/my_vsnprintf.c test_vsnprintf.c
$(LINK) $(FLAGS) -DMAIN ./test_vsnprintf.c $(LDADD) $(LIBS) $(LINK) $(FLAGS) -DMAIN ./test_vsnprintf.c $(LDADD) $(LIBS)
$(RM) -f test_vsnprintf.* $(RM) -f test_vsnprintf.c
test_io_cache: mf_iocache.c $(LIBRARIES) test_io_cache$(EXEEXT): mf_iocache.c $(LIBRARIES)
$(CP) $(srcdir)/mf_iocache.c test_io_cache.c $(CP) $(srcdir)/mf_iocache.c test_io_cache.c
$(LINK) $(FLAGS) -DMAIN ./test_io_cache.c $(LDADD) $(LIBS) $(LINK) $(FLAGS) -DMAIN ./test_io_cache.c $(LDADD) $(LIBS)
$(RM) -f test_io_cache.* $(RM) -f test_io_cache.c
test_dir: test_dir.c $(LIBRARIES) test_dir$(EXEEXT): test_dir.c $(LIBRARIES)
$(LINK) $(FLAGS) -DMAIN $(srcdir)/test_dir.c $(LDADD) $(LIBS) $(LINK) $(FLAGS) -DMAIN $(srcdir)/test_dir.c $(LDADD) $(LIBS)
test_charset$(EXEEXT): test_charset.c $(LIBRARIES) test_charset$(EXEEXT): test_charset.c $(LIBRARIES)
$(LINK) $(FLAGS) -DMAIN $(srcdir)/test_charset.c $(LDADD) $(LIBS) $(LINK) $(FLAGS) -DMAIN $(srcdir)/test_charset.c $(LDADD) $(LIBS)
testhash: testhash.c $(LIBRARIES) testhash$(EXEEXT): testhash.c $(LIBRARIES)
$(LINK) $(FLAGS) -DMAIN $(srcdir)/testhash.c $(LDADD) $(LIBS) $(LINK) $(FLAGS) -DMAIN $(srcdir)/testhash.c $(LDADD) $(LIBS)
# Don't update the files from bitkeeper # Don't update the files from bitkeeper

View File

@ -164,7 +164,11 @@ static my_bool read_charset_index(CS_ID ***charsets, myf myflags)
} }
#ifdef __NETWARE__
my_bool STDCALL init_available_charsets(myf myflags)
#else
static my_bool init_available_charsets(myf myflags) static my_bool init_available_charsets(myf myflags)
#endif
{ {
my_bool error=0; my_bool error=0;
/* /*

View File

@ -46,6 +46,8 @@ char *defaults_extra_file=0;
const char *default_directories[]= { const char *default_directories[]= {
#ifdef __WIN__ #ifdef __WIN__
"C:/", "C:/",
#elif defined(__NETWARE__)
"sys:/etc/",
#else #else
"/etc/", "/etc/",
#endif #endif
@ -53,7 +55,7 @@ const char *default_directories[]= {
DATADIR, DATADIR,
#endif #endif
"", /* Place for defaults_extra_dir */ "", /* Place for defaults_extra_dir */
#ifndef __WIN__ #if !defined(__WIN__) && !defined(__NETWARE__)
"~/", "~/",
#endif #endif
NullS, NullS,

View File

@ -24,7 +24,7 @@
#endif #endif
#ifdef HAVE_TEMPNAM #ifdef HAVE_TEMPNAM
#if !defined( MSDOS) && !defined(OS2) #if !defined(MSDOS) && !defined(OS2) && !defined(__NETWARE__)
extern char **environ; extern char **environ;
#endif #endif
#endif #endif
@ -129,7 +129,7 @@ File create_temp_file(char *to, const char *dir, const char *prefix,
if (buffer[strlen(buffer)-1] == '\\') if (buffer[strlen(buffer)-1] == '\\')
buffer[strlen(buffer)-1] = '\0'; buffer[strlen(buffer)-1] = '\0';
putenv( buffer); putenv( buffer);
#else #elif !defined(__NETWARE__)
old_env= (char**) environ; old_env= (char**) environ;
if (dir) if (dir)
{ /* Don't use TMPDIR if dir is given */ { /* Don't use TMPDIR if dir is given */
@ -151,7 +151,7 @@ File create_temp_file(char *to, const char *dir, const char *prefix,
{ {
DBUG_PRINT("error",("Got error: %d from tempnam",errno)); DBUG_PRINT("error",("Got error: %d from tempnam",errno));
} }
#ifndef OS2 #if !defined(OS2) && !defined(__NETWARE__)
environ=(const char**) old_env; environ=(const char**) old_env;
#endif #endif
} }

View File

@ -17,14 +17,14 @@
#define USES_TYPES #define USES_TYPES
#include "my_global.h" #include "my_global.h"
#if !defined(_MSC_VER) && !defined(__BORLANDC__) && !defined(OS2) #if !defined(_MSC_VER) && !defined(__BORLANDC__) && !defined(OS2) && !defined(__NETWARE__)
#include "mysys_priv.h" #include "mysys_priv.h"
#include <sys/times.h> #include <sys/times.h>
#endif #endif
long my_clock(void) long my_clock(void)
{ {
#if !defined(MSDOS) && !defined(__WIN__) && !defined(OS2) #if !defined(MSDOS) && !defined(__WIN__) && !defined(OS2) && !defined(__NETWARE__)
struct tms tmsbuf; struct tms tmsbuf;
VOID(times(&tmsbuf)); VOID(times(&tmsbuf));
return (tmsbuf.tms_utime + tmsbuf.tms_stime); return (tmsbuf.tms_utime + tmsbuf.tms_stime);

View File

@ -80,7 +80,7 @@ int my_copy(const char *from, const char *to, myf MyFlags)
if (MyFlags & MY_HOLD_ORIGINAL_MODES && new_file_stat) if (MyFlags & MY_HOLD_ORIGINAL_MODES && new_file_stat)
DBUG_RETURN(0); /* File copyed but not stat */ DBUG_RETURN(0); /* File copyed but not stat */
VOID(chmod(to, stat_buff.st_mode & 07777)); /* Copy modes */ VOID(chmod(to, stat_buff.st_mode & 07777)); /* Copy modes */
#if !defined(MSDOS) && !defined(__WIN__) && !defined(__EMX__) && !defined(OS2) #if !defined(MSDOS) && !defined(__WIN__) && !defined(__EMX__) && !defined(OS2) && !defined(__NETWARE__)
VOID(chown(to, stat_buff.st_uid,stat_buff.st_gid)); /* Copy ownership */ VOID(chown(to, stat_buff.st_uid,stat_buff.st_gid)); /* Copy ownership */
#endif #endif
#if !defined(VMS) && !defined(__ZTC__) #if !defined(VMS) && !defined(__ZTC__)

View File

@ -32,7 +32,7 @@
#endif #endif
#ifdef __EMX__ #ifdef __EMX__
// chdir2 support also drive change /* chdir2 support also drive change */
#define chdir _chdir2 #define chdir _chdir2
#endif #endif

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2000 MySQL AB /* Copyright (C) 2000-2003 MySQL AB
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@ -41,6 +41,12 @@ static my_bool win32_init_tcp_ip();
#else #else
#define my_win_init() #define my_win_init()
#endif #endif
#ifdef __NETWARE__
static void netware_init();
#else
#define netware_init()
#endif
my_bool my_init_done=0; my_bool my_init_done=0;
@ -64,12 +70,16 @@ void my_init(void)
if (my_init_done) if (my_init_done)
return; return;
my_init_done=1; my_init_done=1;
#if defined(THREAD) && defined(SAFE_MUTEX)
safe_mutex_global_init(); /* Must be called early */
#endif
netware_init();
#ifdef THREAD #ifdef THREAD
#if defined(HAVE_PTHREAD_INIT) #if defined(HAVE_PTHREAD_INIT)
pthread_init(); /* Must be called before DBUG_ENTER */ pthread_init(); /* Must be called before DBUG_ENTER */
#endif #endif
my_thread_global_init(); my_thread_global_init();
#if !defined( __WIN__) && !defined(OS2) #if !defined( __WIN__) && !defined(OS2) && !defined(__NETWARE__)
sigfillset(&my_signals); /* signals blocked by mf_brkhant */ sigfillset(&my_signals); /* signals blocked by mf_brkhant */
#endif #endif
#endif /* THREAD */ #endif /* THREAD */
@ -143,7 +153,7 @@ Voluntary context switches %ld, Involuntary context switches %ld\n",
rus.ru_msgsnd, rus.ru_msgrcv, rus.ru_nsignals, rus.ru_msgsnd, rus.ru_msgrcv, rus.ru_nsignals,
rus.ru_nvcsw, rus.ru_nivcsw); rus.ru_nvcsw, rus.ru_nivcsw);
#endif #endif
#if defined(MSDOS) && !defined(__WIN__) #if ( defined(MSDOS) || defined(__NETWARE__) ) && !defined(__WIN__)
fprintf(info_file,"\nRun time: %.1f\n",(double) clock()/CLOCKS_PER_SEC); fprintf(info_file,"\nRun time: %.1f\n",(double) clock()/CLOCKS_PER_SEC);
#endif #endif
#if defined(SAFEMALLOC) #if defined(SAFEMALLOC)
@ -160,21 +170,27 @@ Voluntary context switches %ld, Involuntary context switches %ld\n",
#endif #endif
} }
#ifdef THREAD #ifdef THREAD
pthread_mutex_destroy(&THR_LOCK_keycache);
pthread_mutex_destroy(&THR_LOCK_malloc);
pthread_mutex_destroy(&THR_LOCK_open);
DBUG_POP(); /* Must be done before my_thread_end */ DBUG_POP(); /* Must be done before my_thread_end */
my_once_free(); my_once_free();
my_thread_end(); my_thread_end();
my_thread_global_end(); my_thread_global_end();
#endif #if defined(SAFE_MUTEX)
/*
Check on destroying of mutexes. A few may be left that will get cleaned
up by C++ destructors
*/
safe_mutex_end(infoflag & MY_GIVE_INFO ? stderr : (FILE *) 0);
#endif /* defined(SAFE_MUTEX) */
#endif /* THREAD */
#ifdef __WIN__ #ifdef __WIN__
if (have_tcpip); if (have_tcpip)
WSACleanup( ); WSACleanup();
#endif /* __WIN__ */ #endif /* __WIN__ */
my_init_done=0; my_init_done=0;
} /* my_end */ } /* my_end */
#ifdef __WIN__ #ifdef __WIN__
/* /*
@ -263,10 +279,10 @@ static void my_win_init(void)
/*------------------------------------------------------------------ /*------------------------------------------------------------------
** Name: CheckForTcpip| Desc: checks if tcpip has been installed on system Name: CheckForTcpip| Desc: checks if tcpip has been installed on system
** According to Microsoft Developers documentation the first registry According to Microsoft Developers documentation the first registry
** entry should be enough to check if TCP/IP is installed, but as expected entry should be enough to check if TCP/IP is installed, but as expected
** this doesn't work on all Win32 machines :( this doesn't work on all Win32 machines :(
------------------------------------------------------------------*/ ------------------------------------------------------------------*/
#define TCPIPKEY "SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters" #define TCPIPKEY "SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters"
@ -292,6 +308,7 @@ static my_bool win32_have_tcpip(void)
return (TRUE); return (TRUE);
} }
static my_bool win32_init_tcp_ip() static my_bool win32_init_tcp_ip()
{ {
if (win32_have_tcpip()) if (win32_have_tcpip())
@ -323,4 +340,64 @@ static my_bool win32_init_tcp_ip()
} }
return(0); return(0);
} }
#endif #endif /* __WIN__ */
#ifdef __NETWARE__
/****************************************************************************
Do basic initialisation for netware needed by most programs
****************************************************************************/
static void netware_init()
{
char cwd[PATH_MAX], *name
/* init only if we are not a client library */
if (my_progname)
{
#if SUPPORTED_BY_LIBC /* Removed until supported in Libc */
struct termios tp;
/* Disable control characters */
tcgetattr(STDIN_FILENO, &tp);
tp.c_cc[VINTR] = _POSIX_VDISABLE;
tp.c_cc[VEOF] = _POSIX_VDISABLE;
tp.c_cc[VSUSP] = _POSIX_VDISABLE;
tcsetattr(STDIN_FILENO, TCSANOW, &tp);
#endif /* SUPPORTED_BY_LIBC */
/* With stdout redirection */
if (!isatty(STDOUT_FILENO))
{
setscreenmode(SCR_AUTOCLOSE_ON_EXIT); /* auto close the screen */
}
else
{
setscreenmode(SCR_NO_MODE); /* keep the screen up */
}
/* Parse program name and change to base format */
name= my_progname;
for (; *name; name++)
{
if (*name == '\\')
{
*name = '/';
}
else
{
*name = tolower(*name);
}
}
/*
Set the current working directory to the base directory of the file
name (assuming the binary is in 'base-file-name/bin/'
*/
strmov(cwd, my_progname);
if ((name= strindex(cwd, "/bin/")) != NULL)
{
*name= 0;
chdir(cwd);
}
}
}
#endif /* __NETWARE__ */

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2000 MySQL AB /* Copyright (C) 2000-2003 MySQL AB
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@ -30,6 +30,9 @@
#define INCL_BASE #define INCL_BASE
#define INCL_NOPMAPI #define INCL_NOPMAPI
#include <os2emx.h> #include <os2emx.h>
#endif
#ifdef __NETWARE__
#include <nks/fsio.h>
#endif #endif
/* Lock a part of a file */ /* Lock a part of a file */
@ -40,6 +43,9 @@ int my_lock(File fd, int locktype, my_off_t start, my_off_t length,
#ifdef HAVE_FCNTL #ifdef HAVE_FCNTL
int value; int value;
ALARM_VARIABLES; ALARM_VARIABLES;
#endif
#ifdef __NETWARE__
int nxErrno;
#endif #endif
DBUG_ENTER("my_lock"); DBUG_ENTER("my_lock");
DBUG_PRINT("my",("Fd: %d Op: %d start: %ld Length: %ld MyFlags: %d", DBUG_PRINT("my",("Fd: %d Op: %d start: %ld Length: %ld MyFlags: %d",
@ -50,7 +56,47 @@ int my_lock(File fd, int locktype, my_off_t start, my_off_t length,
if (my_disable_locking) if (my_disable_locking)
DBUG_RETURN(0); DBUG_RETURN(0);
#if defined(__EMX__) || defined(OS2) #if defined(__NETWARE__)
{
NXSOffset_t nxLength = length;
unsigned long nxLockFlags = 0;
if (length == F_TO_EOF)
{
/* EOF is interpreted as a very large length. */
nxLength = 0x7FFFFFFFFFFFFFFF;
}
if (locktype == F_UNLCK)
{
/* The lock flags are currently ignored by NKS. */
if (!(nxErrno= NXFileRangeUnlock(fd, 0L, start, nxLength)))
DBUG_RETURN(0);
}
else
{
if (locktype == F_RDLCK)
{
/* A read lock is mapped to a shared lock. */
nxLockFlags = NX_RANGE_LOCK_SHARED;
}
else
{
/* A write lock is mapped to an exclusive lock. */
nxLockFlags = NX_RANGE_LOCK_EXCL;
}
if (MyFlags & MY_DONT_WAIT)
{
/* Don't block on the lock. */
nxLockFlags |= NX_RANGE_LOCK_TRYLOCK;
}
if (!(nxErrno= NXFileRangeLock(fd, nxLockFlags, start, nxLength)))
DBUG_RETURN(0);
}
}
#elif defined(__EMX__) || defined(OS2)
if (!_lock64( fd, locktype, start, length, MyFlags)) if (!_lock64( fd, locktype, start, length, MyFlags))
DBUG_RETURN(0); DBUG_RETURN(0);
@ -103,8 +149,12 @@ int my_lock(File fd, int locktype, my_off_t start, my_off_t length,
#endif /* HAVE_FCNTL */ #endif /* HAVE_FCNTL */
#endif /* HAVE_LOCKING */ #endif /* HAVE_LOCKING */
#ifdef __NETWARE__
my_errno = nxErrno;
#else
/* We got an error. We don't want EACCES errors */ /* We got an error. We don't want EACCES errors */
my_errno=(errno == EACCES) ? EAGAIN : errno ? errno : -1; my_errno=(errno == EACCES) ? EAGAIN : errno ? errno : -1;
#endif
if (MyFlags & MY_WME) if (MyFlags & MY_WME)
{ {
if (locktype == F_UNLCK) if (locktype == F_UNLCK)

View File

@ -23,7 +23,11 @@ int my_message_no_curses(uint error __attribute__((unused)),
DBUG_PRINT("enter",("message: %s",str)); DBUG_PRINT("enter",("message: %s",str));
(void) fflush(stdout); (void) fflush(stdout);
if (MyFlags & ME_BELL) if (MyFlags & ME_BELL)
#ifdef __NETWARE__
ringbell(); /* Bell */
#else
(void) fputc('\007',stderr); /* Bell */ (void) fputc('\007',stderr); /* Bell */
#endif /* __NETWARE__ */
if (my_progname) if (my_progname)
{ {
(void)fputs(my_progname,stderr); (void)fputs(": ",stderr); (void)fputs(my_progname,stderr); (void)fputs(": ",stderr);

150
mysys/my_netware.c Normal file
View File

@ -0,0 +1,150 @@
/* Copyright (C) 2003 MySQL AB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
/*
Function specific to netware
*/
#include <mysys_priv.h>
#ifdef __NETWARE__
#include <library.h>
/*
PMUserLicenseRequest is an API exported by the polimgr.nlm
(loaded by the NetWare OS when it comes up) for use by other
NLM-based NetWare products/services.
PMUserLicenseRequest provides a couple of functions:
1) it will optionally request a User license or ensure that
one already exists for the specified User in userInfo
2) it utilizes the NetWare usage metering service to
record usage information about your product/service.
*/
long PMMeteredUsageRequest
(
/*
NDS distinguished name or IP address or ??. asciiz string, e.g.
".CN=Admin.O=this.T=MYTREE."
*/
char *userInfo,
long infoType, /* see defined values */
/*
string used to identify the calling service, used to index the
metered info e.g. "iPrint"
*/
char *serviceID,
char tranAddrType, /* type of address that follows */
char *tranAddr, /* ptr to a 10-byte array */
long flags, /* see defined values */
/* NLS error code, if any. NULL input is okay */
long *licRequestErrCode,
/* meter service error code, if any. NULL input is okay */
long *storeMeterInfoErrCode,
/*
error code from NLSMeter if
storeMeterInfoErrCode == PM_LICREQ_NLSMETERERROR.
NULL input is okay
*/
long *NLSMeterErrCode
);
ypedef long(*PMUR)(char*, long, char*, char, char*, long, long*, long*,
long*);
/* infoType */
/* indicates that the info in the userInfo param is an NDS user */
#define PM_USERINFO_TYPE_NDS 1
/* indicates that the info in the userInfo param is NOT an NDS user */
#define PM_USERINFO_TYPE_ADDRESS 2
/* Flags */
/*
Tells the service that it should not check to see if the NDS user
contained in the userInfo param has a NetWare User License - just
record metering information; this is ignored if infoType !=
PM_USERINFO_TYPE_NDS
*/
#define PM_FLAGS_METER_ONLY 0x0000001
/*
Indicates that the values in the userInfo and serviceID parameters
are unicode strings, so that the metering service bypasses
converting these to unicode (again)
*/
#define PM_LICREQ_ALREADY_UNICODE 0x0000002
/*
Useful only if infoType is PM_USERINFO_TYPE_NDS - indicates a "no
stop" policy of the calling service
*/
#define PM_LICREQ_ALWAYS_METER 0x0000004
/*
net Address Types - system-defined types of net addresses that can
be used in the tranAddrType field
*/
#define NLS_TRAN_TYPE_IPX 0x00000001 /* An IPX address */
#define NLS_TRAN_TYPE_IP 0x00000008 /* An IP address */
#define NLS_ADDR_TYPE_MAC 0x000000F1 /* a MAC address */
/*
Net Address Sizes - lengths that correspond to the tranAddrType
field (just fyi)
*/
#define NLS_IPX_ADDR_SIZE 10 /* the size of an IPX address */
#define NLS_IP_ADDR_SIZE 4 /* the size of an IP address */
#define NLS_MAC_ADDR_SIZE 6 /* the size of a MAC address */
void netware_reg_user(const char *ip, const char *user,
const char *application)
{
PMUR usage_request;
long licRequestErrCode = 0;
long storeMeterInfoErrCode = 0;
long nlsMeterErrCode = 0;
/* import the symbol */
usage_request= ((PMUR)ImportPublicObject(getnlmhandle(),
"PMMeteredUsageRequest"));
if (usage_request != NULL)
{
unsigned long iaddr;
char addr[NLS_IPX_ADDR_SIZE];
/* create address */
iaddr = htonl(inet_addr(ip));
bzero(addr, NLS_IPX_ADDR_SIZE);
memcpy(addr, &iaddr, NLS_IP_ADDR_SIZE);
/* call to NLS */
usage_request(user,
PM_USERINFO_TYPE_ADDRESS,
application,
NLS_TRAN_TYPE_IP,
addr,
PM_FLAGS_METER_ONLY,
&licRequestErrCode,
&storeMeterInfoErrCode,
&nlsMeterErrCode);
/* release symbol */
UnImportPublicObject(getnlmhandle(), "PMMeteredUsageRequest");
}
}
#endif /* __NETWARE__ */

View File

@ -26,7 +26,6 @@
#include "mysys_priv.h" #include "mysys_priv.h"
#if defined(THREAD) && defined(OS2) #if defined(THREAD) && defined(OS2)
#include <m_string.h> #include <m_string.h>
//#undef getpid
#include <process.h> #include <process.h>
#include <sys/timeb.h> #include <sys/timeb.h>

View File

@ -1,4 +1,4 @@
/* Copyright (C) Yuri Dario & 2000 MySQL AB /* Copyright (C) Yuri Dario & 2000-2003 MySQL AB
All the above parties has a full, independent copyright to All the above parties has a full, independent copyright to
the following code, including the right to use the code in the following code, including the right to use the code in
any manner without any demands from the other parties. any manner without any demands from the other parties.
@ -18,77 +18,79 @@
Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA */ MA 02111-1307, USA */
/* Win32 directory search emulation */ /* Win32 directory search emulation */
#if defined(OS2) #if defined(OS2)
//#define _DEBUG
long _findfirst( char* path, struct _finddata_t* dos_file) long _findfirst( char* path, struct _finddata_t* dos_file)
{ {
HDIR hdir = HDIR_CREATE; HDIR hdir = HDIR_CREATE;
APIRET rc; APIRET rc;
FILEFINDBUF3 buf3; FILEFINDBUF3 buf3;
ULONG entries = 1; ULONG entries = 1;
#ifdef _DEBUG #ifdef _DEBUG
printf( "_findfirst path %s\n", path); printf( "_findfirst path %s\n", path);
#endif #endif
memset( &buf3, 0, sizeof( buf3)); memset( &buf3, 0, sizeof( buf3));
rc = DosFindFirst( rc = DosFindFirst(
path, /* Address of the ASCIIZ path name of the file or subdirectory to be found. */ path, /* The ASCIIZ path name of the file or subdirectory to be found. */
&hdir, /* Address of the handle associated with this DosFindFirst request. */ &hdir, /* The handle associated with this DosFindFirst request. */
FILE_NORMAL | FILE_DIRECTORY, /* Attribute value that determines the file objects to be searched for. */ FILE_NORMAL | FILE_DIRECTORY, /* Attribute value that determines the file objects to be searched for. */
&buf3, /* Result buffer. */ &buf3, /* Result buffer. */
sizeof( buf3), /* The length, in bytes, of pfindbuf. */ sizeof( buf3), /* The length, in bytes, of pfindbuf. */
&entries, /* Pointer to the number of entries: */ &entries, /* Pointer to the number of entries: */
FIL_STANDARD); /* The level of file information required. */ FIL_STANDARD); /* The level of file information required. */
#ifdef _DEBUG #ifdef _DEBUG
printf( "_findfirst rc=%d hdir=%d entries=%d->%s\n", rc, hdir, entries, buf3.achName); printf( "_findfirst rc=%d hdir=%d entries=%d->%s\n", rc, hdir, entries,
buf3.achName);
#endif #endif
if (rc /* && entries == 0 */) if (rc /* && entries == 0 */)
return -1; return -1;
if (dos_file) { if (dos_file)
memset( dos_file, 0, sizeof( struct _finddata_t)); {
strcpy( dos_file->name, buf3.achName); memset( dos_file, 0, sizeof( struct _finddata_t));
dos_file->size = buf3.cbFile; strcpy( dos_file->name, buf3.achName);
dos_file->attrib = buf3.attrFile; dos_file->size = buf3.cbFile;
} dos_file->attrib = buf3.attrFile;
return (ULONG) hdir; }
return (ULONG) hdir;
} }
long _findnext( long hdir, struct _finddata_t* dos_file) long _findnext( long hdir, struct _finddata_t* dos_file)
{ {
APIRET rc; APIRET rc;
FILEFINDBUF3 buf3; FILEFINDBUF3 buf3;
ULONG entries = 1; ULONG entries = 1;
memset( &buf3, 0, sizeof( buf3)); memset( &buf3, 0, sizeof( buf3));
rc = DosFindNext( rc = DosFindNext(hdir,
hdir, &buf3, /* Result buffer. */
&buf3, /* Result buffer. */ sizeof( buf3), /* Length, in bytes, of pfindbuf. */
sizeof( buf3), /* The length, in bytes, of pfindbuf. */ &entries); /* Pointer to the number of entries */
&entries); /* Pointer to the number of entries: */
#ifdef _DEBUG #ifdef _DEBUG
printf( "_findnext rc=%d hdir=%d entries=%d->%s\n", rc, hdir, entries, buf3.achName); printf( "_findnext rc=%d hdir=%d entries=%d->%s\n", rc, hdir, entries,
buf3.achName);
#endif #endif
if (rc /* && entries == 0 */) if (rc /* && entries == 0 */)
return -1; return -1;
if (dos_file) { if (dos_file)
memset( dos_file, 0, sizeof( struct _finddata_t)); {
strcpy( dos_file->name, buf3.achName); memset( dos_file, 0, sizeof( struct _finddata_t));
dos_file->size = buf3.cbFile; strcpy( dos_file->name, buf3.achName);
dos_file->attrib = buf3.attrFile; dos_file->size = buf3.cbFile;
} dos_file->attrib = buf3.attrFile;
return 0; }
return 0;
} }
void _findclose( long hdir) void _findclose( long hdir)
@ -101,82 +103,82 @@ void _findclose( long hdir)
#endif #endif
} }
DIR* opendir( char* path) DIR* opendir(char* path)
{ {
DIR* dir = (DIR*) calloc( 1, sizeof( DIR)); DIR* dir = (DIR*) calloc(1, sizeof( DIR));
char buffer[260]; char buffer[260];
APIRET rc; APIRET rc;
ULONG entries = 1; ULONG entries = 1;
strcpy( buffer, path); strmov(strmov(buffer, path), "*.*");
strcat( buffer, "*.*");
#ifdef _DEBUG #ifdef _DEBUG
printf( "_findfirst path %s\n", buffer); printf( "_findfirst path %s\n", buffer);
#endif #endif
dir->hdir = HDIR_CREATE; dir->hdir = HDIR_CREATE;
memset( &dir->buf3, 0, sizeof( dir->buf3)); memset( &dir->buf3, 0, sizeof( dir->buf3));
rc = DosFindFirst( rc = DosFindFirst(
buffer, /* Address of the ASCIIZ path name of the file or subdirectory to be found. */ buffer, /* Address of the ASCIIZ path name of the file or subdirectory to be found. */
&dir->hdir, /* Address of the handle associated with this DosFindFirst request. */ &dir->hdir, /* Address of the handle associated with this DosFindFirst request. */
FILE_NORMAL | FILE_DIRECTORY, /* Attribute value that determines the file objects to be searched for. */ FILE_NORMAL | FILE_DIRECTORY, /* Attribute value that determines the file objects to be searched for. */
&dir->buf3, /* Result buffer. */ &dir->buf3, /* Result buffer. */
sizeof( dir->buf3), /* The length, in bytes, of pfindbuf. */ sizeof( dir->buf3), /* The length, in bytes, of pfindbuf. */
&entries, /* Pointer to the number of entries: */ &entries, /* Pointer to the number of entries: */
FIL_STANDARD); /* The level of file information required. */ FIL_STANDARD); /* The level of file information required. */
#ifdef _DEBUG #ifdef _DEBUG
printf( "opendir rc=%d hdir=%d entries=%d->%s\n", rc, dir->hdir, entries, dir->buf3.achName); printf( "opendir rc=%d hdir=%d entries=%d->%s\n", rc, dir->hdir, entries, dir->buf3.achName);
#endif #endif
if (rc /* && entries == 0 */) if (rc /* && entries == 0 */)
return NULL; return NULL;
return dir; return dir;
} }
struct dirent* readdir( DIR* dir) struct dirent* readdir( DIR* dir)
{ {
APIRET rc; APIRET rc;
//FILEFINDBUF3 buf3; ULONG entries = 1;
ULONG entries = 1;
if (!dir->buf3.achName[0]) // file not found on previous query if (!dir->buf3.achName[0]) /* file not found on previous query */
return NULL; return NULL;
// copy last file name /* copy last file name */
strcpy( dir->ent.d_name, dir->buf3.achName); strcpy( dir->ent.d_name, dir->buf3.achName);
// query next file /* query next file */
memset( &dir->buf3, 0, sizeof( dir->buf3)); memset( &dir->buf3, 0, sizeof( dir->buf3));
rc = DosFindNext( rc= DosFindNext(
dir->hdir, dir->hdir,
&dir->buf3, /* Result buffer. */ &dir->buf3, /* Result buffer. */
sizeof( dir->buf3), /* The length, in bytes, of pfindbuf. */ sizeof(dir->buf3), /* Length, in bytes, of pfindbuf. */
&entries); /* Pointer to the number of entries: */ &entries); /* Pointer to the number of entries */
#ifdef _DEBUG #ifdef _DEBUG
printf( "_findnext rc=%d hdir=%d entries=%d->%s\n", rc, dir->hdir, entries, dir->buf3.achName); printf( "_findnext rc=%d hdir=%d entries=%d->%s\n", rc, dir->hdir, entries,
dir->buf3.achName);
#endif #endif
if (rc /* && entries == 0 */) if (rc /* && entries == 0 */)
strcpy( dir->buf3.achName, ""); // reset name for next query *dir->buf3.achName= 0; /* reset name for next query */
return &dir->ent; return &dir->ent;
} }
int closedir (DIR *dir) int closedir (DIR *dir)
{ {
APIRET rc; APIRET rc;
rc = DosFindClose( dir->hdir); rc = DosFindClose( dir->hdir);
#ifdef _DEBUG #ifdef _DEBUG
printf( "_findclose rc=%d hdir=%d\n", rc, dir->hdir); printf( "_findclose rc=%d hdir=%d\n", rc, dir->hdir);
#endif #endif
free(dir); free(dir);
return 0; return 0;
} }
#endif /* OS2 */
#endif // OS2

View File

@ -29,26 +29,35 @@ extern "C" {
struct _finddata_t struct _finddata_t
{ {
unsigned attrib; unsigned attrib;
//unsigned long time_create; /* -1 for FAT file systems */ #ifdef NOT_USED
//unsigned long time_access; /* -1 for FAT file systems */ unsigned long time_create; /* -1 for FAT file systems */
//unsigned long time_write; unsigned long time_access; /* -1 for FAT file systems */
unsigned long size; unsigned long time_write;
char name[260]; #endif
//uint16 wr_date; unsigned long size;
//uint16 wr_time; char name[260];
#ifdef NOT_USED
uint16 wr_date;
uint16 wr_time;
#endif
}; };
struct dirent struct dirent
{ {
//unsigned attrib; #ifdef NOT_USED
//unsigned long time_create; /* -1 for FAT file systems */ unsigned attrib;
//unsigned long time_access; /* -1 for FAT file systems */ unsigned long time_create; /* -1 for FAT file systems */
//unsigned long time_write; unsigned long time_access; /* -1 for FAT file systems */
//unsigned long size; unsigned long time_write;
char d_name[260]; unsigned long size;
//uint16 wr_date; #endif
//uint16 wr_time; char d_name[260];
#ifdef NOT_USED
uint16 wr_date;
uint16 wr_time;
#endif
}; };
struct DIR struct DIR
@ -62,16 +71,18 @@ DIR *opendir ( char *);
struct dirent *readdir (DIR *); struct dirent *readdir (DIR *);
int closedir (DIR *); int closedir (DIR *);
//#define _A_NORMAL FILE_NORMAL #ifdef NOT_USED
//#define _A_SUBDIR FILE_DIRECTORY #define _A_NORMAL FILE_NORMAL
//#define _A_RDONLY FILE_READONLY #define _A_SUBDIR FILE_DIRECTORY
#define _A_RDONLY FILE_READONLY
//long _findfirst( char*, struct _finddata_t*); long _findfirst( char*, struct _finddata_t*);
//long _findnext( long, struct _finddata_t*); long _findnext( long, struct _finddata_t*);
//void _findclose( long); void _findclose( long);
#endif
#ifdef __cplusplus_00 #ifdef __cplusplus_00
} }
#endif #endif
#endif // __MY_OS2DIRSRCH2_H__ #endif /* __MY_OS2DIRSRCH2_H__ */

View File

@ -24,10 +24,11 @@ int _lock64( int fd, int locktype, my_off_t start,
my_off_t length, myf MyFlags); my_off_t length, myf MyFlags);
int _sopen64( const char *name, int oflag, int shflag, int mask); int _sopen64( const char *name, int oflag, int shflag, int mask);
// /*
// this class is used to define a global c++ variable, that This class is used to define a global c++ variable, that
// is initialized before main() gets called. is initialized before main() gets called.
// */
class File64bit class File64bit
{ {
public: public:
@ -150,7 +151,7 @@ static unsigned char const errno_tab[] =
_DosSetFilePtrL = NULL; _DosSetFilePtrL = NULL;
return; return;
} }
// notify success /* notify success */
#ifdef MYSQL_SERVER #ifdef MYSQL_SERVER
printf( "WSeB 64bit file API loaded.\n"); printf( "WSeB 64bit file API loaded.\n");
#endif #endif
@ -164,230 +165,230 @@ void _OS2errno( APIRET rc)
errno = errno_tab[rc]; errno = errno_tab[rc];
} }
longlong _lseek64( int fd, longlong offset, int seektype)
longlong _lseek64( int fd, longlong offset, int seektype)
{ {
APIRET rc; APIRET rc;
longlong actual; longlong actual;
if (_DosSetFilePtrL) if (_DosSetFilePtrL)
rc = _DosSetFilePtrL( fd, offset, seektype, &actual); rc = _DosSetFilePtrL( fd, offset, seektype, &actual);
else { else
ULONG ulActual; {
rc = DosSetFilePtr( fd, (long) offset, seektype, &ulActual); ULONG ulActual;
actual = ulActual; rc = DosSetFilePtr( fd, (long) offset, seektype, &ulActual);
} actual = ulActual;
}
if (!rc) if (!rc)
return( actual);/* NO_ERROR */ return( actual); /* NO_ERROR */
// set errno _OS2errno( rc); /* set errno */
_OS2errno( rc); return(-1); /* seek failed */
// seek failed
return(-1);
} }
inline _SetFileLocksL(HFILE hFile,
PFILELOCKL pflUnlock, inline APIRET _SetFileLocksL(HFILE hFile,
PFILELOCKL pflLock, PFILELOCKL pflUnlock,
ULONG timeout, PFILELOCKL pflLock,
ULONG flags) ULONG timeout,
ULONG flags)
{ {
if (_DosSetFileLocksL) { if (_DosSetFileLocksL)
APIRET rc; {
rc = _DosSetFileLocksL( hFile, pflUnlock, pflLock, timeout, flags); APIRET rc;
rc = _DosSetFileLocksL( hFile, pflUnlock, pflLock, timeout, flags);
// on FAT/HPFS/LAN a INVALID_PARAMETER is returned, seems that /*
// only JFS can handle >2GB ranges. on FAT/HPFS/LAN a INVALID_PARAMETER is returned, seems that
if (rc != 87) only JFS can handle >2GB ranges.
return rc; */
if (rc != 87)
return rc;
/* got INVALID_PARAMETER, fallback to standard call */
}
// got INVALID_PARAMETER, fallback to standard call FILELOCK flUnlock = { pflUnlock->lOffset, pflUnlock->lRange };
} FILELOCK flLock = { pflLock->lOffset, pflLock->lRange };
return DosSetFileLocks( hFile, &flUnlock, &flLock, timeout, flags);
FILELOCK flUnlock = { pflUnlock->lOffset, pflUnlock->lRange };
FILELOCK flLock = { pflLock->lOffset, pflLock->lRange };
return DosSetFileLocks( hFile, &flUnlock, &flLock, timeout, flags);
} }
int _lock64( int fd, int locktype, my_off_t start,
my_off_t length, myf MyFlags) int _lock64( int fd, int locktype, my_off_t start,
my_off_t length, myf MyFlags)
{ {
FILELOCKL LockArea = {0,0}, UnlockArea = {0,0}; FILELOCKL LockArea = {0,0}, UnlockArea = {0,0};
ULONG readonly = 0; ULONG readonly = 0;
APIRET rc = -1; APIRET rc = -1;
switch( locktype) { switch (locktype) {
case F_UNLCK: case F_UNLCK:
UnlockArea.lOffset = start; UnlockArea.lOffset = start;
UnlockArea.lRange = length ? length : LONGLONG_MAX; UnlockArea.lRange = length ? length : LONGLONG_MAX;
break; break;
case F_RDLCK: case F_RDLCK:
case F_WRLCK: case F_WRLCK:
LockArea.lOffset = start; LockArea.lOffset = start;
LockArea.lRange = length ? length : LONGLONG_MAX; LockArea.lRange = length ? length : LONGLONG_MAX;
readonly = (locktype == F_RDLCK ? 1 : 0); readonly = (locktype == F_RDLCK ? 1 : 0);
break; break;
default: default:
errno = EINVAL; errno = EINVAL;
rc = -1; rc = -1;
break; break;
} }
if (MyFlags & MY_DONT_WAIT) { if (MyFlags & MY_DONT_WAIT)
{
rc = _SetFileLocksL( fd, &UnlockArea, &LockArea, 0, readonly);
/* printf("fd %d, locktype %d, rc %d (dont_wait)\n", fd, locktype, rc); */
if (rc == 33) { /* Lock Violation */
rc = _SetFileLocksL( fd, &UnlockArea, &LockArea, 0, readonly); DBUG_PRINT("info",("Was locked, trying with timeout"));
//printf( "fd %d, locktype %d, rc %d (dont_wait)\n", fd, locktype, rc); rc = _SetFileLocksL( fd, &UnlockArea, &LockArea, 1 * 1000, readonly);
if (rc == 33) { /* Lock Violation */ /* printf( "fd %d, locktype %d, rc %d (dont_wait with timeout)\n", fd, locktype, rc); */
}
DBUG_PRINT("info",("Was locked, trying with timeout")); }
rc = _SetFileLocksL( fd, &UnlockArea, &LockArea, 1 * 1000, readonly); else
//printf( "fd %d, locktype %d, rc %d (dont_wait with timeout)\n", fd, locktype, rc); {
} while (rc = _SetFileLocksL( fd, &UnlockArea, &LockArea, 0, readonly) &&
(rc == 33))
} else { {
printf(".");
while( rc = _SetFileLocksL( fd, &UnlockArea, &LockArea, 0, readonly) && (rc == 33)) { DosSleep(1 * 1000);
printf("."); }
DosSleep(1 * 1000); /* printf( "fd %d, locktype %d, rc %d (wait2)\n", fd, locktype, rc); */
} }
//printf( "fd %d, locktype %d, rc %d (wait2)\n", fd, locktype, rc); if (!rc)
} return(0); /* NO_ERROR */
_OS2errno( rc); /* set errno */
if (!rc) return(-1); /* lock failed */
return( 0);/* NO_ERROR */
// set errno
_OS2errno( rc);
// lock failed
return(-1);
} }
int sopen( const char *name, int oflag, int shflag, int mask)
int sopen(const char *name, int oflag, int shflag, int mask)
{ {
int fail_errno; int fail_errno;
APIRET rc = 0; APIRET rc = 0;
HFILE hf = 0; HFILE hf = 0;
ULONG ulAction = 0; ULONG ulAction = 0;
LONGLONG cbFile = 0; LONGLONG cbFile = 0;
ULONG ulAttribute = FILE_NORMAL; ULONG ulAttribute = FILE_NORMAL;
ULONG fsOpenFlags = 0; ULONG fsOpenFlags = 0;
ULONG fsOpenMode = 0; ULONG fsOpenMode = 0;
/* Extract the access mode and sharing mode bits. */ /* Extract the access mode and sharing mode bits. */
fsOpenMode = (shflag & 0xFF) | (oflag & 0x03); fsOpenMode = (shflag & 0xFF) | (oflag & 0x03);
/* Translate ERROR_OPEN_FAILED to ENOENT unless O_EXCL is set (see /*
below). */ Translate ERROR_OPEN_FAILED to ENOENT unless O_EXCL is set (see
fail_errno = ENOENT; below).
*/
fail_errno = ENOENT;
/* Compute `open_flag' depending on `flags'. Note that _SO_CREAT is /*
set for O_CREAT. */ Compute `open_flag' depending on `flags'. Note that _SO_CREAT is
set for O_CREAT.
*/
if (oflag & O_CREAT) if (oflag & O_CREAT)
{ {
if (oflag & O_EXCL) if (oflag & O_EXCL)
{ {
fsOpenFlags = OPEN_ACTION_FAIL_IF_EXISTS | OPEN_ACTION_CREATE_IF_NEW; fsOpenFlags = OPEN_ACTION_FAIL_IF_EXISTS | OPEN_ACTION_CREATE_IF_NEW;
fail_errno = EEXIST; fail_errno = EEXIST;
} }
else if (oflag & O_TRUNC) else if (oflag & O_TRUNC)
fsOpenFlags = OPEN_ACTION_REPLACE_IF_EXISTS | OPEN_ACTION_CREATE_IF_NEW; fsOpenFlags = OPEN_ACTION_REPLACE_IF_EXISTS | OPEN_ACTION_CREATE_IF_NEW;
else else
fsOpenFlags = OPEN_ACTION_OPEN_IF_EXISTS | OPEN_ACTION_CREATE_IF_NEW; fsOpenFlags = OPEN_ACTION_OPEN_IF_EXISTS | OPEN_ACTION_CREATE_IF_NEW;
if (mask & S_IWRITE) if (mask & S_IWRITE)
ulAttribute = FILE_NORMAL; ulAttribute = FILE_NORMAL;
else else
ulAttribute = FILE_READONLY; ulAttribute = FILE_READONLY;
} }
else if (oflag & O_TRUNC) else if (oflag & O_TRUNC)
fsOpenFlags = OPEN_ACTION_REPLACE_IF_EXISTS | OPEN_ACTION_FAIL_IF_NEW; fsOpenFlags = OPEN_ACTION_REPLACE_IF_EXISTS | OPEN_ACTION_FAIL_IF_NEW;
else else
fsOpenFlags = OPEN_ACTION_OPEN_IF_EXISTS | OPEN_ACTION_FAIL_IF_NEW; fsOpenFlags = OPEN_ACTION_OPEN_IF_EXISTS | OPEN_ACTION_FAIL_IF_NEW;
/* Try to open the file and handle errors. */ /* Try to open the file and handle errors. */
if (_DosOpenL) if (_DosOpenL)
rc = _DosOpenL( name, &hf, &ulAction, cbFile, rc = _DosOpenL( name, &hf, &ulAction, cbFile,
ulAttribute, fsOpenFlags, fsOpenMode, NULL); ulAttribute, fsOpenFlags, fsOpenMode, NULL);
else else
rc = DosOpen( name, &hf, &ulAction, (LONG) cbFile, rc = DosOpen( name, &hf, &ulAction, (LONG) cbFile,
ulAttribute, fsOpenFlags, fsOpenMode, NULL); ulAttribute, fsOpenFlags, fsOpenMode, NULL);
if (rc == ERROR_OPEN_FAILED) if (rc == ERROR_OPEN_FAILED)
{ {
errno = fail_errno; errno = fail_errno;
return -1; return -1;
} }
if (rc != 0) if (rc != 0)
{ {
// set errno _OS2errno( rc); /* set errno */
_OS2errno( rc); return -1;
return -1; }
} if (oflag & O_APPEND)
_lseek64( hf, 0L, SEEK_END);
if (oflag & O_APPEND) return hf;
_lseek64( hf, 0L, SEEK_END);
return hf;
} }
int read( int fd, void *buffer, unsigned int count)
int read(int fd, void *buffer, unsigned int count)
{ {
APIRET rc; APIRET rc;
ULONG actual; ULONG actual;
rc = DosRead( fd, (PVOID) buffer, count, &actual); rc= DosRead( fd, (PVOID) buffer, count, &actual);
if (!rc) if (!rc)
return( actual);/* NO_ERROR */ return( actual); /* NO_ERROR */
_OS2errno( rc); /* set errno */
// set errno return(-1); /* read failed */
_OS2errno( rc);
// write failed
return(-1);
} }
int write( int fd, const void *buffer, unsigned int count)
int write(int fd, const void *buffer, unsigned int count)
{ {
APIRET rc; APIRET rc;
ULONG actual; ULONG actual;
rc = DosWrite( fd, (PVOID) buffer, count, &actual); rc = DosWrite( fd, (PVOID) buffer, count, &actual);
if (!rc) if (!rc)
return( actual);/* NO_ERROR */ return( actual); /* NO_ERROR */
_OS2errno( rc); /* set errno */
// set errno return(-1); /* write failed */
_OS2errno( rc);
// write failed
return(-1);
} }
int close( int fd)
int close( int fd)
{ {
APIRET rc; APIRET rc;
ULONG actual; ULONG actual;
rc = DosClose( fd); rc = DosClose( fd);
if (!rc) if (!rc)
return( 0);/* NO_ERROR */ return( 0); /* NO_ERROR */
_OS2errno( rc); /* set errno */
// set errno return(-1); /* close failed */
_OS2errno( rc);
// write failed
return(-1);
} }
inline int open( const char *name, int oflag)
int open( const char *name, int oflag)
{ {
return sopen( name, oflag, OPEN_SHARE_DENYNONE, S_IREAD | S_IWRITE); return sopen( name, oflag, OPEN_SHARE_DENYNONE, S_IREAD | S_IWRITE);
} }
inline int open( const char *name, int oflag, int mask)
int open( const char *name, int oflag, int mask)
{ {
return sopen( name, oflag, OPEN_SHARE_DENYNONE, mask); return sopen( name, oflag, OPEN_SHARE_DENYNONE, mask);
} }

View File

@ -36,63 +36,48 @@
#include <stdlib.h> #include <stdlib.h>
#include <errno.h> #include <errno.h>
#ifdef _THREAD_SAFE #ifdef _THREAD_SAFE
//#include <pthread.h>
//#include "pthread_private.h"
int int
pthread_mutex_init(pthread_mutex_t * mutex, pthread_mutex_init(pthread_mutex_t * mutex,
const pthread_mutexattr_t * mutex_attr) const pthread_mutexattr_t * mutex_attr)
{ {
APIRET rc = 0; (void) DosCreateMutexSem(NULL,mutex,0,0);
return (0); /* Return the completion status: */
rc = DosCreateMutexSem(NULL,mutex,0,0);
/* Return the completion status: */
return (0);
} }
int int
pthread_mutex_destroy(pthread_mutex_t * mutex) pthread_mutex_destroy(pthread_mutex_t * mutex)
{ {
APIRET rc = 0; APIRET rc;
do
{
rc = DosCloseMutexSem(*mutex);
if (rc == 301) DosReleaseMutexSem(*mutex);
} while (rc == 301);
do { *mutex = 0;
rc = DosCloseMutexSem(*mutex); return (0); /* Return the completion status: */
if (rc == 301) DosReleaseMutexSem(*mutex);
} while (rc == 301);
*mutex = 0;
/* Return the completion status: */
return (0);
} }
int int
pthread_mutex_lock(pthread_mutex_t * mutex) pthread_mutex_lock(pthread_mutex_t * mutex)
{ {
int ret = 0; APIRET rc;
int status = 0;
APIRET rc = 0;
rc = DosRequestMutexSem(*mutex,SEM_INDEFINITE_WAIT); rc = DosRequestMutexSem(*mutex,SEM_INDEFINITE_WAIT);
if (rc) if (rc)
return(EINVAL); return(EINVAL);
/* Return the completion status: */ return (0); /* Return the completion status: */
return (0);
} }
int int
pthread_mutex_unlock(pthread_mutex_t * mutex) pthread_mutex_unlock(pthread_mutex_t * mutex)
{ {
int ret = 0; (void) DosReleaseMutexSem(*mutex);
APIRET rc = 0; return (0); /* Return the completion status: */
int status;
rc = DosReleaseMutexSem(*mutex);
/* Return the completion status: */
return (0);
} }
#endif #endif

View File

@ -61,10 +61,9 @@ static pthread_handler_decl(pthread_start,param)
win_pthread_self=((struct pthread_map *) param)->pthreadself; win_pthread_self=((struct pthread_map *) param)->pthreadself;
pthread_mutex_unlock(&THR_LOCK_thread); pthread_mutex_unlock(&THR_LOCK_thread);
free((char*) param); /* Free param from create */ free((char*) param); /* Free param from create */
//pthread_exit((void*) (*func)(func_param)); /* pthread_exit((void*) (*func)(func_param)); */
(*func)(func_param); (*func)(func_param);
DBUG_RETURN(0); DBUG_RETURN(0);
//return 0; /* Safety */
} }

View File

@ -30,115 +30,122 @@ PULONG tls_storage; /* TLS local storage */
DWORD tls_bits[2]; /* TLS in-use bits */ DWORD tls_bits[2]; /* TLS in-use bits */
pthread_mutex_t tls_mutex; /* TLS mutex for in-use bits */ pthread_mutex_t tls_mutex; /* TLS mutex for in-use bits */
DWORD TlsAlloc( void) DWORD TlsAlloc( void)
{ {
DWORD index = -1; DWORD index = -1;
DWORD mask, tibidx; DWORD mask, tibidx;
int i; int i;
if (tls_storage == NULL) { if (tls_storage == NULL)
{
APIRET rc; APIRET rc;
// allocate memory for TLS storage /* allocate memory for TLS storage */
rc = DosAllocThreadLocalMemory( 1, &tls_storage); rc = DosAllocThreadLocalMemory( 1, &tls_storage);
if (rc) { if (rc)
fprintf( stderr, "DosAllocThreadLocalMemory error: return code = %u\n", rc); fprintf( stderr, "DosAllocThreadLocalMemory error: return code = %u\n",
} rc);
/* create a mutex */
if (pthread_mutex_init( &tls_mutex, NULL))
fprintf( stderr, "Failed to init TLS mutex\n");
}
// create a mutex pthread_mutex_lock( &tls_mutex);
if (pthread_mutex_init( &tls_mutex, NULL))
fprintf( stderr, "Failed to init TLS mutex\n");
}
pthread_mutex_lock( &tls_mutex); tibidx = 0;
if (tls_bits[0] == 0xFFFFFFFF)
tibidx = 0; {
if (tls_bits[0] == 0xFFFFFFFF) { if (tls_bits[1] == 0xFFFFFFFF)
if (tls_bits[1] == 0xFFFFFFFF) { {
fprintf( stderr, "tid#%d, no more TLS bits available\n", _threadid); fprintf( stderr, "tid#%d, no more TLS bits available\n", _threadid);
pthread_mutex_unlock( &tls_mutex);
return -1;
}
tibidx = 1;
}
for( i=0; i<32; i++) {
mask = (1 << i);
if ((tls_bits[ tibidx] & mask) == 0) {
tls_bits[ tibidx] |= mask;
index = (tibidx*32) + i;
break;
}
}
tls_storage[index] = 0;
pthread_mutex_unlock( &tls_mutex);
//fprintf( stderr, "tid#%d, TlsAlloc index %d\n", _threadid, index);
return index;
}
BOOL TlsFree( DWORD index)
{
int tlsidx;
DWORD mask;
if (index >= TLS_MINIMUM_AVAILABLE)
return NULL;
pthread_mutex_lock( &tls_mutex);
tlsidx = 0;
if (index > 32) {
tlsidx++;
}
mask = (1 << index);
if (tls_bits[ tlsidx] & mask) {
tls_bits[tlsidx] &= ~mask;
tls_storage[index] = 0;
pthread_mutex_unlock( &tls_mutex); pthread_mutex_unlock( &tls_mutex);
return TRUE; return -1;
} }
tibidx = 1;
}
pthread_mutex_unlock( &tls_mutex); for (i=0; i<32; i++)
return FALSE; {
mask = (1 << i);
if ((tls_bits[ tibidx] & mask) == 0)
{
tls_bits[ tibidx] |= mask;
index = (tibidx*32) + i;
break;
}
}
tls_storage[index] = 0;
pthread_mutex_unlock( &tls_mutex);
/* fprintf( stderr, "tid#%d, TlsAlloc index %d\n", _threadid, index); */
return index;
} }
BOOL TlsFree( DWORD index)
PVOID TlsGetValue( DWORD index)
{ {
if (index >= TLS_MINIMUM_AVAILABLE) int tlsidx;
return NULL; DWORD mask;
// verify if memory has been allocated for this thread if (index >= TLS_MINIMUM_AVAILABLE)
if (*tls_storage == NULL) { return NULL;
// allocate memory for indexes
*tls_storage = (ULONG)calloc( TLS_MINIMUM_AVAILABLE, sizeof(int));
//fprintf( stderr, "tid#%d, tls_storage %x\n", _threadid, *tls_storage);
}
ULONG* tls_array = (ULONG*) *tls_storage; pthread_mutex_lock( &tls_mutex);
return (PVOID) tls_array[ index];
tlsidx = 0;
if (index > 32)
tlsidx++;
mask = (1 << index);
if (tls_bits[ tlsidx] & mask)
{
tls_bits[tlsidx] &= ~mask;
tls_storage[index] = 0;
pthread_mutex_unlock( &tls_mutex);
return TRUE;
}
pthread_mutex_unlock( &tls_mutex);
return FALSE;
} }
BOOL TlsSetValue( DWORD index, PVOID val)
PVOID TlsGetValue( DWORD index)
{
if (index >= TLS_MINIMUM_AVAILABLE)
return NULL;
/* verify if memory has been allocated for this thread */
if (*tls_storage == NULL)
{
/* allocate memory for indexes */
*tls_storage = (ULONG)calloc( TLS_MINIMUM_AVAILABLE, sizeof(int));
/* fprintf(stderr, "tid#%d, tls_storage %x\n", _threadid, *tls_storage); */
}
ULONG* tls_array = (ULONG*) *tls_storage;
return (PVOID) tls_array[index];
}
BOOL TlsSetValue( DWORD index, PVOID val)
{ {
// verify if memory has been allocated for this thread /* verify if memory has been allocated for this thread */
if (*tls_storage == NULL) { if (*tls_storage == NULL)
// allocate memory for indexes {
*tls_storage = (ULONG)calloc( TLS_MINIMUM_AVAILABLE, sizeof(int)); /* allocate memory for indexes */
//fprintf( stderr, "tid#%d, tls_storage %x\n", _threadid, *tls_storage); *tls_storage = (ULONG)calloc( TLS_MINIMUM_AVAILABLE, sizeof(int));
} /* fprintf(stderr, "tid#%d, tls_storage %x\n", _threadid, *tls_storage); */
}
if (index >= TLS_MINIMUM_AVAILABLE) if (index >= TLS_MINIMUM_AVAILABLE)
return FALSE; return FALSE;
ULONG* tls_array = (ULONG*) *tls_storage; ULONG* tls_array = (ULONG*) *tls_storage;
//fprintf( stderr, "tid#%d, TlsSetValue array %08x index %d -> %08x (old)\n", _threadid, tls_array, index, tls_array[ index]); /* fprintf( stderr, "tid#%d, TlsSetValue array %08x index %d -> %08x (old)\n", _threadid, tls_array, index, tls_array[ index]); */
tls_array[ index] = (ULONG) val; tls_array[ index] = (ULONG) val;
//fprintf( stderr, "tid#%d, TlsSetValue array %08x index %d -> %08x\n", _threadid, tls_array, index, val); /* fprintf( stderr, "tid#%d, TlsSetValue array %08x index %d -> %08x\n", _threadid, tls_array, index, val); */
return TRUE;
return TRUE;
} }

View File

@ -425,6 +425,19 @@ int my_pthread_cond_init(pthread_cond_t *mp, const pthread_condattr_t *attr)
#endif #endif
#ifdef __NETWARE__
/* NetWare does not re-acquire the lock if the condition fails */
int my_pthread_cond_timedwait(pthread_cond_t *cond, pthread_mutex_t *mutex,
struct timespec *abstime)
{
int err= pthread_cond_timedwait(cond, mutex, abstime);
if (err)
pthread_mutex_lock(mutex);
return err;
}
#endif /* __NETWARE__ */
/***************************************************************************** /*****************************************************************************
Patches for HPUX Patches for HPUX
We need these because the pthread_mutex.. code returns -1 on error, We need these because the pthread_mutex.. code returns -1 on error,

View File

@ -90,7 +90,7 @@ int my_copystat(const char *from, const char *to, int MyFlags)
return 1; return 1;
VOID(chmod(to, statbuf.st_mode & 07777)); /* Copy modes */ VOID(chmod(to, statbuf.st_mode & 07777)); /* Copy modes */
#if !defined(MSDOS) && !defined(__WIN__) && !defined(__EMX__) && !defined(OS2) #if !defined(MSDOS) && !defined(__WIN__) && !defined(__EMX__) && !defined(OS2) && !defined(__NETWARE__)
if (statbuf.st_nlink > 1 && MyFlags & MY_LINK_WARNING) if (statbuf.st_nlink > 1 && MyFlags & MY_LINK_WARNING)
{ {
if (MyFlags & MY_LINK_WARNING) if (MyFlags & MY_LINK_WARNING)

View File

@ -14,22 +14,25 @@
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
/* Wait a given time (On systems that dont have sleep !!; MSDOS) */ /* Wait a given number of microseconds */
#include "mysys_priv.h" #include "mysys_priv.h"
#include <m_string.h> #include <m_string.h>
#ifdef _MSC_VER void my_sleep(ulong m_seconds)
void sleep(sec)
int sec;
{ {
ulong start; #ifdef __NETWARE__
DBUG_ENTER("sleep"); delay(m_seconds/1000+1);
#elif defined(OS2)
start=(ulong) time((time_t*) 0); DosSleep(m_seconds/1000+1);
#elif defined(HAVE_SELECT)
struct timeval t;
t.tv_sec= m_seconds / 1000000L;
t.tv_usec= m_seconds % 1000000L;
select(0,0,0,0,&t); /* sleep */
#else
uint sec= (uint) (m_seconds / 1000000L);
ulong start= (ulong) time((time_t*) 0);
while ((ulong) time((time_t*) 0) < start+sec); while ((ulong) time((time_t*) 0) < start+sec);
DBUG_VOID_RETURN; #endif
} /* sleep */ }
#endif /* MSDOS */

View File

@ -38,7 +38,7 @@
#endif #endif
#ifdef HAVE_TEMPNAM #ifdef HAVE_TEMPNAM
#if !defined( MSDOS) && !defined(OS2) #if !defined( MSDOS) && !defined(OS2) && !defined(__NETWARE__)
extern char **environ; extern char **environ;
#endif #endif
#endif #endif
@ -104,14 +104,14 @@ my_string my_tempnam(const char *dir, const char *pfx,
dir=temp; dir=temp;
} }
#ifdef OS2 #ifdef OS2
// changing environ variable doesn't work with VACPP /* changing environ variable doesn't work with VACPP */
char buffer[256]; char buffer[256];
sprintf( buffer, "TMP=%s", dir); sprintf( buffer, "TMP=%s", dir);
// remove ending backslash /* remove ending backslash */
if (buffer[strlen(buffer)-1] == '\\') if (buffer[strlen(buffer)-1] == '\\')
buffer[strlen(buffer)-1] = '\0'; buffer[strlen(buffer)-1] = '\0';
putenv( buffer); putenv( buffer);
#else #elif !defined(__NETWARE__)
old_env=(char**)environ; old_env=(char**)environ;
if (dir) if (dir)
{ /* Don't use TMPDIR if dir is given */ { /* Don't use TMPDIR if dir is given */
@ -120,7 +120,7 @@ my_string my_tempnam(const char *dir, const char *pfx,
} }
#endif #endif
res=tempnam((char*) dir,(my_string) pfx); /* Use stand. dir with prefix */ res=tempnam((char*) dir,(my_string) pfx); /* Use stand. dir with prefix */
#ifndef OS2 #if !defined(OS2) && !defined(__NETWARE__)
((char**) environ)=(char**) old_env; ((char**) environ)=(char**) old_env;
#endif #endif
if (!res) if (!res)

View File

@ -93,6 +93,18 @@ void my_thread_global_end(void)
#endif #endif
#ifdef PPTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP #ifdef PPTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP
pthread_mutexattr_destroy(&my_errchk_mutexattr); pthread_mutexattr_destroy(&my_errchk_mutexattr);
#endif
pthread_mutex_destroy(&THR_LOCK_malloc);
pthread_mutex_destroy(&THR_LOCK_open);
pthread_mutex_destroy(&THR_LOCK_keycache);
pthread_mutex_destroy(&THR_LOCK_lock);
pthread_mutex_destroy(&THR_LOCK_isam);
pthread_mutex_destroy(&THR_LOCK_myisam);
pthread_mutex_destroy(&THR_LOCK_heap);
pthread_mutex_destroy(&THR_LOCK_net);
pthread_mutex_destroy(&THR_LOCK_charset);
#ifndef HAVE_LOCALTIME_R
pthread_mutex_destroy(&LOCK_localtime_r);
#endif #endif
#ifndef HAVE_GETHOSTBYNAME_R #ifndef HAVE_GETHOSTBYNAME_R
pthread_mutex_destroy(&LOCK_gethostbyname_r); pthread_mutex_destroy(&LOCK_gethostbyname_r);

View File

@ -23,9 +23,9 @@
#ifdef THREAD #ifdef THREAD
#include <my_pthread.h> #include <my_pthread.h>
extern pthread_mutex_t THR_LOCK_malloc,THR_LOCK_open,THR_LOCK_keycache, extern pthread_mutex_t THR_LOCK_malloc, THR_LOCK_open, THR_LOCK_keycache;
THR_LOCK_lock,THR_LOCK_isam,THR_LOCK_net,THR_LOCK_charset; extern pthread_mutex_t THR_LOCK_lock, THR_LOCK_isam, THR_LOCK_net;
extern pthread_mutex_t LOCK_bitmap; extern pthread_mutex_t THR_LOCK_charset;
#else #else
#include <my_no_pthread.h> #include <my_no_pthread.h>
#endif #endif

View File

@ -239,8 +239,8 @@ gptr _myrealloc (register gptr pPtr, register uint uSize,
if (*((long*) ((char*) &pRec -> lSpecialValue+sf_malloc_prehunc)) if (*((long*) ((char*) &pRec -> lSpecialValue+sf_malloc_prehunc))
!= MAGICKEY) != MAGICKEY)
{ {
fprintf (stderr, "Reallocating unallocated data at line %d, '%s'\n", fprintf(stderr, "Error: Reallocating unallocated data at line %d, '%s'\n",
uLine, sFile); uLine, sFile);
DBUG_PRINT("safe",("Reallocating unallocated data at line %d, '%s'", DBUG_PRINT("safe",("Reallocating unallocated data at line %d, '%s'",
uLine, sFile)); uLine, sFile));
(void) fflush(stderr); (void) fflush(stderr);
@ -295,8 +295,8 @@ void _myfree (gptr pPtr, const char *sFile, uint uLine, myf myflags)
if (*((long*) ((char*) &pRec -> lSpecialValue+sf_malloc_prehunc)) if (*((long*) ((char*) &pRec -> lSpecialValue+sf_malloc_prehunc))
!= MAGICKEY) != MAGICKEY)
{ {
fprintf (stderr, "Freeing unallocated data at line %d, '%s'\n", fprintf(stderr, "Error: Freeing unallocated data at line %d, '%s'\n",
uLine, sFile); uLine, sFile);
DBUG_PRINT("safe",("Unallocated data at line %d, '%s'",uLine,sFile)); DBUG_PRINT("safe",("Unallocated data at line %d, '%s'",uLine,sFile));
(void) fflush(stderr); (void) fflush(stderr);
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
@ -336,8 +336,8 @@ static int check_ptr(const char *where, byte *ptr, const char *sFile,
{ {
if (!ptr) if (!ptr)
{ {
fprintf (stderr, "%s NULL pointer at line %d, '%s'\n", fprintf(stderr, "Error: %s NULL pointer at line %d, '%s'\n",
where,uLine, sFile); where,uLine, sFile);
DBUG_PRINT("safe",("Null pointer at line %d '%s'", uLine, sFile)); DBUG_PRINT("safe",("Null pointer at line %d '%s'", uLine, sFile));
(void) fflush(stderr); (void) fflush(stderr);
return 1; return 1;
@ -345,8 +345,8 @@ static int check_ptr(const char *where, byte *ptr, const char *sFile,
#ifndef _MSC_VER #ifndef _MSC_VER
if ((long) ptr & (ALIGN_SIZE(1)-1)) if ((long) ptr & (ALIGN_SIZE(1)-1))
{ {
fprintf (stderr, "%s wrong aligned pointer at line %d, '%s'\n", fprintf(stderr, "Error: %s wrong aligned pointer at line %d, '%s'\n",
where,uLine, sFile); where,uLine, sFile);
DBUG_PRINT("safe",("Wrong aligned pointer at line %d, '%s'", DBUG_PRINT("safe",("Wrong aligned pointer at line %d, '%s'",
uLine,sFile)); uLine,sFile));
(void) fflush(stderr); (void) fflush(stderr);
@ -355,8 +355,8 @@ static int check_ptr(const char *where, byte *ptr, const char *sFile,
#endif #endif
if (ptr < sf_min_adress || ptr > sf_max_adress) if (ptr < sf_min_adress || ptr > sf_max_adress)
{ {
fprintf (stderr, "%s pointer out of range at line %d, '%s'\n", fprintf(stderr, "Error: %s pointer out of range at line %d, '%s'\n",
where,uLine, sFile); where,uLine, sFile);
DBUG_PRINT("safe",("Pointer out of range at line %d '%s'", DBUG_PRINT("safe",("Pointer out of range at line %d '%s'",
uLine,sFile)); uLine,sFile));
(void) fflush(stderr); (void) fflush(stderr);
@ -388,7 +388,7 @@ void TERMINATE (FILE *file)
{ {
if (file) if (file)
{ {
fprintf (file, "cNewCount: %d\n", cNewCount); fprintf(file, "Warning: Not freed memory segments: %d\n", cNewCount);
(void) fflush(file); (void) fflush(file);
} }
DBUG_PRINT("safe",("cNewCount: %d",cNewCount)); DBUG_PRINT("safe",("cNewCount: %d",cNewCount));
@ -403,7 +403,7 @@ void TERMINATE (FILE *file)
{ {
if (file) if (file)
{ {
fprintf(file, "Memory that was not free'ed (%ld bytes):\n",lCurMemory); fprintf(file, "Warning: Memory that was not free'ed (%ld bytes):\n",lCurMemory);
(void) fflush(file); (void) fflush(file);
} }
DBUG_PRINT("safe",("Memory that was not free'ed (%ld bytes):",lCurMemory)); DBUG_PRINT("safe",("Memory that was not free'ed (%ld bytes):",lCurMemory));
@ -411,11 +411,11 @@ void TERMINATE (FILE *file)
{ {
if (file) if (file)
{ {
fprintf (file, fprintf(file,
"\t%6u bytes at 0x%09lx, allocated at line %4u in '%s'", "\t%6u bytes at 0x%09lx, allocated at line %4u in '%s'",
pPtr -> uDataSize, pPtr -> uDataSize,
(ulong) &(pPtr -> aData[sf_malloc_prehunc]), (ulong) &(pPtr -> aData[sf_malloc_prehunc]),
pPtr -> uLineNum, pPtr -> sFileName); pPtr -> uLineNum, pPtr -> sFileName);
fprintf(file, "\n"); fprintf(file, "\n");
(void) fflush(file); (void) fflush(file);
} }
@ -429,8 +429,8 @@ void TERMINATE (FILE *file)
/* Report the memory usage statistics */ /* Report the memory usage statistics */
if (file) if (file)
{ {
fprintf (file, "Maximum memory usage: %ld bytes (%ldk)\n", fprintf(file, "Maximum memory usage: %ld bytes (%ldk)\n",
lMaxMemory, (lMaxMemory + 1023L) / 1024L); lMaxMemory, (lMaxMemory + 1023L) / 1024L);
(void) fflush(file); (void) fflush(file);
} }
DBUG_PRINT("safe",("Maximum memory usage: %ld bytes (%ldk)", DBUG_PRINT("safe",("Maximum memory usage: %ld bytes (%ldk)",
@ -453,9 +453,9 @@ static int _checkchunk (register struct remember *pRec, const char *sFile,
if (*((long*) ((char*) &pRec -> lSpecialValue+sf_malloc_prehunc)) if (*((long*) ((char*) &pRec -> lSpecialValue+sf_malloc_prehunc))
!= MAGICKEY) != MAGICKEY)
{ {
fprintf (stderr, "Memory allocated at %s:%d was underrun,", fprintf(stderr, "Error: Memory allocated at %s:%d was underrun,",
pRec -> sFileName, pRec -> uLineNum); pRec -> sFileName, pRec -> uLineNum);
fprintf (stderr, " discovered at %s:%d\n", sFile, uLine); fprintf(stderr, " discovered at %s:%d\n", sFile, uLine);
(void) fflush(stderr); (void) fflush(stderr);
DBUG_PRINT("safe",("Underrun at %lx, allocated at %s:%d", DBUG_PRINT("safe",("Underrun at %lx, allocated at %s:%d",
&(pRec -> aData[sf_malloc_prehunc]), &(pRec -> aData[sf_malloc_prehunc]),
@ -472,9 +472,9 @@ static int _checkchunk (register struct remember *pRec, const char *sFile,
*magicp++ != MAGICEND2 || *magicp++ != MAGICEND2 ||
*magicp++ != MAGICEND3) *magicp++ != MAGICEND3)
{ {
fprintf (stderr, "Memory allocated at %s:%d was overrun,", fprintf(stderr, "Error: Memory allocated at %s:%d was overrun,",
pRec -> sFileName, pRec -> uLineNum); pRec -> sFileName, pRec -> uLineNum);
fprintf (stderr, " discovered at '%s:%d'\n", sFile, uLine); fprintf(stderr, " discovered at '%s:%d'\n", sFile, uLine);
(void) fflush(stderr); (void) fflush(stderr);
DBUG_PRINT("safe",("Overrun at %lx, allocated at %s:%d", DBUG_PRINT("safe",("Overrun at %lx, allocated at %s:%d",
&(pRec -> aData[sf_malloc_prehunc]), &(pRec -> aData[sf_malloc_prehunc]),
@ -505,9 +505,9 @@ int _sanity (const char *sFile, uint uLine)
pthread_mutex_unlock(&THR_LOCK_malloc); pthread_mutex_unlock(&THR_LOCK_malloc);
if (count || pTmp) if (count || pTmp)
{ {
const char *format="Safemalloc link list destroyed, discovered at '%s:%d'"; const char *format="Error: Safemalloc link list destroyed, discovered at '%s:%d'";
fprintf (stderr, format, sFile, uLine); fputc('\n',stderr); fprintf(stderr, format, sFile, uLine); fputc('\n',stderr);
fprintf (stderr, "root=%p,count=%d,pTmp=%p\n", pRememberRoot,count,pTmp); fprintf(stderr, "root=%p,count=%d,pTmp=%p\n", pRememberRoot,count,pTmp);
(void) fflush(stderr); (void) fflush(stderr);
DBUG_PRINT("safe",(format, sFile, uLine)); DBUG_PRINT("safe",(format, sFile, uLine));
flag=1; flag=1;

View File

@ -229,8 +229,13 @@ void thr_end_alarm(thr_alarm_t *alarmed)
(long) *alarmed)); (long) *alarmed));
} }
if (alarm_aborted && !alarm_queue.elements) if (alarm_aborted && !alarm_queue.elements)
{
delete_queue(&alarm_queue); delete_queue(&alarm_queue);
pthread_mutex_unlock(&LOCK_alarm); pthread_mutex_unlock(&LOCK_alarm);
pthread_mutex_destroy(&LOCK_alarm);
}
else
pthread_mutex_unlock(&LOCK_alarm);
pthread_sigmask(SIG_SETMASK,&old_mask,NULL); pthread_sigmask(SIG_SETMASK,&old_mask,NULL);
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
} }
@ -367,19 +372,25 @@ static sig_handler process_alarm_part2(int sig __attribute__((unused)))
void end_thr_alarm(void) void end_thr_alarm(void)
{ {
DBUG_ENTER("end_thr_alarm"); DBUG_ENTER("end_thr_alarm");
pthread_mutex_lock(&LOCK_alarm);
if (!alarm_aborted) if (!alarm_aborted)
{ {
my_bool deleted=0;
pthread_mutex_lock(&LOCK_alarm);
DBUG_PRINT("info",("Resheduling %d waiting alarms",alarm_queue.elements)); DBUG_PRINT("info",("Resheduling %d waiting alarms",alarm_queue.elements));
alarm_aborted=1; /* mark aborted */ alarm_aborted=1; /* mark aborted */
if (!alarm_queue.elements) if (!alarm_queue.elements)
{
deleted= 1;
delete_queue(&alarm_queue); delete_queue(&alarm_queue);
}
if (pthread_equal(pthread_self(),alarm_thread)) if (pthread_equal(pthread_self(),alarm_thread))
alarm(1); /* Shut down everything soon */ alarm(1); /* Shut down everything soon */
else else
reschedule_alarms(); reschedule_alarms();
pthread_mutex_unlock(&LOCK_alarm);
if (deleted)
pthread_mutex_destroy(&LOCK_alarm);
} }
pthread_mutex_unlock(&LOCK_alarm);
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
} }

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2000 MySQL AB /* Copyright (C) 2000-2003 MySQL AB
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@ -20,13 +20,15 @@
#if defined(HAVE_LINUXTHREADS) && !defined (__USE_UNIX98) #if defined(HAVE_LINUXTHREADS) && !defined (__USE_UNIX98)
#define __USE_UNIX98 /* To get rw locks under Linux */ #define __USE_UNIX98 /* To get rw locks under Linux */
#endif #endif
#include <m_string.h>
#if defined(THREAD) && defined(SAFE_MUTEX) #if defined(THREAD) && defined(SAFE_MUTEX)
#undef SAFE_MUTEX /* Avoid safe_mutex redefinitions */ #undef SAFE_MUTEX /* Avoid safe_mutex redefinitions */
#include <my_pthread.h> #include "mysys_priv.h"
#include "my_static.h"
#include <m_string.h>
#ifndef DO_NOT_REMOVE_THREAD_WRAPPERS #ifndef DO_NOT_REMOVE_THREAD_WRAPPERS
/* Remove wrappers */ /* Remove wrappers */
#undef pthread_mutex_t
#undef pthread_mutex_init #undef pthread_mutex_init
#undef pthread_mutex_lock #undef pthread_mutex_lock
#undef pthread_mutex_unlock #undef pthread_mutex_unlock
@ -38,15 +40,55 @@
#endif #endif
#endif /* DO_NOT_REMOVE_THREAD_WRAPPERS */ #endif /* DO_NOT_REMOVE_THREAD_WRAPPERS */
static pthread_mutex_t THR_LOCK_mutex;
static ulong safe_mutex_count= 0; /* Number of mutexes created */
#ifdef SAFE_MUTEX_DETECT_DESTROY
static struct st_safe_mutex_info_t *safe_mutex_root= NULL;
#endif
void safe_mutex_global_init(void)
{
pthread_mutex_init(&THR_LOCK_mutex,MY_MUTEX_INIT_FAST);
}
int safe_mutex_init(safe_mutex_t *mp, int safe_mutex_init(safe_mutex_t *mp,
const pthread_mutexattr_t *attr __attribute__((unused))) const pthread_mutexattr_t *attr __attribute__((unused)),
const char *file __attribute__((unused)),
uint line __attribute__((unused)))
{ {
bzero((char*) mp,sizeof(*mp)); bzero((char*) mp,sizeof(*mp));
pthread_mutex_init(&mp->global,MY_MUTEX_INIT_ERRCHK); pthread_mutex_init(&mp->global,MY_MUTEX_INIT_ERRCHK);
pthread_mutex_init(&mp->mutex,attr); pthread_mutex_init(&mp->mutex,attr);
#ifdef SAFE_MUTEX_DETECT_DESTROY
/*
Monitor the freeing of mutexes. This code depends on single thread init
and destroy
*/
if ((mp->info= (safe_mutex_info_t *) malloc(sizeof(safe_mutex_info_t))))
{
struct st_safe_mutex_info_t *info =mp->info;
info->init_file= (char *) file;
info->init_line= line;
info->prev= NULL;
info->next= NULL;
pthread_mutex_lock(&THR_LOCK_mutex);
if ((info->next= safe_mutex_root))
safe_mutex_root->prev= info;
safe_mutex_root= info;
safe_mutex_count++;
pthread_mutex_unlock(&THR_LOCK_mutex);
}
#else
thread_safe_increment(safe_mutex_count, &THR_LOCK_mutex);
#endif /* SAFE_MUTEX_DETECT_DESTROY */
return 0; return 0;
} }
int safe_mutex_lock(safe_mutex_t *mp,const char *file, uint line) int safe_mutex_lock(safe_mutex_t *mp,const char *file, uint line)
{ {
int error; int error;
@ -199,6 +241,11 @@ int safe_cond_timedwait(pthread_cond_t *cond, safe_mutex_t *mp,
fflush(stderr); fflush(stderr);
abort(); abort();
} }
#ifdef __NETWARE__
/* NetWare doesn't re-acquire the mutex on an error */
if (error && pthread_mutex_lock(&mp->mutex))
mp->count--;
#endif /* __NETWARE__ */
mp->thread=pthread_self(); mp->thread=pthread_self();
mp->file= (char*) file; mp->file= (char*) file;
mp->line=line; mp->line=line;
@ -206,6 +253,7 @@ int safe_cond_timedwait(pthread_cond_t *cond, safe_mutex_t *mp,
return error; return error;
} }
int safe_mutex_destroy(safe_mutex_t *mp, const char *file, uint line) int safe_mutex_destroy(safe_mutex_t *mp, const char *file, uint line)
{ {
int error=0; int error=0;
@ -225,7 +273,70 @@ int safe_mutex_destroy(safe_mutex_t *mp, const char *file, uint line)
if (pthread_mutex_destroy(&mp->mutex)) if (pthread_mutex_destroy(&mp->mutex))
error=1; error=1;
#endif #endif
#ifdef SAFE_MUTEX_DETECT_DESTROY
if (mp->info)
{
struct st_safe_mutex_info_t *info= mp->info;
pthread_mutex_lock(&THR_LOCK_mutex);
if (info->prev)
info->prev->next = info->next;
else
safe_mutex_root = info->next;
if (info->next)
info->next->prev = info->prev;
safe_mutex_count--;
pthread_mutex_unlock(&THR_LOCK_mutex);
free(info);
mp->info= NULL; /* Get crash if double free */
}
#else
thread_safe_sub(safe_mutex_count, 1, &THR_LOCK_mutex);
#endif /* SAFE_MUTEX_DETECT_DESTROY */
return error; return error;
} }
/*
Free global resources and check that all mutex has been destroyed
SYNOPSIS
safe_mutex_end()
file Print errors on this file
NOTES
We can't use DBUG_PRINT() here as we have in my_end() disabled
DBUG handling before calling this function.
In MySQL one may get one warning for a mutex created in my_thr_init.c
This is ok, as this thread may not yet have been exited.
*/
void safe_mutex_end(FILE *file __attribute__((unused)))
{
if (!safe_mutex_count) /* safetly */
pthread_mutex_destroy(&THR_LOCK_mutex);
#ifdef SAFE_MUTEX_DETECT_DESTROY
if (!file)
return;
if (safe_mutex_count)
{
fprintf(file, "Warning: Not destroyed mutex: %lu\n", safe_mutex_count);
(void) fflush(file);
}
{
struct st_safe_mutex_info_t *ptr;
for (ptr= safe_mutex_root ; ptr ; ptr= ptr->next)
{
fprintf(file, "\tMutex initiated at line %4u in '%s'\n",
ptr->init_line, ptr->init_file);
(void) fflush(file);
}
}
#endif /* SAFE_MUTEX_DETECT_DESTROY */
}
#endif /* THREAD && SAFE_MUTEX */ #endif /* THREAD && SAFE_MUTEX */

0
netware/Makefile.am Normal file
View File

4162
netware/netware.patch Normal file

File diff suppressed because it is too large Load Diff

View File

@ -46,16 +46,37 @@ if [ -d $BASE ] ; then
rm -r -f $BASE rm -r -f $BASE
fi fi
BS=""
EXTRA_BIN_FILES=""
BASE_SYSTEM="any"
MYSQL_SHARE=$BASE/share/mysql
case $system in
*netware*)
BASE_SYSTEM="netware"
BS=".nlm"
MYSQL_SHARE=$BASE/share
EXTRA_BIN_FILES="netware/mysqld_safe.nlm netware/mysql_install_db.nlm \
netware/init_db.sql netware/test_db.sql netware/mysql_explain_log.nlm \
netware/mysqlhotcopy.nlm netware/libmysql.nlm"
;;
esac
mkdir $BASE $BASE/bin $BASE/data $BASE/data/mysql $BASE/data/test \ mkdir $BASE $BASE/bin $BASE/data $BASE/data/mysql $BASE/data/test \
$BASE/include $BASE/lib $BASE/support-files $BASE/share $BASE/share/mysql \ $BASE/include $BASE/lib $BASE/support-files $BASE/share $BASE/scripts \
$BASE/tests $BASE/scripts $BASE/sql-bench $BASE/mysql-test \ $BASE/mysql-test $BASE/mysql-test/t $BASE/mysql-test/r \
$BASE/mysql-test/t $BASE/mysql-test/r \ $BASE/mysql-test/include $BASE/mysql-test/std_data
$BASE/mysql-test/include $BASE/mysql-test/std_data $BASE/man $BASE/man/man1
if [ $BASE_SYSTEM != "netware" ] ; then
mkdir $BASE/share/mysql $BASE/tests $BASE/sql-bench $BASE/man $BASE/man/man1
fi
chmod o-rwx $BASE/data $BASE/data/* chmod o-rwx $BASE/data $BASE/data/*
for i in ChangeLog COPYING COPYING.LIB README Docs/INSTALL-BINARY \ for i in ChangeLog COPYING COPYING.LIB README Docs/INSTALL-BINARY \
MySQLEULA.txt Docs/manual.html Docs/manual.txt Docs/manual_toc.html MySQLEULA.txt Docs/manual.html Docs/manual.txt Docs/manual_toc.html \
LICENSE.doc README.NW Docs/mysqlbug.txt
do do
if [ -f $i ] if [ -f $i ]
then then
@ -63,18 +84,23 @@ do
fi fi
done done
for i in extra/comp_err extra/replace extra/perror extra/resolveip \ for i in extra/comp_err$BS extra/replace$BS extra/perror$BS \
extra/my_print_defaults extra/mysql_waitpid extra/resolve_stack_dump \ extra/resolveip$BS extra/my_print_defaults$BS \
isam/isamchk isam/pack_isam myisam/myisamchk \ extra/resolve_stack_dump$BS extra/mysql_waitpid$BS \
myisam/myisampack sql/mysqld client/mysqlbinlog \ isam/isamchk$BS isam/pack_isam$BS \
client/mysql sql/mysqld client/mysqlshow client/mysqlcheck \ myisam/myisamchk$BS myisam/myisampack$BS myisam/myisamlog$BS \
client/mysqladmin client/mysqldump client/mysqlimport client/mysqltest \ sql/mysqld$BS \
client/mysqlmanagerc client/mysqlmanager-pwgen tools/mysqlmanager \ client/mysql$BS client/mysqlshow$BS client/mysqladmin$BS \
client/.libs/mysql client/.libs/mysqlshow client/.libs/mysqladmin \ client/mysqldump$BS client/mysqlimport$BS \
client/.libs/mysqldump client/.libs/mysqlimport client/.libs/mysqltest \ client/mysqltest$BS client/mysqlcheck$BS \
client/.libs/mysqlcheck client/.libs/mysqlbinlog \ client/mysqlbinlog$BS client/mysqlmanagerc$BS \
client/.libs/mysqlmanagerc client/.libs/mysqlmanager-pwgen \ client/mysqlmanager-pwgen$BS tools/mysqlmanager$BS \
tools/.libs/mysqlmanager client/.libs/mysql client/.libs/mysqlshow client/.libs/mysqladmin \
client/.libs/mysqldump client/.libs/mysqlimport \
client/.libs/mysqltest client/.libs/mysqlcheck \
client/.libs/mysqlbinlog client/.libs/mysqlmanagerc \
client/.libs/mysqlmanager-pwgen tools/.libs/mysqlmanager \
$EXTRA_BIN_FILES
do do
if [ -f $i ] if [ -f $i ]
then then
@ -86,6 +112,7 @@ if [ x$STRIP = x1 ] ; then
strip $BASE/bin/* strip $BASE/bin/*
fi fi
# Copy not binary files
for i in sql/mysqld.sym.gz for i in sql/mysqld.sym.gz
do do
if [ -f $i ] if [ -f $i ]
@ -94,7 +121,11 @@ do
fi fi
done done
for i in libmysql/.libs/libmysqlclient.a libmysql/.libs/libmysqlclient.so* libmysql/libmysqlclient.* libmysql_r/.libs/libmysqlclient_r.a libmysql_r/.libs/libmysqlclient_r.so* libmysql_r/libmysqlclient_r.* mysys/libmysys.a strings/libmystrings.a dbug/libdbug.a libmysqld/.libs/libmysqld.a libmysqld/.libs/libmysqld.so* libmysqld/libmysqld.a if [ $BASE_SYSTEM = "netware" ] ; then
$CP -r netware/scripts/* $BASE/scripts
fi
for i in libmysql/.libs/libmysqlclient.a libmysql/.libs/libmysqlclient.so* libmysql/libmysqlclient.* libmysql_r/.libs/libmysqlclient_r.a libmysql_r/.libs/libmysqlclient_r.so* libmysql_r/libmysqlclient_r.* mysys/libmysys.a strings/libmystrings.a dbug/libdbug.a libmysqld/.libs/libmysqld.a libmysqld/.libs/libmysqld.so* libmysqld/libmysqld.a netware/libmysql.imp
do do
if [ -f $i ] if [ -f $i ]
then then
@ -102,39 +133,72 @@ do
fi fi
done done
# convert the libs to .lib for NetWare
if [ $BASE_SYSTEM = "netware" ] ; then
for i in $BASE/lib/*.a
do
libname=`basename $i .a`
$MV $i $BASE/lib/$libname.lib
done
fi
$CP config.h include/* $BASE/include $CP config.h include/* $BASE/include
rm $BASE/include/Makefile*; rm $BASE/include/*.in rm -f $BASE/include/Makefile* $BASE/include/*.in $BASE/include/config-win.h
if [ $BASE_SYSTEM != "netware" ] ; then
rm -f $BASE/include/config-netware.h
fi
$CP tests/*.res tests/*.tst tests/*.pl $BASE/tests if [ -d tests ] ; then
$CP tests/*.res tests/*.tst tests/*.pl $BASE/tests
fi
if [ -d man ] ; then
$CP man/*.1 $BASE/man/man1
fi
$CP support-files/* $BASE/support-files $CP support-files/* $BASE/support-files
$CP man/*.1 $BASE/man/man1
$CP -r sql/share/* $BASE/share/mysql if [ $BASE_SYSTEM == "netware" ] ; then
rm -f $BASE/share/mysql/Makefile* $BASE/share/mysql/*/*.OLD rm -f $BASE/support-files/magic \
$BASE/support-files/mysql.server \
$BASE/support-files/mysql*.spec \
$BASE/support-files/mysql-log-rotate \
$BASE/support-files/binary-configure
fi
$CP -r sql/share/* $MYSQL_SHARE
rm -f $MYSQL_SHARE/Makefile* $MYSQL_SHARE/*/*.OLD
for i in mysql-test/mysql-test-run mysql-test/install_test_db \
mysql-test/README \
netware/mysql_test_run.nlm netware/install_test_db.ncf
do
if [ -f $i ]
then
$CP $i $BASE/mysql-test
fi
done
$CP mysql-test/mysql-test-run mysql-test/install_test_db $BASE/mysql-test/
$CP mysql-test/README $BASE/mysql-test/README
$CP mysql-test/include/*.inc $BASE/mysql-test/include $CP mysql-test/include/*.inc $BASE/mysql-test/include
$CP mysql-test/std_data/*.dat mysql-test/std_data/*.001 $BASE/mysql-test/std_data $CP mysql-test/std_data/*.dat mysql-test/std_data/*.001 $BASE/mysql-test/std_data
$CP mysql-test/t/*.test mysql-test/t/*.opt mysql-test/t/*.sh $BASE/mysql-test/t $CP mysql-test/t/*test mysql-test/t/*.opt mysql-test/t/*.sh $BASE/mysql-test/t
$CP mysql-test/r/*.result mysql-test/r/*.require $BASE/mysql-test/r $CP mysql-test/r/*result mysql-test/r/*.require $BASE/mysql-test/r
if [ $BASE_SYSTEM != "netware" ] ; then
$CP scripts/* $BASE/bin
$BASE/bin/replace \@localstatedir\@ ./data \@bindir\@ ./bin \@scriptdir\@ ./bin \@libexecdir\@ ./bin \@sbindir\@ ./bin \@prefix\@ . \@HOSTNAME\@ @HOSTNAME@ < $SOURCE/scripts/mysql_install_db.sh > $BASE/scripts/mysql_install_db
$BASE/bin/replace \@prefix\@ /usr/local/mysql \@bindir\@ ./bin \@MYSQLD_USER\@ root \@localstatedir\@ /usr/local/mysql/data \@HOSTNAME\@ @HOSTNAME@ < $SOURCE/support-files/mysql.server.sh > $BASE/support-files/mysql.server
$BASE/bin/replace /my/gnu/bin/hostname /bin/hostname -- $BASE/bin/mysqld_safe
mv $BASE/support-files/binary-configure $BASE/configure
chmod a+x $BASE/bin/* $BASE/scripts/* $BASE/support-files/mysql-* $BASE/support-files/mysql.server $BASE/configure
$CP -r sql-bench/* $BASE/sql-bench
rm -f $BASE/sql-bench/*.sh $BASE/sql-bench/Makefile* $BASE/lib/*.la
fi
$CP scripts/* $BASE/bin
rm -f $BASE/bin/Makefile* $BASE/bin/*.in $BASE/bin/*.sh $BASE/bin/mysql_install_db $BASE/bin/make_binary_distribution $BASE/bin/setsomevars $BASE/support-files/Makefile* $BASE/support-files/*.sh rm -f $BASE/bin/Makefile* $BASE/bin/*.in $BASE/bin/*.sh $BASE/bin/mysql_install_db $BASE/bin/make_binary_distribution $BASE/bin/setsomevars $BASE/support-files/Makefile* $BASE/support-files/*.sh
$BASE/bin/replace \@localstatedir\@ ./data \@bindir\@ ./bin \@scriptdir\@ ./bin \@libexecdir\@ ./bin \@sbindir\@ ./bin \@prefix\@ . \@HOSTNAME\@ @HOSTNAME@ < $SOURCE/scripts/mysql_install_db.sh > $BASE/scripts/mysql_install_db
$BASE/bin/replace \@prefix\@ /usr/local/mysql \@bindir\@ ./bin \@MYSQLD_USER\@ root \@localstatedir\@ /usr/local/mysql/data \@HOSTNAME\@ @HOSTNAME@ < $SOURCE/support-files/mysql.server.sh > $BASE/support-files/mysql.server
$BASE/bin/replace /my/gnu/bin/hostname /bin/hostname -- $BASE/bin/mysqld_safe
# Make safe_mysqld a symlink to mysqld_safe for backwards portability # Make safe_mysqld a symlink to mysqld_safe for backwards portability
# To be removed in MySQL 4.1 # To be removed in MySQL 4.1
(cd $BASE/bin ; ln -s mysqld_safe safe_mysqld ) (cd $BASE/bin ; ln -s mysqld_safe safe_mysqld )
mv $BASE/support-files/binary-configure $BASE/configure
chmod a+x $BASE/bin/* $BASE/scripts/* $BASE/support-files/mysql-* $BASE/support-files/mysql.server $BASE/configure
$CP -r sql-bench/* $BASE/sql-bench
rm -f $BASE/sql-bench/*.sh $BASE/sql-bench/Makefile* $BASE/lib/*.la
# Clean up if we did this from a bk tree # Clean up if we did this from a bk tree
if [ -d $BASE/sql-bench/SCCS ] ; then if [ -d $BASE/sql-bench/SCCS ] ; then
find $BASE/share -name SCCS -print | xargs rm -r -f find $BASE/share -name SCCS -print | xargs rm -r -f
@ -196,7 +260,7 @@ which_1 ()
# Create the result tar file # Create the result tar file
# #
tar=`which_1 gtar` tar=`which_1 gnutar gtar`
if test "$?" = "1" -o "$tar" = "" if test "$?" = "1" -o "$tar" = ""
then then
tar=tar tar=tar

File diff suppressed because it is too large Load Diff

View File

@ -93,7 +93,7 @@ DEFS = -DMYSQL_SERVER \
# Don't put lex_hash.h in BUILT_SOURCES as this will give infinite recursion # Don't put lex_hash.h in BUILT_SOURCES as this will give infinite recursion
BUILT_SOURCES = sql_yacc.cc sql_yacc.h BUILT_SOURCES = sql_yacc.cc sql_yacc.h
EXTRA_DIST = udf_example.cc $(BUILT_SOURCES) EXTRA_DIST = udf_example.cc $(BUILT_SOURCES)
YFLAGS = -d AM_YFLAGS = -d
link_sources: link_sources:
rm -f mini_client_errors.c rm -f mini_client_errors.c

View File

@ -104,4 +104,15 @@ error:
VOID(pthread_mutex_unlock(&LOCK_des_key_file)); VOID(pthread_mutex_unlock(&LOCK_des_key_file));
DBUG_RETURN(result); DBUG_RETURN(result);
} }
void free_des_key_file()
{
if (initialized)
{
initialized= 01;
pthread_mutex_destroy(&LOCK_des_key_file);
}
}
#endif /* HAVE_OPENSSL */ #endif /* HAVE_OPENSSL */

View File

@ -830,6 +830,7 @@ innobase_end(void)
err = innobase_shutdown_for_mysql(); err = innobase_shutdown_for_mysql();
hash_free(&innobase_open_tables); hash_free(&innobase_open_tables);
my_free(internal_innobase_data_file_path,MYF(MY_ALLOW_ZERO_PTR)); my_free(internal_innobase_data_file_path,MYF(MY_ALLOW_ZERO_PTR));
pthread_mutex_destroy(&innobase_mutex);
if (err != DB_SUCCESS) { if (err != DB_SUCCESS) {

View File

@ -497,7 +497,7 @@ int ha_myisam::repair(THD* thd, HA_CHECK_OPT *check_opt)
(uint) (T_RETRY_WITHOUT_QUICK | T_QUICK))) (uint) (T_RETRY_WITHOUT_QUICK | T_QUICK)))
{ {
param.testflag&= ~T_RETRY_WITHOUT_QUICK; param.testflag&= ~T_RETRY_WITHOUT_QUICK;
sql_print_error("Warning: Retrying repair of: '%s' without quick", sql_print_error("Note: Retrying repair of: '%s' without quick",
table->path); table->path);
continue; continue;
} }
@ -505,7 +505,7 @@ int ha_myisam::repair(THD* thd, HA_CHECK_OPT *check_opt)
if ((param.testflag & T_REP_BY_SORT)) if ((param.testflag & T_REP_BY_SORT))
{ {
param.testflag= (param.testflag & ~T_REP_BY_SORT) | T_REP; param.testflag= (param.testflag & ~T_REP_BY_SORT) | T_REP;
sql_print_error("Warning: Retrying repair of: '%s' with keycache", sql_print_error("Note: Retrying repair of: '%s' with keycache",
table->path); table->path);
continue; continue;
} }
@ -515,7 +515,7 @@ int ha_myisam::repair(THD* thd, HA_CHECK_OPT *check_opt)
!(check_opt->flags & T_VERY_SILENT)) !(check_opt->flags & T_VERY_SILENT))
{ {
char llbuff[22],llbuff2[22]; char llbuff[22],llbuff2[22];
sql_print_error("Warning: Found %s of %s rows when repairing '%s'", sql_print_error("Note: Found %s of %s rows when repairing '%s'",
llstr(file->state->records, llbuff), llstr(file->state->records, llbuff),
llstr(start_records, llbuff2), llstr(start_records, llbuff2),
table->path); table->path);

View File

@ -27,7 +27,9 @@
extern "C" { // Because of SCO 3.2V4.2 extern "C" { // Because of SCO 3.2V4.2
#endif #endif
#if !defined( __WIN__) && !defined(OS2) #if !defined( __WIN__) && !defined(OS2)
#if !defined(__NETWARE__)
#include <sys/resource.h> #include <sys/resource.h>
#endif /* __NETWARE__ */
#ifdef HAVE_SYS_UN_H #ifdef HAVE_SYS_UN_H
#include <sys/un.h> #include <sys/un.h>
#endif #endif

View File

@ -86,6 +86,9 @@ public:
virtual bool is_null() { return 0; } virtual bool is_null() { return 0; }
virtual unsigned int size_of()= 0; virtual unsigned int size_of()= 0;
virtual void top_level_item() {} virtual void top_level_item() {}
virtual void set_result_field(Field *field) {}
virtual bool is_result_field() { return 0; }
virtual void save_in_result_field(bool no_conversions) {}
}; };
@ -356,12 +359,19 @@ public:
table_map used_tables() const { return 1; } table_map used_tables() const { return 1; }
virtual void fix_length_and_dec()=0; virtual void fix_length_and_dec()=0;
unsigned int size_of() { return sizeof(*this);} unsigned int size_of() { return sizeof(*this);}
void set_result_field(Field *field) { result_field= field; }
bool is_result_field() { return 1; }
void save_in_result_field(bool no_conversions)
{
save_in_field(result_field, no_conversions);
}
}; };
class Item_ref :public Item_ident class Item_ref :public Item_ident
{ {
public: public:
Field *result_field; /* Save result here */
Item **ref; Item **ref;
Item_ref(char *db_par,char *table_name_par,char *field_name_par) Item_ref(char *db_par,char *table_name_par,char *field_name_par)
:Item_ident(db_par,table_name_par,field_name_par),ref(0) {} :Item_ident(db_par,table_name_par,field_name_par),ref(0) {}
@ -407,6 +417,12 @@ public:
enum Item_result result_type () const { return (*ref)->result_type(); } enum Item_result result_type () const { return (*ref)->result_type(); }
table_map used_tables() const { return (*ref)->used_tables(); } table_map used_tables() const { return (*ref)->used_tables(); }
unsigned int size_of() { return sizeof(*this);} unsigned int size_of() { return sizeof(*this);}
void set_result_field(Field *field) { result_field= field; }
bool is_result_field() { return 1; }
void save_in_result_field(bool no_conversions)
{
(*ref)->save_in_field(result_field, no_conversions);
}
}; };

View File

@ -424,12 +424,6 @@ Item *create_load_file(Item* a)
return new Item_load_file(a); return new Item_load_file(a);
} }
Item *create_wait_for_master_pos(Item* a, Item* b)
{
current_thd->safe_to_cache_query=0;
return new Item_master_pos_wait(a, b);
}
Item *create_func_cast(Item *a, Item_cast cast_type) Item *create_func_cast(Item *a, Item_cast cast_type)
{ {
Item *res; Item *res;

View File

@ -92,6 +92,5 @@ Item *create_func_ucase(Item* a);
Item *create_func_version(void); Item *create_func_version(void);
Item *create_func_weekday(Item* a); Item *create_func_weekday(Item* a);
Item *create_load_file(Item* a); Item *create_load_file(Item* a);
Item *create_wait_for_master_pos(Item* a, Item* b);
Item *create_func_is_free_lock(Item* a); Item *create_func_is_free_lock(Item* a);
Item *create_func_quote(Item* a); Item *create_func_quote(Item* a);

View File

@ -1509,6 +1509,7 @@ void item_user_lock_init(void)
void item_user_lock_free(void) void item_user_lock_free(void)
{ {
hash_free(&hash_user_locks); hash_free(&hash_user_locks);
pthread_mutex_destroy(&LOCK_user_locks);
} }
void item_user_lock_release(ULL *ull) void item_user_lock_release(ULL *ull)
@ -1549,9 +1550,10 @@ longlong Item_master_pos_wait::val_int()
null_value = 1; null_value = 1;
return 0; return 0;
} }
ulong pos = (ulong)args[1]->val_int(); longlong pos = args[1]->val_int();
longlong timeout = (arg_count==3) ? args[2]->val_int() : 0 ;
LOCK_ACTIVE_MI; LOCK_ACTIVE_MI;
if ((event_count = active_mi->rli.wait_for_pos(thd, log_name, pos)) == -1) if ((event_count = active_mi->rli.wait_for_pos(thd, log_name, pos, timeout)) == -2)
{ {
null_value = 1; null_value = 1;
event_count=0; event_count=0;

View File

@ -865,9 +865,10 @@ class Item_master_pos_wait :public Item_int_func
String value; String value;
public: public:
Item_master_pos_wait(Item *a,Item *b) :Item_int_func(a,b) {} Item_master_pos_wait(Item *a,Item *b) :Item_int_func(a,b) {}
Item_master_pos_wait(Item *a,Item *b,Item *c) :Item_int_func(a,b,c) {}
longlong val_int(); longlong val_int();
const char *func_name() const { return "master_pos_wait"; } const char *func_name() const { return "master_pos_wait"; }
void fix_length_and_dec() { max_length=1; maybe_null=1;} void fix_length_and_dec() { max_length=21; maybe_null=1;}
unsigned int size_of() { return sizeof(*this);} unsigned int size_of() { return sizeof(*this);}
}; };

View File

@ -1089,7 +1089,7 @@ bool Item_sum_count_distinct::add()
if (always_null) if (always_null)
return 0; return 0;
copy_fields(tmp_table_param); copy_fields(tmp_table_param);
copy_funcs(tmp_table_param->funcs); copy_funcs(tmp_table_param->items_to_copy);
for (Field **field=table->field ; *field ; field++) for (Field **field=table->field ; *field ; field++)
if ((*field)->is_real_null(0)) if ((*field)->is_real_null(0))

View File

@ -462,9 +462,8 @@ static SYMBOL sql_functions[] = {
{ "LOWER", SYM(FUNC_ARG1),0,CREATE_FUNC(create_func_lcase)}, { "LOWER", SYM(FUNC_ARG1),0,CREATE_FUNC(create_func_lcase)},
{ "LPAD", SYM(FUNC_ARG3),0,CREATE_FUNC(create_func_lpad)}, { "LPAD", SYM(FUNC_ARG3),0,CREATE_FUNC(create_func_lpad)},
{ "LTRIM", SYM(FUNC_ARG1),0,CREATE_FUNC(create_func_ltrim)}, { "LTRIM", SYM(FUNC_ARG1),0,CREATE_FUNC(create_func_ltrim)},
{ "MASTER_POS_WAIT", SYM(FUNC_ARG2),0,
CREATE_FUNC(create_wait_for_master_pos)},
{ "MAKE_SET", SYM(MAKE_SET_SYM),0,0}, { "MAKE_SET", SYM(MAKE_SET_SYM),0,0},
{ "MASTER_POS_WAIT", SYM(MASTER_POS_WAIT),0,0},
{ "MAX", SYM(MAX_SYM),0,0}, { "MAX", SYM(MAX_SYM),0,0},
{ "MD5", SYM(FUNC_ARG1),0,CREATE_FUNC(create_func_md5)}, { "MD5", SYM(FUNC_ARG1),0,CREATE_FUNC(create_func_md5)},
{ "MID", SYM(SUBSTRING),0,0}, /* unireg function */ { "MID", SYM(SUBSTRING),0,0}, /* unireg function */

View File

@ -96,9 +96,16 @@ MYSQL_LOG::MYSQL_LOG()
MYSQL_LOG::~MYSQL_LOG() MYSQL_LOG::~MYSQL_LOG()
{
cleanup();
}
void MYSQL_LOG::cleanup()
{ {
if (inited) if (inited)
{ {
close(1);
inited= 0;
(void) pthread_mutex_destroy(&LOCK_log); (void) pthread_mutex_destroy(&LOCK_log);
(void) pthread_mutex_destroy(&LOCK_index); (void) pthread_mutex_destroy(&LOCK_index);
(void) pthread_cond_destroy(&update_cond); (void) pthread_cond_destroy(&update_cond);
@ -1063,7 +1070,7 @@ bool MYSQL_LOG::write(Log_event* event_info)
if (thd->last_insert_id_used) if (thd->last_insert_id_used)
{ {
Intvar_log_event e(thd,(uchar) LAST_INSERT_ID_EVENT, Intvar_log_event e(thd,(uchar) LAST_INSERT_ID_EVENT,
thd->last_insert_id); thd->current_insert_id);
e.set_log_pos(this); e.set_log_pos(this);
if (thd->server_id) if (thd->server_id)
e.server_id = thd->server_id; e.server_id = thd->server_id;
@ -1430,6 +1437,10 @@ void MYSQL_LOG:: wait_for_update(THD* thd)
at once after close, in which case we don't want to at once after close, in which case we don't want to
close the index file. close the index file.
We only write a 'stop' event to the log if exiting is set We only write a 'stop' event to the log if exiting is set
NOTES
One can do an open on the object at once after doing a close.
The internal structures are not freed until cleanup() is called
*/ */
void MYSQL_LOG::close(bool exiting) void MYSQL_LOG::close(bool exiting)

View File

@ -14,7 +14,7 @@
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#ifdef __EMX__ #if defined(__EMX__) || defined(__NETWARE__)
#include "../mysys/my_lock.c" #include "../mysys/my_lock.c"
#else #else

Some files were not shown because too many files have changed in this diff Show More