mirror of
https://github.com/MariaDB/server.git
synced 2025-01-29 02:05:57 +01:00
merge
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:
commit
c97ddd06f4
121 changed files with 7065 additions and 64246 deletions
|
@ -3,7 +3,7 @@
|
|||
path=`dirname $0`
|
||||
. "$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"
|
||||
cxx_warnings="$cxx_warnings $debug_extra_warnings"
|
||||
extra_configs="$pentium_configs $debug_configs"
|
||||
|
|
|
@ -27,7 +27,7 @@ EXTRA_DIST = $(noinst_SCRIPTS) $(BUILT_SOURCES) mysqld_error.txt \
|
|||
all: $(targets) txt_files
|
||||
|
||||
txt_files: ../INSTALL-SOURCE ../COPYING ../COPYING.LIB \
|
||||
INSTALL-BINARY # ../MIRRORS
|
||||
INSTALL-BINARY
|
||||
|
||||
CLEAN_FILES: $(BUILD_SOURCES)
|
||||
touch $(BUILD_SOURCES)
|
||||
|
@ -254,8 +254,5 @@ INSTALL-BINARY: mysql.info $(GT)
|
|||
../COPYING.LIB: mysql.info $(GT)
|
||||
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
|
||||
%::SCCS/s.%
|
||||
|
|
59832
Docs/manual.texi
59832
Docs/manual.texi
File diff suppressed because it is too large
Load diff
14
Docs/reservedwords.texi
Normal file
14
Docs/reservedwords.texi
Normal 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.
|
|
@ -24,8 +24,9 @@ EXTRA_DIST = INSTALL-SOURCE README \
|
|||
SUBDIRS = . include @docs_dirs@ @readline_dir@ \
|
||||
@thread_dirs@ pstack @sql_client_dirs@ \
|
||||
@sql_server_dirs@ scripts man tests \
|
||||
BUILD os2 libmysql_r @libmysqld_dirs@ \
|
||||
@bench_dirs@ support-files @fs_dirs@ @tools_dirs@
|
||||
BUILD os2 @libmysqld_dirs@ \
|
||||
@bench_dirs@ support-files @fs_dirs@ @tools_dirs@ \
|
||||
@platform_dir@
|
||||
|
||||
# Relink after clean
|
||||
linked_sources = linked_client_sources linked_server_sources \
|
||||
|
|
|
@ -121,7 +121,7 @@ __os_openhandle(dbenv, name, flags, mode, fhp)
|
|||
} else {
|
||||
#if defined(HAVE_FCNTL_F_SETFD)
|
||||
/* 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();
|
||||
__db_err(dbenv, "fcntl(F_SETFD): %s",
|
||||
strerror(ret));
|
||||
|
|
161
client/mysql.cc
161
client/mysql.cc
|
@ -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
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -40,7 +40,7 @@
|
|||
#include <signal.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 */
|
||||
#define MAX_COLUMN_LENGTH 1024
|
||||
|
@ -79,7 +79,7 @@ extern "C" {
|
|||
#undef bcmp // Fix problem with new readline
|
||||
#if defined( __WIN__) || defined(OS2)
|
||||
#include <conio.h>
|
||||
#else
|
||||
#elif !defined(__NETWARE__)
|
||||
#include <readline/readline.h>
|
||||
#define HAVE_READLINE
|
||||
#endif
|
||||
|
@ -91,12 +91,16 @@ extern "C" {
|
|||
#define vidattr(A) {} // Can't get this to work
|
||||
#endif
|
||||
|
||||
#ifdef __WIN__
|
||||
#ifdef FN_NO_CASE_SENCE
|
||||
#define cmp_database(A,B) my_strcasecmp((A),(B))
|
||||
#else
|
||||
#define cmp_database(A,B) strcmp((A),(B))
|
||||
#endif
|
||||
|
||||
#if !defined( __WIN__) && !defined( OS2) && !defined(__NETWARE__) && (!defined(HAVE_mit_thread) || !defined(THREAD))
|
||||
#define USE_POPEN
|
||||
#endif
|
||||
|
||||
#include "completion_hash.h"
|
||||
|
||||
#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_use(String *str,char*), com_source(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*);
|
||||
|
||||
#ifndef __WIN__
|
||||
#ifdef USE_POPEN
|
||||
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
|
||||
|
||||
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 init_pager();
|
||||
static void end_pager();
|
||||
static int init_tee(char *);
|
||||
static void init_tee(const char *);
|
||||
static void end_tee();
|
||||
static const char* construct_prompt();
|
||||
static void init_username();
|
||||
|
@ -210,18 +214,18 @@ static COMMANDS commands[] = {
|
|||
{ "clear", 'c', com_clear, 0, "Clear command."},
|
||||
{ "connect",'r', com_connect,1,
|
||||
"Reconnect to the server. Optional arguments are db and host." },
|
||||
#ifndef __WIN__
|
||||
#ifdef USE_POPEN
|
||||
{ "edit", 'e', com_edit, 0, "Edit command with $EDITOR."},
|
||||
#endif
|
||||
{ "ego", 'G', com_ego, 0,
|
||||
"Send command to mysql server, display result vertically."},
|
||||
{ "exit", 'q', com_quit, 0, "Exit mysql. Same as quit."},
|
||||
{ "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." },
|
||||
#endif
|
||||
{ "notee", 't', com_notee, 0, "Don't write into outfile." },
|
||||
#ifndef __WIN__
|
||||
#ifdef USE_POPEN
|
||||
{ "pager", 'P', com_pager, 1,
|
||||
"Set PAGER [to_pager]. Print the query results via PAGER." },
|
||||
#endif
|
||||
|
@ -232,7 +236,7 @@ static COMMANDS commands[] = {
|
|||
{ "source", '.', com_source, 1,
|
||||
"Execute a SQL script file. Takes a file name as an argument."},
|
||||
{ "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."},
|
||||
#endif
|
||||
{ "tee", 'T', com_tee, 1,
|
||||
|
@ -302,8 +306,8 @@ int main(int argc,char *argv[])
|
|||
current_prompt = my_strdup(default_prompt,MYF(MY_WME));
|
||||
prompt_counter=0;
|
||||
|
||||
strmov(outfile, "\0"); // no (default) outfile, unless given at least once
|
||||
strmov(pager, "stdout"); // the default, if --pager wasn't given
|
||||
outfile[0]=0; // no (default) outfile
|
||||
strmov(pager, "stdout"); // the default, if --pager wasn't given
|
||||
{
|
||||
char *tmp=getenv("PAGER");
|
||||
if (tmp)
|
||||
|
@ -491,7 +495,7 @@ static struct my_option my_long_options[] =
|
|||
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,
|
||||
NO_ARG, 0, 0, 0, 0, 0, 0},
|
||||
#ifndef __WIN__
|
||||
#ifdef USE_POPEN
|
||||
{"no-pager", OPT_NOPAGER,
|
||||
"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},
|
||||
|
@ -512,7 +516,7 @@ static struct my_option my_long_options[] =
|
|||
{"one-database", 'o',
|
||||
"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},
|
||||
#ifndef __WIN__
|
||||
#ifdef USE_POPEN
|
||||
{"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.",
|
||||
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();
|
||||
}
|
||||
else
|
||||
opt_outfile= init_tee(argument);
|
||||
init_tee(argument);
|
||||
break;
|
||||
case OPT_NOTEE:
|
||||
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)
|
||||
{
|
||||
#if defined( __WIN__) || defined(OS2)
|
||||
#if defined( __WIN__) || defined(OS2) || defined(__NETWARE__)
|
||||
char linebuffer[254];
|
||||
#endif
|
||||
char *line;
|
||||
|
@ -792,30 +796,33 @@ static int read_lines(bool execute_commands)
|
|||
}
|
||||
else
|
||||
{
|
||||
#if defined( __WIN__) || defined(OS2)
|
||||
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() :
|
||||
char *prompt= (char*) (glob_buffer.is_empty() ? construct_prompt() :
|
||||
!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)
|
||||
fprintf(OUTFILE, "%s\n", line);
|
||||
}
|
||||
|
@ -1497,7 +1504,7 @@ com_go(String *buffer,char *line __attribute__((unused)))
|
|||
|
||||
static void init_pager()
|
||||
{
|
||||
#if !defined( __WIN__) && !defined( OS2) && (!defined(HAVE_mit_thread) || !defined(THREAD))
|
||||
#ifdef USE_POPEN
|
||||
if (!opt_nopager)
|
||||
{
|
||||
if (!(PAGER= popen(pager, "w")))
|
||||
|
@ -1513,30 +1520,35 @@ static void init_pager()
|
|||
|
||||
static void end_pager()
|
||||
{
|
||||
#if !defined( __WIN__) && !defined( OS2) && !(defined(HAVE_mit_thread) && defined(THREAD))
|
||||
#ifdef USE_POPEN
|
||||
if (!opt_nopager)
|
||||
pclose(PAGER);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
static int init_tee(char* newfile)
|
||||
static void init_tee(const char *file_name)
|
||||
{
|
||||
FILE* new_outfile;
|
||||
if (!(new_outfile= my_fopen(newfile, O_APPEND | O_WRONLY, MYF(MY_WME))))
|
||||
return 0;
|
||||
if (opt_outfile)
|
||||
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;
|
||||
strmake(outfile,newfile,FN_REFLEN-1);
|
||||
tee_fprintf(stdout, "Logging to file '%s'\n", outfile);
|
||||
return 1;
|
||||
strmake(outfile, file_name, FN_REFLEN-1);
|
||||
tee_fprintf(stdout, "Logging to file '%s'\n", file_name);
|
||||
opt_outfile= 1;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
static void end_tee()
|
||||
{
|
||||
my_fclose(OUTFILE, MYF(0));
|
||||
OUTFILE= 0;
|
||||
opt_outfile= 0;
|
||||
return;
|
||||
}
|
||||
|
@ -1576,6 +1588,9 @@ print_table_data(MYSQL_RES *result)
|
|||
MYSQL_ROW cur;
|
||||
MYSQL_FIELD *field;
|
||||
bool *num_flag;
|
||||
#ifdef __NETWARE__
|
||||
uint lines= 0;
|
||||
#endif
|
||||
|
||||
num_flag=(bool*) my_alloca(sizeof(bool)*mysql_num_fields(result));
|
||||
if (info_flag)
|
||||
|
@ -1631,16 +1646,24 @@ print_table_data(MYSQL_RES *result)
|
|||
length, str);
|
||||
}
|
||||
(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);
|
||||
my_afree((gptr) num_flag);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
print_table_data_html(MYSQL_RES *result)
|
||||
{
|
||||
MYSQL_ROW cur;
|
||||
MYSQL_FIELD *field;
|
||||
MYSQL_ROW cur;
|
||||
MYSQL_FIELD *field;
|
||||
#ifdef __NETWARE__
|
||||
uint lines= 0;
|
||||
#endif
|
||||
|
||||
mysql_field_seek(result,0);
|
||||
(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("</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);
|
||||
}
|
||||
|
@ -1698,6 +1725,10 @@ print_table_data_xml(MYSQL_RES *result)
|
|||
" ") : "NULL"));
|
||||
}
|
||||
(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);
|
||||
}
|
||||
|
@ -1730,6 +1761,10 @@ print_table_data_vertically(MYSQL_RES *result)
|
|||
tee_fprintf(PAGER, "%*s: ",(int) max_length,field->name);
|
||||
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");
|
||||
return 0;
|
||||
}
|
||||
opt_outfile= 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);
|
||||
init_tee(file_name);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -1892,7 +1923,7 @@ com_notee(String *buffer __attribute__((unused)),
|
|||
Sorry, this command is not available in Windows.
|
||||
*/
|
||||
|
||||
#ifndef __WIN__
|
||||
#ifdef USE_POPEN
|
||||
static int
|
||||
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 */
|
||||
while (isspace(*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");
|
||||
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
|
||||
*/
|
||||
|
||||
#ifndef __WIN__
|
||||
#ifdef USE_POPEN
|
||||
static int
|
||||
com_edit(String *buffer,char *line __attribute__((unused)))
|
||||
{
|
||||
|
@ -1996,6 +2027,10 @@ static int
|
|||
com_quit(String *buffer __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;
|
||||
return 1;
|
||||
}
|
||||
|
@ -2011,7 +2046,7 @@ com_rehash(String *buffer __attribute__((unused)),
|
|||
}
|
||||
|
||||
|
||||
#ifndef __WIN__
|
||||
#ifdef USE_POPEN
|
||||
static int
|
||||
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");
|
||||
vidattr(A_NORMAL);
|
||||
}
|
||||
#ifndef __WIN__
|
||||
#ifdef USE_POPEN
|
||||
tee_fprintf(stdout, "Current pager:\t\t%s\n", pager);
|
||||
tee_fprintf(stdout, "Using outfile:\t\t'%s'\n", opt_outfile ? outfile : "");
|
||||
#endif
|
||||
|
@ -2500,7 +2535,7 @@ void tee_putc(int c, FILE *file)
|
|||
putc(c, OUTFILE);
|
||||
}
|
||||
|
||||
#if defined( __WIN__) || defined( OS2)
|
||||
#if defined( __WIN__) || defined( OS2) || defined(__NETWARE__)
|
||||
#include <time.h>
|
||||
#else
|
||||
#include <sys/times.h>
|
||||
|
@ -2512,7 +2547,7 @@ void tee_putc(int c, FILE *file)
|
|||
|
||||
static ulong start_timer(void)
|
||||
{
|
||||
#if defined( __WIN__) || defined( OS2)
|
||||
#if defined( __WIN__) || defined( OS2) || defined(__NETWARE__)
|
||||
return clock();
|
||||
#else
|
||||
struct tms tms_tmp;
|
||||
|
|
|
@ -24,8 +24,8 @@
|
|||
#endif
|
||||
#include <sys/stat.h>
|
||||
|
||||
#define ADMIN_VERSION "8.39"
|
||||
#define MAX_MYSQL_VAR 128
|
||||
#define ADMIN_VERSION "8.40"
|
||||
#define MAX_MYSQL_VAR 256
|
||||
#define SHUTDOWN_DEF_TIMEOUT 3600 /* Wait for shutdown */
|
||||
#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]);
|
||||
|
||||
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,
|
||||
llstr((tmp - last_values[row]), buff));
|
||||
last_values[row] = tmp;
|
||||
|
@ -994,7 +994,7 @@ static void print_relative_row_vert(MYSQL_RES *result __attribute__((unused)),
|
|||
if (!row)
|
||||
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,
|
||||
llstr((tmp - last_values[row]), buff));
|
||||
|
||||
|
|
|
@ -341,7 +341,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
|
|||
tty_password=1;
|
||||
break;
|
||||
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))))
|
||||
exit(1);
|
||||
break;
|
||||
|
|
|
@ -677,7 +677,7 @@ int open_file(const char* name)
|
|||
|
||||
if (*cur_file && cur_file == file_stack_end)
|
||||
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);
|
||||
cur_file++;
|
||||
*++lineno=1;
|
||||
|
@ -685,18 +685,6 @@ int open_file(const char* name)
|
|||
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 */
|
||||
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;
|
||||
}
|
||||
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);
|
||||
break;
|
||||
}
|
||||
|
@ -2561,7 +2549,7 @@ static int read_server_arguments(const char* name)
|
|||
embedded_server_arg_count=1;
|
||||
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;
|
||||
while (embedded_server_arg_count < MAX_SERVER_ARGS &&
|
||||
(str=fgets(argument,sizeof(argument), file)))
|
||||
|
|
214
configure.in
214
configure.in
|
@ -38,9 +38,18 @@ rm -f $AVAILABLE_LANGUAGES_ERRORS_RULES
|
|||
for i in $AVAILABLE_LANGUAGES
|
||||
do
|
||||
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
|
||||
\$(top_builddir)/extra/comp_err \$^ $i/errmsg.sys" \
|
||||
>> $AVAILABLE_LANGUAGES_ERRORS_RULES
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
#####
|
||||
|
@ -130,7 +139,14 @@ AC_PROG_CXX
|
|||
AC_PROG_CPP
|
||||
|
||||
# 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`
|
||||
;;
|
||||
esac
|
||||
if test $? -eq "0"
|
||||
then
|
||||
AC_MSG_CHECKING("C Compiler version");
|
||||
|
@ -138,7 +154,14 @@ then
|
|||
else
|
||||
CC_VERSION=""
|
||||
fi
|
||||
case $SYSTEM_TYPE in
|
||||
*netware*)
|
||||
CXX_VERSION=`$CXX -version | grep -i version`
|
||||
;;
|
||||
*)
|
||||
CXX_VERSION=`$CXX --version | sed 1q`
|
||||
;;
|
||||
esac
|
||||
if test $? -eq "0"
|
||||
then
|
||||
AC_MSG_CHECKING("C++ compiler version");
|
||||
|
@ -186,6 +209,11 @@ AC_CHECK_PROG(DVIS, tex, manual.dvi)
|
|||
AC_MSG_CHECKING("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([
|
||||
int main()
|
||||
{
|
||||
|
@ -205,11 +233,13 @@ AC_DEFINE(SPRINTF_RETURNS_INT) AC_MSG_RESULT("int"),
|
|||
char buf[6];
|
||||
if((char*)sprintf(buf,s) == buf + strlen(s))
|
||||
return 0;
|
||||
return -1;
|
||||
return -1;
|
||||
}
|
||||
], AC_DEFINE(SPRINTF_RETURNS_PTR) AC_MSG_RESULT("ptr"),
|
||||
AC_DEFINE(SPRINTF_RETURNS_GARBAGE) AC_MSG_RESULT("garbage")))
|
||||
|
||||
;;
|
||||
esac
|
||||
|
||||
|
||||
# option, cache_name, variable,
|
||||
# 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)
|
||||
# This must be able to take a -f flag like normal unix 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 test -n "$LN_CP_F"; then
|
||||
LN_CP_F="$LN_CP_F -s"
|
||||
fi
|
||||
fi
|
||||
|
||||
AC_PATH_PROG(MV, mv, mv)
|
||||
AC_PATH_PROG(RM, rm, rm)
|
||||
|
@ -429,6 +461,9 @@ else
|
|||
*cygwin*)
|
||||
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.])
|
||||
esac
|
||||
|
@ -853,6 +888,11 @@ fi
|
|||
NON_THREADED_CLIENT_LIBS="$LIBS"
|
||||
|
||||
AC_MSG_CHECKING([for int8])
|
||||
case $SYSTEM_TYPE in
|
||||
*netware)
|
||||
AC_MSG_RESULT([no])
|
||||
;;
|
||||
*)
|
||||
AC_TRY_RUN([
|
||||
#ifdef HAVE_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])
|
||||
)
|
||||
;;
|
||||
esac
|
||||
|
||||
#
|
||||
# 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"
|
||||
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
|
||||
|
||||
|
||||
|
@ -1389,7 +1532,12 @@ LIBS="$my_save_LIBS"
|
|||
AC_SUBST(LIBDL)
|
||||
|
||||
# System characteristics
|
||||
case $SYSTEM_TYPE in
|
||||
*netware* | *modesto*) ;;
|
||||
*)
|
||||
AC_SYS_RESTARTABLE_SYSCALLS
|
||||
;;
|
||||
esac
|
||||
|
||||
# Build optimized or debug version ?
|
||||
# First check for gcc and g++
|
||||
|
@ -1414,6 +1562,13 @@ else
|
|||
OPTIMIZE_CXXFLAGS="-O"
|
||||
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,
|
||||
[ --without-debug Build a production version without debugging code],
|
||||
[with_debug=$withval],
|
||||
|
@ -1561,6 +1716,7 @@ MYSQL_CHECK_FP_EXCEPT
|
|||
# Do the c++ compiler have a bool type
|
||||
MYSQL_CXX_BOOL
|
||||
# Check some common bugs with gcc 2.8.# on sparc
|
||||
if ! ( expr "$SYSTEM_TYPE" : ".*netware.*" > /dev/null ); then
|
||||
MYSQL_CHECK_LONGLONG_TO_FLOAT
|
||||
if test "$ac_cv_conv_longlong_to_float" != "yes"
|
||||
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
|
||||
again]);
|
||||
fi
|
||||
fi
|
||||
MYSQL_PTHREAD_YIELD
|
||||
|
||||
######################################################################
|
||||
|
@ -1988,6 +2145,11 @@ AC_ARG_WITH(readline,
|
|||
[ with_readline=$withval ],
|
||||
[ 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"
|
||||
then
|
||||
readline_dir="readline"
|
||||
|
@ -1998,6 +2160,7 @@ else
|
|||
readline_dir=""
|
||||
readline_link="-lreadline"
|
||||
fi
|
||||
fi
|
||||
AC_SUBST(readline_dir)
|
||||
AC_SUBST(readline_link)
|
||||
|
||||
|
@ -2031,6 +2194,13 @@ AC_ARG_WITH(extra-charsets,
|
|||
[extra_charsets="$withval"],
|
||||
[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")
|
||||
|
||||
if test "$extra_charsets" = none; then
|
||||
|
@ -2269,11 +2439,18 @@ AC_SUBST(CLIENT_LIBS)
|
|||
AC_SUBST(sql_client_dirs)
|
||||
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"
|
||||
then
|
||||
AC_DEFINE(THREAD)
|
||||
# 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)
|
||||
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)
|
||||
|
@ -2377,7 +2554,7 @@ EOF
|
|||
then
|
||||
innodb_conf_flags=--disable-dependency-tracking
|
||||
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])
|
||||
|
||||
echo "END OF INNODB CONFIGURATION"
|
||||
|
@ -2435,20 +2612,21 @@ AC_SUBST(GXX)
|
|||
#AC_SUBST(TOOLS_LIBS)
|
||||
|
||||
# Output results
|
||||
AC_OUTPUT(Makefile extra/Makefile mysys/Makefile isam/Makefile \
|
||||
strings/Makefile regex/Makefile heap/Makefile \
|
||||
bdb/Makefile \
|
||||
myisam/Makefile myisammrg/Makefile \
|
||||
os2/Makefile os2/include/Makefile os2/include/sys/Makefile \
|
||||
man/Makefile BUILD/Makefile readline/Makefile vio/Makefile \
|
||||
libmysql_r/Makefile libmysqld/Makefile libmysqld/examples/Makefile \
|
||||
libmysql/Makefile client/Makefile \
|
||||
pstack/Makefile pstack/aout/Makefile sql/Makefile sql/share/Makefile \
|
||||
merge/Makefile dbug/Makefile scripts/Makefile \
|
||||
include/Makefile sql-bench/Makefile tools/Makefile \
|
||||
tests/Makefile Docs/Makefile support-files/Makefile \
|
||||
mysql-test/Makefile \
|
||||
include/mysql_version.h
|
||||
AC_OUTPUT(Makefile extra/Makefile mysys/Makefile isam/Makefile dnl
|
||||
strings/Makefile regex/Makefile heap/Makefile dnl
|
||||
bdb/Makefile dnl
|
||||
myisam/Makefile myisammrg/Makefile dnl
|
||||
os2/Makefile os2/include/Makefile os2/include/sys/Makefile dnl
|
||||
man/Makefile BUILD/Makefile readline/Makefile vio/Makefile dnl
|
||||
libmysql_r/Makefile libmysqld/Makefile libmysqld/examples/Makefile dnl
|
||||
libmysql/Makefile client/Makefile dnl
|
||||
pstack/Makefile pstack/aout/Makefile sql/Makefile sql/share/Makefile dnl
|
||||
merge/Makefile dbug/Makefile scripts/Makefile dnl
|
||||
include/Makefile sql-bench/Makefile tools/Makefile dnl
|
||||
tests/Makefile Docs/Makefile support-files/Makefile dnl
|
||||
mysql-test/Makefile dnl
|
||||
netware/Makefile dnl
|
||||
include/mysql_version.h dnl
|
||||
, , [
|
||||
test -z "$CONFIG_HEADERS" || echo timestamp > stamp-h
|
||||
])
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
|
||||
/* 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 <m_ctype.h>
|
||||
|
@ -147,8 +147,11 @@ int main(int argc, char **argv)
|
|||
else
|
||||
{
|
||||
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++)
|
||||
(void) printf(", %s", *q);
|
||||
#endif /* __NETWARE__ */
|
||||
puts("");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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 \
|
||||
my_getopt.h sslopt-longopts.h \
|
||||
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\
|
||||
myisam.h myisampack.h myisammrg.h ft_global.h\
|
||||
my_dir.h mysys_err.h my_base.h \
|
||||
|
|
86
include/config-netware.h
Normal file
86
include/config-netware.h
Normal 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; }
|
|
@ -182,6 +182,8 @@ inline double ulonglong2double(ulonglong value)
|
|||
#define tell(A) _telli64(A)
|
||||
#endif
|
||||
|
||||
#define set_timespec(ABSTIME,SEC) { (ABSTIME).tv_sec=time((time_t*)0) + (time_t) (SEC); (ABSTIME).tv_nsec=0; }
|
||||
|
||||
#define STACK_DIRECTION -1
|
||||
|
||||
/* 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_const_cast(A) const_cast<A>
|
||||
|
||||
|
||||
/* MYSQL OPTIONS */
|
||||
|
||||
#ifdef _CUSTOMCONFIG_
|
||||
|
|
|
@ -51,6 +51,12 @@
|
|||
#include <config-win.h>
|
||||
#elif defined(OS2)
|
||||
#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
|
||||
#include <my_config.h>
|
||||
#if defined(__cplusplus) && defined(inline)
|
||||
|
@ -442,17 +448,20 @@ typedef SOCKET_SIZE_TYPE size_socket;
|
|||
|
||||
/* file create flags */
|
||||
|
||||
#ifndef O_SHARE
|
||||
#ifndef O_SHARE /* Probably not windows */
|
||||
#define O_SHARE 0 /* Flag to my_open for shared files */
|
||||
#ifndef O_BINARY
|
||||
#define O_BINARY 0 /* Flag to my_open for binary files */
|
||||
#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
|
||||
#define HAVE_FCNTL_LOCK
|
||||
#define F_TO_EOF 0L /* Param to lockf() to lock rest of file */
|
||||
#endif
|
||||
#endif /* O_SHARE */
|
||||
|
||||
#ifndef O_TEMPORARY
|
||||
#define O_TEMPORARY 0
|
||||
#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_WRITE 1000 /* How often we want info on screen */
|
||||
|
||||
#ifndef set_timespec
|
||||
#ifdef HAVE_TIMESPEC_TS_SEC
|
||||
#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
|
||||
#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_nsec=tv.tv_usec*1000;\
|
||||
}
|
||||
#endif
|
||||
#endif /* HAVE_TIMESPEC_TS_SEC */
|
||||
#endif /* set_timespec */
|
||||
|
||||
/*
|
||||
Define-funktions for reading and storing in machine independent format
|
||||
|
|
|
@ -44,7 +44,7 @@ C_MODE_START
|
|||
#include <sys/ioctl.h>
|
||||
#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.h>
|
||||
#include <netinet/ip.h>
|
||||
|
|
|
@ -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))
|
||||
#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)
|
||||
#define my_pthread_getspecific(T,A) ((T) &(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 */
|
||||
|
||||
#if defined(__NETWARE__) && !defined(SAFE_MUTEX_DETECT_DESTROY)
|
||||
#define SAFE_MUTEX_DETECT_DESTROY
|
||||
#endif
|
||||
|
||||
typedef struct st_safe_mutex_t
|
||||
{
|
||||
pthread_mutex_t global,mutex;
|
||||
char *file;
|
||||
uint line,count;
|
||||
pthread_t thread;
|
||||
#ifdef SAFE_MUTEX_DETECT_DESTROY
|
||||
struct st_safe_mutex_info_t *info; /* to track destroying of mutexes */
|
||||
#endif
|
||||
} 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_unlock(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);
|
||||
int safe_cond_timedwait(pthread_cond_t *cond, safe_mutex_t *mp,
|
||||
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 */
|
||||
#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_timedwait
|
||||
#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_unlock(A) safe_mutex_unlock((A),__FILE__,__LINE__)
|
||||
#define pthread_mutex_destroy(A) safe_mutex_destroy((A),__FILE__,__LINE__)
|
||||
|
|
|
@ -731,29 +731,32 @@ extern void my_free_lock(byte *ptr,myf flags);
|
|||
#define my_free_lock(A,B) my_free((A),(B))
|
||||
#endif
|
||||
#define alloc_root_inited(A) ((A)->min_malloc != 0)
|
||||
void init_alloc_root(MEM_ROOT *mem_root, uint block_size, uint pre_alloc_size);
|
||||
gptr alloc_root(MEM_ROOT *mem_root,unsigned int Size);
|
||||
void free_root(MEM_ROOT *root, myf MyFLAGS);
|
||||
void set_prealloc_root(MEM_ROOT *root, char *ptr);
|
||||
char *strdup_root(MEM_ROOT *root,const char *str);
|
||||
char *strmake_root(MEM_ROOT *root,const char *str,uint len);
|
||||
char *memdup_root(MEM_ROOT *root,const char *str,uint len);
|
||||
void load_defaults(const char *conf_file, const char **groups,
|
||||
int *argc, char ***argv);
|
||||
void free_defaults(char **argv);
|
||||
void print_defaults(const char *conf_file, const char **groups);
|
||||
my_bool my_compress(byte *, ulong *, ulong *);
|
||||
my_bool my_uncompress(byte *, ulong *, ulong *);
|
||||
byte *my_compress_alloc(const byte *packet, ulong *len, ulong *complen);
|
||||
ulong checksum(const byte *mem, uint count);
|
||||
uint my_bit_log2(ulong value);
|
||||
extern void init_alloc_root(MEM_ROOT *mem_root, uint block_size,
|
||||
uint pre_alloc_size);
|
||||
extern gptr alloc_root(MEM_ROOT *mem_root,unsigned int Size);
|
||||
extern void free_root(MEM_ROOT *root, myf MyFLAGS);
|
||||
extern void set_prealloc_root(MEM_ROOT *root, char *ptr);
|
||||
extern char *strdup_root(MEM_ROOT *root,const char *str);
|
||||
extern char *strmake_root(MEM_ROOT *root,const char *str,uint len);
|
||||
extern char *memdup_root(MEM_ROOT *root,const char *str,uint len);
|
||||
extern void load_defaults(const char *conf_file, const char **groups,
|
||||
int *argc, char ***argv);
|
||||
extern void free_defaults(char **argv);
|
||||
extern void print_defaults(const char *conf_file, const char **groups);
|
||||
extern my_bool my_compress(byte *, ulong *, ulong *);
|
||||
extern my_bool my_uncompress(byte *, ulong *, ulong *);
|
||||
extern byte *my_compress_alloc(const byte *packet, ulong *len, ulong *complen);
|
||||
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__
|
||||
extern my_bool have_tcpip; /* Is set if tcpip is used */
|
||||
#endif
|
||||
#ifdef __NETWARE__
|
||||
void netware_reg_user(const char *ip, const char *user,
|
||||
const char *application);
|
||||
#endif
|
||||
|
||||
C_MODE_END
|
||||
#include "raid.h"
|
||||
|
|
|
@ -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
|
||||
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 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_NOT_NULL(n) ((n) & NOT_NULL_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,
|
||||
const char *arg, unsigned long length, my_bool skipp_check);
|
||||
unsigned long net_safe_read(MYSQL* mysql);
|
||||
void STDCALL mysql_once_init(void);
|
||||
|
||||
#ifdef __NETWARE__
|
||||
#pragma pack(pop) /* restore alignment */
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -608,7 +608,7 @@ btr_cur_open_at_index_side(
|
|||
if (estimate) {
|
||||
btr_cur_add_path_info(cursor, height,
|
||||
root_height);
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
@ -622,8 +622,8 @@ btr_cur_open_at_index_side(
|
|||
}
|
||||
|
||||
if (estimate) {
|
||||
btr_cur_add_path_info(cursor, height, root_height);
|
||||
}
|
||||
btr_cur_add_path_info(cursor, height, root_height);
|
||||
}
|
||||
|
||||
height--;
|
||||
|
||||
|
|
|
@ -110,14 +110,14 @@ case "$target" in
|
|||
CFLAGS="$CFLAGS -DUNIV_INTEL_X86";;
|
||||
esac
|
||||
|
||||
AC_OUTPUT(Makefile os/Makefile ut/Makefile btr/Makefile
|
||||
buf/Makefile com/Makefile data/Makefile
|
||||
dict/Makefile dyn/Makefile
|
||||
eval/Makefile fil/Makefile fsp/Makefile fut/Makefile
|
||||
ha/Makefile ibuf/Makefile include/Makefile
|
||||
lock/Makefile log/Makefile
|
||||
mach/Makefile mem/Makefile mtr/Makefile odbc/Makefile
|
||||
page/Makefile pars/Makefile que/Makefile
|
||||
read/Makefile rem/Makefile row/Makefile
|
||||
srv/Makefile sync/Makefile thr/Makefile trx/Makefile
|
||||
AC_OUTPUT(Makefile os/Makefile ut/Makefile btr/Makefile dnl
|
||||
buf/Makefile com/Makefile data/Makefile dnl
|
||||
dict/Makefile dyn/Makefile dnl
|
||||
eval/Makefile fil/Makefile fsp/Makefile fut/Makefile dnl
|
||||
ha/Makefile ibuf/Makefile include/Makefile dnl
|
||||
lock/Makefile log/Makefile dnl
|
||||
mach/Makefile mem/Makefile mtr/Makefile odbc/Makefile dnl
|
||||
page/Makefile pars/Makefile que/Makefile dnl
|
||||
read/Makefile rem/Makefile row/Makefile dnl
|
||||
srv/Makefile sync/Makefile thr/Makefile trx/Makefile dnl
|
||||
usr/Makefile)
|
||||
|
|
|
@ -15,9 +15,10 @@ Created 9/8/1995 Heikki Tuuri
|
|||
/* 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
|
||||
can wait inside InnoDB */
|
||||
#ifdef __WIN__
|
||||
#if defined(__WIN__) || defined(__NETWARE__)
|
||||
/* Create less event semaphores because Win 98/ME had difficult creating
|
||||
40000 event semaphores */
|
||||
/* TODO: these just take a lot of memory on NetWare. should netware move up? */
|
||||
#define OS_THREAD_MAX_N 1000
|
||||
#else
|
||||
#define OS_THREAD_MAX_N 10000
|
||||
|
|
|
@ -8,6 +8,7 @@ Created 10/21/1995 Heikki Tuuri
|
|||
|
||||
#include "os0file.h"
|
||||
#include "os0sync.h"
|
||||
#include "os0thread.h"
|
||||
#include "ut0mem.h"
|
||||
#include "srv0srv.h"
|
||||
#include "fil0fil.h"
|
||||
|
@ -1093,6 +1094,7 @@ os_file_write(
|
|||
DWORD low;
|
||||
DWORD high;
|
||||
ulint i;
|
||||
ulint n_retries = 0;
|
||||
|
||||
ut_a((offset & 0xFFFFFFFF) == offset);
|
||||
|
||||
|
@ -1101,7 +1103,7 @@ os_file_write(
|
|||
ut_ad(file);
|
||||
ut_ad(buf);
|
||||
ut_ad(n > 0);
|
||||
|
||||
retry:
|
||||
low = offset;
|
||||
high = offset_high;
|
||||
|
||||
|
@ -1145,6 +1147,19 @@ os_file_write(
|
|||
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) {
|
||||
|
||||
ut_print_timestamp(stderr);
|
||||
|
@ -1157,7 +1172,7 @@ os_file_write(
|
|||
"InnoDB: what the error number means.\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",
|
||||
name, offset_high, offset, n, len,
|
||||
name, offset_high, offset, n, (ulint)len,
|
||||
(ulint)GetLastError());
|
||||
|
||||
os_has_said_disk_full = TRUE;
|
||||
|
@ -1180,13 +1195,13 @@ os_file_write(
|
|||
|
||||
fprintf(stderr,
|
||||
" 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: 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: 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",
|
||||
name, offset_high, offset, n, (ulint)ret,
|
||||
name, offset_high, offset, n, (long int)ret,
|
||||
(ulint)errno);
|
||||
os_has_said_disk_full = TRUE;
|
||||
}
|
||||
|
|
|
@ -495,6 +495,8 @@ os_fast_mutex_free(
|
|||
ut_a(fast_mutex);
|
||||
|
||||
DeleteCriticalSection((LPCRITICAL_SECTION) fast_mutex);
|
||||
#elif defined(__NETWARE__) || defined(SAFE_MUTEX_DETECT_DESTROY)
|
||||
pthread_mutex_destroy(fast_mutex);
|
||||
#else
|
||||
UT_NOT_USED(fast_mutex);
|
||||
|
||||
|
|
|
@ -214,6 +214,8 @@ os_thread_sleep(
|
|||
{
|
||||
#ifdef __WIN__
|
||||
Sleep(tm / 1000);
|
||||
#elif defined(__NETWARE__)
|
||||
delay(tm / 1000);
|
||||
#else
|
||||
struct timeval t;
|
||||
|
||||
|
|
|
@ -1700,8 +1700,63 @@ srv_general_init(void)
|
|||
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 =======================*/
|
||||
|
||||
#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
|
||||
(>= srv_thread_concurrency) inside InnoDB. The threads wait in a FIFO queue. */
|
||||
|
|
|
@ -1415,6 +1415,10 @@ innobase_start_or_create_for_mysql(void)
|
|||
|
||||
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) {
|
||||
ut_print_timestamp(stderr);
|
||||
fprintf(stderr, " InnoDB: Started\n");
|
||||
|
@ -1461,12 +1465,28 @@ innobase_shutdown_for_mysql(void)
|
|||
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
|
||||
before freeing all memory. Now this can potentially cause a seg
|
||||
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();
|
||||
#endif
|
||||
|
||||
|
|
|
@ -220,7 +220,7 @@ mutex_create_func(
|
|||
char* cfile_name, /* in: file name 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);
|
||||
#else
|
||||
os_fast_mutex_init(&(mutex->os_fast_mutex));
|
||||
|
|
14
isam/test3.c
14
isam/test3.c
|
@ -16,6 +16,8 @@
|
|||
|
||||
/* Test av locking */
|
||||
|
||||
#ifndef __NETWARE__
|
||||
|
||||
#include "nisam.h"
|
||||
#include <sys/types.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);
|
||||
return 0;
|
||||
}
|
||||
|
||||
#else /* __NETWARE__ */
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
main()
|
||||
{
|
||||
fprintf(stderr,"this test has not been ported to NetWare\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif /* __NETWARE__ */
|
||||
|
|
|
@ -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 \
|
||||
my_compress.lo array.lo my_once.lo list.lo my_net.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_getopt.lo my_gethostbyname.lo my_port.lo
|
||||
sqlobjects = net.lo
|
||||
|
|
|
@ -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
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -34,7 +34,7 @@
|
|||
#include <pwd.h>
|
||||
#endif /* HAVE_PWD_H */
|
||||
#else /* ! HAVE_GETPASS */
|
||||
#if !defined( __WIN__) && !defined(OS2)
|
||||
#if !defined(__WIN__) && !defined(OS2) && !defined(__NETWARE__)
|
||||
#include <sys/ioctl.h>
|
||||
#ifdef HAVE_TERMIOS_H /* For tty-password */
|
||||
#include <termios.h>
|
||||
|
@ -53,7 +53,9 @@
|
|||
#include <asm/termiobits.h>
|
||||
#endif
|
||||
#else
|
||||
#ifndef __NETWARE__
|
||||
#include <conio.h>
|
||||
#endif /* __NETWARE__ */
|
||||
#endif /* __WIN__ */
|
||||
#endif /* HAVE_GETPASS */
|
||||
|
||||
|
@ -61,9 +63,16 @@
|
|||
#define getpass(A) getpassphrase(A)
|
||||
#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 */
|
||||
|
||||
#ifdef __NETWARE__
|
||||
#undef _getch
|
||||
#undef _cputs
|
||||
#define _getch getcharacter
|
||||
#define _cputs(A) putstring(A)
|
||||
#endif
|
||||
|
||||
char *get_tty_password(char *opt_message)
|
||||
{
|
||||
char to[80];
|
||||
|
@ -100,12 +109,11 @@ char *get_tty_password(char *opt_message)
|
|||
|
||||
#else
|
||||
|
||||
|
||||
#ifndef HAVE_GETPASS
|
||||
/*
|
||||
** Can't use fgets, because readline will get confused
|
||||
** length is max number of chars in to, not counting \0
|
||||
* to will not include the eol characters.
|
||||
Can't use fgets, because readline will get confused
|
||||
length is max number of chars in to, not counting \0
|
||||
to will not include the eol characters.
|
||||
*/
|
||||
|
||||
static void get_password(char *to,uint length,int fd,bool echo)
|
||||
|
|
|
@ -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
|
||||
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
|
||||
|
||||
#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)
|
||||
#else
|
||||
#include <errno.h>
|
||||
#define SOCKET_ERROR -1
|
||||
#endif /* __WIN__ */
|
||||
|
||||
static void mysql_once_init(void);
|
||||
static MYSQL_DATA *read_rows (MYSQL *mysql,MYSQL_FIELD *fields,
|
||||
uint field_count);
|
||||
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 **groups __attribute__((unused)))
|
||||
{
|
||||
mysql_once_init();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -108,6 +108,8 @@ void STDCALL mysql_server_end()
|
|||
/* If library called my_init(), free memory allocated by it */
|
||||
if (!org_my_init_done)
|
||||
my_end(0);
|
||||
else
|
||||
mysql_thread_end();
|
||||
}
|
||||
|
||||
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,
|
||||
uint timeout)
|
||||
{
|
||||
#if defined(__WIN__) || defined(OS2)
|
||||
#if defined(__WIN__) || defined(OS2) || defined(__NETWARE__)
|
||||
return connect(s, (struct sockaddr*) name, namelen);
|
||||
#else
|
||||
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,
|
||||
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);
|
||||
if (mysql_reconnect(mysql))
|
||||
goto end;
|
||||
|
@ -522,7 +531,16 @@ struct passwd *getpwuid(uid_t);
|
|||
char* getlogin(void);
|
||||
#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)
|
||||
{
|
||||
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)
|
||||
{
|
||||
|
|
|
@ -34,6 +34,10 @@
|
|||
|
||||
#if defined(OS2)
|
||||
# include <sys/un.h>
|
||||
#elif defined(__NETWARE__)
|
||||
#include <netdb.h>
|
||||
#include <sys/select.h>
|
||||
#include <sys/utsname.h>
|
||||
#elif !defined( __WIN__)
|
||||
#include <sys/resource.h>
|
||||
#ifdef HAVE_SYS_UN_H
|
||||
|
|
2
ltconfig
2
ltconfig
|
@ -3013,7 +3013,7 @@ hardcode_libdir_flag_spec=$hardcode_libdir_flag_spec
|
|||
# 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
|
||||
# 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
|
||||
# so it is overridden.
|
||||
hardcode_libdir_flag_spec=" -D_DEBIAN_PATCHED_LIBTOOL_ "
|
||||
|
|
|
@ -16,6 +16,8 @@
|
|||
|
||||
/* Test av locking */
|
||||
|
||||
#ifndef __NETWARE__
|
||||
|
||||
#include "myisam.h"
|
||||
#include <sys/types.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);
|
||||
return 0;
|
||||
}
|
||||
|
||||
#else /* __NETWARE__ */
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
main()
|
||||
{
|
||||
fprintf(stderr,"this test has not been ported to NetWare\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif /* __NETWARE__ */
|
||||
|
|
4
mysql-test/include/have_crypt.inc
Normal file
4
mysql-test/include/have_crypt.inc
Normal file
|
@ -0,0 +1,4 @@
|
|||
-- require r/have_crypt.require
|
||||
disable_query_log;
|
||||
show variables like "have_crypt";
|
||||
enable_query_log;
|
|
@ -106,6 +106,7 @@ TAIL=tail
|
|||
ECHO=echo # use internal echo if possible
|
||||
EXPR=expr # use internal if possible
|
||||
FIND=find
|
||||
GREP=grep
|
||||
if test $? != 0; then exit 1; fi
|
||||
PRINTF=printf
|
||||
RM=rm
|
||||
|
@ -605,6 +606,30 @@ report_stats () {
|
|||
$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"
|
||||
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 () {
|
||||
|
|
|
@ -36,6 +36,10 @@ select t2.isbn,city,t1.libname,count(distinct t1.libname) as a from t3 left join
|
|||
isbn city libname a
|
||||
007 Berkeley Berkeley Public1 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;
|
||||
create table t1 (f1 int);
|
||||
insert into t1 values (1);
|
||||
|
|
|
@ -32,6 +32,11 @@ userid MIN(t1.score)
|
|||
1 1
|
||||
2 2
|
||||
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;
|
||||
userid MIN(t1.score)
|
||||
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)
|
||||
1 1.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;
|
||||
CREATE TABLE t1 (
|
||||
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);
|
||||
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)
|
||||
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;
|
||||
cid CONCAT(firstname, ' ', surname) COUNT(call_id)
|
||||
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;
|
||||
table type possible_keys key key_len ref rows Extra
|
||||
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;
|
||||
userid count(*)
|
||||
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;
|
||||
table type possible_keys key key_len ref rows Extra
|
||||
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;
|
||||
spid count(*)
|
||||
1 1
|
||||
|
@ -264,6 +281,9 @@ spid count(*)
|
|||
explain select sql_big_result spid,sum(userid) from t1 group by spid desc;
|
||||
table type possible_keys key key_len ref rows Extra
|
||||
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;
|
||||
spid sum(userid)
|
||||
5 3
|
||||
|
@ -274,6 +294,9 @@ spid sum(userid)
|
|||
explain select sql_big_result score,count(*) from t1 group by score desc;
|
||||
table type possible_keys key key_len ref rows Extra
|
||||
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;
|
||||
score count(*)
|
||||
3 3
|
||||
|
@ -481,3 +504,28 @@ NULL 9
|
|||
3
|
||||
b 1
|
||||
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;
|
||||
|
|
2
mysql-test/r/have_crypt.require
Normal file
2
mysql-test/r/have_crypt.require
Normal file
|
@ -0,0 +1,2 @@
|
|||
Variable_name Value
|
||||
have_crypt YES
|
|
@ -8,6 +8,7 @@ drop database if exists foo;
|
|||
create database foo;
|
||||
drop database if exists bar;
|
||||
create database bar;
|
||||
create database foo;
|
||||
drop table if exists foo.foo;
|
||||
create table foo.foo (n int);
|
||||
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;
|
||||
n m
|
||||
4 15
|
||||
drop database if exists bar;
|
||||
drop database if exists foo;
|
||||
drop database if exists bar;
|
||||
drop database bar;
|
||||
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;
|
||||
create database foo;
|
||||
create database bar;
|
||||
|
|
15
mysql-test/r/rpl_insert_id.result
Normal file
15
mysql-test/r/rpl_insert_id.result
Normal 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
|
9
mysql-test/r/rpl_master_pos_wait.result
Normal file
9
mysql-test/r/rpl_master_pos_wait.result
Normal 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
|
|
@ -4,7 +4,7 @@ connection con1;
|
|||
set SQL_LOG_BIN=0;
|
||||
drop table if exists t1;
|
||||
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 '../tmp';
|
||||
drop table t1;
|
||||
|
|
|
@ -31,6 +31,7 @@ insert into t1 values ('Berkeley Public2','Berkeley');
|
|||
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(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;
|
||||
|
||||
#
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
-- source include/have_crypt.inc
|
||||
|
||||
select length(encrypt('foo', 'ff')) <> 0;
|
||||
--replace_result $1$aa$4OSUA5cjdx0RUQ08opV27/ aaqPiZY5xR5l.
|
||||
select password('test'),length(encrypt('test')),encrypt('test','aa');
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
drop table if exists test.t1,mysqltest.t1,mysqltest.t2;
|
||||
reset query cache;
|
||||
flush status;
|
||||
connect (root,localhost,root,,test,0,master.sock);
|
||||
connect (root,localhost,root,,test,$MASTER_MYPORT,master.sock);
|
||||
connection root;
|
||||
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));
|
||||
insert into test.t1 values ("test.t1");
|
||||
select * from t1;
|
||||
connect (root2,localhost,root,,mysqltest,0,master.sock);
|
||||
connect (root2,localhost,root,,mysqltest,$MASTER_MYPORT,master.sock);
|
||||
connection root2;
|
||||
# put queries in cache
|
||||
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;
|
||||
|
||||
# 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;
|
||||
select "user1";
|
||||
select * from t1;
|
||||
|
@ -47,13 +47,14 @@ show status like "Qcache_hits";
|
|||
show status like "Qcache_not_cached";
|
||||
|
||||
# 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;
|
||||
select "user2";
|
||||
select * from t1;
|
||||
select a from t1;
|
||||
select c from t1;
|
||||
select * from mysqltest.t1,test.t1;
|
||||
--replace_result 127.0.0.1 localhost
|
||||
--error 1142
|
||||
select * from t2;
|
||||
show status like "Qcache_queries_in_cache";
|
||||
|
@ -61,16 +62,20 @@ show status like "Qcache_hits";
|
|||
show status like "Qcache_not_cached";
|
||||
|
||||
# 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;
|
||||
select "user3";
|
||||
--replace_result 127.0.0.1 localhost
|
||||
--error 1143
|
||||
select * from t1;
|
||||
select a from t1;
|
||||
--replace_result 127.0.0.1 localhost
|
||||
--error 1143
|
||||
select c from t1;
|
||||
--replace_result 127.0.0.1 localhost
|
||||
--error 1142
|
||||
select * from t2;
|
||||
--replace_result 127.0.0.1 localhost
|
||||
--error 1143
|
||||
select mysqltest.t1.c from test.t1,mysqltest.t1;
|
||||
show status like "Qcache_queries_in_cache";
|
||||
|
@ -78,7 +83,7 @@ show status like "Qcache_hits";
|
|||
show status like "Qcache_not_cached";
|
||||
|
||||
# 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;
|
||||
select "user4";
|
||||
--error 1046
|
||||
|
|
|
@ -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');
|
||||
|
||||
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+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;
|
||||
|
||||
#
|
||||
|
@ -100,6 +102,7 @@ INSERT INTO t2 VALUES (91,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 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;
|
||||
|
||||
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);
|
||||
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 having (count(*)+1) IN (4,3);
|
||||
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;
|
||||
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 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;
|
||||
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;
|
||||
drop table t1;
|
||||
|
||||
|
@ -365,3 +372,17 @@ select a,count(*) from t1 group by a;
|
|||
set option sql_big_tables=1;
|
||||
select a,count(*) from t1 group by a;
|
||||
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;
|
||||
|
|
|
@ -9,6 +9,7 @@ create database bar;
|
|||
save_master_pos;
|
||||
connection slave;
|
||||
sync_with_master;
|
||||
create database foo;
|
||||
drop table if exists foo.foo;
|
||||
create table foo.foo (n int);
|
||||
insert into foo.foo values(4);
|
||||
|
@ -24,13 +25,14 @@ connection slave;
|
|||
sync_with_master;
|
||||
select foo.foo.n,bar.bar.m from foo.foo,bar.bar;
|
||||
connection master;
|
||||
drop database if exists bar;
|
||||
drop database bar;
|
||||
drop database if exists foo;
|
||||
save_master_pos;
|
||||
connection slave;
|
||||
sync_with_master;
|
||||
drop database if exists bar;
|
||||
drop database if exists foo;
|
||||
--error 1008
|
||||
drop database bar;
|
||||
drop database foo;
|
||||
|
||||
# Now let's test load data from master
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
connect (master,localhost,root,,test,0,master.sock);
|
||||
connect (slave,localhost,root,,test,0, slave.sock);
|
||||
connect (master,localhost,root,,test,$MASTER_MYPORT,master.sock);
|
||||
connect (slave,localhost,root,,test,$SLAVE_MYPORT,slave.sock);
|
||||
connection master;
|
||||
reset master;
|
||||
show master status;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
connect (master,localhost,root,,test,0,master.sock);
|
||||
connect (slave,localhost,root,,test,0,slave.sock);
|
||||
connect (master,localhost,root,,test,$MASTER_MYPORT,master.sock);
|
||||
connect (slave,localhost,root,,test,$SLAVE_MYPORT,slave.sock);
|
||||
connection master;
|
||||
reset master;
|
||||
grant replication slave on *.* to replicate@localhost identified by 'aaaaaaaaaaaaaaab';
|
||||
|
|
39
mysql-test/t/rpl_insert_id.test
Normal file
39
mysql-test/t/rpl_insert_id.test
Normal 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;
|
9
mysql-test/t/rpl_master_pos_wait.test
Normal file
9
mysql-test/t/rpl_master_pos_wait.test
Normal 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);
|
|
@ -9,9 +9,9 @@
|
|||
# changes
|
||||
# - 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;
|
||||
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 chmod 000 var/slave-data/master.info;
|
||||
connection slave;
|
||||
|
|
|
@ -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_getopt.c my_mkdir.c \
|
||||
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_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 \
|
||||
thr_mutex.c thr_rwlock.c
|
||||
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
|
||||
#
|
||||
|
||||
test_thr_alarm: thr_alarm.c $(LIBRARIES)
|
||||
test_thr_alarm$(EXEEXT): thr_alarm.c $(LIBRARIES)
|
||||
$(CP) $(srcdir)/thr_alarm.c ./test_thr_alarm.c
|
||||
$(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
|
||||
$(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
|
||||
$(LINK) $(FLAGS) -DMAIN ./test_vsnprintf.c $(LDADD) $(LIBS)
|
||||
$(RM) -f test_vsnprintf.*
|
||||
test_io_cache: mf_iocache.c $(LIBRARIES)
|
||||
$(RM) -f test_vsnprintf.c
|
||||
test_io_cache$(EXEEXT): mf_iocache.c $(LIBRARIES)
|
||||
$(CP) $(srcdir)/mf_iocache.c test_io_cache.c
|
||||
$(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)
|
||||
|
||||
test_charset$(EXEEXT): test_charset.c $(LIBRARIES)
|
||||
$(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)
|
||||
|
||||
# Don't update the files from bitkeeper
|
||||
|
|
|
@ -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)
|
||||
#endif
|
||||
{
|
||||
my_bool error=0;
|
||||
/*
|
||||
|
|
|
@ -46,6 +46,8 @@ char *defaults_extra_file=0;
|
|||
const char *default_directories[]= {
|
||||
#ifdef __WIN__
|
||||
"C:/",
|
||||
#elif defined(__NETWARE__)
|
||||
"sys:/etc/",
|
||||
#else
|
||||
"/etc/",
|
||||
#endif
|
||||
|
@ -53,7 +55,7 @@ const char *default_directories[]= {
|
|||
DATADIR,
|
||||
#endif
|
||||
"", /* Place for defaults_extra_dir */
|
||||
#ifndef __WIN__
|
||||
#if !defined(__WIN__) && !defined(__NETWARE__)
|
||||
"~/",
|
||||
#endif
|
||||
NullS,
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
#endif
|
||||
|
||||
#ifdef HAVE_TEMPNAM
|
||||
#if !defined( MSDOS) && !defined(OS2)
|
||||
#if !defined(MSDOS) && !defined(OS2) && !defined(__NETWARE__)
|
||||
extern char **environ;
|
||||
#endif
|
||||
#endif
|
||||
|
@ -129,7 +129,7 @@ File create_temp_file(char *to, const char *dir, const char *prefix,
|
|||
if (buffer[strlen(buffer)-1] == '\\')
|
||||
buffer[strlen(buffer)-1] = '\0';
|
||||
putenv( buffer);
|
||||
#else
|
||||
#elif !defined(__NETWARE__)
|
||||
old_env= (char**) environ;
|
||||
if (dir)
|
||||
{ /* 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));
|
||||
}
|
||||
#ifndef OS2
|
||||
#if !defined(OS2) && !defined(__NETWARE__)
|
||||
environ=(const char**) old_env;
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -17,14 +17,14 @@
|
|||
#define USES_TYPES
|
||||
#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 <sys/times.h>
|
||||
#endif
|
||||
|
||||
long my_clock(void)
|
||||
{
|
||||
#if !defined(MSDOS) && !defined(__WIN__) && !defined(OS2)
|
||||
#if !defined(MSDOS) && !defined(__WIN__) && !defined(OS2) && !defined(__NETWARE__)
|
||||
struct tms tmsbuf;
|
||||
VOID(times(&tmsbuf));
|
||||
return (tmsbuf.tms_utime + tmsbuf.tms_stime);
|
||||
|
|
|
@ -80,7 +80,7 @@ int my_copy(const char *from, const char *to, myf MyFlags)
|
|||
if (MyFlags & MY_HOLD_ORIGINAL_MODES && new_file_stat)
|
||||
DBUG_RETURN(0); /* File copyed but not stat */
|
||||
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 */
|
||||
#endif
|
||||
#if !defined(VMS) && !defined(__ZTC__)
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
#endif
|
||||
|
||||
#ifdef __EMX__
|
||||
// chdir2 support also drive change
|
||||
/* chdir2 support also drive change */
|
||||
#define chdir _chdir2
|
||||
#endif
|
||||
|
||||
|
|
107
mysys/my_init.c
107
mysys/my_init.c
|
@ -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
|
||||
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
|
||||
#define my_win_init()
|
||||
#endif
|
||||
#ifdef __NETWARE__
|
||||
static void netware_init();
|
||||
#else
|
||||
#define netware_init()
|
||||
#endif
|
||||
|
||||
|
||||
my_bool my_init_done=0;
|
||||
|
||||
|
@ -64,12 +70,16 @@ void my_init(void)
|
|||
if (my_init_done)
|
||||
return;
|
||||
my_init_done=1;
|
||||
#if defined(THREAD) && defined(SAFE_MUTEX)
|
||||
safe_mutex_global_init(); /* Must be called early */
|
||||
#endif
|
||||
netware_init();
|
||||
#ifdef THREAD
|
||||
#if defined(HAVE_PTHREAD_INIT)
|
||||
pthread_init(); /* Must be called before DBUG_ENTER */
|
||||
#endif
|
||||
my_thread_global_init();
|
||||
#if !defined( __WIN__) && !defined(OS2)
|
||||
#if !defined( __WIN__) && !defined(OS2) && !defined(__NETWARE__)
|
||||
sigfillset(&my_signals); /* signals blocked by mf_brkhant */
|
||||
#endif
|
||||
#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_nvcsw, rus.ru_nivcsw);
|
||||
#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);
|
||||
#endif
|
||||
#if defined(SAFEMALLOC)
|
||||
|
@ -160,21 +170,27 @@ Voluntary context switches %ld, Involuntary context switches %ld\n",
|
|||
#endif
|
||||
}
|
||||
#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 */
|
||||
my_once_free();
|
||||
my_thread_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__
|
||||
if (have_tcpip);
|
||||
WSACleanup( );
|
||||
if (have_tcpip)
|
||||
WSACleanup();
|
||||
#endif /* __WIN__ */
|
||||
my_init_done=0;
|
||||
my_init_done=0;
|
||||
} /* my_end */
|
||||
|
||||
|
||||
#ifdef __WIN__
|
||||
|
||||
/*
|
||||
|
@ -263,10 +279,10 @@ static void my_win_init(void)
|
|||
|
||||
|
||||
/*------------------------------------------------------------------
|
||||
** Name: CheckForTcpip| Desc: checks if tcpip has been installed on system
|
||||
** According to Microsoft Developers documentation the first registry
|
||||
** entry should be enough to check if TCP/IP is installed, but as expected
|
||||
** this doesn't work on all Win32 machines :(
|
||||
Name: CheckForTcpip| Desc: checks if tcpip has been installed on system
|
||||
According to Microsoft Developers documentation the first registry
|
||||
entry should be enough to check if TCP/IP is installed, but as expected
|
||||
this doesn't work on all Win32 machines :(
|
||||
------------------------------------------------------------------*/
|
||||
|
||||
#define TCPIPKEY "SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters"
|
||||
|
@ -292,6 +308,7 @@ static my_bool win32_have_tcpip(void)
|
|||
return (TRUE);
|
||||
}
|
||||
|
||||
|
||||
static my_bool win32_init_tcp_ip()
|
||||
{
|
||||
if (win32_have_tcpip())
|
||||
|
@ -323,4 +340,64 @@ static my_bool win32_init_tcp_ip()
|
|||
}
|
||||
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__ */
|
||||
|
|
|
@ -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
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -30,6 +30,9 @@
|
|||
#define INCL_BASE
|
||||
#define INCL_NOPMAPI
|
||||
#include <os2emx.h>
|
||||
#endif
|
||||
#ifdef __NETWARE__
|
||||
#include <nks/fsio.h>
|
||||
#endif
|
||||
|
||||
/* 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
|
||||
int value;
|
||||
ALARM_VARIABLES;
|
||||
#endif
|
||||
#ifdef __NETWARE__
|
||||
int nxErrno;
|
||||
#endif
|
||||
DBUG_ENTER("my_lock");
|
||||
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)
|
||||
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))
|
||||
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_LOCKING */
|
||||
|
||||
#ifdef __NETWARE__
|
||||
my_errno = nxErrno;
|
||||
#else
|
||||
/* We got an error. We don't want EACCES errors */
|
||||
my_errno=(errno == EACCES) ? EAGAIN : errno ? errno : -1;
|
||||
#endif
|
||||
if (MyFlags & MY_WME)
|
||||
{
|
||||
if (locktype == F_UNLCK)
|
||||
|
|
|
@ -23,7 +23,11 @@ int my_message_no_curses(uint error __attribute__((unused)),
|
|||
DBUG_PRINT("enter",("message: %s",str));
|
||||
(void) fflush(stdout);
|
||||
if (MyFlags & ME_BELL)
|
||||
#ifdef __NETWARE__
|
||||
ringbell(); /* Bell */
|
||||
#else
|
||||
(void) fputc('\007',stderr); /* Bell */
|
||||
#endif /* __NETWARE__ */
|
||||
if (my_progname)
|
||||
{
|
||||
(void)fputs(my_progname,stderr); (void)fputs(": ",stderr);
|
||||
|
|
150
mysys/my_netware.c
Normal file
150
mysys/my_netware.c
Normal 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__ */
|
|
@ -26,7 +26,6 @@
|
|||
#include "mysys_priv.h"
|
||||
#if defined(THREAD) && defined(OS2)
|
||||
#include <m_string.h>
|
||||
//#undef getpid
|
||||
#include <process.h>
|
||||
#include <sys/timeb.h>
|
||||
|
||||
|
|
|
@ -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
|
||||
the following code, including the right to use the code in
|
||||
any manner without any demands from the other parties.
|
||||
|
@ -18,77 +18,79 @@
|
|||
Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
|
||||
MA 02111-1307, USA */
|
||||
|
||||
|
||||
/* Win32 directory search emulation */
|
||||
|
||||
#if defined(OS2)
|
||||
|
||||
//#define _DEBUG
|
||||
|
||||
long _findfirst( char* path, struct _finddata_t* dos_file)
|
||||
{
|
||||
HDIR hdir = HDIR_CREATE;
|
||||
APIRET rc;
|
||||
FILEFINDBUF3 buf3;
|
||||
ULONG entries = 1;
|
||||
HDIR hdir = HDIR_CREATE;
|
||||
APIRET rc;
|
||||
FILEFINDBUF3 buf3;
|
||||
ULONG entries = 1;
|
||||
|
||||
#ifdef _DEBUG
|
||||
printf( "_findfirst path %s\n", path);
|
||||
printf( "_findfirst path %s\n", path);
|
||||
#endif
|
||||
|
||||
memset( &buf3, 0, sizeof( buf3));
|
||||
rc = DosFindFirst(
|
||||
path, /* Address of the ASCIIZ path name of the file or subdirectory to be found. */
|
||||
&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. */
|
||||
&buf3, /* Result buffer. */
|
||||
sizeof( buf3), /* The length, in bytes, of pfindbuf. */
|
||||
&entries, /* Pointer to the number of entries: */
|
||||
FIL_STANDARD); /* The level of file information required. */
|
||||
memset( &buf3, 0, sizeof( buf3));
|
||||
rc = DosFindFirst(
|
||||
path, /* The ASCIIZ path name of the file or subdirectory to be found. */
|
||||
&hdir, /* The handle associated with this DosFindFirst request. */
|
||||
FILE_NORMAL | FILE_DIRECTORY, /* Attribute value that determines the file objects to be searched for. */
|
||||
&buf3, /* Result buffer. */
|
||||
sizeof( buf3), /* The length, in bytes, of pfindbuf. */
|
||||
&entries, /* Pointer to the number of entries: */
|
||||
FIL_STANDARD); /* The level of file information required. */
|
||||
|
||||
#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
|
||||
|
||||
if (rc /* && entries == 0 */)
|
||||
return -1;
|
||||
if (rc /* && entries == 0 */)
|
||||
return -1;
|
||||
|
||||
if (dos_file) {
|
||||
memset( dos_file, 0, sizeof( struct _finddata_t));
|
||||
strcpy( dos_file->name, buf3.achName);
|
||||
dos_file->size = buf3.cbFile;
|
||||
dos_file->attrib = buf3.attrFile;
|
||||
}
|
||||
return (ULONG) hdir;
|
||||
if (dos_file)
|
||||
{
|
||||
memset( dos_file, 0, sizeof( struct _finddata_t));
|
||||
strcpy( dos_file->name, buf3.achName);
|
||||
dos_file->size = buf3.cbFile;
|
||||
dos_file->attrib = buf3.attrFile;
|
||||
}
|
||||
return (ULONG) hdir;
|
||||
}
|
||||
|
||||
|
||||
long _findnext( long hdir, struct _finddata_t* dos_file)
|
||||
{
|
||||
APIRET rc;
|
||||
FILEFINDBUF3 buf3;
|
||||
ULONG entries = 1;
|
||||
APIRET rc;
|
||||
FILEFINDBUF3 buf3;
|
||||
ULONG entries = 1;
|
||||
|
||||
memset( &buf3, 0, sizeof( buf3));
|
||||
rc = DosFindNext(
|
||||
hdir,
|
||||
&buf3, /* Result buffer. */
|
||||
sizeof( buf3), /* The length, in bytes, of pfindbuf. */
|
||||
&entries); /* Pointer to the number of entries: */
|
||||
memset( &buf3, 0, sizeof( buf3));
|
||||
rc = DosFindNext(hdir,
|
||||
&buf3, /* Result buffer. */
|
||||
sizeof( buf3), /* Length, in bytes, of pfindbuf. */
|
||||
&entries); /* Pointer to the number of entries */
|
||||
|
||||
#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
|
||||
|
||||
if (rc /* && entries == 0 */)
|
||||
return -1;
|
||||
if (rc /* && entries == 0 */)
|
||||
return -1;
|
||||
|
||||
if (dos_file) {
|
||||
memset( dos_file, 0, sizeof( struct _finddata_t));
|
||||
strcpy( dos_file->name, buf3.achName);
|
||||
dos_file->size = buf3.cbFile;
|
||||
dos_file->attrib = buf3.attrFile;
|
||||
}
|
||||
return 0;
|
||||
if (dos_file)
|
||||
{
|
||||
memset( dos_file, 0, sizeof( struct _finddata_t));
|
||||
strcpy( dos_file->name, buf3.achName);
|
||||
dos_file->size = buf3.cbFile;
|
||||
dos_file->attrib = buf3.attrFile;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void _findclose( long hdir)
|
||||
|
@ -101,82 +103,82 @@ void _findclose( long hdir)
|
|||
#endif
|
||||
}
|
||||
|
||||
DIR* opendir( char* path)
|
||||
DIR* opendir(char* path)
|
||||
{
|
||||
DIR* dir = (DIR*) calloc( 1, sizeof( DIR));
|
||||
char buffer[260];
|
||||
APIRET rc;
|
||||
ULONG entries = 1;
|
||||
DIR* dir = (DIR*) calloc(1, sizeof( DIR));
|
||||
char buffer[260];
|
||||
APIRET rc;
|
||||
ULONG entries = 1;
|
||||
|
||||
strcpy( buffer, path);
|
||||
strcat( buffer, "*.*");
|
||||
strmov(strmov(buffer, path), "*.*");
|
||||
|
||||
#ifdef _DEBUG
|
||||
printf( "_findfirst path %s\n", buffer);
|
||||
printf( "_findfirst path %s\n", buffer);
|
||||
#endif
|
||||
|
||||
dir->hdir = HDIR_CREATE;
|
||||
memset( &dir->buf3, 0, sizeof( dir->buf3));
|
||||
rc = DosFindFirst(
|
||||
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. */
|
||||
FILE_NORMAL | FILE_DIRECTORY, /* Attribute value that determines the file objects to be searched for. */
|
||||
&dir->buf3, /* Result buffer. */
|
||||
sizeof( dir->buf3), /* The length, in bytes, of pfindbuf. */
|
||||
&entries, /* Pointer to the number of entries: */
|
||||
FIL_STANDARD); /* The level of file information required. */
|
||||
dir->hdir = HDIR_CREATE;
|
||||
memset( &dir->buf3, 0, sizeof( dir->buf3));
|
||||
rc = DosFindFirst(
|
||||
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. */
|
||||
FILE_NORMAL | FILE_DIRECTORY, /* Attribute value that determines the file objects to be searched for. */
|
||||
&dir->buf3, /* Result buffer. */
|
||||
sizeof( dir->buf3), /* The length, in bytes, of pfindbuf. */
|
||||
&entries, /* Pointer to the number of entries: */
|
||||
FIL_STANDARD); /* The level of file information required. */
|
||||
|
||||
#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
|
||||
|
||||
if (rc /* && entries == 0 */)
|
||||
return NULL;
|
||||
if (rc /* && entries == 0 */)
|
||||
return NULL;
|
||||
|
||||
return dir;
|
||||
return dir;
|
||||
}
|
||||
|
||||
|
||||
struct dirent* readdir( DIR* dir)
|
||||
{
|
||||
APIRET rc;
|
||||
//FILEFINDBUF3 buf3;
|
||||
ULONG entries = 1;
|
||||
APIRET rc;
|
||||
ULONG entries = 1;
|
||||
|
||||
if (!dir->buf3.achName[0]) // file not found on previous query
|
||||
return NULL;
|
||||
if (!dir->buf3.achName[0]) /* file not found on previous query */
|
||||
return NULL;
|
||||
|
||||
// copy last file name
|
||||
strcpy( dir->ent.d_name, dir->buf3.achName);
|
||||
/* copy last file name */
|
||||
strcpy( dir->ent.d_name, dir->buf3.achName);
|
||||
|
||||
// query next file
|
||||
memset( &dir->buf3, 0, sizeof( dir->buf3));
|
||||
rc = DosFindNext(
|
||||
dir->hdir,
|
||||
&dir->buf3, /* Result buffer. */
|
||||
sizeof( dir->buf3), /* The length, in bytes, of pfindbuf. */
|
||||
&entries); /* Pointer to the number of entries: */
|
||||
/* query next file */
|
||||
memset( &dir->buf3, 0, sizeof( dir->buf3));
|
||||
rc= DosFindNext(
|
||||
dir->hdir,
|
||||
&dir->buf3, /* Result buffer. */
|
||||
sizeof(dir->buf3), /* Length, in bytes, of pfindbuf. */
|
||||
&entries); /* Pointer to the number of entries */
|
||||
|
||||
#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
|
||||
|
||||
if (rc /* && entries == 0 */)
|
||||
strcpy( dir->buf3.achName, ""); // reset name for next query
|
||||
if (rc /* && entries == 0 */)
|
||||
*dir->buf3.achName= 0; /* reset name for next query */
|
||||
|
||||
return &dir->ent;
|
||||
return &dir->ent;
|
||||
}
|
||||
|
||||
|
||||
int closedir (DIR *dir)
|
||||
{
|
||||
APIRET rc;
|
||||
APIRET rc;
|
||||
|
||||
rc = DosFindClose( dir->hdir);
|
||||
rc = DosFindClose( dir->hdir);
|
||||
#ifdef _DEBUG
|
||||
printf( "_findclose rc=%d hdir=%d\n", rc, dir->hdir);
|
||||
printf( "_findclose rc=%d hdir=%d\n", rc, dir->hdir);
|
||||
#endif
|
||||
free(dir);
|
||||
return 0;
|
||||
free(dir);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
#endif // OS2
|
||||
#endif /* OS2 */
|
||||
|
|
|
@ -29,26 +29,35 @@ extern "C" {
|
|||
|
||||
struct _finddata_t
|
||||
{
|
||||
unsigned attrib;
|
||||
//unsigned long time_create; /* -1 for FAT file systems */
|
||||
//unsigned long time_access; /* -1 for FAT file systems */
|
||||
//unsigned long time_write;
|
||||
unsigned long size;
|
||||
char name[260];
|
||||
//uint16 wr_date;
|
||||
//uint16 wr_time;
|
||||
unsigned attrib;
|
||||
#ifdef NOT_USED
|
||||
unsigned long time_create; /* -1 for FAT file systems */
|
||||
unsigned long time_access; /* -1 for FAT file systems */
|
||||
unsigned long time_write;
|
||||
#endif
|
||||
unsigned long size;
|
||||
char name[260];
|
||||
#ifdef NOT_USED
|
||||
uint16 wr_date;
|
||||
uint16 wr_time;
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
struct dirent
|
||||
{
|
||||
//unsigned attrib;
|
||||
//unsigned long time_create; /* -1 for FAT file systems */
|
||||
//unsigned long time_access; /* -1 for FAT file systems */
|
||||
//unsigned long time_write;
|
||||
//unsigned long size;
|
||||
char d_name[260];
|
||||
//uint16 wr_date;
|
||||
//uint16 wr_time;
|
||||
#ifdef NOT_USED
|
||||
unsigned attrib;
|
||||
unsigned long time_create; /* -1 for FAT file systems */
|
||||
unsigned long time_access; /* -1 for FAT file systems */
|
||||
unsigned long time_write;
|
||||
unsigned long size;
|
||||
#endif
|
||||
char d_name[260];
|
||||
#ifdef NOT_USED
|
||||
uint16 wr_date;
|
||||
uint16 wr_time;
|
||||
#endif
|
||||
};
|
||||
|
||||
struct DIR
|
||||
|
@ -62,16 +71,18 @@ DIR *opendir ( char *);
|
|||
struct dirent *readdir (DIR *);
|
||||
int closedir (DIR *);
|
||||
|
||||
//#define _A_NORMAL FILE_NORMAL
|
||||
//#define _A_SUBDIR FILE_DIRECTORY
|
||||
//#define _A_RDONLY FILE_READONLY
|
||||
#ifdef NOT_USED
|
||||
#define _A_NORMAL FILE_NORMAL
|
||||
#define _A_SUBDIR FILE_DIRECTORY
|
||||
#define _A_RDONLY FILE_READONLY
|
||||
|
||||
//long _findfirst( char*, struct _finddata_t*);
|
||||
//long _findnext( long, struct _finddata_t*);
|
||||
//void _findclose( long);
|
||||
long _findfirst( char*, struct _finddata_t*);
|
||||
long _findnext( long, struct _finddata_t*);
|
||||
void _findclose( long);
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus_00
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // __MY_OS2DIRSRCH2_H__
|
||||
#endif /* __MY_OS2DIRSRCH2_H__ */
|
||||
|
|
|
@ -24,10 +24,11 @@ int _lock64( int fd, int locktype, my_off_t start,
|
|||
my_off_t length, myf MyFlags);
|
||||
int _sopen64( const char *name, int oflag, int shflag, int mask);
|
||||
|
||||
//
|
||||
// this class is used to define a global c++ variable, that
|
||||
// is initialized before main() gets called.
|
||||
//
|
||||
/*
|
||||
This class is used to define a global c++ variable, that
|
||||
is initialized before main() gets called.
|
||||
*/
|
||||
|
||||
class File64bit
|
||||
{
|
||||
public:
|
||||
|
@ -150,7 +151,7 @@ static unsigned char const errno_tab[] =
|
|||
_DosSetFilePtrL = NULL;
|
||||
return;
|
||||
}
|
||||
// notify success
|
||||
/* notify success */
|
||||
#ifdef MYSQL_SERVER
|
||||
printf( "WSeB 64bit file API loaded.\n");
|
||||
#endif
|
||||
|
@ -164,230 +165,230 @@ void _OS2errno( APIRET rc)
|
|||
errno = errno_tab[rc];
|
||||
}
|
||||
|
||||
longlong _lseek64( int fd, longlong offset, int seektype)
|
||||
|
||||
longlong _lseek64( int fd, longlong offset, int seektype)
|
||||
{
|
||||
APIRET rc;
|
||||
longlong actual;
|
||||
APIRET rc;
|
||||
longlong actual;
|
||||
|
||||
if (_DosSetFilePtrL)
|
||||
rc = _DosSetFilePtrL( fd, offset, seektype, &actual);
|
||||
else {
|
||||
ULONG ulActual;
|
||||
rc = DosSetFilePtr( fd, (long) offset, seektype, &ulActual);
|
||||
actual = ulActual;
|
||||
}
|
||||
if (_DosSetFilePtrL)
|
||||
rc = _DosSetFilePtrL( fd, offset, seektype, &actual);
|
||||
else
|
||||
{
|
||||
ULONG ulActual;
|
||||
rc = DosSetFilePtr( fd, (long) offset, seektype, &ulActual);
|
||||
actual = ulActual;
|
||||
}
|
||||
|
||||
if (!rc)
|
||||
return( actual);/* NO_ERROR */
|
||||
if (!rc)
|
||||
return( actual); /* NO_ERROR */
|
||||
|
||||
// set errno
|
||||
_OS2errno( rc);
|
||||
// seek failed
|
||||
return(-1);
|
||||
_OS2errno( rc); /* set errno */
|
||||
return(-1); /* seek failed */
|
||||
}
|
||||
|
||||
inline _SetFileLocksL(HFILE hFile,
|
||||
PFILELOCKL pflUnlock,
|
||||
PFILELOCKL pflLock,
|
||||
ULONG timeout,
|
||||
ULONG flags)
|
||||
|
||||
inline APIRET _SetFileLocksL(HFILE hFile,
|
||||
PFILELOCKL pflUnlock,
|
||||
PFILELOCKL pflLock,
|
||||
ULONG timeout,
|
||||
ULONG flags)
|
||||
{
|
||||
if (_DosSetFileLocksL) {
|
||||
APIRET rc;
|
||||
rc = _DosSetFileLocksL( hFile, pflUnlock, pflLock, timeout, flags);
|
||||
if (_DosSetFileLocksL)
|
||||
{
|
||||
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.
|
||||
if (rc != 87)
|
||||
return rc;
|
||||
/*
|
||||
on FAT/HPFS/LAN a INVALID_PARAMETER is returned, seems that
|
||||
only JFS can handle >2GB ranges.
|
||||
*/
|
||||
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};
|
||||
ULONG readonly = 0;
|
||||
APIRET rc = -1;
|
||||
FILELOCKL LockArea = {0,0}, UnlockArea = {0,0};
|
||||
ULONG readonly = 0;
|
||||
APIRET rc = -1;
|
||||
|
||||
switch( locktype) {
|
||||
case F_UNLCK:
|
||||
UnlockArea.lOffset = start;
|
||||
UnlockArea.lRange = length ? length : LONGLONG_MAX;
|
||||
break;
|
||||
switch (locktype) {
|
||||
case F_UNLCK:
|
||||
UnlockArea.lOffset = start;
|
||||
UnlockArea.lRange = length ? length : LONGLONG_MAX;
|
||||
break;
|
||||
|
||||
case F_RDLCK:
|
||||
case F_WRLCK:
|
||||
LockArea.lOffset = start;
|
||||
LockArea.lRange = length ? length : LONGLONG_MAX;
|
||||
readonly = (locktype == F_RDLCK ? 1 : 0);
|
||||
break;
|
||||
case F_RDLCK:
|
||||
case F_WRLCK:
|
||||
LockArea.lOffset = start;
|
||||
LockArea.lRange = length ? length : LONGLONG_MAX;
|
||||
readonly = (locktype == F_RDLCK ? 1 : 0);
|
||||
break;
|
||||
|
||||
default:
|
||||
errno = EINVAL;
|
||||
rc = -1;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
errno = EINVAL;
|
||||
rc = -1;
|
||||
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);
|
||||
//printf( "fd %d, locktype %d, rc %d (dont_wait)\n", fd, locktype, rc);
|
||||
if (rc == 33) { /* Lock Violation */
|
||||
|
||||
DBUG_PRINT("info",("Was locked, trying with timeout"));
|
||||
rc = _SetFileLocksL( fd, &UnlockArea, &LockArea, 1 * 1000, readonly);
|
||||
//printf( "fd %d, locktype %d, rc %d (dont_wait with timeout)\n", fd, locktype, rc);
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
while( rc = _SetFileLocksL( fd, &UnlockArea, &LockArea, 0, readonly) && (rc == 33)) {
|
||||
printf(".");
|
||||
DosSleep(1 * 1000);
|
||||
}
|
||||
//printf( "fd %d, locktype %d, rc %d (wait2)\n", fd, locktype, rc);
|
||||
}
|
||||
|
||||
if (!rc)
|
||||
return( 0);/* NO_ERROR */
|
||||
|
||||
// set errno
|
||||
_OS2errno( rc);
|
||||
// lock failed
|
||||
return(-1);
|
||||
DBUG_PRINT("info",("Was locked, trying with timeout"));
|
||||
rc = _SetFileLocksL( fd, &UnlockArea, &LockArea, 1 * 1000, readonly);
|
||||
/* printf( "fd %d, locktype %d, rc %d (dont_wait with timeout)\n", fd, locktype, rc); */
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
while (rc = _SetFileLocksL( fd, &UnlockArea, &LockArea, 0, readonly) &&
|
||||
(rc == 33))
|
||||
{
|
||||
printf(".");
|
||||
DosSleep(1 * 1000);
|
||||
}
|
||||
/* printf( "fd %d, locktype %d, rc %d (wait2)\n", fd, locktype, rc); */
|
||||
}
|
||||
if (!rc)
|
||||
return(0); /* NO_ERROR */
|
||||
_OS2errno( rc); /* set errno */
|
||||
return(-1); /* lock failed */
|
||||
}
|
||||
|
||||
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;
|
||||
APIRET rc = 0;
|
||||
HFILE hf = 0;
|
||||
ULONG ulAction = 0;
|
||||
LONGLONG cbFile = 0;
|
||||
ULONG ulAttribute = FILE_NORMAL;
|
||||
ULONG fsOpenFlags = 0;
|
||||
ULONG fsOpenMode = 0;
|
||||
int fail_errno;
|
||||
APIRET rc = 0;
|
||||
HFILE hf = 0;
|
||||
ULONG ulAction = 0;
|
||||
LONGLONG cbFile = 0;
|
||||
ULONG ulAttribute = FILE_NORMAL;
|
||||
ULONG fsOpenFlags = 0;
|
||||
ULONG fsOpenMode = 0;
|
||||
|
||||
/* Extract the access mode and sharing mode bits. */
|
||||
fsOpenMode = (shflag & 0xFF) | (oflag & 0x03);
|
||||
/* Extract the access mode and sharing mode bits. */
|
||||
fsOpenMode = (shflag & 0xFF) | (oflag & 0x03);
|
||||
|
||||
/* Translate ERROR_OPEN_FAILED to ENOENT unless O_EXCL is set (see
|
||||
below). */
|
||||
fail_errno = ENOENT;
|
||||
/*
|
||||
Translate ERROR_OPEN_FAILED to ENOENT unless O_EXCL is set (see
|
||||
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_EXCL)
|
||||
{
|
||||
fsOpenFlags = OPEN_ACTION_FAIL_IF_EXISTS | OPEN_ACTION_CREATE_IF_NEW;
|
||||
fail_errno = EEXIST;
|
||||
}
|
||||
else if (oflag & O_TRUNC)
|
||||
fsOpenFlags = OPEN_ACTION_REPLACE_IF_EXISTS | OPEN_ACTION_CREATE_IF_NEW;
|
||||
else
|
||||
fsOpenFlags = OPEN_ACTION_OPEN_IF_EXISTS | OPEN_ACTION_CREATE_IF_NEW;
|
||||
if (oflag & O_CREAT)
|
||||
{
|
||||
if (oflag & O_EXCL)
|
||||
{
|
||||
fsOpenFlags = OPEN_ACTION_FAIL_IF_EXISTS | OPEN_ACTION_CREATE_IF_NEW;
|
||||
fail_errno = EEXIST;
|
||||
}
|
||||
else if (oflag & O_TRUNC)
|
||||
fsOpenFlags = OPEN_ACTION_REPLACE_IF_EXISTS | OPEN_ACTION_CREATE_IF_NEW;
|
||||
else
|
||||
fsOpenFlags = OPEN_ACTION_OPEN_IF_EXISTS | OPEN_ACTION_CREATE_IF_NEW;
|
||||
|
||||
if (mask & S_IWRITE)
|
||||
ulAttribute = FILE_NORMAL;
|
||||
else
|
||||
ulAttribute = FILE_READONLY;
|
||||
if (mask & S_IWRITE)
|
||||
ulAttribute = FILE_NORMAL;
|
||||
else
|
||||
ulAttribute = FILE_READONLY;
|
||||
|
||||
}
|
||||
else if (oflag & O_TRUNC)
|
||||
fsOpenFlags = OPEN_ACTION_REPLACE_IF_EXISTS | OPEN_ACTION_FAIL_IF_NEW;
|
||||
else
|
||||
fsOpenFlags = OPEN_ACTION_OPEN_IF_EXISTS | OPEN_ACTION_FAIL_IF_NEW;
|
||||
}
|
||||
else if (oflag & O_TRUNC)
|
||||
fsOpenFlags = OPEN_ACTION_REPLACE_IF_EXISTS | OPEN_ACTION_FAIL_IF_NEW;
|
||||
else
|
||||
fsOpenFlags = OPEN_ACTION_OPEN_IF_EXISTS | OPEN_ACTION_FAIL_IF_NEW;
|
||||
|
||||
/* Try to open the file and handle errors. */
|
||||
if (_DosOpenL)
|
||||
rc = _DosOpenL( name, &hf, &ulAction, cbFile,
|
||||
ulAttribute, fsOpenFlags, fsOpenMode, NULL);
|
||||
else
|
||||
rc = DosOpen( name, &hf, &ulAction, (LONG) cbFile,
|
||||
ulAttribute, fsOpenFlags, fsOpenMode, NULL);
|
||||
/* Try to open the file and handle errors. */
|
||||
if (_DosOpenL)
|
||||
rc = _DosOpenL( name, &hf, &ulAction, cbFile,
|
||||
ulAttribute, fsOpenFlags, fsOpenMode, NULL);
|
||||
else
|
||||
rc = DosOpen( name, &hf, &ulAction, (LONG) cbFile,
|
||||
ulAttribute, fsOpenFlags, fsOpenMode, NULL);
|
||||
|
||||
if (rc == ERROR_OPEN_FAILED)
|
||||
{
|
||||
errno = fail_errno;
|
||||
return -1;
|
||||
}
|
||||
if (rc != 0)
|
||||
{
|
||||
// set errno
|
||||
_OS2errno( rc);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (oflag & O_APPEND)
|
||||
_lseek64( hf, 0L, SEEK_END);
|
||||
|
||||
return hf;
|
||||
if (rc == ERROR_OPEN_FAILED)
|
||||
{
|
||||
errno = fail_errno;
|
||||
return -1;
|
||||
}
|
||||
if (rc != 0)
|
||||
{
|
||||
_OS2errno( rc); /* set errno */
|
||||
return -1;
|
||||
}
|
||||
if (oflag & O_APPEND)
|
||||
_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;
|
||||
ULONG actual;
|
||||
APIRET rc;
|
||||
ULONG actual;
|
||||
|
||||
rc = DosRead( fd, (PVOID) buffer, count, &actual);
|
||||
rc= DosRead( fd, (PVOID) buffer, count, &actual);
|
||||
|
||||
if (!rc)
|
||||
return( actual);/* NO_ERROR */
|
||||
|
||||
// set errno
|
||||
_OS2errno( rc);
|
||||
// write failed
|
||||
return(-1);
|
||||
if (!rc)
|
||||
return( actual); /* NO_ERROR */
|
||||
_OS2errno( rc); /* set errno */
|
||||
return(-1); /* read failed */
|
||||
}
|
||||
|
||||
int write( int fd, const void *buffer, unsigned int count)
|
||||
|
||||
int write(int fd, const void *buffer, unsigned int count)
|
||||
{
|
||||
APIRET rc;
|
||||
ULONG actual;
|
||||
APIRET rc;
|
||||
ULONG actual;
|
||||
|
||||
rc = DosWrite( fd, (PVOID) buffer, count, &actual);
|
||||
rc = DosWrite( fd, (PVOID) buffer, count, &actual);
|
||||
|
||||
if (!rc)
|
||||
return( actual);/* NO_ERROR */
|
||||
|
||||
// set errno
|
||||
_OS2errno( rc);
|
||||
// write failed
|
||||
return(-1);
|
||||
if (!rc)
|
||||
return( actual); /* NO_ERROR */
|
||||
_OS2errno( rc); /* set errno */
|
||||
return(-1); /* write failed */
|
||||
}
|
||||
|
||||
int close( int fd)
|
||||
|
||||
int close( int fd)
|
||||
{
|
||||
APIRET rc;
|
||||
ULONG actual;
|
||||
APIRET rc;
|
||||
ULONG actual;
|
||||
|
||||
rc = DosClose( fd);
|
||||
rc = DosClose( fd);
|
||||
|
||||
if (!rc)
|
||||
return( 0);/* NO_ERROR */
|
||||
|
||||
// set errno
|
||||
_OS2errno( rc);
|
||||
// write failed
|
||||
return(-1);
|
||||
if (!rc)
|
||||
return( 0); /* NO_ERROR */
|
||||
_OS2errno( rc); /* set errno */
|
||||
return(-1); /* close failed */
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
|
|
@ -36,63 +36,48 @@
|
|||
#include <stdlib.h>
|
||||
#include <errno.h>
|
||||
#ifdef _THREAD_SAFE
|
||||
//#include <pthread.h>
|
||||
//#include "pthread_private.h"
|
||||
|
||||
int
|
||||
pthread_mutex_init(pthread_mutex_t * mutex,
|
||||
const pthread_mutexattr_t * mutex_attr)
|
||||
{
|
||||
APIRET rc = 0;
|
||||
|
||||
rc = DosCreateMutexSem(NULL,mutex,0,0);
|
||||
|
||||
/* Return the completion status: */
|
||||
return (0);
|
||||
(void) DosCreateMutexSem(NULL,mutex,0,0);
|
||||
return (0); /* Return the completion status: */
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
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 {
|
||||
rc = DosCloseMutexSem(*mutex);
|
||||
if (rc == 301) DosReleaseMutexSem(*mutex);
|
||||
} while (rc == 301);
|
||||
|
||||
*mutex = 0;
|
||||
|
||||
/* Return the completion status: */
|
||||
return (0);
|
||||
*mutex = 0;
|
||||
return (0); /* Return the completion status: */
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
pthread_mutex_lock(pthread_mutex_t * mutex)
|
||||
{
|
||||
int ret = 0;
|
||||
int status = 0;
|
||||
APIRET rc = 0;
|
||||
APIRET rc;
|
||||
|
||||
rc = DosRequestMutexSem(*mutex,SEM_INDEFINITE_WAIT);
|
||||
if (rc)
|
||||
return(EINVAL);
|
||||
/* Return the completion status: */
|
||||
return (0);
|
||||
rc = DosRequestMutexSem(*mutex,SEM_INDEFINITE_WAIT);
|
||||
if (rc)
|
||||
return(EINVAL);
|
||||
return (0); /* Return the completion status: */
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
pthread_mutex_unlock(pthread_mutex_t * mutex)
|
||||
{
|
||||
int ret = 0;
|
||||
APIRET rc = 0;
|
||||
int status;
|
||||
|
||||
rc = DosReleaseMutexSem(*mutex);
|
||||
|
||||
/* Return the completion status: */
|
||||
return (0);
|
||||
(void) DosReleaseMutexSem(*mutex);
|
||||
return (0); /* Return the completion status: */
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -61,10 +61,9 @@ static pthread_handler_decl(pthread_start,param)
|
|||
win_pthread_self=((struct pthread_map *) param)->pthreadself;
|
||||
pthread_mutex_unlock(&THR_LOCK_thread);
|
||||
free((char*) param); /* Free param from create */
|
||||
//pthread_exit((void*) (*func)(func_param));
|
||||
/* pthread_exit((void*) (*func)(func_param)); */
|
||||
(*func)(func_param);
|
||||
DBUG_RETURN(0);
|
||||
//return 0; /* Safety */
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -30,115 +30,122 @@ PULONG tls_storage; /* TLS local storage */
|
|||
DWORD tls_bits[2]; /* TLS in-use bits */
|
||||
pthread_mutex_t tls_mutex; /* TLS mutex for in-use bits */
|
||||
|
||||
|
||||
DWORD TlsAlloc( void)
|
||||
{
|
||||
DWORD index = -1;
|
||||
DWORD mask, tibidx;
|
||||
int i;
|
||||
DWORD index = -1;
|
||||
DWORD mask, tibidx;
|
||||
int i;
|
||||
|
||||
if (tls_storage == NULL) {
|
||||
if (tls_storage == NULL)
|
||||
{
|
||||
|
||||
APIRET rc;
|
||||
APIRET rc;
|
||||
|
||||
// allocate memory for TLS storage
|
||||
rc = DosAllocThreadLocalMemory( 1, &tls_storage);
|
||||
if (rc) {
|
||||
fprintf( stderr, "DosAllocThreadLocalMemory error: return code = %u\n", rc);
|
||||
}
|
||||
/* allocate memory for TLS storage */
|
||||
rc = DosAllocThreadLocalMemory( 1, &tls_storage);
|
||||
if (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
|
||||
if (pthread_mutex_init( &tls_mutex, NULL))
|
||||
fprintf( stderr, "Failed to init TLS mutex\n");
|
||||
}
|
||||
pthread_mutex_lock( &tls_mutex);
|
||||
|
||||
pthread_mutex_lock( &tls_mutex);
|
||||
|
||||
tibidx = 0;
|
||||
if (tls_bits[0] == 0xFFFFFFFF) {
|
||||
if (tls_bits[1] == 0xFFFFFFFF) {
|
||||
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;
|
||||
tibidx = 0;
|
||||
if (tls_bits[0] == 0xFFFFFFFF)
|
||||
{
|
||||
if (tls_bits[1] == 0xFFFFFFFF)
|
||||
{
|
||||
fprintf( stderr, "tid#%d, no more TLS bits available\n", _threadid);
|
||||
pthread_mutex_unlock( &tls_mutex);
|
||||
return TRUE;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
tibidx = 1;
|
||||
}
|
||||
|
||||
pthread_mutex_unlock( &tls_mutex);
|
||||
return FALSE;
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
PVOID TlsGetValue( DWORD index)
|
||||
BOOL TlsFree( DWORD index)
|
||||
{
|
||||
if (index >= TLS_MINIMUM_AVAILABLE)
|
||||
return NULL;
|
||||
int tlsidx;
|
||||
DWORD mask;
|
||||
|
||||
// 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);
|
||||
}
|
||||
if (index >= TLS_MINIMUM_AVAILABLE)
|
||||
return NULL;
|
||||
|
||||
ULONG* tls_array = (ULONG*) *tls_storage;
|
||||
return (PVOID) tls_array[ index];
|
||||
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);
|
||||
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
|
||||
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);
|
||||
}
|
||||
/* 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); */
|
||||
}
|
||||
|
||||
if (index >= TLS_MINIMUM_AVAILABLE)
|
||||
return FALSE;
|
||||
if (index >= TLS_MINIMUM_AVAILABLE)
|
||||
return FALSE;
|
||||
|
||||
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]);
|
||||
tls_array[ index] = (ULONG) val;
|
||||
//fprintf( stderr, "tid#%d, TlsSetValue array %08x index %d -> %08x\n", _threadid, tls_array, index, val);
|
||||
|
||||
return TRUE;
|
||||
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]); */
|
||||
tls_array[ index] = (ULONG) val;
|
||||
/* fprintf( stderr, "tid#%d, TlsSetValue array %08x index %d -> %08x\n", _threadid, tls_array, index, val); */
|
||||
return TRUE;
|
||||
}
|
||||
|
|
|
@ -425,6 +425,19 @@ int my_pthread_cond_init(pthread_cond_t *mp, const pthread_condattr_t *attr)
|
|||
#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
|
||||
We need these because the pthread_mutex.. code returns -1 on error,
|
||||
|
|
|
@ -90,7 +90,7 @@ int my_copystat(const char *from, const char *to, int MyFlags)
|
|||
return 1;
|
||||
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 (MyFlags & MY_LINK_WARNING)
|
||||
|
|
|
@ -14,22 +14,25 @@
|
|||
along with this program; if not, write to the Free Software
|
||||
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 <m_string.h>
|
||||
|
||||
#ifdef _MSC_VER
|
||||
|
||||
void sleep(sec)
|
||||
int sec;
|
||||
void my_sleep(ulong m_seconds)
|
||||
{
|
||||
ulong start;
|
||||
DBUG_ENTER("sleep");
|
||||
|
||||
start=(ulong) time((time_t*) 0);
|
||||
#ifdef __NETWARE__
|
||||
delay(m_seconds/1000+1);
|
||||
#elif defined(OS2)
|
||||
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);
|
||||
DBUG_VOID_RETURN;
|
||||
} /* sleep */
|
||||
|
||||
#endif /* MSDOS */
|
||||
#endif
|
||||
}
|
|
@ -38,7 +38,7 @@
|
|||
#endif
|
||||
|
||||
#ifdef HAVE_TEMPNAM
|
||||
#if !defined( MSDOS) && !defined(OS2)
|
||||
#if !defined( MSDOS) && !defined(OS2) && !defined(__NETWARE__)
|
||||
extern char **environ;
|
||||
#endif
|
||||
#endif
|
||||
|
@ -104,14 +104,14 @@ my_string my_tempnam(const char *dir, const char *pfx,
|
|||
dir=temp;
|
||||
}
|
||||
#ifdef OS2
|
||||
// changing environ variable doesn't work with VACPP
|
||||
/* changing environ variable doesn't work with VACPP */
|
||||
char buffer[256];
|
||||
sprintf( buffer, "TMP=%s", dir);
|
||||
// remove ending backslash
|
||||
/* remove ending backslash */
|
||||
if (buffer[strlen(buffer)-1] == '\\')
|
||||
buffer[strlen(buffer)-1] = '\0';
|
||||
putenv( buffer);
|
||||
#else
|
||||
#elif !defined(__NETWARE__)
|
||||
old_env=(char**)environ;
|
||||
if (dir)
|
||||
{ /* Don't use TMPDIR if dir is given */
|
||||
|
@ -120,7 +120,7 @@ my_string my_tempnam(const char *dir, const char *pfx,
|
|||
}
|
||||
#endif
|
||||
res=tempnam((char*) dir,(my_string) pfx); /* Use stand. dir with prefix */
|
||||
#ifndef OS2
|
||||
#if !defined(OS2) && !defined(__NETWARE__)
|
||||
((char**) environ)=(char**) old_env;
|
||||
#endif
|
||||
if (!res)
|
||||
|
|
|
@ -93,6 +93,18 @@ void my_thread_global_end(void)
|
|||
#endif
|
||||
#ifdef PPTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP
|
||||
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
|
||||
#ifndef HAVE_GETHOSTBYNAME_R
|
||||
pthread_mutex_destroy(&LOCK_gethostbyname_r);
|
||||
|
|
|
@ -23,9 +23,9 @@
|
|||
|
||||
#ifdef THREAD
|
||||
#include <my_pthread.h>
|
||||
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 LOCK_bitmap;
|
||||
extern pthread_mutex_t THR_LOCK_malloc, THR_LOCK_open, THR_LOCK_keycache;
|
||||
extern pthread_mutex_t THR_LOCK_lock, THR_LOCK_isam, THR_LOCK_net;
|
||||
extern pthread_mutex_t THR_LOCK_charset;
|
||||
#else
|
||||
#include <my_no_pthread.h>
|
||||
#endif
|
||||
|
|
|
@ -239,8 +239,8 @@ gptr _myrealloc (register gptr pPtr, register uint uSize,
|
|||
if (*((long*) ((char*) &pRec -> lSpecialValue+sf_malloc_prehunc))
|
||||
!= MAGICKEY)
|
||||
{
|
||||
fprintf (stderr, "Reallocating unallocated data at line %d, '%s'\n",
|
||||
uLine, sFile);
|
||||
fprintf(stderr, "Error: Reallocating unallocated data at line %d, '%s'\n",
|
||||
uLine, sFile);
|
||||
DBUG_PRINT("safe",("Reallocating unallocated data at line %d, '%s'",
|
||||
uLine, sFile));
|
||||
(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))
|
||||
!= MAGICKEY)
|
||||
{
|
||||
fprintf (stderr, "Freeing unallocated data at line %d, '%s'\n",
|
||||
uLine, sFile);
|
||||
fprintf(stderr, "Error: Freeing unallocated data at line %d, '%s'\n",
|
||||
uLine, sFile);
|
||||
DBUG_PRINT("safe",("Unallocated data at line %d, '%s'",uLine,sFile));
|
||||
(void) fflush(stderr);
|
||||
DBUG_VOID_RETURN;
|
||||
|
@ -336,8 +336,8 @@ static int check_ptr(const char *where, byte *ptr, const char *sFile,
|
|||
{
|
||||
if (!ptr)
|
||||
{
|
||||
fprintf (stderr, "%s NULL pointer at line %d, '%s'\n",
|
||||
where,uLine, sFile);
|
||||
fprintf(stderr, "Error: %s NULL pointer at line %d, '%s'\n",
|
||||
where,uLine, sFile);
|
||||
DBUG_PRINT("safe",("Null pointer at line %d '%s'", uLine, sFile));
|
||||
(void) fflush(stderr);
|
||||
return 1;
|
||||
|
@ -345,8 +345,8 @@ static int check_ptr(const char *where, byte *ptr, const char *sFile,
|
|||
#ifndef _MSC_VER
|
||||
if ((long) ptr & (ALIGN_SIZE(1)-1))
|
||||
{
|
||||
fprintf (stderr, "%s wrong aligned pointer at line %d, '%s'\n",
|
||||
where,uLine, sFile);
|
||||
fprintf(stderr, "Error: %s wrong aligned pointer at line %d, '%s'\n",
|
||||
where,uLine, sFile);
|
||||
DBUG_PRINT("safe",("Wrong aligned pointer at line %d, '%s'",
|
||||
uLine,sFile));
|
||||
(void) fflush(stderr);
|
||||
|
@ -355,8 +355,8 @@ static int check_ptr(const char *where, byte *ptr, const char *sFile,
|
|||
#endif
|
||||
if (ptr < sf_min_adress || ptr > sf_max_adress)
|
||||
{
|
||||
fprintf (stderr, "%s pointer out of range at line %d, '%s'\n",
|
||||
where,uLine, sFile);
|
||||
fprintf(stderr, "Error: %s pointer out of range at line %d, '%s'\n",
|
||||
where,uLine, sFile);
|
||||
DBUG_PRINT("safe",("Pointer out of range at line %d '%s'",
|
||||
uLine,sFile));
|
||||
(void) fflush(stderr);
|
||||
|
@ -388,7 +388,7 @@ void TERMINATE (FILE *file)
|
|||
{
|
||||
if (file)
|
||||
{
|
||||
fprintf (file, "cNewCount: %d\n", cNewCount);
|
||||
fprintf(file, "Warning: Not freed memory segments: %d\n", cNewCount);
|
||||
(void) fflush(file);
|
||||
}
|
||||
DBUG_PRINT("safe",("cNewCount: %d",cNewCount));
|
||||
|
@ -403,7 +403,7 @@ void TERMINATE (FILE *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);
|
||||
}
|
||||
DBUG_PRINT("safe",("Memory that was not free'ed (%ld bytes):",lCurMemory));
|
||||
|
@ -411,11 +411,11 @@ void TERMINATE (FILE *file)
|
|||
{
|
||||
if (file)
|
||||
{
|
||||
fprintf (file,
|
||||
"\t%6u bytes at 0x%09lx, allocated at line %4u in '%s'",
|
||||
pPtr -> uDataSize,
|
||||
(ulong) &(pPtr -> aData[sf_malloc_prehunc]),
|
||||
pPtr -> uLineNum, pPtr -> sFileName);
|
||||
fprintf(file,
|
||||
"\t%6u bytes at 0x%09lx, allocated at line %4u in '%s'",
|
||||
pPtr -> uDataSize,
|
||||
(ulong) &(pPtr -> aData[sf_malloc_prehunc]),
|
||||
pPtr -> uLineNum, pPtr -> sFileName);
|
||||
fprintf(file, "\n");
|
||||
(void) fflush(file);
|
||||
}
|
||||
|
@ -429,8 +429,8 @@ void TERMINATE (FILE *file)
|
|||
/* Report the memory usage statistics */
|
||||
if (file)
|
||||
{
|
||||
fprintf (file, "Maximum memory usage: %ld bytes (%ldk)\n",
|
||||
lMaxMemory, (lMaxMemory + 1023L) / 1024L);
|
||||
fprintf(file, "Maximum memory usage: %ld bytes (%ldk)\n",
|
||||
lMaxMemory, (lMaxMemory + 1023L) / 1024L);
|
||||
(void) fflush(file);
|
||||
}
|
||||
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))
|
||||
!= MAGICKEY)
|
||||
{
|
||||
fprintf (stderr, "Memory allocated at %s:%d was underrun,",
|
||||
pRec -> sFileName, pRec -> uLineNum);
|
||||
fprintf (stderr, " discovered at %s:%d\n", sFile, uLine);
|
||||
fprintf(stderr, "Error: Memory allocated at %s:%d was underrun,",
|
||||
pRec -> sFileName, pRec -> uLineNum);
|
||||
fprintf(stderr, " discovered at %s:%d\n", sFile, uLine);
|
||||
(void) fflush(stderr);
|
||||
DBUG_PRINT("safe",("Underrun at %lx, allocated at %s:%d",
|
||||
&(pRec -> aData[sf_malloc_prehunc]),
|
||||
|
@ -472,9 +472,9 @@ static int _checkchunk (register struct remember *pRec, const char *sFile,
|
|||
*magicp++ != MAGICEND2 ||
|
||||
*magicp++ != MAGICEND3)
|
||||
{
|
||||
fprintf (stderr, "Memory allocated at %s:%d was overrun,",
|
||||
pRec -> sFileName, pRec -> uLineNum);
|
||||
fprintf (stderr, " discovered at '%s:%d'\n", sFile, uLine);
|
||||
fprintf(stderr, "Error: Memory allocated at %s:%d was overrun,",
|
||||
pRec -> sFileName, pRec -> uLineNum);
|
||||
fprintf(stderr, " discovered at '%s:%d'\n", sFile, uLine);
|
||||
(void) fflush(stderr);
|
||||
DBUG_PRINT("safe",("Overrun at %lx, allocated at %s:%d",
|
||||
&(pRec -> aData[sf_malloc_prehunc]),
|
||||
|
@ -505,9 +505,9 @@ int _sanity (const char *sFile, uint uLine)
|
|||
pthread_mutex_unlock(&THR_LOCK_malloc);
|
||||
if (count || pTmp)
|
||||
{
|
||||
const char *format="Safemalloc link list destroyed, discovered at '%s:%d'";
|
||||
fprintf (stderr, format, sFile, uLine); fputc('\n',stderr);
|
||||
fprintf (stderr, "root=%p,count=%d,pTmp=%p\n", pRememberRoot,count,pTmp);
|
||||
const char *format="Error: Safemalloc link list destroyed, discovered at '%s:%d'";
|
||||
fprintf(stderr, format, sFile, uLine); fputc('\n',stderr);
|
||||
fprintf(stderr, "root=%p,count=%d,pTmp=%p\n", pRememberRoot,count,pTmp);
|
||||
(void) fflush(stderr);
|
||||
DBUG_PRINT("safe",(format, sFile, uLine));
|
||||
flag=1;
|
||||
|
|
|
@ -229,8 +229,13 @@ void thr_end_alarm(thr_alarm_t *alarmed)
|
|||
(long) *alarmed));
|
||||
}
|
||||
if (alarm_aborted && !alarm_queue.elements)
|
||||
{
|
||||
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);
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
|
@ -367,19 +372,25 @@ static sig_handler process_alarm_part2(int sig __attribute__((unused)))
|
|||
void end_thr_alarm(void)
|
||||
{
|
||||
DBUG_ENTER("end_thr_alarm");
|
||||
pthread_mutex_lock(&LOCK_alarm);
|
||||
if (!alarm_aborted)
|
||||
{
|
||||
{
|
||||
my_bool deleted=0;
|
||||
pthread_mutex_lock(&LOCK_alarm);
|
||||
DBUG_PRINT("info",("Resheduling %d waiting alarms",alarm_queue.elements));
|
||||
alarm_aborted=1; /* mark aborted */
|
||||
if (!alarm_queue.elements)
|
||||
{
|
||||
deleted= 1;
|
||||
delete_queue(&alarm_queue);
|
||||
}
|
||||
if (pthread_equal(pthread_self(),alarm_thread))
|
||||
alarm(1); /* Shut down everything soon */
|
||||
else
|
||||
reschedule_alarms();
|
||||
pthread_mutex_unlock(&LOCK_alarm);
|
||||
if (deleted)
|
||||
pthread_mutex_destroy(&LOCK_alarm);
|
||||
}
|
||||
pthread_mutex_unlock(&LOCK_alarm);
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -20,13 +20,15 @@
|
|||
#if defined(HAVE_LINUXTHREADS) && !defined (__USE_UNIX98)
|
||||
#define __USE_UNIX98 /* To get rw locks under Linux */
|
||||
#endif
|
||||
#include <m_string.h>
|
||||
#if defined(THREAD) && defined(SAFE_MUTEX)
|
||||
#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
|
||||
/* Remove wrappers */
|
||||
#undef pthread_mutex_t
|
||||
#undef pthread_mutex_init
|
||||
#undef pthread_mutex_lock
|
||||
#undef pthread_mutex_unlock
|
||||
|
@ -38,15 +40,55 @@
|
|||
#endif
|
||||
#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,
|
||||
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));
|
||||
pthread_mutex_init(&mp->global,MY_MUTEX_INIT_ERRCHK);
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
int safe_mutex_lock(safe_mutex_t *mp,const char *file, uint line)
|
||||
{
|
||||
int error;
|
||||
|
@ -199,6 +241,11 @@ int safe_cond_timedwait(pthread_cond_t *cond, safe_mutex_t *mp,
|
|||
fflush(stderr);
|
||||
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->file= (char*) file;
|
||||
mp->line=line;
|
||||
|
@ -206,6 +253,7 @@ int safe_cond_timedwait(pthread_cond_t *cond, safe_mutex_t *mp,
|
|||
return error;
|
||||
}
|
||||
|
||||
|
||||
int safe_mutex_destroy(safe_mutex_t *mp, const char *file, uint line)
|
||||
{
|
||||
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))
|
||||
error=1;
|
||||
#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;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
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 */
|
||||
|
|
0
netware/Makefile.am
Normal file
0
netware/Makefile.am
Normal file
4162
netware/netware.patch
Normal file
4162
netware/netware.patch
Normal file
File diff suppressed because it is too large
Load diff
|
@ -46,16 +46,37 @@ if [ -d $BASE ] ; then
|
|||
rm -r -f $BASE
|
||||
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 \
|
||||
$BASE/include $BASE/lib $BASE/support-files $BASE/share $BASE/share/mysql \
|
||||
$BASE/tests $BASE/scripts $BASE/sql-bench $BASE/mysql-test \
|
||||
$BASE/mysql-test/t $BASE/mysql-test/r \
|
||||
$BASE/mysql-test/include $BASE/mysql-test/std_data $BASE/man $BASE/man/man1
|
||||
|
||||
$BASE/include $BASE/lib $BASE/support-files $BASE/share $BASE/scripts \
|
||||
$BASE/mysql-test $BASE/mysql-test/t $BASE/mysql-test/r \
|
||||
$BASE/mysql-test/include $BASE/mysql-test/std_data
|
||||
|
||||
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/*
|
||||
|
||||
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
|
||||
if [ -f $i ]
|
||||
then
|
||||
|
@ -63,18 +84,23 @@ do
|
|||
fi
|
||||
done
|
||||
|
||||
for i in extra/comp_err extra/replace extra/perror extra/resolveip \
|
||||
extra/my_print_defaults extra/mysql_waitpid extra/resolve_stack_dump \
|
||||
isam/isamchk isam/pack_isam myisam/myisamchk \
|
||||
myisam/myisampack sql/mysqld client/mysqlbinlog \
|
||||
client/mysql sql/mysqld client/mysqlshow client/mysqlcheck \
|
||||
client/mysqladmin client/mysqldump client/mysqlimport client/mysqltest \
|
||||
client/mysqlmanagerc client/mysqlmanager-pwgen tools/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
|
||||
for i in extra/comp_err$BS extra/replace$BS extra/perror$BS \
|
||||
extra/resolveip$BS extra/my_print_defaults$BS \
|
||||
extra/resolve_stack_dump$BS extra/mysql_waitpid$BS \
|
||||
isam/isamchk$BS isam/pack_isam$BS \
|
||||
myisam/myisamchk$BS myisam/myisampack$BS myisam/myisamlog$BS \
|
||||
sql/mysqld$BS \
|
||||
client/mysql$BS client/mysqlshow$BS client/mysqladmin$BS \
|
||||
client/mysqldump$BS client/mysqlimport$BS \
|
||||
client/mysqltest$BS client/mysqlcheck$BS \
|
||||
client/mysqlbinlog$BS client/mysqlmanagerc$BS \
|
||||
client/mysqlmanager-pwgen$BS tools/mysqlmanager$BS \
|
||||
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
|
||||
if [ -f $i ]
|
||||
then
|
||||
|
@ -86,6 +112,7 @@ if [ x$STRIP = x1 ] ; then
|
|||
strip $BASE/bin/*
|
||||
fi
|
||||
|
||||
# Copy not binary files
|
||||
for i in sql/mysqld.sym.gz
|
||||
do
|
||||
if [ -f $i ]
|
||||
|
@ -94,7 +121,11 @@ do
|
|||
fi
|
||||
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
|
||||
if [ -f $i ]
|
||||
then
|
||||
|
@ -102,39 +133,72 @@ do
|
|||
fi
|
||||
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
|
||||
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 man/*.1 $BASE/man/man1
|
||||
|
||||
$CP -r sql/share/* $BASE/share/mysql
|
||||
rm -f $BASE/share/mysql/Makefile* $BASE/share/mysql/*/*.OLD
|
||||
if [ $BASE_SYSTEM == "netware" ] ; then
|
||||
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/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/r/*.result mysql-test/r/*.require $BASE/mysql-test/r
|
||||
$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
|
||||
|
||||
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
|
||||
|
||||
$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
|
||||
# To be removed in MySQL 4.1
|
||||
(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
|
||||
if [ -d $BASE/sql-bench/SCCS ] ; then
|
||||
find $BASE/share -name SCCS -print | xargs rm -r -f
|
||||
|
@ -196,7 +260,7 @@ which_1 ()
|
|||
# Create the result tar file
|
||||
#
|
||||
|
||||
tar=`which_1 gtar`
|
||||
tar=`which_1 gnutar gtar`
|
||||
if test "$?" = "1" -o "$tar" = ""
|
||||
then
|
||||
tar=tar
|
||||
|
|
3307
sql/ChangeLog
3307
sql/ChangeLog
File diff suppressed because it is too large
Load diff
|
@ -93,7 +93,7 @@ DEFS = -DMYSQL_SERVER \
|
|||
# Don't put lex_hash.h in BUILT_SOURCES as this will give infinite recursion
|
||||
BUILT_SOURCES = sql_yacc.cc sql_yacc.h
|
||||
EXTRA_DIST = udf_example.cc $(BUILT_SOURCES)
|
||||
YFLAGS = -d
|
||||
AM_YFLAGS = -d
|
||||
|
||||
link_sources:
|
||||
rm -f mini_client_errors.c
|
||||
|
|
|
@ -104,4 +104,15 @@ error:
|
|||
VOID(pthread_mutex_unlock(&LOCK_des_key_file));
|
||||
DBUG_RETURN(result);
|
||||
}
|
||||
|
||||
|
||||
void free_des_key_file()
|
||||
{
|
||||
if (initialized)
|
||||
{
|
||||
initialized= 01;
|
||||
pthread_mutex_destroy(&LOCK_des_key_file);
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* HAVE_OPENSSL */
|
||||
|
|
|
@ -830,6 +830,7 @@ innobase_end(void)
|
|||
err = innobase_shutdown_for_mysql();
|
||||
hash_free(&innobase_open_tables);
|
||||
my_free(internal_innobase_data_file_path,MYF(MY_ALLOW_ZERO_PTR));
|
||||
pthread_mutex_destroy(&innobase_mutex);
|
||||
|
||||
if (err != DB_SUCCESS) {
|
||||
|
||||
|
|
|
@ -497,7 +497,7 @@ int ha_myisam::repair(THD* thd, HA_CHECK_OPT *check_opt)
|
|||
(uint) (T_RETRY_WITHOUT_QUICK | T_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);
|
||||
continue;
|
||||
}
|
||||
|
@ -505,7 +505,7 @@ int ha_myisam::repair(THD* thd, HA_CHECK_OPT *check_opt)
|
|||
if ((param.testflag & T_REP_BY_SORT))
|
||||
{
|
||||
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);
|
||||
continue;
|
||||
}
|
||||
|
@ -515,7 +515,7 @@ int ha_myisam::repair(THD* thd, HA_CHECK_OPT *check_opt)
|
|||
!(check_opt->flags & T_VERY_SILENT))
|
||||
{
|
||||
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(start_records, llbuff2),
|
||||
table->path);
|
||||
|
|
|
@ -27,7 +27,9 @@
|
|||
extern "C" { // Because of SCO 3.2V4.2
|
||||
#endif
|
||||
#if !defined( __WIN__) && !defined(OS2)
|
||||
#if !defined(__NETWARE__)
|
||||
#include <sys/resource.h>
|
||||
#endif /* __NETWARE__ */
|
||||
#ifdef HAVE_SYS_UN_H
|
||||
#include <sys/un.h>
|
||||
#endif
|
||||
|
|
16
sql/item.h
16
sql/item.h
|
@ -86,6 +86,9 @@ public:
|
|||
virtual bool is_null() { return 0; }
|
||||
virtual unsigned int size_of()= 0;
|
||||
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; }
|
||||
virtual void fix_length_and_dec()=0;
|
||||
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
|
||||
{
|
||||
public:
|
||||
Field *result_field; /* Save result here */
|
||||
Item **ref;
|
||||
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) {}
|
||||
|
@ -407,6 +417,12 @@ public:
|
|||
enum Item_result result_type () const { return (*ref)->result_type(); }
|
||||
table_map used_tables() const { return (*ref)->used_tables(); }
|
||||
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);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -424,12 +424,6 @@ Item *create_load_file(Item* 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 *res;
|
||||
|
|
|
@ -92,6 +92,5 @@ Item *create_func_ucase(Item* a);
|
|||
Item *create_func_version(void);
|
||||
Item *create_func_weekday(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_quote(Item* a);
|
||||
|
|
|
@ -1509,6 +1509,7 @@ void item_user_lock_init(void)
|
|||
void item_user_lock_free(void)
|
||||
{
|
||||
hash_free(&hash_user_locks);
|
||||
pthread_mutex_destroy(&LOCK_user_locks);
|
||||
}
|
||||
|
||||
void item_user_lock_release(ULL *ull)
|
||||
|
@ -1549,9 +1550,10 @@ longlong Item_master_pos_wait::val_int()
|
|||
null_value = 1;
|
||||
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;
|
||||
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;
|
||||
event_count=0;
|
||||
|
|
|
@ -865,9 +865,10 @@ class Item_master_pos_wait :public Item_int_func
|
|||
String value;
|
||||
public:
|
||||
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();
|
||||
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);}
|
||||
};
|
||||
|
||||
|
|
|
@ -1089,7 +1089,7 @@ bool Item_sum_count_distinct::add()
|
|||
if (always_null)
|
||||
return 0;
|
||||
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++)
|
||||
if ((*field)->is_real_null(0))
|
||||
|
|
|
@ -462,9 +462,8 @@ static SYMBOL sql_functions[] = {
|
|||
{ "LOWER", SYM(FUNC_ARG1),0,CREATE_FUNC(create_func_lcase)},
|
||||
{ "LPAD", SYM(FUNC_ARG3),0,CREATE_FUNC(create_func_lpad)},
|
||||
{ "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},
|
||||
{ "MASTER_POS_WAIT", SYM(MASTER_POS_WAIT),0,0},
|
||||
{ "MAX", SYM(MAX_SYM),0,0},
|
||||
{ "MD5", SYM(FUNC_ARG1),0,CREATE_FUNC(create_func_md5)},
|
||||
{ "MID", SYM(SUBSTRING),0,0}, /* unireg function */
|
||||
|
|
13
sql/log.cc
13
sql/log.cc
|
@ -96,9 +96,16 @@ MYSQL_LOG::MYSQL_LOG()
|
|||
|
||||
|
||||
MYSQL_LOG::~MYSQL_LOG()
|
||||
{
|
||||
cleanup();
|
||||
}
|
||||
|
||||
void MYSQL_LOG::cleanup()
|
||||
{
|
||||
if (inited)
|
||||
{
|
||||
close(1);
|
||||
inited= 0;
|
||||
(void) pthread_mutex_destroy(&LOCK_log);
|
||||
(void) pthread_mutex_destroy(&LOCK_index);
|
||||
(void) pthread_cond_destroy(&update_cond);
|
||||
|
@ -1063,7 +1070,7 @@ bool MYSQL_LOG::write(Log_event* event_info)
|
|||
if (thd->last_insert_id_used)
|
||||
{
|
||||
Intvar_log_event e(thd,(uchar) LAST_INSERT_ID_EVENT,
|
||||
thd->last_insert_id);
|
||||
thd->current_insert_id);
|
||||
e.set_log_pos(this);
|
||||
if (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
|
||||
close the index file.
|
||||
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)
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
|
||||
|
||||
#ifdef __EMX__
|
||||
#if defined(__EMX__) || defined(__NETWARE__)
|
||||
#include "../mysys/my_lock.c"
|
||||
#else
|
||||
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue