mirror of
https://github.com/MariaDB/server.git
synced 2025-01-29 02:05:57 +01:00
Fixes for OS2.
Fix bug in isamlog Add argument types to function declarations. Docs/manual.texi: Updated credits client/mysql.cc: Fixes for OS2 client/mysqladmin.c: Fixes for OS2 client/mysqldump.c: Fixes for OS2 client/mysqlimport.c: Fixes for OS2 client/mysqltest.c: Fixes for OS2 dbug/dbug.c: Fixes for OS2. Use new C calling convention. dbug/factorial.c: Fixes for OS2. Use new C calling convention. include/errmsg.h: Fix for OS2 include/global.h: Fixes for OS2. include/my_pthread.h: Fixes for OS2. include/my_sys.h: Fixes for OS2. include/mysql_com.h: Move defines to global.h include/thr_alarm.h: Fixes for OS2. isam/isamchk.c: Fixes for OS2. Add arguments to function declarations. isam/isamlog.c: Fixes for OS2. Fix bug in logfile handling. isam/test1.c: Add arguments to function decl isam/test2.c: Add arguments to function declarations. isam/test_all.res: Update result libmysql/get_password.c: Fixes for OS2. libmysql/libmysql.c: Fixes for OS2. libmysql/net.c: Fixes for OS2. libmysql/violite.c: Add arguments to function declarations. merge/_locking.c: Add argument types to function declarations. merge/close.c: Add argument types to function declarations. merge/create.c: Add argument types to function declarations. merge/extra.c: Add argument types to function declarations. merge/open.c: Add argument types to function declarations. merge/panic.c: Add argument types to function declarations. merge/rsame.c: Add argument types to function declarations. merge/update.c: Add argument types to function declarations. myisam/ft_eval.c: Portability fix myisam/ft_search.c: Portability fix myisam/ft_test1.c: Portability fix myisam/ftdefs.h: Portability fix myisam/mi_check.c: Portability fix myisam/mi_test1.c: Portability fix myisam/mi_test2.c: Portability fix myisam/mi_test_all.sh: Update to test for MACH variable myisam/myisamlog.c: Cleanup myisam/myisampack.c: Don't use variable 'new' myisam/sort.c: Portability fix myisammrg/myrg_delete.c: Add argument types to function declarations. myisammrg/myrg_locking.c: Add argument types to function declarations. myisammrg/myrg_open.c: Add argument types to function declarations. myisammrg/myrg_panic.c: Add argument types to function declarations. mysql-test/t/backup.test: Fix for OS2 mysql-test/t/show_check.test: Fix for OS2 mysys/charset.c: Dont use variable 'new' mysys/default.c: Fixes for OS2. mysys/getopt.c: Fixes for OS2. mysys/getopt1.c: Fixes for OS2. mysys/list.c: Don't use variable 'new' mysys/mf_dirname.c: Fixes for OS2. mysys/mf_format.c: Fixes for OS2. mysys/mf_path.c: Fixes for OS2. mysys/mf_qsort.c: Portability fix mysys/mf_tempfile.c: Fixes for OS2. mysys/my_clock.c: Fixes for OS2. mysys/my_copy.c: Fixes for OS2. mysys/my_create.c: Fixes for OS2. mysys/my_getwd.c: Fixes for OS2. mysys/my_init.c: Fixes for OS2. mysys/my_lib.c: Fixes for OS2. mysys/my_lock.c: Fixes for OS2. mysys/my_malloc.c: Portability fix mysys/my_mkdir.c: Fixes for OS2. mysys/my_open.c: Fixes for OS2. mysys/my_pthread.c: Fixes for OS2. mysys/my_realloc.c: Fixes for OS2. mysys/my_redel.c: Fixes for OS2. mysys/my_static.c: Fixes for OS2. mysys/my_tempnam.c: Fixes for OS2. mysys/my_thr_init.c: Fixes for OS2. mysys/my_write.c: Fixes for OS2. mysys/test_charset.c: Fixes for OS2. mysys/thr_alarm.c: Fixes for OS2. mysys/tree.c: Fixes for OS2. sql/field.cc: Fixes for OS2. sql/field.h: Fixes for OS2. sql/gen_lex_hash.cc: Fixes for OS2. sql/hostname.cc: Fixes for OS2. sql/item_func.cc: Fixes for OS2. sql/item_strfunc.cc: Fixes for OS2. sql/log_event.cc: Fixes for OS2. sql/md5.c: Fixes for OS2. sql/mini_client.cc: Fixes for OS2. sql/mysql_priv.h: Fixes for OS2. sql/mysqld.cc: Fixes for OS2. sql/net_serv.cc: Fixes for OS2. sql/slave.cc: Fixes for OS2. sql/sql_base.cc: Fixes for OS2. sql/sql_db.cc: Portability fix sql/sql_insert.cc: Fixes for OS2. sql/sql_load.cc: Fixes for OS2. sql/sql_parse.cc: Fixes for OS2. sql/sql_table.cc: Fixes for OS2. sql/sql_udf.cc: Fixes for OS2. sql/violite.c: Fixes for OS2. strings/ctype-big5.c: Fixes for OS2. strings/ctype-gbk.c: Fixes for OS2. strings/ctype-sjis.c: Fixes for OS2. strings/ctype-tis620.c: Fixes for OS2. strings/ctype.c: Fixes for OS2. strings/strnlen.c: Fixes for OS2.
This commit is contained in:
parent
d61418b94f
commit
31b9e6e03f
137 changed files with 9927 additions and 852 deletions
|
@ -46155,6 +46155,8 @@ incredible help we got in managing the MySQL mailing lists.
|
|||
@item Igor Romanenko @email{igor@@frog.kiev.ua}
|
||||
@code{mysqldump} (previously @code{msqldump}, but ported and enhanced by
|
||||
Monty).
|
||||
@item Yuri Dario
|
||||
For keeping up and extending the MySQL OS/2 port.
|
||||
@item Tim Bunce, Alligator Descartes
|
||||
For the @code{DBD} (Perl) interface.
|
||||
@item Tim Bunce
|
||||
|
@ -46282,6 +46284,8 @@ MySQL server.
|
|||
@item Albert Chin-A-Young.
|
||||
Configure updates for Tru64, large file support and better TCP wrappers
|
||||
support.
|
||||
@item John Birrell
|
||||
Emulation of pthread_mutex() for OS/2.
|
||||
@end table
|
||||
|
||||
Other contributors, bugfinders, and testers: James H. Thompson, Maurizio
|
||||
|
@ -46543,6 +46547,8 @@ not yet 100% confident in this code.
|
|||
@appendixsubsec Changes in release 3.23.42
|
||||
@itemize @bullet
|
||||
@item
|
||||
Applied large patch for OS/2 from Yuri Dario.
|
||||
@item
|
||||
Fixed problem with InnoDB when one could get the error @code{Can't
|
||||
execute the given command...} even when one didn't have an active
|
||||
transaction.
|
||||
|
|
|
@ -77,7 +77,7 @@ extern "C" {
|
|||
|
||||
#undef bcmp // Fix problem with new readline
|
||||
#undef bzero
|
||||
#ifdef __WIN__
|
||||
#if defined( __WIN__) || defined(OS2)
|
||||
#include <conio.h>
|
||||
#else
|
||||
#include <readline/readline.h>
|
||||
|
@ -569,7 +569,7 @@ static int get_options(int argc, char **argv)
|
|||
|
||||
set_all_changeable_vars(changeable_vars);
|
||||
while ((c=getopt_long(argc,argv,
|
||||
"?ABCD:LfgGHinNoqrstTU::vVw::WEe:h:O:P:S:u:#::p::",
|
||||
(char*) "?ABCD:LfgGHinNoqrstTU::vVw::WEe:h:O:P:S:u:#::p::",
|
||||
long_options, &option_index)) != EOF)
|
||||
{
|
||||
switch(c) {
|
||||
|
@ -767,10 +767,20 @@ static int get_options(int argc, char **argv)
|
|||
return(0);
|
||||
}
|
||||
|
||||
#if defined(OS2)
|
||||
static char* readline( char* prompt)
|
||||
{
|
||||
#if defined(OS2)
|
||||
static char linebuffer[254];
|
||||
#endif
|
||||
puts( prompt);
|
||||
return gets( linebuffer);
|
||||
}
|
||||
#endif
|
||||
|
||||
static int read_lines(bool execute_commands)
|
||||
{
|
||||
#ifdef __WIN__
|
||||
#if defined( __WIN__) || defined(OS2)
|
||||
char linebuffer[254];
|
||||
#endif
|
||||
char *line;
|
||||
|
@ -790,7 +800,7 @@ static int read_lines(bool execute_commands)
|
|||
}
|
||||
else
|
||||
{
|
||||
#ifdef __WIN__
|
||||
#if defined( __WIN__) || defined(OS2)
|
||||
if (opt_outfile && glob_buffer.is_empty())
|
||||
fflush(OUTFILE);
|
||||
tee_fputs(glob_buffer.is_empty() ? "mysql> " :
|
||||
|
@ -1483,7 +1493,7 @@ com_go(String *buffer,char *line __attribute__((unused)))
|
|||
|
||||
static void init_pager()
|
||||
{
|
||||
#ifndef __WIN__
|
||||
#if !defined( __WIN__) && !defined( OS2)
|
||||
if (!opt_nopager)
|
||||
{
|
||||
if (!(PAGER= popen(pager, "w")))
|
||||
|
@ -1499,7 +1509,7 @@ static void init_pager()
|
|||
|
||||
static void end_pager()
|
||||
{
|
||||
#ifndef __WIN__
|
||||
#if !defined( __WIN__) && !defined( OS2)
|
||||
if (!opt_nopager)
|
||||
pclose(PAGER);
|
||||
#endif
|
||||
|
@ -2337,6 +2347,9 @@ void tee_fprintf(FILE *file, const char *fmt, ...)
|
|||
|
||||
va_start(args, fmt);
|
||||
(void) vfprintf(file, fmt, args);
|
||||
#ifdef OS2
|
||||
fflush( file);
|
||||
#endif
|
||||
if (opt_outfile)
|
||||
(void) vfprintf(OUTFILE, fmt, args);
|
||||
va_end(args);
|
||||
|
@ -2346,6 +2359,9 @@ void tee_fprintf(FILE *file, const char *fmt, ...)
|
|||
void tee_fputs(const char *s, FILE *file)
|
||||
{
|
||||
fputs(s, file);
|
||||
#ifdef OS2
|
||||
fflush( file);
|
||||
#endif
|
||||
if (opt_outfile)
|
||||
fputs(s, OUTFILE);
|
||||
}
|
||||
|
@ -2355,6 +2371,9 @@ void tee_puts(const char *s, FILE *file)
|
|||
{
|
||||
fputs(s, file);
|
||||
fputs("\n", file);
|
||||
#ifdef OS2
|
||||
fflush( file);
|
||||
#endif
|
||||
if (opt_outfile)
|
||||
{
|
||||
fputs(s, OUTFILE);
|
||||
|
@ -2365,11 +2384,14 @@ void tee_puts(const char *s, FILE *file)
|
|||
void tee_putc(int c, FILE *file)
|
||||
{
|
||||
putc(c, file);
|
||||
#ifdef OS2
|
||||
fflush( file);
|
||||
#endif
|
||||
if (opt_outfile)
|
||||
putc(c, OUTFILE);
|
||||
}
|
||||
|
||||
#ifdef __WIN__
|
||||
#if defined( __WIN__) || defined( OS2)
|
||||
#include <time.h>
|
||||
#else
|
||||
#include <sys/times.h>
|
||||
|
@ -2379,7 +2401,7 @@ void tee_putc(int c, FILE *file)
|
|||
|
||||
static ulong start_timer(void)
|
||||
{
|
||||
#ifdef __WIN__
|
||||
#if defined( __WIN__) || defined( OS2)
|
||||
return clock();
|
||||
#else
|
||||
struct tms tms_tmp;
|
||||
|
|
|
@ -132,7 +132,7 @@ static struct option long_options[] = {
|
|||
{0, 0, 0, 0}
|
||||
};
|
||||
|
||||
CHANGEABLE_VAR changeable_vars[] = {
|
||||
static CHANGEABLE_VAR changeable_vars[] = {
|
||||
{ "connect_timeout", (long*) &opt_connect_timeout, 0, 0, 3600*12, 0, 1},
|
||||
{ "shutdown_timeout", (long*) &opt_shutdown_timeout, SHUTDOWN_DEF_TIMEOUT, 0,
|
||||
3600*12, 0, 1},
|
||||
|
@ -152,7 +152,8 @@ int main(int argc,char *argv[])
|
|||
load_defaults("my",load_default_groups,&argc,&argv);
|
||||
set_all_changeable_vars( changeable_vars );
|
||||
|
||||
while ((c=getopt_long(argc,argv,"h:i:p::u:#::P:sS:Ct:fq?vVw::WrEO:",
|
||||
while ((c=getopt_long(argc,argv,
|
||||
(char*) "h:i:p::u:#::P:sS:Ct:fq?vVw::WrEO:",
|
||||
long_options, &option_index)) != EOF)
|
||||
{
|
||||
switch(c) {
|
||||
|
@ -1121,14 +1122,15 @@ static void wait_pidfile(char *pidfile)
|
|||
uint count=0;
|
||||
|
||||
system_filename(buff,pidfile);
|
||||
while ((fd = open(buff, O_RDONLY)) >= 0 && count++ < opt_shutdown_timeout)
|
||||
while ((fd = my_open(buff, O_RDONLY, MYF(0))) >= 0 &&
|
||||
count++ < opt_shutdown_timeout)
|
||||
{
|
||||
close(fd);
|
||||
my_close(fd,MYF(0));
|
||||
sleep(1);
|
||||
}
|
||||
if (fd >= 0)
|
||||
{
|
||||
close(fd);
|
||||
my_close(fd,MYF(0));
|
||||
fprintf(stderr,
|
||||
"Warning; Aborted waiting on pid file: '%s' after %d seconds\n",
|
||||
buff, count-1);
|
||||
|
|
|
@ -85,11 +85,11 @@ static int first_error=0;
|
|||
extern ulong net_buffer_length;
|
||||
static DYNAMIC_STRING extended_row;
|
||||
#include "sslopt-vars.h"
|
||||
FILE *result_file;
|
||||
FILE *md_result_file;
|
||||
|
||||
enum options {OPT_FTB=256, OPT_LTB, OPT_ENC, OPT_O_ENC, OPT_ESC, OPT_KEYWORDS,
|
||||
OPT_LOCKS, OPT_DROP, OPT_OPTIMIZE, OPT_DELAYED, OPT_TABLES,
|
||||
OPT_CHARSETS_DIR, OPT_DEFAULT_CHARSET};
|
||||
enum md_options {OPT_FTB=256, OPT_LTB, OPT_ENC, OPT_O_ENC, OPT_ESC,
|
||||
OPT_KEYWORDS, OPT_LOCKS, OPT_DROP, OPT_OPTIMIZE, OPT_DELAYED,
|
||||
OPT_TABLES, MD_OPT_CHARSETS_DIR, MD_OPT_DEFAULT_CHARSET};
|
||||
|
||||
static struct option long_options[] =
|
||||
{
|
||||
|
@ -98,12 +98,12 @@ static struct option long_options[] =
|
|||
{"add-drop-table", no_argument, 0, OPT_DROP},
|
||||
{"add-locks", no_argument, 0, OPT_LOCKS},
|
||||
{"allow-keywords", no_argument, 0, OPT_KEYWORDS},
|
||||
{"character-sets-dir",required_argument,0, OPT_CHARSETS_DIR},
|
||||
{"character-sets-dir",required_argument,0, MD_OPT_CHARSETS_DIR},
|
||||
{"complete-insert", no_argument, 0, 'c'},
|
||||
{"compress", no_argument, 0, 'C'},
|
||||
{"databases", no_argument, 0, 'B'},
|
||||
{"debug", optional_argument, 0, '#'},
|
||||
{"default-character-set", required_argument, 0, OPT_DEFAULT_CHARSET},
|
||||
{"default-character-set", required_argument, 0, MD_OPT_DEFAULT_CHARSET},
|
||||
{"delayed-insert", no_argument, 0, OPT_DELAYED},
|
||||
{"extended-insert", no_argument, 0, 'e'},
|
||||
{"fields-terminated-by", required_argument, 0, (int) OPT_FTB},
|
||||
|
@ -145,7 +145,7 @@ static struct option long_options[] =
|
|||
|
||||
static const char *load_default_groups[]= { "mysqldump","client",0 };
|
||||
|
||||
CHANGEABLE_VAR changeable_vars[] = {
|
||||
CHANGEABLE_VAR md_changeable_vars[] = {
|
||||
{ "max_allowed_packet", (long*) &max_allowed_packet,24*1024*1024,4096,
|
||||
24*1024L*1024L,MALLOC_OVERHEAD,1024},
|
||||
{ "net_buffer_length", (long*) &net_buffer_length,1024*1024L-1025,4096,
|
||||
|
@ -265,10 +265,10 @@ puts("\
|
|||
print_defaults("my",load_default_groups);
|
||||
|
||||
printf("\nPossible variables for option --set-variable (-O) are:\n");
|
||||
for (i=0 ; changeable_vars[i].name ; i++)
|
||||
for (i=0 ; md_changeable_vars[i].name ; i++)
|
||||
printf("%-20s current value: %lu\n",
|
||||
changeable_vars[i].name,
|
||||
(ulong) *changeable_vars[i].varptr);
|
||||
md_changeable_vars[i].name,
|
||||
(ulong) *md_changeable_vars[i].varptr);
|
||||
} /* usage */
|
||||
|
||||
|
||||
|
@ -290,9 +290,9 @@ static int get_options(int *argc,char ***argv)
|
|||
int c,option_index;
|
||||
my_bool tty_password=0;
|
||||
|
||||
result_file=stdout;
|
||||
md_result_file=stdout;
|
||||
load_defaults("my",load_default_groups,argc,argv);
|
||||
set_all_changeable_vars(changeable_vars);
|
||||
set_all_changeable_vars(md_changeable_vars);
|
||||
while ((c=getopt_long(*argc,*argv,
|
||||
"#::p::h:u:O:P:r:S:T:EBaAcCdefFlnqtvVw:?Ix",
|
||||
long_options, &option_index)) != EOF)
|
||||
|
@ -307,10 +307,10 @@ static int get_options(int *argc,char ***argv)
|
|||
case 'A':
|
||||
opt_alldbs=1;
|
||||
break;
|
||||
case OPT_DEFAULT_CHARSET:
|
||||
case MD_OPT_DEFAULT_CHARSET:
|
||||
default_charset= optarg;
|
||||
break;
|
||||
case OPT_CHARSETS_DIR:
|
||||
case MD_OPT_CHARSETS_DIR:
|
||||
charsets_dir= optarg;
|
||||
break;
|
||||
case 'f':
|
||||
|
@ -332,7 +332,7 @@ static int get_options(int *argc,char ***argv)
|
|||
break;
|
||||
#endif
|
||||
case 'O':
|
||||
if (set_changeable_var(optarg, changeable_vars))
|
||||
if (set_changeable_var(optarg, md_changeable_vars))
|
||||
{
|
||||
usage();
|
||||
return(1);
|
||||
|
@ -355,7 +355,7 @@ static int get_options(int *argc,char ***argv)
|
|||
opt_mysql_port= (unsigned int) atoi(optarg);
|
||||
break;
|
||||
case 'r':
|
||||
if (!(result_file = my_fopen(optarg, O_WRONLY | O_BINARY,
|
||||
if (!(md_result_file = my_fopen(optarg, O_WRONLY | O_BINARY,
|
||||
MYF(MY_WME))))
|
||||
exit(1);
|
||||
break;
|
||||
|
@ -602,7 +602,7 @@ static uint getTableStructure(char *table, char* db)
|
|||
char *strpos, *table_name;
|
||||
const char *delayed;
|
||||
char name_buff[NAME_LEN+3],table_buff[NAME_LEN+3];
|
||||
FILE *sql_file = result_file;
|
||||
FILE *sql_file = md_result_file;
|
||||
DBUG_ENTER("getTableStructure");
|
||||
|
||||
delayed= opt_delayed ? " DELAYED " : "";
|
||||
|
@ -973,14 +973,14 @@ static void dumpTable(uint numFields, char *table)
|
|||
}
|
||||
else
|
||||
{
|
||||
fprintf(result_file,"\n#\n# Dumping data for table '%s'\n", table);
|
||||
fprintf(md_result_file,"\n#\n# Dumping data for table '%s'\n", table);
|
||||
sprintf(query, "SELECT * FROM %s", quote_name(table,table_buff));
|
||||
if (where)
|
||||
{
|
||||
fprintf(result_file,"# WHERE: %s\n",where);
|
||||
fprintf(md_result_file,"# WHERE: %s\n",where);
|
||||
strxmov(strend(query), " WHERE ",where,NullS);
|
||||
}
|
||||
fputs("#\n\n", result_file);
|
||||
fputs("#\n\n", md_result_file);
|
||||
|
||||
if (mysql_query(sock, query))
|
||||
{
|
||||
|
@ -1007,7 +1007,7 @@ static void dumpTable(uint numFields, char *table)
|
|||
}
|
||||
|
||||
if (opt_lock)
|
||||
fprintf(result_file,"LOCK TABLES %s WRITE;\n",
|
||||
fprintf(md_result_file,"LOCK TABLES %s WRITE;\n",
|
||||
quote_name(table,table_buff));
|
||||
|
||||
total_length=net_buffer_length; /* Force row break */
|
||||
|
@ -1021,7 +1021,7 @@ static void dumpTable(uint numFields, char *table)
|
|||
ulong *lengths=mysql_fetch_lengths(res);
|
||||
rownr++;
|
||||
if (!extended_insert)
|
||||
fputs(insert_pat,result_file);
|
||||
fputs(insert_pat,md_result_file);
|
||||
mysql_field_seek(res,0);
|
||||
|
||||
for (i = 0; i < mysql_num_fields(res); i++)
|
||||
|
@ -1075,17 +1075,17 @@ static void dumpTable(uint numFields, char *table)
|
|||
else
|
||||
{
|
||||
if (i)
|
||||
fputc(',',result_file);
|
||||
fputc(',',md_result_file);
|
||||
if (row[i])
|
||||
{
|
||||
if (!IS_NUM_FIELD(field))
|
||||
unescape(result_file, row[i], lengths[i]);
|
||||
unescape(md_result_file, row[i], lengths[i]);
|
||||
else
|
||||
fputs(row[i],result_file);
|
||||
fputs(row[i],md_result_file);
|
||||
}
|
||||
else
|
||||
{
|
||||
fputs("NULL",result_file);
|
||||
fputs("NULL",md_result_file);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1098,25 +1098,25 @@ static void dumpTable(uint numFields, char *table)
|
|||
if (total_length + row_length < net_buffer_length)
|
||||
{
|
||||
total_length += row_length;
|
||||
fputc(',',result_file); /* Always row break */
|
||||
fputs(extended_row.str,result_file);
|
||||
fputc(',',md_result_file); /* Always row break */
|
||||
fputs(extended_row.str,md_result_file);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (row_break)
|
||||
fputs(";\n", result_file);
|
||||
fputs(";\n", md_result_file);
|
||||
row_break=1; /* This is first row */
|
||||
fputs(insert_pat,result_file);
|
||||
fputs(extended_row.str,result_file);
|
||||
fputs(insert_pat,md_result_file);
|
||||
fputs(extended_row.str,md_result_file);
|
||||
total_length = row_length+init_length;
|
||||
}
|
||||
}
|
||||
else
|
||||
fputs(");\n", result_file);
|
||||
fputs(");\n", md_result_file);
|
||||
}
|
||||
if (extended_insert && row_break)
|
||||
fputs(";\n", result_file); /* If not empty table */
|
||||
fflush(result_file);
|
||||
fputs(";\n", md_result_file); /* If not empty table */
|
||||
fflush(md_result_file);
|
||||
if (mysql_errno(sock))
|
||||
{
|
||||
sprintf(query,"%s: Error %d: %s when dumping table '%s' at row: %ld\n",
|
||||
|
@ -1130,7 +1130,7 @@ static void dumpTable(uint numFields, char *table)
|
|||
return;
|
||||
}
|
||||
if (opt_lock)
|
||||
fputs("UNLOCK TABLES;\n", result_file);
|
||||
fputs("UNLOCK TABLES;\n", md_result_file);
|
||||
mysql_free_result(res);
|
||||
}
|
||||
} /* dumpTable */
|
||||
|
@ -1206,11 +1206,11 @@ static int init_dumping(char *database)
|
|||
{
|
||||
if (opt_databases || opt_alldbs)
|
||||
{
|
||||
fprintf(result_file,"\n#\n# Current Database: %s\n#\n", database);
|
||||
fprintf(md_result_file,"\n#\n# Current Database: %s\n#\n", database);
|
||||
if (!opt_create_db)
|
||||
fprintf(result_file,"\nCREATE DATABASE /*!32312 IF NOT EXISTS*/ %s;\n",
|
||||
fprintf(md_result_file,"\nCREATE DATABASE /*!32312 IF NOT EXISTS*/ %s;\n",
|
||||
database);
|
||||
fprintf(result_file,"\nUSE %s;\n", database);
|
||||
fprintf(md_result_file,"\nUSE %s;\n", database);
|
||||
}
|
||||
}
|
||||
if (extended_insert)
|
||||
|
@ -1342,7 +1342,7 @@ int main(int argc, char **argv)
|
|||
if (dbConnect(current_host, current_user, opt_password))
|
||||
exit(EX_MYSQLERR);
|
||||
if (!path)
|
||||
write_heder(result_file, *argv);
|
||||
write_heder(md_result_file, *argv);
|
||||
|
||||
if (opt_first_slave)
|
||||
{
|
||||
|
@ -1378,9 +1378,9 @@ int main(int argc, char **argv)
|
|||
}
|
||||
}
|
||||
dbDisconnect(current_host);
|
||||
fputs("\n", result_file);
|
||||
if (result_file != stdout)
|
||||
my_fclose(result_file, MYF(0));
|
||||
fputs("\n", md_result_file);
|
||||
if (md_result_file != stdout)
|
||||
my_fclose(md_result_file, MYF(0));
|
||||
my_free(opt_password, MYF(MY_ALLOW_ZERO_PTR));
|
||||
if (extended_insert)
|
||||
dynstr_free(&extended_row);
|
||||
|
|
|
@ -41,7 +41,7 @@ static char *field_escape(char *to,const char *from,uint length);
|
|||
static char *add_load_option(char *ptr,const char *object,
|
||||
const char *statement);
|
||||
|
||||
static my_bool verbose=0,lock_tables=0,ignore_errors=0,delete=0,
|
||||
static my_bool verbose=0,lock_tables=0,ignore_errors=0,opt_delete=0,
|
||||
replace=0,silent=0,ignore=0,opt_compress=0,opt_local_file=0;
|
||||
|
||||
static MYSQL mysql_connection;
|
||||
|
@ -54,8 +54,8 @@ static uint opt_mysql_port=0;
|
|||
static my_string opt_mysql_unix_port=0;
|
||||
#include "sslopt-vars.h"
|
||||
|
||||
enum options {OPT_FTB=256, OPT_LTB, OPT_ENC, OPT_O_ENC, OPT_ESC,
|
||||
OPT_LOW_PRIORITY, OPT_CHARSETS_DIR, OPT_DEFAULT_CHARSET};
|
||||
enum mi_options {OPT_FTB=256, OPT_LTB, OPT_ENC, OPT_O_ENC, OPT_ESC,
|
||||
OPT_LOW_PRIORITY, OPT_CHARSETS_DIR, OPT_DEFAULT_CHARSET};
|
||||
|
||||
static struct option long_options[] =
|
||||
{
|
||||
|
@ -173,7 +173,8 @@ static int get_options(int *argc, char ***argv)
|
|||
int c, option_index;
|
||||
my_bool tty_password=0;
|
||||
|
||||
while ((c=getopt_long(*argc,*argv,"#::p::c:h:u:P:S:CdfilLrsvV?IW",
|
||||
while ((c=getopt_long(*argc,*argv,
|
||||
(char*) "#::p::c:h:u:P:S:CdfilLrsvV?IW",
|
||||
long_options, &option_index)) != EOF)
|
||||
{
|
||||
switch(c) {
|
||||
|
@ -190,7 +191,7 @@ static int get_options(int *argc, char ***argv)
|
|||
charsets_dir= optarg;
|
||||
break;
|
||||
case 'd':
|
||||
delete= 1;
|
||||
opt_delete= 1;
|
||||
break;
|
||||
case 'f':
|
||||
ignore_errors= 1;
|
||||
|
@ -313,7 +314,7 @@ static int write_to_table(char *filename, MYSQL *sock)
|
|||
else
|
||||
my_load_path(hard_path, filename, NULL); /* filename includes the path */
|
||||
|
||||
if (delete)
|
||||
if (opt_delete)
|
||||
{
|
||||
if (verbose)
|
||||
fprintf(stdout, "Deleting the old data from table %s\n", tablename);
|
||||
|
|
|
@ -51,7 +51,11 @@
|
|||
#include <mysql.h>
|
||||
#include <mysql_version.h>
|
||||
#include <m_ctype.h>
|
||||
#include <my_config.h>
|
||||
#ifdef OS2
|
||||
#include <config-os2.h>
|
||||
#else
|
||||
#include <my_config.h>
|
||||
#endif
|
||||
#include <my_dir.h>
|
||||
#include <hash.h>
|
||||
#include <mysqld_error.h>
|
||||
|
@ -829,6 +833,17 @@ int do_sleep(struct st_query* q)
|
|||
if (!*p)
|
||||
die("Missing argument in sleep\n");
|
||||
t.tv_usec = 0;
|
||||
|
||||
#ifdef OS2
|
||||
|
||||
if (opt_sleep)
|
||||
DosSleep( opt_sleep * 1000);
|
||||
else
|
||||
DosSleep( atof( p) * 1000);
|
||||
|
||||
return 0;
|
||||
|
||||
#else
|
||||
if (opt_sleep)
|
||||
t.tv_sec = opt_sleep;
|
||||
else
|
||||
|
@ -858,6 +873,7 @@ int do_sleep(struct st_query* q)
|
|||
}
|
||||
t.tv_usec *= dec_mul;
|
||||
return select(0,0,0,0, &t);
|
||||
#endif
|
||||
}
|
||||
|
||||
static void get_file_name(char *filename, struct st_query* q)
|
||||
|
@ -1881,8 +1897,8 @@ static VAR* var_init(VAR* v, const char* name, int name_len, const char* val,
|
|||
|
||||
static void var_free(void* v)
|
||||
{
|
||||
my_free(((VAR*)v)->str_val, MYF(MY_WME));
|
||||
my_free(v, MYF(MY_WME));
|
||||
my_free(((VAR*) v)->str_val, MYF(MY_WME));
|
||||
my_free((char*) v, MYF(MY_WME));
|
||||
}
|
||||
|
||||
|
||||
|
@ -2744,7 +2760,7 @@ uint replace_strings(REPLACE *rep, my_string *start,uint *max_length,
|
|||
{
|
||||
reg1 REPLACE *rep_pos;
|
||||
reg2 REPLACE_STRING *rep_str;
|
||||
my_string to,end,pos,new;
|
||||
my_string to,end,pos,new_str;
|
||||
|
||||
end=(to= *start) + *max_length-1;
|
||||
rep_pos=rep+1;
|
||||
|
@ -2756,10 +2772,10 @@ uint replace_strings(REPLACE *rep, my_string *start,uint *max_length,
|
|||
if (to == end)
|
||||
{
|
||||
(*max_length)+=8192;
|
||||
if (!(new=my_realloc(*start,*max_length,MYF(MY_WME))))
|
||||
if (!(new_str=my_realloc(*start,*max_length,MYF(MY_WME))))
|
||||
return (uint) -1;
|
||||
to=new+(to - *start);
|
||||
end=(*start=new)+ *max_length-1;
|
||||
to=new_str+(to - *start);
|
||||
end=(*start=new_str)+ *max_length-1;
|
||||
}
|
||||
*to++= *from++;
|
||||
}
|
||||
|
@ -2771,10 +2787,10 @@ uint replace_strings(REPLACE *rep, my_string *start,uint *max_length,
|
|||
if (to == end)
|
||||
{
|
||||
(*max_length)*=2;
|
||||
if (!(new=my_realloc(*start,*max_length,MYF(MY_WME))))
|
||||
if (!(new_str=my_realloc(*start,*max_length,MYF(MY_WME))))
|
||||
return (uint) -1;
|
||||
to=new+(to - *start);
|
||||
end=(*start=new)+ *max_length-1;
|
||||
to=new_str+(to - *start);
|
||||
end=(*start=new_str)+ *max_length-1;
|
||||
}
|
||||
*to++= *pos;
|
||||
}
|
||||
|
|
179
dbug/dbug.c
179
dbug/dbug.c
|
@ -307,6 +307,7 @@ static char *static_strtok(char *s1,pchar chr);
|
|||
* Macros and defines for testing file accessibility under UNIX and MSDOS.
|
||||
*/
|
||||
|
||||
#undef EXISTS
|
||||
#if !defined(HAVE_ACCESS) || defined(MSDOS)
|
||||
#define EXISTS(pathname) (FALSE) /* Assume no existance */
|
||||
#define Writable(name) (TRUE)
|
||||
|
@ -489,8 +490,7 @@ static CODE_STATE static_code_state = { 0,0,"?func","?file",NULL,0,NULL,
|
|||
*
|
||||
*/
|
||||
|
||||
void _db_push_ (control)
|
||||
const char *control;
|
||||
void _db_push_ (const char *control)
|
||||
{
|
||||
reg1 char *scan;
|
||||
reg2 struct link *temp;
|
||||
|
@ -691,15 +691,14 @@ void _db_pop_ ()
|
|||
*
|
||||
*/
|
||||
|
||||
void _db_enter_ (_func_, _file_, _line_, _sfunc_, _sfile_, _slevel_,
|
||||
_sframep_)
|
||||
const char *_func_;
|
||||
const char *_file_;
|
||||
uint _line_;
|
||||
const char **_sfunc_;
|
||||
const char **_sfile_;
|
||||
uint *_slevel_;
|
||||
char ***_sframep_ __attribute__((unused));
|
||||
void _db_enter_ (
|
||||
const char *_func_,
|
||||
const char *_file_,
|
||||
uint _line_,
|
||||
const char **_sfunc_,
|
||||
const char **_sfile_,
|
||||
uint *_slevel_,
|
||||
char ***_sframep_ __attribute__((unused)))
|
||||
{
|
||||
reg1 CODE_STATE *state;
|
||||
|
||||
|
@ -777,11 +776,11 @@ char ***_sframep_ __attribute__((unused));
|
|||
*
|
||||
*/
|
||||
|
||||
void _db_return_ (_line_, _sfunc_, _sfile_, _slevel_)
|
||||
uint _line_;
|
||||
const char **_sfunc_;
|
||||
const char **_sfile_;
|
||||
uint *_slevel_;
|
||||
void _db_return_ (
|
||||
uint _line_,
|
||||
const char **_sfunc_,
|
||||
const char **_sfile_,
|
||||
uint *_slevel_)
|
||||
{
|
||||
CODE_STATE *state;
|
||||
|
||||
|
@ -851,9 +850,9 @@ uint *_slevel_;
|
|||
*
|
||||
*/
|
||||
|
||||
void _db_pargs_ (_line_, keyword)
|
||||
uint _line_;
|
||||
const char *keyword;
|
||||
void _db_pargs_ (
|
||||
uint _line_,
|
||||
const char *keyword)
|
||||
{
|
||||
CODE_STATE *state=code_state();
|
||||
state->u_line = _line_;
|
||||
|
@ -934,10 +933,11 @@ void _db_doprnt_ (const char *format,...)
|
|||
* Is used to examine corrputed memory or arrays.
|
||||
*/
|
||||
|
||||
void _db_dump_(_line_,keyword,memory,length)
|
||||
uint _line_,length;
|
||||
const char *keyword;
|
||||
const char *memory;
|
||||
void _db_dump_(
|
||||
uint _line_,
|
||||
const char *keyword,
|
||||
const char *memory,
|
||||
uint length)
|
||||
{
|
||||
int pos;
|
||||
char dbuff[90];
|
||||
|
@ -1004,11 +1004,11 @@ const char *memory;
|
|||
*
|
||||
*/
|
||||
|
||||
static struct link *ListParse (ctlp)
|
||||
char *ctlp;
|
||||
static struct link *ListParse (
|
||||
char *ctlp)
|
||||
{
|
||||
REGISTER char *start;
|
||||
REGISTER struct link *new;
|
||||
REGISTER struct link *new_malloc;
|
||||
REGISTER struct link *head;
|
||||
|
||||
head = NULL;
|
||||
|
@ -1020,10 +1020,10 @@ char *ctlp;
|
|||
if (*ctlp == ',') {
|
||||
*ctlp++ = EOS;
|
||||
}
|
||||
new = (struct link *) DbugMalloc (sizeof (struct link));
|
||||
new -> str = StrDup (start);
|
||||
new -> next_link = head;
|
||||
head = new;
|
||||
new_malloc = (struct link *) DbugMalloc (sizeof (struct link));
|
||||
new_malloc -> str = StrDup (start);
|
||||
new_malloc -> next_link = head;
|
||||
head = new_malloc;
|
||||
}
|
||||
return (head);
|
||||
}
|
||||
|
@ -1052,9 +1052,9 @@ char *ctlp;
|
|||
*
|
||||
*/
|
||||
|
||||
static BOOLEAN InList (linkp, cp)
|
||||
struct link *linkp;
|
||||
const char *cp;
|
||||
static BOOLEAN InList (
|
||||
struct link *linkp,
|
||||
const char *cp)
|
||||
{
|
||||
REGISTER struct link *scan;
|
||||
REGISTER BOOLEAN result;
|
||||
|
@ -1098,7 +1098,7 @@ const char *cp;
|
|||
|
||||
static void PushState ()
|
||||
{
|
||||
REGISTER struct state *new;
|
||||
REGISTER struct state *new_malloc;
|
||||
|
||||
if (!init_done)
|
||||
{
|
||||
|
@ -1106,19 +1106,19 @@ static void PushState ()
|
|||
init_done=TRUE;
|
||||
}
|
||||
(void) code_state(); /* Alloc memory */
|
||||
new = (struct state *) DbugMalloc (sizeof (struct state));
|
||||
new -> flags = 0;
|
||||
new -> delay = 0;
|
||||
new -> maxdepth = MAXDEPTH;
|
||||
new -> sub_level=0;
|
||||
new -> out_file = stderr;
|
||||
new -> prof_file = (FILE*) 0;
|
||||
new -> functions = NULL;
|
||||
new -> p_functions = NULL;
|
||||
new -> keywords = NULL;
|
||||
new -> processes = NULL;
|
||||
new -> next_state = stack;
|
||||
stack=new;
|
||||
new_malloc = (struct state *) DbugMalloc (sizeof (struct state));
|
||||
new_malloc -> flags = 0;
|
||||
new_malloc -> delay = 0;
|
||||
new_malloc -> maxdepth = MAXDEPTH;
|
||||
new_malloc -> sub_level=0;
|
||||
new_malloc -> out_file = stderr;
|
||||
new_malloc -> prof_file = (FILE*) 0;
|
||||
new_malloc -> functions = NULL;
|
||||
new_malloc -> p_functions = NULL;
|
||||
new_malloc -> keywords = NULL;
|
||||
new_malloc -> processes = NULL;
|
||||
new_malloc -> next_state = stack;
|
||||
stack=new_malloc;
|
||||
}
|
||||
|
||||
|
||||
|
@ -1216,8 +1216,8 @@ static BOOLEAN DoProfile ()
|
|||
*
|
||||
*/
|
||||
|
||||
BOOLEAN _db_keyword_ (keyword)
|
||||
const char *keyword;
|
||||
BOOLEAN _db_keyword_ (
|
||||
const char *keyword)
|
||||
{
|
||||
REGISTER BOOLEAN result;
|
||||
CODE_STATE *state;
|
||||
|
@ -1256,8 +1256,8 @@ const char *keyword;
|
|||
*
|
||||
*/
|
||||
|
||||
static void Indent (indent)
|
||||
int indent;
|
||||
static void Indent (
|
||||
int indent)
|
||||
{
|
||||
REGISTER int count;
|
||||
|
||||
|
@ -1289,8 +1289,8 @@ int indent;
|
|||
*
|
||||
*/
|
||||
|
||||
static void FreeList (linkp)
|
||||
struct link *linkp;
|
||||
static void FreeList (
|
||||
struct link *linkp)
|
||||
{
|
||||
REGISTER struct link *old;
|
||||
|
||||
|
@ -1325,13 +1325,13 @@ struct link *linkp;
|
|||
*/
|
||||
|
||||
|
||||
static char *StrDup (str)
|
||||
const char *str;
|
||||
static char *StrDup (
|
||||
const char *str)
|
||||
{
|
||||
reg1 char *new;
|
||||
new = DbugMalloc ((int) strlen (str) + 1);
|
||||
(void) strcpy (new, str);
|
||||
return (new);
|
||||
reg1 char *new_malloc;
|
||||
new_malloc = DbugMalloc ((int) strlen (str) + 1);
|
||||
(void) strcpy (new_malloc, str);
|
||||
return (new_malloc);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1354,8 +1354,8 @@ const char *str;
|
|||
*
|
||||
*/
|
||||
|
||||
static void DoPrefix (_line_)
|
||||
uint _line_;
|
||||
static void DoPrefix (
|
||||
uint _line_)
|
||||
{
|
||||
CODE_STATE *state;
|
||||
state=code_state();
|
||||
|
@ -1419,7 +1419,7 @@ static void DBUGOpenFile (const char *name,int append)
|
|||
}
|
||||
else
|
||||
{
|
||||
if (!Writable(name))
|
||||
if (!Writable((char*)name))
|
||||
{
|
||||
(void) fprintf (stderr, ERR_OPEN, _db_process_, name);
|
||||
perror ("");
|
||||
|
@ -1528,8 +1528,8 @@ static FILE *OpenProfile (const char *name)
|
|||
*
|
||||
*/
|
||||
|
||||
static void CloseFile (fp)
|
||||
FILE *fp;
|
||||
static void CloseFile (
|
||||
FILE *fp)
|
||||
{
|
||||
if (fp != stderr && fp != stdout) {
|
||||
if (fclose (fp) == EOF) {
|
||||
|
@ -1590,14 +1590,14 @@ static void DbugExit (const char *why)
|
|||
*
|
||||
*/
|
||||
|
||||
static char *DbugMalloc (size)
|
||||
int size;
|
||||
static char *DbugMalloc (
|
||||
int size)
|
||||
{
|
||||
register char *new;
|
||||
register char *new_malloc;
|
||||
|
||||
if (!(new = malloc ((unsigned int) size)))
|
||||
if (!(new_malloc = (char*) malloc ((unsigned int) size)))
|
||||
DbugExit ("out of memory");
|
||||
return (new);
|
||||
return (new_malloc);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1606,9 +1606,9 @@ int size;
|
|||
* separator (to allow directory-paths in dos).
|
||||
*/
|
||||
|
||||
static char *static_strtok (s1, separator)
|
||||
char *s1;
|
||||
pchar separator;
|
||||
static char *static_strtok (
|
||||
char *s1,
|
||||
pchar separator)
|
||||
{
|
||||
static char *end = NULL;
|
||||
reg1 char *rtnval,*cpy;
|
||||
|
@ -1692,8 +1692,8 @@ static char *BaseName (const char *pathname)
|
|||
|
||||
#ifndef Writable
|
||||
|
||||
static BOOLEAN Writable (pathname)
|
||||
char *pathname;
|
||||
static BOOLEAN Writable (
|
||||
char *pathname)
|
||||
{
|
||||
REGISTER BOOLEAN granted;
|
||||
REGISTER char *lastslash;
|
||||
|
@ -1746,8 +1746,8 @@ char *pathname;
|
|||
*/
|
||||
|
||||
#ifndef ChangeOwner
|
||||
static void ChangeOwner (pathname)
|
||||
char *pathname;
|
||||
static void ChangeOwner (
|
||||
char *pathname)
|
||||
{
|
||||
if (chown (pathname, getuid (), getgid ()) == -1)
|
||||
{
|
||||
|
@ -1847,8 +1847,8 @@ EXPORT void _db_longjmp_ ()
|
|||
#define HZ (50) /* Probably in some header somewhere */
|
||||
#endif
|
||||
|
||||
static int DelayArg (value)
|
||||
int value;
|
||||
static int DelayArg (
|
||||
int value)
|
||||
{
|
||||
uint delayarg = 0;
|
||||
|
||||
|
@ -1868,8 +1868,8 @@ int value;
|
|||
*/
|
||||
|
||||
#if ! defined(Delay) && ! defined(AMIGA)
|
||||
static int Delay (ticks)
|
||||
int ticks;
|
||||
static int Delay (
|
||||
int ticks)
|
||||
{
|
||||
return ticks;
|
||||
}
|
||||
|
@ -1969,12 +1969,13 @@ void _db_unlock_file()
|
|||
* own for whatever system that you have.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_GETRUSAGE
|
||||
#ifndef THREAD
|
||||
#if defined(HAVE_GETRUSAGE)
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/resource.h>
|
||||
|
||||
/* extern int getrusage(int, struct rusage *); */
|
||||
/* extern int getrusage(int, struct rusage *); */
|
||||
|
||||
/*
|
||||
* Returns the user time in milliseconds used by this process so
|
||||
|
@ -1989,15 +1990,13 @@ static unsigned long Clock ()
|
|||
return ((ru.ru_utime.tv_sec * 1000) + (ru.ru_utime.tv_usec / 1000));
|
||||
}
|
||||
|
||||
#else
|
||||
#if defined(MSDOS) || defined(__WIN__)
|
||||
#elif defined(MSDOS) || defined(__WIN__) || defined(OS2)
|
||||
|
||||
static ulong Clock()
|
||||
{
|
||||
return clock()*(1000/CLOCKS_PER_SEC);
|
||||
}
|
||||
#else
|
||||
#ifdef amiga
|
||||
#elif defined (amiga)
|
||||
|
||||
struct DateStamp { /* Yes, this is a hack, but doing it right */
|
||||
long ds_Days; /* is incredibly ugly without splitting this */
|
||||
|
@ -2030,19 +2029,13 @@ static unsigned long Clock ()
|
|||
}
|
||||
return (millisec);
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
#ifndef THREAD
|
||||
static unsigned long Clock ()
|
||||
{
|
||||
return (0);
|
||||
}
|
||||
#endif
|
||||
#endif /* amiga */
|
||||
#endif /* MSDOS || __WIN__ */
|
||||
#endif /* RUSAGE */
|
||||
|
||||
#endif /* THREADS */
|
||||
|
||||
#ifdef NO_VARARGS
|
||||
|
||||
|
|
|
@ -4,8 +4,8 @@
|
|||
|
||||
#include <global.h>
|
||||
|
||||
int factorial (value)
|
||||
register int value;
|
||||
int factorial (
|
||||
register int value)
|
||||
{
|
||||
DBUG_ENTER ("factorial");
|
||||
DBUG_PRINT ("find", ("find %d factorial", value));
|
||||
|
|
822
include/config-os2.h
Normal file
822
include/config-os2.h
Normal file
|
@ -0,0 +1,822 @@
|
|||
/* Copyright (C) 2000 MySQL AB & Yuri Dario
|
||||
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.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library 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
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
|
||||
MA 02111-1307, USA */
|
||||
|
||||
/* Defines for OS2 to make it compatible for MySQL */
|
||||
|
||||
#ifndef __CONFIG_OS2_H__
|
||||
#define __CONFIG_OS2_H__
|
||||
|
||||
#include <os2.h>
|
||||
#include <math.h>
|
||||
#include <io.h>
|
||||
|
||||
/* Define to name of system eg solaris*/
|
||||
#define SYSTEM_TYPE "IBM OS/2 Warp"
|
||||
/* Define to machine type name eg sun10 */
|
||||
#define MACHINE_TYPE "i686"
|
||||
/* Name of package */
|
||||
#define PACKAGE "mysql"
|
||||
/* Version number of package */
|
||||
#define VERSION MYSQL_SERVER_VERSION
|
||||
/* Default socket */
|
||||
#define MYSQL_UNIX_ADDR "\\socket\\MySQL"
|
||||
|
||||
#define FN_LIBCHAR '\\'
|
||||
#define FN_ROOTDIR "\\"
|
||||
#define MY_NFILE 1024 /* This is only used to save filenames */
|
||||
|
||||
#define HAVE_ACCESS
|
||||
|
||||
#define DEFAULT_MYSQL_HOME "c:\\mysql"
|
||||
#define DEFAULT_BASEDIR "C:\\"
|
||||
#define SHAREDIR "share"
|
||||
#define DEFAULT_CHARSET_HOME "C:/mysql/"
|
||||
#define _POSIX_PATH_MAX 255
|
||||
#define DWORD ULONG
|
||||
|
||||
#define O_SHARE 0x1000 /* Open file in sharing mode */
|
||||
#define FILE_BINARY O_BINARY /* my_fopen in binary mode */
|
||||
#define S_IROTH S_IREAD /* for my_lib */
|
||||
|
||||
#define O_NONBLOCK 0x10
|
||||
|
||||
#define NO_OPEN_3 /* For my_create() */
|
||||
#define SIGQUIT SIGTERM /* No SIGQUIT */
|
||||
#define SIGALRM 14 /* Alarm */
|
||||
|
||||
#define NO_FCNTL_NONBLOCK
|
||||
|
||||
#define EFBIG E2BIG
|
||||
//#define ENFILE EMFILE
|
||||
//#define ENAMETOOLONG (EOS2ERR+2)
|
||||
//#define ETIMEDOUT 145
|
||||
//#define EPIPE 146
|
||||
#define EROFS 147
|
||||
|
||||
#define sleep(A) DosSleep((A)*1000)
|
||||
#define closesocket(A) soclose(A)
|
||||
|
||||
#define F_OK 0
|
||||
#define W_OK 2
|
||||
|
||||
#define bzero(x,y) memset((x),'\0',(y))
|
||||
#define bcopy(x,y,z) memcpy((y),(x),(z))
|
||||
#define bcmp(x,y,z) memcmp((y),(x),(z))
|
||||
|
||||
#define F_RDLCK 4 /* Read lock. */
|
||||
#define F_WRLCK 2 /* Write lock. */
|
||||
#define F_UNLCK 0 /* Remove lock. */
|
||||
|
||||
#define S_IFMT 0xF000 /* Mask for file type */
|
||||
#define F_TO_EOF 0L /* Param to lockf() to lock rest of file */
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
#endif
|
||||
double _cdecl rint( double nr);
|
||||
|
||||
DWORD TlsAlloc( void);
|
||||
BOOL TlsFree( DWORD);
|
||||
PVOID TlsGetValue( DWORD);
|
||||
BOOL TlsSetValue( DWORD, PVOID);
|
||||
|
||||
/* support for > 2GB file size */
|
||||
#define SIZEOF_OFF_T 8
|
||||
#define lseek(A,B,C) _lseek64( A, B, C)
|
||||
#define tell(A) _lseek64( A, 0, SEEK_CUR)
|
||||
|
||||
/* Some typedefs */
|
||||
typedef ulonglong os_off_t;
|
||||
|
||||
/* config.h. Generated automatically by configure. */
|
||||
/* config.h.in. Generated automatically from configure.in by autoheader. */
|
||||
|
||||
/* Define if using alloca.c. */
|
||||
/* #undef C_ALLOCA */
|
||||
|
||||
/* Define to empty if the keyword does not work. */
|
||||
/* #undef const */
|
||||
|
||||
/* Define to one of _getb67, GETB67, getb67 for Cray-2 and Cray-YMP systems.
|
||||
This function is required for alloca.c support on those systems. */
|
||||
/* #undef CRAY_STACKSEG_END */
|
||||
|
||||
/* Define if you have alloca, as a function or macro. */
|
||||
#define HAVE_ALLOCA 1
|
||||
|
||||
/* Define if you have <alloca.h> and it should be used (not on Ultrix). */
|
||||
//#define HAVE_ALLOCA_H 1
|
||||
|
||||
/* Define if you don't have vprintf but do have _doprnt. */
|
||||
/* #undef HAVE_DOPRNT */
|
||||
|
||||
/* Define if you have a working `mmap' system call. */
|
||||
/* #undef HAVE_MMAP */
|
||||
|
||||
/* Define if system calls automatically restart after interruption
|
||||
by a signal. */
|
||||
/* #undef HAVE_RESTARTABLE_SYSCALLS */
|
||||
|
||||
/* Define if your struct stat has st_rdev. */
|
||||
#define HAVE_ST_RDEV 1
|
||||
|
||||
/* Define if you have <sys/wait.h> that is POSIX.1 compatible. */
|
||||
//#define HAVE_SYS_WAIT_H 1
|
||||
|
||||
/* Define if you don't have tm_zone but do have the external array
|
||||
tzname. */
|
||||
#define HAVE_TZNAME 1
|
||||
|
||||
/* Define if utime(file, NULL) sets file's timestamp to the present. */
|
||||
#define HAVE_UTIME_NULL 1
|
||||
|
||||
/* Define if you have the vprintf function. */
|
||||
#define HAVE_VPRINTF 1
|
||||
|
||||
/* Define as __inline if that's what the C compiler calls it. */
|
||||
/* #undef inline */
|
||||
|
||||
/* Define to `long' if <sys/types.h> doesn't define. */
|
||||
/* #undef off_t */
|
||||
|
||||
/* Define as the return type of signal handlers (int or void). */
|
||||
#define RETSIGTYPE void
|
||||
|
||||
/* Define to `unsigned' if <sys/types.h> doesn't define. */
|
||||
/* #undef size_t */
|
||||
|
||||
/* If using the C implementation of alloca, define if you know the
|
||||
direction of stack growth for your system; otherwise it will be
|
||||
automatically deduced at run-time.
|
||||
STACK_DIRECTION > 0 => grows toward higher addresses
|
||||
STACK_DIRECTION < 0 => grows toward lower addresses
|
||||
STACK_DIRECTION = 0 => direction of growth unknown
|
||||
*/
|
||||
#define STACK_DIRECTION -1
|
||||
|
||||
/* Define if the `S_IS*' macros in <sys/stat.h> do not work properly. */
|
||||
/* #undef STAT_MACROS_BROKEN */
|
||||
|
||||
/* Define if you have the ANSI C header files. */
|
||||
#define STDC_HEADERS 1
|
||||
|
||||
/* Define if you can safely include both <sys/time.h> and <time.h>. */
|
||||
#define TIME_WITH_SYS_TIME 1
|
||||
|
||||
/* Define if your <sys/time.h> declares struct tm. */
|
||||
/* #undef TM_IN_SYS_TIME */
|
||||
|
||||
/* Define if your processor stores words with the most significant
|
||||
byte first (like Motorola and SPARC, unlike Intel and VAX). */
|
||||
/* #undef WORDS_BIGENDIAN */
|
||||
|
||||
/* Version of .frm files */
|
||||
#define DOT_FRM_VERSION 6
|
||||
|
||||
/* READLINE: */
|
||||
#define FIONREAD_IN_SYS_IOCTL 1
|
||||
|
||||
/* READLINE: Define if your system defines TIOCGWINSZ in sys/ioctl.h. */
|
||||
/* #undef GWINSZ_IN_SYS_IOCTL */
|
||||
|
||||
/* Do we have FIONREAD */
|
||||
#define FIONREAD_IN_SYS_IOCTL 1
|
||||
|
||||
/* atomic_add() from <asm/atomic.h> (Linux only) */
|
||||
/* #undef HAVE_ATOMIC_ADD */
|
||||
|
||||
/* atomic_sub() from <asm/atomic.h> (Linux only) */
|
||||
/* #undef HAVE_ATOMIC_SUB */
|
||||
|
||||
/* bool is not defined by all C++ compilators */
|
||||
#define HAVE_BOOL 1
|
||||
|
||||
/* Have berkeley db installed */
|
||||
//#define HAVE_BERKELEY_DB 1
|
||||
|
||||
/* DSB style signals ? */
|
||||
/* #undef HAVE_BSD_SIGNALS */
|
||||
|
||||
/* Can netinet be included */
|
||||
/* #undef HAVE_BROKEN_NETINET_INCLUDES */
|
||||
|
||||
/* READLINE: */
|
||||
/* #undef HAVE_BSD_SIGNALS */
|
||||
|
||||
/* ZLIB and compress: */
|
||||
#define HAVE_COMPRESS 1
|
||||
|
||||
/* Define if we are using OSF1 DEC threads */
|
||||
/* #undef HAVE_DEC_THREADS */
|
||||
|
||||
/* Define if we are using OSF1 DEC threads on 3.2 */
|
||||
/* #undef HAVE_DEC_3_2_THREADS */
|
||||
|
||||
/* fp_except from ieeefp.h */
|
||||
/* #undef HAVE_FP_EXCEPT */
|
||||
|
||||
/* READLINE: */
|
||||
/* #undef HAVE_GETPW_DECLS */
|
||||
|
||||
/* Solaris define gethostbyname_r with 5 arguments. glibc2 defines
|
||||
this with 6 arguments */
|
||||
/* #undef HAVE_GETHOSTBYNAME_R_GLIBC2_STYLE */
|
||||
|
||||
/* In OSF 4.0f the 3'd argument to gethostname_r is hostent_data * */
|
||||
/* #undef HAVE_GETHOSTBYNAME_R_RETURN_INT */
|
||||
|
||||
/* Define if int8, int16 and int32 types exist */
|
||||
/* #undef HAVE_INT_8_16_32 */
|
||||
|
||||
/* Define if have -lwrap */
|
||||
/* #undef HAVE_LIBWRAP */
|
||||
|
||||
/* Define if we are using Xavier Leroy's LinuxThreads */
|
||||
/* #undef HAVE_LINUXTHREADS */
|
||||
|
||||
/* Do we use user level threads */
|
||||
/* #undef HAVE_mit_thread */
|
||||
|
||||
/* For some non posix threads */
|
||||
/* #undef HAVE_NONPOSIX_PTHREAD_GETSPECIFIC */
|
||||
|
||||
/* For some non posix threads */
|
||||
/* #undef HAVE_NONPOSIX_PTHREAD_MUTEX_INIT */
|
||||
|
||||
/* READLINE: */
|
||||
#define HAVE_POSIX_SIGNALS 1
|
||||
|
||||
/* sigwait with one argument */
|
||||
/* #undef HAVE_NONPOSIX_SIGWAIT */
|
||||
|
||||
/* pthread_attr_setscope */
|
||||
#define HAVE_PTHREAD_ATTR_SETSCOPE 1
|
||||
|
||||
/* POSIX readdir_r */
|
||||
/* #undef HAVE_READDIR_R */
|
||||
|
||||
/* POSIX sigwait */
|
||||
/* #undef HAVE_SIGWAIT */
|
||||
|
||||
/* crypt */
|
||||
#define HAVE_CRYPT 1
|
||||
|
||||
/* Solaris define gethostbyaddr_r with 7 arguments. glibc2 defines
|
||||
this with 8 arguments */
|
||||
/* #undef HAVE_SOLARIS_STYLE_GETHOST */
|
||||
|
||||
/* Timespec has a ts_sec instead of tv_sev */
|
||||
#define HAVE_TIMESPEC_TS_SEC 1
|
||||
|
||||
/* Have the tzname variable */
|
||||
#define HAVE_TZNAME 1
|
||||
|
||||
/* Define if the system files define uchar */
|
||||
/* #undef HAVE_UCHAR */
|
||||
|
||||
/* Define if the system files define uint */
|
||||
/* #undef HAVE_UINT */
|
||||
|
||||
/* Define if the system files define ulong */
|
||||
/* #undef HAVE_ULONG */
|
||||
|
||||
/* UNIXWARE7 threads are not posix */
|
||||
/* #undef HAVE_UNIXWARE7_THREADS */
|
||||
|
||||
/* new UNIXWARE7 threads that are not yet posix */
|
||||
/* #undef HAVE_UNIXWARE7_POSIX */
|
||||
|
||||
/* READLINE: */
|
||||
/* #undef HAVE_USG_SIGHOLD */
|
||||
|
||||
/* Define if want -lwrap */
|
||||
/* #undef LIBWRAP */
|
||||
|
||||
/* mysql client protocoll version */
|
||||
#define PROTOCOL_VERSION 10
|
||||
|
||||
/* Define if qsort returns void */
|
||||
#define QSORT_TYPE_IS_VOID 1
|
||||
|
||||
/* Define as the return type of qsort (int or void). */
|
||||
#define RETQSORTTYPE void
|
||||
|
||||
/* Define as the base type of the last arg to accept */
|
||||
#define SOCKET_SIZE_TYPE int
|
||||
|
||||
/* Last argument to get/setsockopt */
|
||||
/* #undef SOCKOPT_OPTLEN_TYPE */
|
||||
|
||||
/* #undef SPEED_T_IN_SYS_TYPES */
|
||||
/* #undef SPRINTF_RETURNS_PTR */
|
||||
#define SPRINTF_RETURNS_INT 1
|
||||
/* #undef SPRINTF_RETURNS_GARBAGE */
|
||||
|
||||
/* #undef STRUCT_DIRENT_HAS_D_FILENO */
|
||||
#define STRUCT_DIRENT_HAS_D_INO 1
|
||||
|
||||
/* Define if you want to have threaded code. This may be undef on client code */
|
||||
#define THREAD 1
|
||||
|
||||
/* Should be client be thread safe */
|
||||
/* #undef THREAD_SAFE_CLIENT */
|
||||
|
||||
/* READLINE: */
|
||||
/* #undef TIOCSTAT_IN_SYS_IOCTL */
|
||||
|
||||
/* Use multi-byte character routines */
|
||||
/* #undef USE_MB */
|
||||
/* #undef USE_MB_IDENT */
|
||||
|
||||
/* Use MySQL RAID */
|
||||
/* #undef USE_RAID */
|
||||
|
||||
/* Use strcoll() functions when comparing and sorting. */
|
||||
/* #undef USE_STRCOLL */
|
||||
|
||||
/* READLINE: */
|
||||
#define VOID_SIGHANDLER 1
|
||||
|
||||
/* The number of bytes in a char. */
|
||||
#define SIZEOF_CHAR 1
|
||||
|
||||
/* The number of bytes in a int. */
|
||||
#define SIZEOF_INT 4
|
||||
|
||||
/* The number of bytes in a long. */
|
||||
#define SIZEOF_LONG 4
|
||||
|
||||
/* The number of bytes in a long long. */
|
||||
#define SIZEOF_LONG_LONG 8
|
||||
|
||||
/* Define if you have the alarm function. */
|
||||
#define HAVE_ALARM 1
|
||||
|
||||
/* Define if you have the atod function. */
|
||||
/* #undef HAVE_ATOD */
|
||||
|
||||
/* Define if you have the bcmp function. */
|
||||
#define HAVE_BCMP 1
|
||||
|
||||
/* Define if you have the bfill function. */
|
||||
/* #undef HAVE_BFILL */
|
||||
|
||||
/* Define if you have the bmove function. */
|
||||
/* #undef HAVE_BMOVE */
|
||||
|
||||
/* Define if you have the bzero function. */
|
||||
#define HAVE_BZERO 1
|
||||
|
||||
/* Define if you have the chsize function. */
|
||||
#define HAVE_CHSIZE 1
|
||||
|
||||
/* Define if you have the cuserid function. */
|
||||
//#define HAVE_CUSERID 1
|
||||
|
||||
/* Define if you have the dlerror function. */
|
||||
#define HAVE_DLERROR 1
|
||||
|
||||
/* Define if you have the dlopen function. */
|
||||
#define HAVE_DLOPEN 1
|
||||
|
||||
/* Define if you have the fchmod function. */
|
||||
/* #undef HAVE_FCHMOD */
|
||||
|
||||
/* Define if you have the fcntl function. */
|
||||
//#define HAVE_FCNTL 1
|
||||
|
||||
/* Define if you have the fconvert function. */
|
||||
/* #undef HAVE_FCONVERT */
|
||||
|
||||
/* Define if you have the finite function. */
|
||||
/* #undef HAVE_FINITE */
|
||||
|
||||
/* Define if you have the fpresetsticky function. */
|
||||
/* #undef HAVE_FPRESETSTICKY */
|
||||
|
||||
/* Define if you have the fpsetmask function. */
|
||||
/* #undef HAVE_FPSETMASK */
|
||||
|
||||
/* Define if you have the fseeko function. */
|
||||
/* #undef HAVE_FSEEKO */
|
||||
|
||||
/* Define if you have the ftruncate function. */
|
||||
//#define HAVE_FTRUNCATE 1
|
||||
|
||||
/* Define if you have the getcwd function. */
|
||||
#define HAVE_GETCWD 1
|
||||
|
||||
/* Define if you have the gethostbyaddr_r function. */
|
||||
/* #undef HAVE_GETHOSTBYADDR_R */
|
||||
|
||||
/* Define if you have the gethostbyname_r function. */
|
||||
/* #undef HAVE_GETHOSTBYNAME_R */
|
||||
|
||||
/* Define if you have the getpagesize function. */
|
||||
#define HAVE_GETPAGESIZE 1
|
||||
|
||||
/* Define if you have the getpass function. */
|
||||
//#define HAVE_GETPASS 1
|
||||
|
||||
/* Define if you have the getpassphrase function. */
|
||||
/* #undef HAVE_GETPASSPHRASE */
|
||||
|
||||
/* Define if you have the getpwnam function. */
|
||||
//#define HAVE_GETPWNAM 1
|
||||
|
||||
/* Define if you have the getpwuid function. */
|
||||
//#define HAVE_GETPWUID 1
|
||||
|
||||
/* Define if you have the getrlimit function. */
|
||||
/* #undef HAVE_GETRLIMIT */
|
||||
|
||||
/* Define if you have the getrusage function. */
|
||||
/* #undef HAVE_GETRUSAGE */
|
||||
|
||||
/* Define if you have the getwd function. */
|
||||
#define HAVE_GETWD 1
|
||||
|
||||
/* Define if you have the index function. */
|
||||
#define HAVE_INDEX 1
|
||||
|
||||
/* Define if you have the initgroups function. */
|
||||
/* #undef HAVE_INITGROUPS */
|
||||
|
||||
/* Define if you have the localtime_r function. */
|
||||
#define HAVE_LOCALTIME_R 1
|
||||
|
||||
/* Define if you have the locking function. */
|
||||
/* #undef HAVE_LOCKING */
|
||||
|
||||
/* Define if you have the longjmp function. */
|
||||
#define HAVE_LONGJMP 1
|
||||
|
||||
/* Define if you have the lrand48 function. */
|
||||
/* #undef HAVE_LRAND48 */
|
||||
|
||||
/* Define if you have the lstat function. */
|
||||
/* #undef HAVE_LSTAT */
|
||||
|
||||
/* Define if you have the madvise function. */
|
||||
/* #undef HAVE_MADVISE */
|
||||
|
||||
/* Define if you have the memcpy function. */
|
||||
#define HAVE_MEMCPY 1
|
||||
|
||||
/* Define if you have the memmove function. */
|
||||
#define HAVE_MEMMOVE 1
|
||||
|
||||
/* Define if you have the mkstemp function. */
|
||||
//#define HAVE_MKSTEMP 1
|
||||
|
||||
/* Define if you have the mlockall function. */
|
||||
/* #undef HAVE_MLOCKALL */
|
||||
|
||||
/* Define if you have the perror function. */
|
||||
#define HAVE_PERROR 1
|
||||
|
||||
/* Define if you have the poll function. */
|
||||
/* #undef HAVE_POLL */
|
||||
|
||||
/* Define if you have the pread function. */
|
||||
/* #undef HAVE_PREAD */
|
||||
|
||||
/* Define if you have the pthread_attr_create function. */
|
||||
/* #undef HAVE_PTHREAD_ATTR_CREATE */
|
||||
|
||||
/* Define if you have the pthread_attr_setprio function. */
|
||||
#define HAVE_PTHREAD_ATTR_SETPRIO 1
|
||||
|
||||
/* Define if you have the pthread_attr_setschedparam function. */
|
||||
/* #undef HAVE_PTHREAD_ATTR_SETSCHEDPARAM */
|
||||
|
||||
/* Define if you have the pthread_attr_setstacksize function. */
|
||||
#define HAVE_PTHREAD_ATTR_SETSTACKSIZE 1
|
||||
|
||||
/* Define if you have the pthread_condattr_create function. */
|
||||
/* #undef HAVE_PTHREAD_CONDATTR_CREATE */
|
||||
|
||||
/* Define if you have the pthread_getsequence_np function. */
|
||||
/* #undef HAVE_PTHREAD_GETSEQUENCE_NP */
|
||||
|
||||
/* Define if you have the pthread_init function. */
|
||||
/* #undef HAVE_PTHREAD_INIT */
|
||||
|
||||
/* Define if you have the pthread_rwlock_rdlock function. */
|
||||
/* #undef HAVE_PTHREAD_RWLOCK_RDLOCK */
|
||||
|
||||
/* Define if you have the pthread_setprio function. */
|
||||
#define HAVE_PTHREAD_SETPRIO 1
|
||||
|
||||
/* Define if you have the pthread_setprio_np function. */
|
||||
/* #undef HAVE_PTHREAD_SETPRIO_NP */
|
||||
|
||||
/* Define if you have the pthread_setschedparam function. */
|
||||
/* #undef HAVE_PTHREAD_SETSCHEDPARAM */
|
||||
|
||||
/* Define if you have the pthread_sigmask function. */
|
||||
#define HAVE_PTHREAD_SIGMASK 1
|
||||
|
||||
/* Define if you have the putenv function. */
|
||||
#define HAVE_PUTENV 1
|
||||
|
||||
/* Define if you have the readlink function. */
|
||||
/* #undef HAVE_READLINK */
|
||||
|
||||
/* Define if you have the realpath function. */
|
||||
/* #undef HAVE_REALPATH */
|
||||
|
||||
/* Define if you have the rename function. */
|
||||
#define HAVE_RENAME 1
|
||||
|
||||
/* Define if you have the rint function. */
|
||||
#define HAVE_RINT 1
|
||||
|
||||
/* Define if you have the rwlock_init function. */
|
||||
/* #undef HAVE_RWLOCK_INIT */
|
||||
|
||||
/* Define if you have the select function. */
|
||||
#define HAVE_SELECT 1
|
||||
|
||||
/* Define if you have the setenv function. */
|
||||
/* #undef HAVE_SETENV */
|
||||
|
||||
/* Define if you have the setlocale function. */
|
||||
#define HAVE_SETLOCALE 1
|
||||
|
||||
/* Define if you have the setupterm function. */
|
||||
/* #undef HAVE_SETUPTERM */
|
||||
|
||||
/* Define if you have the sighold function. */
|
||||
/* #undef HAVE_SIGHOLD */
|
||||
|
||||
/* Define if you have the sigset function. */
|
||||
/* #undef HAVE_SIGSET */
|
||||
|
||||
/* Define if you have the sigthreadmask function. */
|
||||
/* #undef HAVE_SIGTHREADMASK */
|
||||
|
||||
/* Define if you have the snprintf function. */
|
||||
//#define HAVE_SNPRINTF 1
|
||||
|
||||
/* Define if you have the socket function. */
|
||||
#define HAVE_SOCKET 1
|
||||
|
||||
/* Define if you have the stpcpy function. */
|
||||
/* #undef HAVE_STPCPY */
|
||||
|
||||
/* Define if you have the strcasecmp function. */
|
||||
/* #undef HAVE_STRCASECMP */
|
||||
|
||||
/* Define if you have the strcoll function. */
|
||||
#define HAVE_STRCOLL 1
|
||||
|
||||
/* Define if you have the strerror function. */
|
||||
#define HAVE_STRERROR 1
|
||||
|
||||
/* Define if you have the strnlen function. */
|
||||
/* #undef HAVE_STRNLEN */
|
||||
|
||||
/* Define if you have the strpbrk function. */
|
||||
#define HAVE_STRPBRK 1
|
||||
|
||||
/* Define if you have the strstr function. */
|
||||
#define HAVE_STRSTR 1
|
||||
|
||||
/* Define if you have the strtok_r function. */
|
||||
/* #undef HAVE_STRTOK_R */
|
||||
|
||||
/* Define if you have the strtol function. */
|
||||
#define HAVE_STRTOL 1
|
||||
|
||||
/* Define if you have the strtoul function. */
|
||||
#define HAVE_STRTOUL 1
|
||||
|
||||
/* Define if you have the strtoull function. */
|
||||
/* #undef HAVE_STRTOULL */
|
||||
|
||||
/* Define if you have the tcgetattr function. */
|
||||
#define HAVE_TCGETATTR 1
|
||||
|
||||
/* Define if you have the tell function. */
|
||||
#define HAVE_TELL 1
|
||||
|
||||
/* Define if you have the tempnam function. */
|
||||
#define HAVE_TEMPNAM 1
|
||||
|
||||
/* Define if you have the thr_setconcurrency function. */
|
||||
/* #undef HAVE_THR_SETCONCURRENCY */
|
||||
|
||||
/* Define if you have the vidattr function. */
|
||||
/* #undef HAVE_VIDATTR */
|
||||
|
||||
/* Define if you have the <alloca.h> header file. */
|
||||
//#define HAVE_ALLOCA_H 1
|
||||
|
||||
/* Define if you have the <arpa/inet.h> header file. */
|
||||
#define HAVE_ARPA_INET_H 1
|
||||
|
||||
/* Define if you have the <asm/termbits.h> header file. */
|
||||
/* #undef HAVE_ASM_TERMBITS_H */
|
||||
|
||||
/* Define if you have the <crypt.h> header file. */
|
||||
#define HAVE_CRYPT_H 1
|
||||
|
||||
/* Define if you have the <curses.h> header file. */
|
||||
//#define HAVE_CURSES_H 1
|
||||
|
||||
/* Define if you have the <dirent.h> header file. */
|
||||
//#define HAVE_DIRENT_H 1
|
||||
|
||||
/* Define if you have the <fcntl.h> header file. */
|
||||
#define HAVE_FCNTL_H 1
|
||||
|
||||
/* Define if you have the <float.h> header file. */
|
||||
#define HAVE_FLOAT_H 1
|
||||
|
||||
/* Define if you have the <floatingpoint.h> header file. */
|
||||
/* #undef HAVE_FLOATINGPOINT_H */
|
||||
|
||||
/* Define if you have the <grp.h> header file. */
|
||||
//#define HAVE_GRP_H 1
|
||||
|
||||
/* Define if you have the <ieeefp.h> header file. */
|
||||
/* #undef HAVE_IEEEFP_H */
|
||||
|
||||
/* Define if you have the <limits.h> header file. */
|
||||
#define HAVE_LIMITS_H 1
|
||||
|
||||
/* Define if you have the <locale.h> header file. */
|
||||
#define HAVE_LOCALE_H 1
|
||||
|
||||
/* Define if you have the <memory.h> header file. */
|
||||
#define HAVE_MEMORY_H 1
|
||||
|
||||
/* Define if you have the <ndir.h> header file. */
|
||||
/* #undef HAVE_NDIR_H */
|
||||
|
||||
/* Define if you have the <netinet/in.h> header file. */
|
||||
#define HAVE_NETINET_IN_H 1
|
||||
|
||||
/* Define if you have the <paths.h> header file. */
|
||||
/* #undef HAVE_PATHS_H */
|
||||
|
||||
/* Define if you have the <pwd.h> header file. */
|
||||
//#define HAVE_PWD_H 1
|
||||
|
||||
/* Define if you have the <sched.h> header file. */
|
||||
/* #undef HAVE_SCHED_H */
|
||||
|
||||
/* Define if you have the <select.h> header file. */
|
||||
/* #undef HAVE_SELECT_H */
|
||||
|
||||
/* Define if you have the <stdarg.h> header file. */
|
||||
#define HAVE_STDARG_H 1
|
||||
|
||||
/* Define if you have the <stddef.h> header file. */
|
||||
#define HAVE_STDDEF_H 1
|
||||
|
||||
/* Define if you have the <stdlib.h> header file. */
|
||||
#define HAVE_STDLIB_H 1
|
||||
|
||||
/* Define if you have the <string.h> header file. */
|
||||
#define HAVE_STRING_H 1
|
||||
|
||||
/* Define if you have the <strings.h> header file. */
|
||||
//#define HAVE_STRINGS_H 1
|
||||
|
||||
/* Define if you have the <synch.h> header file. */
|
||||
/* #undef HAVE_SYNCH_H */
|
||||
|
||||
/* Define if you have the <sys/dir.h> header file. */
|
||||
//#define HAVE_SYS_DIR_H 1
|
||||
|
||||
/* Define if you have the <sys/file.h> header file. */
|
||||
//#define HAVE_SYS_FILE_H 1
|
||||
|
||||
/* Define if you have the <sys/ioctl.h> header file. */
|
||||
#define HAVE_SYS_IOCTL_H 1
|
||||
|
||||
/* Define if you have the <sys/mman.h> header file. */
|
||||
/* #undef HAVE_SYS_MMAN_H */
|
||||
|
||||
/* Define if you have the <sys/ndir.h> header file. */
|
||||
/* #undef HAVE_SYS_NDIR_H */
|
||||
|
||||
/* Define if you have the <sys/pte.h> header file. */
|
||||
/* #undef HAVE_SYS_PTE_H */
|
||||
|
||||
/* Define if you have the <sys/ptem.h> header file. */
|
||||
/* #undef HAVE_SYS_PTEM_H */
|
||||
|
||||
/* Define if you have the <sys/select.h> header file. */
|
||||
#define HAVE_SYS_SELECT_H 1
|
||||
|
||||
/* Define if you have the <sys/socket.h> header file. */
|
||||
#define HAVE_SYS_SOCKET_H 1
|
||||
|
||||
/* Define if you have the <sys/stream.h> header file. */
|
||||
/* #undef HAVE_SYS_STREAM_H */
|
||||
|
||||
/* Define if you have the <sys/timeb.h> header file. */
|
||||
#define HAVE_SYS_TIMEB_H 1
|
||||
|
||||
/* Define if you have the <sys/types.h> header file. */
|
||||
#define HAVE_SYS_TYPES_H 1
|
||||
|
||||
/* Define if you have the <sys/un.h> header file. */
|
||||
#define HAVE_SYS_UN_H 1
|
||||
|
||||
/* Define if you have the <sys/utime.h> header file. */
|
||||
#define HAVE_SYS_UTIME_H 1
|
||||
|
||||
/* Define if you have the <sys/vadvise.h> header file. */
|
||||
/* #undef HAVE_SYS_VADVISE_H */
|
||||
|
||||
/* Define if you have the <sys/wait.h> header file. */
|
||||
//#define HAVE_SYS_WAIT_H 1
|
||||
|
||||
/* Define if you have the <term.h> header file. */
|
||||
/* #undef HAVE_TERM_H */
|
||||
|
||||
/* Define if you have the <termbits.h> header file. */
|
||||
/* #undef HAVE_TERMBITS_H */
|
||||
|
||||
/* Define if you have the <termcap.h> header file. */
|
||||
//#define HAVE_TERMCAP_H 1
|
||||
|
||||
/* Define if you have the <termio.h> header file. */
|
||||
//#define HAVE_TERMIO_H 1
|
||||
|
||||
/* Define if you have the <termios.h> header file. */
|
||||
//#define HAVE_TERMIOS_H 1
|
||||
|
||||
/* Define if you have the <unistd.h> header file. */
|
||||
#define HAVE_UNISTD_H 1
|
||||
|
||||
/* Define if you have the <utime.h> header file. */
|
||||
#define HAVE_UTIME_H 1
|
||||
|
||||
/* Define if you have the <varargs.h> header file. */
|
||||
#define HAVE_VARARGS_H 1
|
||||
|
||||
/* Define if you have the bind library (-lbind). */
|
||||
/* #undef HAVE_LIBBIND */
|
||||
|
||||
/* Define if you have the c_r library (-lc_r). */
|
||||
/* #undef HAVE_LIBC_R */
|
||||
|
||||
/* Define if you have the compat library (-lcompat). */
|
||||
/* #undef HAVE_LIBCOMPAT */
|
||||
|
||||
/* Define if you have the crypt library (-lcrypt). */
|
||||
#define HAVE_LIBCRYPT 1
|
||||
|
||||
/* Define if you have the dl library (-ldl). */
|
||||
#define HAVE_LIBDL 1
|
||||
|
||||
/* Define if you have the gen library (-lgen). */
|
||||
/* #undef HAVE_LIBGEN */
|
||||
|
||||
/* Define if you have the m library (-lm). */
|
||||
#define HAVE_LIBM 1
|
||||
|
||||
/* Define if you have the nsl library (-lnsl). */
|
||||
/* #undef HAVE_LIBNSL */
|
||||
|
||||
/* Define if you have the nsl_r library (-lnsl_r). */
|
||||
/* #undef HAVE_LIBNSL_R */
|
||||
|
||||
/* Define if you have the pthread library (-lpthread). */
|
||||
/* #undef HAVE_LIBPTHREAD */
|
||||
|
||||
/* Define if you have the socket library (-lsocket). */
|
||||
/* #undef HAVE_LIBSOCKET */
|
||||
|
||||
/* Number of bits in a file offset, on hosts where this is settable. */
|
||||
/* #undef _FILE_OFFSET_BITS */
|
||||
|
||||
/* Define to make fseeko etc. visible, on some hosts. */
|
||||
/* #undef _LARGEFILE_SOURCE */
|
||||
|
||||
/* Define for large files, on AIX-style hosts. */
|
||||
/* #undef _LARGE_FILES */
|
||||
|
||||
#endif // __CONFIG_OS2_H__
|
|
@ -29,6 +29,7 @@ extern const char *client_errors[]; /* Error messages */
|
|||
|
||||
#define CR_MIN_ERROR 2000 /* For easier client code */
|
||||
#define CR_MAX_ERROR 2999
|
||||
#undef ER
|
||||
#define ER(X) client_errors[(X)-CR_MIN_ERROR]
|
||||
#define CLIENT_ERRMAP 2 /* Errormap used by my_error() */
|
||||
|
||||
|
|
|
@ -43,14 +43,14 @@
|
|||
|
||||
#if defined(_WIN32) || defined(_WIN64) || defined(__WIN32__) || defined(WIN32)
|
||||
#include <config-win.h>
|
||||
#elif defined(OS2)
|
||||
#include <config-os2.h>
|
||||
#else
|
||||
#include <my_config.h>
|
||||
#endif
|
||||
#if defined(__cplusplus)
|
||||
#if defined(inline)
|
||||
#if defined(__cplusplus) && defined(inline)
|
||||
#undef inline /* fix configure problem */
|
||||
#endif
|
||||
#endif /* _cplusplus */
|
||||
#endif /* _WIN32... */
|
||||
|
||||
/* Fix problem with S_ISLNK() on Linux */
|
||||
#if defined(HAVE_LINUXTHREADS)
|
||||
|
@ -76,7 +76,7 @@
|
|||
#define __STDC_EXT__ 1 /* To get large file support on hpux */
|
||||
#endif
|
||||
|
||||
#if defined(THREAD) && !defined(__WIN__)
|
||||
#if defined(THREAD) && !defined(__WIN__) && !defined(OS2)
|
||||
#ifndef _POSIX_PTHREAD_SEMANTICS
|
||||
#define _POSIX_PTHREAD_SEMANTICS /* We want posix threads */
|
||||
#endif
|
||||
|
@ -220,7 +220,9 @@
|
|||
#define POSIX_MISTAKE 1 /* regexp: Fix stupid spec error */
|
||||
#define USE_REGEX 1 /* We want the use the regex library */
|
||||
/* Do not define for ultra sparcs */
|
||||
#ifndef OS2
|
||||
#define USE_BMOVE512 1 /* Use this unless the system bmove is faster */
|
||||
#endif
|
||||
|
||||
/* Paranoid settings. Define I_AM_PARANOID if you are paranoid */
|
||||
#ifdef I_AM_PARANOID
|
||||
|
@ -470,7 +472,11 @@ extern double my_atof(const char*);
|
|||
#endif
|
||||
#undef remove /* Crashes MySQL on SCO 5.0.0 */
|
||||
#ifndef __WIN__
|
||||
#ifdef OS2
|
||||
#define closesocket(A) soclose(A)
|
||||
#else
|
||||
#define closesocket(A) close(A)
|
||||
#endif
|
||||
#ifndef ulonglong2double
|
||||
#define ulonglong2double(A) ((double) (A))
|
||||
#define my_off_t2double(A) ((double) (A))
|
||||
|
@ -559,9 +565,13 @@ typedef long my_ptrdiff_t;
|
|||
#ifndef NEAR
|
||||
#define NEAR /* Who needs segments ? */
|
||||
#define FAR /* On a good machine */
|
||||
#ifndef HUGE_PTR
|
||||
#define HUGE_PTR
|
||||
#endif
|
||||
#ifndef STDCALL
|
||||
#endif
|
||||
#if defined(__IBMC__) || defined(__IBMCPP__)
|
||||
#define STDCALL _System _Export
|
||||
#elif !defined( STDCALL)
|
||||
#define STDCALL
|
||||
#endif
|
||||
|
||||
|
@ -629,10 +639,20 @@ typedef ulonglong my_off_t;
|
|||
typedef unsigned long my_off_t;
|
||||
#endif
|
||||
#define MY_FILEPOS_ERROR (~(my_off_t) 0)
|
||||
#ifndef __WIN__
|
||||
#if !defined(__WIN__) && !defined(OS2)
|
||||
typedef off_t os_off_t;
|
||||
#endif
|
||||
|
||||
#if defined(__WIN__)
|
||||
#define socket_errno WSAGetLastError()
|
||||
#elif defined(OS2)
|
||||
#define socket_errno sock_errno()
|
||||
#define closesocket(A) soclose(A)
|
||||
#else
|
||||
#define socket_errno errno
|
||||
#define closesocket(A) close(A)
|
||||
#endif
|
||||
|
||||
typedef uint8 int7; /* Most effective integer 0 <= x <= 127 */
|
||||
typedef short int15; /* Most effective integer 0 <= x <= 32767 */
|
||||
typedef char *my_string; /* String of characters */
|
||||
|
|
|
@ -25,9 +25,19 @@
|
|||
#define ETIME ETIMEDOUT /* For FreeBSD */
|
||||
#endif
|
||||
|
||||
#if defined(__WIN__)
|
||||
#if defined(__WIN__) || defined(OS2)
|
||||
|
||||
#ifdef OS2
|
||||
typedef ULONG HANDLE;
|
||||
typedef ULONG DWORD;
|
||||
typedef int sigset_t;
|
||||
#endif
|
||||
|
||||
#ifdef OS2
|
||||
typedef HMTX pthread_mutex_t;
|
||||
#else
|
||||
typedef CRITICAL_SECTION pthread_mutex_t;
|
||||
#endif
|
||||
typedef HANDLE pthread_t;
|
||||
typedef struct thread_attr {
|
||||
DWORD dwStackSize ;
|
||||
|
@ -46,19 +56,30 @@ typedef struct st_pthread_link {
|
|||
|
||||
typedef struct {
|
||||
uint32 waiting;
|
||||
#ifdef OS2
|
||||
HEV semaphore;
|
||||
#else
|
||||
HANDLE semaphore;
|
||||
#endif
|
||||
} pthread_cond_t;
|
||||
|
||||
|
||||
#ifndef OS2
|
||||
struct timespec { /* For pthread_cond_timedwait() */
|
||||
time_t tv_sec;
|
||||
long tv_nsec;
|
||||
};
|
||||
#endif
|
||||
|
||||
typedef int pthread_mutexattr_t;
|
||||
#define win_pthread_self my_thread_var->pthread_self
|
||||
#ifdef OS2
|
||||
#define pthread_handler_decl(A,B) void * _Optlink A(void *B)
|
||||
typedef void * (_Optlink *pthread_handler)(void *);
|
||||
#else
|
||||
#define pthread_handler_decl(A,B) void * __cdecl A(void *B)
|
||||
typedef void * (__cdecl *pthread_handler)(void *);
|
||||
#endif
|
||||
|
||||
void win_pthread_init(void);
|
||||
int win_pthread_setspecific(void *A,void *B,uint length);
|
||||
|
@ -78,12 +99,14 @@ struct tm *localtime_r(const time_t *timep,struct tm *tmp);
|
|||
|
||||
void pthread_exit(void *a); /* was #define pthread_exit(A) ExitThread(A)*/
|
||||
|
||||
#ifndef OS2
|
||||
#define ETIMEDOUT 145 /* Win32 doesn't have this */
|
||||
#define getpid() GetCurrentThreadId()
|
||||
#endif
|
||||
#define pthread_self() win_pthread_self
|
||||
#define HAVE_LOCALTIME_R
|
||||
#define _REENTRANT
|
||||
#define HAVE_PTHREAD_ATTR_SETSTACKSIZE
|
||||
#define HAVE_LOCALTIME_R 1
|
||||
#define _REENTRANT 1
|
||||
#define HAVE_PTHREAD_ATTR_SETSTACKSIZE 1
|
||||
|
||||
#ifdef USE_TLS /* For LIBMYSQL.DLL */
|
||||
#undef SAFE_MUTEX /* This will cause conflicts */
|
||||
|
@ -105,13 +128,23 @@ void pthread_exit(void *a); /* was #define pthread_exit(A) ExitThread(A)*/
|
|||
#endif /* USE_TLS */
|
||||
|
||||
#define pthread_equal(A,B) ((A) == (B))
|
||||
#ifdef OS2
|
||||
int pthread_mutex_init (pthread_mutex_t *, const pthread_mutexattr_t *);
|
||||
int pthread_mutex_lock (pthread_mutex_t *);
|
||||
int pthread_mutex_unlock (pthread_mutex_t *);
|
||||
int pthread_mutex_destroy (pthread_mutex_t *);
|
||||
#define my_pthread_setprio(A,B) DosSetPriority(PRTYS_THREAD,PRTYC_NOCHANGE, B, A)
|
||||
#define pthread_kill(A,B) raise(B)
|
||||
#else
|
||||
#define pthread_mutex_init(A,B) InitializeCriticalSection(A)
|
||||
#define pthread_mutex_lock(A) (EnterCriticalSection(A),0)
|
||||
#define pthread_mutex_unlock(A) LeaveCriticalSection(A)
|
||||
#define pthread_mutex_destroy(A) DeleteCriticalSection(A)
|
||||
#define my_pthread_setprio(A,B) SetThreadPriority(GetCurrentThread(), (B))
|
||||
/* Dummy defines for easier code */
|
||||
#define pthread_kill(A,B) pthread_dummy(0)
|
||||
#endif /* OS2 */
|
||||
|
||||
/* Dummy defines for easier code */
|
||||
#define pthread_attr_setdetachstate(A,B) pthread_dummy(0)
|
||||
#define my_pthread_attr_setprio(A,B) pthread_attr_setprio(A,B)
|
||||
#define pthread_attr_setscope(A,B)
|
||||
|
@ -311,12 +344,15 @@ extern void my_pthread_attr_setprio(pthread_attr_t *attr, int priority);
|
|||
#undef HAVE_GETHOSTBYADDR_R /* No definition */
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_NONPOSIX_PTHREAD_GETSPECIFIC
|
||||
#if defined(OS2)
|
||||
#define my_pthread_getspecific(T,A) ((T) &(A))
|
||||
#define pthread_setspecific(A,B) win_pthread_setspecific(&(A),(B),sizeof(A))
|
||||
#elif !defined( HAVE_NONPOSIX_PTHREAD_GETSPECIFIC)
|
||||
#define my_pthread_getspecific(A,B) ((A) pthread_getspecific(B))
|
||||
#else
|
||||
#define my_pthread_getspecific(A,B) ((A) my_pthread_getspecific_imp(B))
|
||||
void *my_pthread_getspecific_imp(pthread_key_t key);
|
||||
#endif
|
||||
#endif /* OS2 */
|
||||
|
||||
#ifndef HAVE_LOCALTIME_R
|
||||
struct tm *localtime_r(const time_t *clock, struct tm *res);
|
||||
|
|
|
@ -126,6 +126,7 @@ extern uint sf_malloc_prehunc,sf_malloc_endhunc,sf_malloc_quick;
|
|||
extern ulonglong safemalloc_mem_limit;
|
||||
#else
|
||||
#define my_checkmalloc() (0)
|
||||
#undef TERMINATE
|
||||
#define TERMINATE(A) {}
|
||||
#define QUICK_SAFEMALLOC
|
||||
#define NORMAL_SAFEMALLOC
|
||||
|
|
|
@ -233,10 +233,4 @@ void my_thread_end(void);
|
|||
|
||||
#define NULL_LENGTH ((unsigned long) ~0) /* For net_store_length */
|
||||
|
||||
#ifdef __WIN__
|
||||
#define socket_errno WSAGetLastError()
|
||||
#else
|
||||
#define socket_errno errno
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
|
@ -65,7 +65,7 @@ typedef struct st_thr_alarm_entry
|
|||
rf_SetTimer crono;
|
||||
} thr_alarm_entry;
|
||||
|
||||
#elif defined(__EMX__)
|
||||
#elif defined(__EMX__) || defined(OS2)
|
||||
|
||||
typedef struct st_thr_alarm_entry
|
||||
{
|
||||
|
|
103
isam/isamchk.c
103
isam/isamchk.c
|
@ -44,7 +44,7 @@ SET_STACK_SIZE(9000) /* Minimum stack size for program */
|
|||
#define T_SORT_RECORDS 4096
|
||||
#define T_SORT_INDEX 8192
|
||||
#define T_WAIT_FOREVER 16384
|
||||
#define T_REP_BY_SORT 32768
|
||||
#define T_REP_BY_SORT 32768L
|
||||
|
||||
|
||||
#define O_NEW_INDEX 1 /* Bits set in out_flag */
|
||||
|
@ -74,17 +74,17 @@ SET_STACK_SIZE(9000) /* Minimum stack size for program */
|
|||
#define UPDATE_STAT 2
|
||||
#define UPDATE_SORT 4
|
||||
|
||||
typedef struct st_sort_key_blocks { /* Used when sorting */
|
||||
typedef struct st_isam_sort_key_blocks { /* Used when sorting */
|
||||
uchar *buff,*end_pos;
|
||||
uchar lastkey[N_MAX_POSSIBLE_KEY_BUFF];
|
||||
uint last_length;
|
||||
int inited;
|
||||
} SORT_KEY_BLOCKS;
|
||||
} ISAM_SORT_KEY_BLOCKS;
|
||||
|
||||
typedef struct st_sort_info {
|
||||
typedef struct st_isam_sort_info {
|
||||
N_INFO *info;
|
||||
enum data_file_type new_data_file_type;
|
||||
SORT_KEY_BLOCKS *key_block,*key_block_end;
|
||||
ISAM_SORT_KEY_BLOCKS *key_block,*key_block_end;
|
||||
uint key,find_length;
|
||||
ulong pos,max_pos,filepos,start_recpos,filelength,dupp,max_records,unique,
|
||||
buff_length;
|
||||
|
@ -92,9 +92,9 @@ typedef struct st_sort_info {
|
|||
char *record,*buff;
|
||||
N_KEYDEF *keyinfo;
|
||||
N_KEYSEG *keyseg;
|
||||
} SORT_INFO;
|
||||
} ISAM_SORT_INFO;
|
||||
|
||||
enum options {OPT_CHARSETS_DIR=256};
|
||||
enum ic_options {OPT_CHARSETS_DIR_IC=256};
|
||||
|
||||
static ulong use_buffers=0,read_buffer_length=0,write_buffer_length=0,
|
||||
sort_buffer_length=0,sort_key_blocks=0,crc=0,unique_count=0;
|
||||
|
@ -120,7 +120,7 @@ static const char *type_names[]=
|
|||
|
||||
static char temp_filename[FN_REFLEN], *isam_file_name, *default_charset;
|
||||
static IO_CACHE read_cache;
|
||||
static SORT_INFO sort_info;
|
||||
static ISAM_SORT_INFO sort_info;
|
||||
static int tmpfile_createflag=O_RDWR | O_TRUNC | O_EXCL;
|
||||
|
||||
static const char *load_default_groups[]= { "isamchk",0 };
|
||||
|
@ -137,8 +137,8 @@ static int chk_del(N_INFO *info,uint testflag);
|
|||
static int check_k_link(N_INFO *info,uint nr);
|
||||
static int chk_size(N_INFO *info);
|
||||
static int chk_key(N_INFO *info);
|
||||
static int chk_index(N_INFO *info,N_KEYDEF *keyinfo,ulong page,uchar *buff,
|
||||
ulong *keys,uint level);
|
||||
static int chk_index(N_INFO *info, N_KEYDEF *keyinfo, ulong page, uchar *buff,
|
||||
ulong *keys, uint level);
|
||||
static uint isam_key_length(N_INFO *info,N_KEYDEF *keyinfo);
|
||||
static unsigned long calc_checksum(ulong count);
|
||||
static int chk_data_link(N_INFO *info,int extend);
|
||||
|
@ -171,12 +171,12 @@ static int sort_key_cmp(const void *not_used, const void *a,const void *b);
|
|||
static int sort_key_write(const void *a);
|
||||
static ulong get_record_for_key(N_INFO *info,N_KEYDEF *keyinfo,
|
||||
uchar *key);
|
||||
static int sort_insert_key(reg1 SORT_KEY_BLOCKS *key_block,uchar *key,
|
||||
static int sort_insert_key(reg1 ISAM_SORT_KEY_BLOCKS *key_block,uchar *key,
|
||||
ulong prev_block);
|
||||
static int sort_delete_record(void);
|
||||
static void usage(void);
|
||||
static int flush_pending_blocks(void);
|
||||
static SORT_KEY_BLOCKS *alloc_key_blocks(uint blocks,uint buffer_length);
|
||||
static ISAM_SORT_KEY_BLOCKS *alloc_key_blocks(uint blocks,uint buffer_length);
|
||||
static int test_if_almost_full(N_INFO *info);
|
||||
static int recreate_database(N_INFO **info,char *filename);
|
||||
static void save_integer(byte *pos,uint pack_length,ulong value);
|
||||
|
@ -186,9 +186,7 @@ static int update_state_info(N_INFO *info,uint update);
|
|||
|
||||
/* Main program */
|
||||
|
||||
int main(argc,argv)
|
||||
int argc;
|
||||
char **argv;
|
||||
int main( int argc, char **argv)
|
||||
{
|
||||
int error;
|
||||
MY_INIT(argv[0]);
|
||||
|
@ -255,7 +253,7 @@ static CHANGEABLE_VAR changeable_vars[] = {
|
|||
static struct option long_options[] =
|
||||
{
|
||||
{"analyze", no_argument, 0, 'a'},
|
||||
{"character-sets-dir", required_argument, 0, OPT_CHARSETS_DIR},
|
||||
{"character-sets-dir", required_argument, 0, OPT_CHARSETS_DIR_IC},
|
||||
#ifndef DBUG_OFF
|
||||
{"debug", required_argument, 0, '#'},
|
||||
#endif
|
||||
|
@ -284,7 +282,7 @@ static struct option long_options[] =
|
|||
|
||||
static void print_version(void)
|
||||
{
|
||||
printf("%s Ver 5.16 for %s at %s\n",my_progname,SYSTEM_TYPE,
|
||||
printf("%s Ver 5.17 for %s at %s\n",my_progname,SYSTEM_TYPE,
|
||||
MACHINE_TYPE);
|
||||
}
|
||||
|
||||
|
@ -598,7 +596,7 @@ static void get_options(register int *argc,register char ***argv)
|
|||
case 'C':
|
||||
default_charset=optarg;
|
||||
break;
|
||||
case OPT_CHARSETS_DIR:
|
||||
case OPT_CHARSETS_DIR_IC:
|
||||
charsets_dir = optarg;
|
||||
break;
|
||||
case 'b':
|
||||
|
@ -706,9 +704,7 @@ static void get_options(register int *argc,register char ***argv)
|
|||
|
||||
/* Check delete links */
|
||||
|
||||
static int chk_del(info,test_flag)
|
||||
reg1 N_INFO *info;
|
||||
uint test_flag;
|
||||
static int chk_del( reg1 N_INFO *info, uint test_flag)
|
||||
{
|
||||
reg2 ulong i;
|
||||
uint j,delete_link_length;
|
||||
|
@ -793,9 +789,7 @@ wrong:
|
|||
|
||||
/* Kontrollerar l{nkarna i nyckelfilen */
|
||||
|
||||
static int check_k_link(info,nr)
|
||||
register N_INFO *info;
|
||||
uint nr;
|
||||
static int check_k_link( register N_INFO *info, uint nr)
|
||||
{
|
||||
ulong next_link,records;
|
||||
DBUG_ENTER("check_k_link");
|
||||
|
@ -898,8 +892,7 @@ static int chk_size(register N_INFO *info)
|
|||
|
||||
/* Kontrollerar nycklarna */
|
||||
|
||||
static int chk_key(info)
|
||||
register N_INFO *info;
|
||||
static int chk_key( register N_INFO *info)
|
||||
{
|
||||
uint key;
|
||||
ulong keys,all_keydata,all_totaldata,key_totlength,length,
|
||||
|
@ -988,12 +981,8 @@ register N_INFO *info;
|
|||
|
||||
/* Check if index is ok */
|
||||
|
||||
static int chk_index(info,keyinfo,page,buff,keys,level)
|
||||
N_INFO *info;
|
||||
N_KEYDEF *keyinfo;
|
||||
ulong page,*keys;
|
||||
uchar *buff;
|
||||
uint level;
|
||||
static int chk_index(N_INFO *info, N_KEYDEF *keyinfo, ulong page, uchar *buff,
|
||||
ulong *keys,uint level)
|
||||
{
|
||||
int flag;
|
||||
uint used_length,comp_flag,nod_flag;
|
||||
|
@ -1129,9 +1118,7 @@ ulong count;
|
|||
|
||||
/* Calc length of key in normal isam */
|
||||
|
||||
static uint isam_key_length(info,keyinfo)
|
||||
N_INFO *info;
|
||||
reg1 N_KEYDEF *keyinfo;
|
||||
static uint isam_key_length( N_INFO *info, reg1 N_KEYDEF *keyinfo)
|
||||
{
|
||||
uint length;
|
||||
N_KEYSEG *keyseg;
|
||||
|
@ -2962,8 +2949,7 @@ static int sort_key_cmp(const void *not_used __attribute__((unused)),
|
|||
} /* sort_key_cmp */
|
||||
|
||||
|
||||
static int sort_key_write(a)
|
||||
const void *a;
|
||||
static int sort_key_write( const void *a)
|
||||
{
|
||||
int cmp=sort_info.key_block->inited ?
|
||||
_nisam_key_cmp(sort_info.keyseg,sort_info.key_block->lastkey,(uchar*) a,
|
||||
|
@ -2997,10 +2983,7 @@ const void *a;
|
|||
|
||||
/* get pointer to record from a key */
|
||||
|
||||
static ulong get_record_for_key(info,keyinfo,key)
|
||||
N_INFO *info;
|
||||
N_KEYDEF *keyinfo;
|
||||
uchar *key;
|
||||
static ulong get_record_for_key( N_INFO *info, N_KEYDEF *keyinfo, uchar *key)
|
||||
{
|
||||
return _nisam_dpos(info,0,key+_nisam_keylength(keyinfo,key));
|
||||
} /* get_record_for_key */
|
||||
|
@ -3008,10 +2991,8 @@ uchar *key;
|
|||
|
||||
/* Insert a key in sort-key-blocks */
|
||||
|
||||
static int sort_insert_key(key_block,key,prev_block)
|
||||
reg1 SORT_KEY_BLOCKS *key_block;
|
||||
uchar *key;
|
||||
ulong prev_block;
|
||||
static int sort_insert_key(reg1 ISAM_SORT_KEY_BLOCKS *key_block,
|
||||
uchar *key, ulong prev_block)
|
||||
{
|
||||
uint a_length,t_length,nod_flag;
|
||||
ulong filepos;
|
||||
|
@ -3140,7 +3121,7 @@ static int flush_pending_blocks()
|
|||
uint nod_flag,length;
|
||||
ulong filepos;
|
||||
N_INFO *info;
|
||||
SORT_KEY_BLOCKS *key_block;
|
||||
ISAM_SORT_KEY_BLOCKS *key_block;
|
||||
DBUG_ENTER("flush_pending_blocks");
|
||||
|
||||
filepos= NI_POS_ERROR; /* if empty file */
|
||||
|
@ -3169,16 +3150,15 @@ static int flush_pending_blocks()
|
|||
|
||||
/* alloc space and pointers for key_blocks */
|
||||
|
||||
static SORT_KEY_BLOCKS *alloc_key_blocks(blocks,buffer_length)
|
||||
uint blocks,buffer_length;
|
||||
static ISAM_SORT_KEY_BLOCKS *alloc_key_blocks(uint blocks, uint buffer_length)
|
||||
{
|
||||
reg1 uint i;
|
||||
SORT_KEY_BLOCKS *block;
|
||||
ISAM_SORT_KEY_BLOCKS *block;
|
||||
DBUG_ENTER("alloc_key_blocks");
|
||||
|
||||
if (!(block=(SORT_KEY_BLOCKS*) my_malloc((sizeof(SORT_KEY_BLOCKS)+
|
||||
buffer_length+IO_SIZE)*blocks,
|
||||
MYF(0))))
|
||||
if (!(block=(ISAM_SORT_KEY_BLOCKS*) my_malloc((sizeof(ISAM_SORT_KEY_BLOCKS)+
|
||||
buffer_length+IO_SIZE)*blocks,
|
||||
MYF(0))))
|
||||
{
|
||||
print_error("Not Enough memory for sort-key-blocks");
|
||||
return(0);
|
||||
|
@ -3253,8 +3233,7 @@ void print_error(const char *fmt,...)
|
|||
|
||||
/* Check if file is almost full */
|
||||
|
||||
static int test_if_almost_full(info)
|
||||
N_INFO *info;
|
||||
static int test_if_almost_full(N_INFO *info)
|
||||
{
|
||||
double diff= 0.9;
|
||||
if (info->s->base.options & HA_OPTION_COMPRESS_RECORD)
|
||||
|
@ -3274,9 +3253,7 @@ N_INFO *info;
|
|||
|
||||
/* Recreate table with bigger more alloced record-data */
|
||||
|
||||
static int recreate_database(org_info,filename)
|
||||
N_INFO **org_info;
|
||||
char *filename;
|
||||
static int recreate_database(N_INFO **org_info, char *filename)
|
||||
{
|
||||
int error;
|
||||
N_INFO info;
|
||||
|
@ -3369,10 +3346,7 @@ end:
|
|||
|
||||
/* Store long in 1,2,3 or 4 bytes */
|
||||
|
||||
static void save_integer(pos,pack_length,value)
|
||||
byte *pos;
|
||||
uint pack_length;
|
||||
ulong value;
|
||||
static void save_integer( byte *pos, uint pack_length, ulong value)
|
||||
{
|
||||
switch (pack_length) {
|
||||
case 4: int4store(pos,value); break;
|
||||
|
@ -3386,8 +3360,7 @@ ulong value;
|
|||
|
||||
/* write suffix to data file if neaded */
|
||||
|
||||
static int write_data_suffix(info)
|
||||
N_INFO *info;
|
||||
static int write_data_suffix( N_INFO *info)
|
||||
{
|
||||
if (info->s->base.options & HA_OPTION_COMPRESS_RECORD &&
|
||||
sort_info.fix_datafile)
|
||||
|
@ -3407,9 +3380,7 @@ N_INFO *info;
|
|||
|
||||
/* Update state and isamchk_time of indexfile */
|
||||
|
||||
static int update_state_info(info,update)
|
||||
N_INFO *info;
|
||||
uint update;
|
||||
static int update_state_info( N_INFO *info, uint update)
|
||||
{
|
||||
ISAM_SHARE *share=info->s;
|
||||
uint base_pos=uint2korr(info->s->state.header.base_pos);
|
||||
|
|
208
isam/isamlog.c
208
isam/isamlog.c
|
@ -1,15 +1,15 @@
|
|||
/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult 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 */
|
||||
|
@ -29,7 +29,7 @@
|
|||
|
||||
#define FILENAME(A) (A ? A->show_name : "Unknown")
|
||||
|
||||
struct file_info {
|
||||
struct isamlog_file_info {
|
||||
long process;
|
||||
int filenr,id;
|
||||
my_string name,show_name,record;
|
||||
|
@ -46,7 +46,7 @@ struct test_if_open_param {
|
|||
struct st_access_param
|
||||
{
|
||||
ulong min_accessed;
|
||||
struct file_info *found;
|
||||
struct isamlog_file_info *found;
|
||||
};
|
||||
|
||||
#define NO_FILEPOS (ulong) ~0L
|
||||
|
@ -56,21 +56,22 @@ static void get_options(int *argc,char ***argv);
|
|||
static int examine_log(my_string file_name,char **table_names);
|
||||
static int read_string(IO_CACHE *file,gptr *to,uint length);
|
||||
static int file_info_compare(void *a,void *b);
|
||||
static int test_if_open(struct file_info *key,element_count count,
|
||||
static int test_if_open(struct isamlog_file_info *key,element_count count,
|
||||
struct test_if_open_param *param);
|
||||
static void fix_blob_pointers(N_INFO *isam,byte *record);
|
||||
static uint set_maximum_open_files(uint);
|
||||
static int test_when_accessed(struct file_info *key,element_count count,
|
||||
static int test_when_accessed(struct isamlog_file_info *key,element_count count,
|
||||
struct st_access_param *access_param);
|
||||
static void file_info_free(struct file_info *info);
|
||||
static void file_info_free(struct isamlog_file_info *info);
|
||||
static int close_some_file(TREE *tree);
|
||||
static int reopen_closed_file(TREE *tree,struct file_info *file_info);
|
||||
static int find_record_with_key(struct file_info *file_info,byte *record);
|
||||
static int reopen_closed_file(TREE *tree,struct isamlog_file_info *file_info);
|
||||
static int find_record_with_key(struct isamlog_file_info *file_info,
|
||||
byte *record);
|
||||
static void printf_log(const char *str,...);
|
||||
static bool cmp_filename(struct file_info *file_info,my_string name);
|
||||
static bool cmp_filename(struct isamlog_file_info *file_info,my_string name);
|
||||
|
||||
static uint verbose=0,update=0,test_info=0,max_files=0,re_open_count=0,
|
||||
recover=0,prefix_remove=0;
|
||||
recover=0,prefix_remove=0,opt_processes=0;
|
||||
static my_string log_filename=0,filepath=0,write_filename=0,record_pos_file=0;
|
||||
static ulong com_count[10][3],number_of_commands=(ulong) ~0L,start_offset=0,
|
||||
record_pos= NO_FILEPOS,isamlog_filepos,isamlog_process;
|
||||
|
@ -78,9 +79,7 @@ static const char *command_name[]=
|
|||
{"open","write","update","delete","close","extra","lock","re-open",NullS};
|
||||
|
||||
|
||||
int main(argc,argv)
|
||||
int argc;
|
||||
char **argv;
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
int error,i,first;
|
||||
ulong total_count,total_error,total_recover;
|
||||
|
@ -92,11 +91,11 @@ char **argv;
|
|||
max_files=(set_maximum_open_files(min(max_files,8))-6)/2;
|
||||
|
||||
if (update)
|
||||
printf("Trying to %s isamfiles according to log '%s'\n",
|
||||
printf("Trying to %s ISAM files according to log '%s'\n",
|
||||
(recover ? "recover" : "update"),log_filename);
|
||||
error= examine_log(log_filename,argv);
|
||||
if (update && ! error)
|
||||
puts("isamfile:s updated successfully");
|
||||
puts("Tables updated successfully");
|
||||
total_count=total_error=total_recover=0;
|
||||
for (i=first=0 ; command_name[i] ; i++)
|
||||
{
|
||||
|
@ -128,17 +127,15 @@ char **argv;
|
|||
} /* main */
|
||||
|
||||
|
||||
static void get_options(argc,argv)
|
||||
register int *argc;
|
||||
register char ***argv;
|
||||
static void get_options(register int *argc, register char ***argv)
|
||||
{
|
||||
int help,version;
|
||||
const char *usage;
|
||||
char *pos, option;
|
||||
const char *pos,*usage;
|
||||
char option;
|
||||
|
||||
help=0;
|
||||
usage="Usage: %s [-?iruvIV] [-c #] [-f #] [-F filepath/] [-o #] [-R file recordpos] [-w write_file] [log-filename [table ...]] \n";
|
||||
pos= (char*) "";
|
||||
usage="Usage: %s [-?iruvIPV] [-c #] [-f #] [-F filepath/] [-o #] [-R file recordpos] [-w write_file] [log-filename [table ...]] \n";
|
||||
pos= "";
|
||||
|
||||
while (--*argc > 0 && *(pos = *(++*argv)) == '-' ) {
|
||||
while (*++pos)
|
||||
|
@ -147,7 +144,7 @@ register char ***argv;
|
|||
switch((option=*pos)) {
|
||||
case '#':
|
||||
DBUG_PUSH (++pos);
|
||||
pos= (char*) " "; /* Skipp rest of arg */
|
||||
pos=" "; /* Skipp rest of arg */
|
||||
break;
|
||||
case 'c':
|
||||
if (! *++pos)
|
||||
|
@ -158,7 +155,7 @@ register char ***argv;
|
|||
pos= *(++*argv);
|
||||
}
|
||||
number_of_commands=(ulong) atol(pos);
|
||||
pos= (char*) " ";
|
||||
pos=" ";
|
||||
break;
|
||||
case 'u':
|
||||
update=1;
|
||||
|
@ -172,7 +169,7 @@ register char ***argv;
|
|||
pos= *(++*argv);
|
||||
}
|
||||
max_files=(uint) atoi(pos);
|
||||
pos= (char*) " ";
|
||||
pos=" ";
|
||||
break;
|
||||
case 'i':
|
||||
test_info=1;
|
||||
|
@ -186,7 +183,7 @@ register char ***argv;
|
|||
pos= *(++*argv);
|
||||
}
|
||||
start_offset=(ulong) atol(pos);
|
||||
pos= (char*) " ";
|
||||
pos=" ";
|
||||
break;
|
||||
case 'p':
|
||||
if (! *++pos)
|
||||
|
@ -202,6 +199,9 @@ register char ***argv;
|
|||
update=1;
|
||||
recover++;
|
||||
break;
|
||||
case 'P':
|
||||
opt_processes=1;
|
||||
break;
|
||||
case 'R':
|
||||
if (! *++pos)
|
||||
{
|
||||
|
@ -210,11 +210,11 @@ register char ***argv;
|
|||
else
|
||||
pos= *(++*argv);
|
||||
}
|
||||
record_pos_file=pos;
|
||||
record_pos_file=(char*) pos;
|
||||
if (!--*argc)
|
||||
goto err;
|
||||
record_pos=(ulong) atol(*(++*argv));
|
||||
pos= (char*) " ";
|
||||
pos= " ";
|
||||
break;
|
||||
case 'v':
|
||||
verbose++;
|
||||
|
@ -227,8 +227,8 @@ register char ***argv;
|
|||
else
|
||||
pos= *(++*argv);
|
||||
}
|
||||
write_filename=pos;
|
||||
pos= (char*) " ";
|
||||
write_filename=(char*) pos;
|
||||
pos=" ";
|
||||
break;
|
||||
case 'F':
|
||||
if (! *++pos)
|
||||
|
@ -238,20 +238,20 @@ register char ***argv;
|
|||
else
|
||||
pos= *(++*argv);
|
||||
}
|
||||
filepath=pos;
|
||||
pos= (char*) " ";
|
||||
filepath= (char*) pos;
|
||||
pos=" ";
|
||||
break;
|
||||
case 'V':
|
||||
version=1;
|
||||
/* Fall through */
|
||||
case 'I':
|
||||
case '?':
|
||||
printf("%s Ver 3.2 for %s at %s\n",my_progname,SYSTEM_TYPE,
|
||||
printf("%s Ver 3.3 for %s at %s\n",my_progname,SYSTEM_TYPE,
|
||||
MACHINE_TYPE);
|
||||
puts("TCX Datakonsult AB, by Monty, for your professional use\n");
|
||||
puts("By Monty, for your professional use\n");
|
||||
if (version)
|
||||
break;
|
||||
puts("Write info about whats in a nisam log file.");
|
||||
puts("Write info about whats in a ISAM log file.");
|
||||
printf("If no file name is given %s is used\n",log_filename);
|
||||
puts("");
|
||||
printf(usage,my_progname);
|
||||
|
@ -261,6 +261,7 @@ register char ***argv;
|
|||
puts(" -o \"offset\" -p # \"remove # components from path\"");
|
||||
puts(" -r \"recover\" -R \"file recordposition\"");
|
||||
puts(" -u \"update\" -v \"verbose\" -w \"write file\"");
|
||||
puts(" -P \"processes\"");
|
||||
puts("\nOne can give a second and a third '-v' for more verbose.");
|
||||
puts("Normaly one does a update (-u).");
|
||||
puts("If a recover is done all writes and all possibly updates and deletes is done\nand errors are only counted.");
|
||||
|
@ -281,7 +282,7 @@ register char ***argv;
|
|||
}
|
||||
if (*argc >= 1)
|
||||
{
|
||||
log_filename=pos;
|
||||
log_filename=(char*) pos;
|
||||
(*argc)--;
|
||||
(*argv)++;
|
||||
}
|
||||
|
@ -308,7 +309,8 @@ static int examine_log(my_string file_name, char **table_names)
|
|||
FILE *write_file;
|
||||
enum ha_extra_function extra_command;
|
||||
TREE tree;
|
||||
struct file_info file_info,*curr_file_info;
|
||||
struct isamlog_file_info file_info,*curr_file_info;
|
||||
char llbuff[22],llbuff2[22];
|
||||
DBUG_ENTER("examine_log");
|
||||
|
||||
if ((file=my_open(file_name,O_RDONLY,MYF(MY_WME))) < 0)
|
||||
|
@ -336,8 +338,11 @@ static int examine_log(my_string file_name, char **table_names)
|
|||
isamlog_filepos=my_b_tell(&cache)-9L;
|
||||
file_info.filenr=uint2korr(head+1);
|
||||
isamlog_process=file_info.process=(long) uint4korr(head+3);
|
||||
if (!opt_processes)
|
||||
file_info.process=0;
|
||||
result=uint2korr(head+7);
|
||||
if ((curr_file_info=(struct file_info*) tree_search(&tree,&file_info)))
|
||||
if ((curr_file_info=(struct isamlog_file_info*)
|
||||
tree_search(&tree,&file_info)))
|
||||
{
|
||||
curr_file_info->accessed=access_time;
|
||||
if (update && curr_file_info->used && curr_file_info->closed)
|
||||
|
@ -352,7 +357,7 @@ static int examine_log(my_string file_name, char **table_names)
|
|||
}
|
||||
command=(uint) head[0];
|
||||
if (command < sizeof(com_count)/sizeof(com_count[0][0])/3 &&
|
||||
(!curr_file_info || curr_file_info->used))
|
||||
(!table_names[0] || (curr_file_info && curr_file_info->used)))
|
||||
{
|
||||
com_count[command][0]++;
|
||||
if (result)
|
||||
|
@ -360,12 +365,15 @@ static int examine_log(my_string file_name, char **table_names)
|
|||
}
|
||||
switch ((enum nisam_log_commands) command) {
|
||||
case LOG_OPEN:
|
||||
com_count[command][0]--; /* Must be counted explicite */
|
||||
if (result)
|
||||
com_count[command][1]--;
|
||||
if (!table_names[0])
|
||||
{
|
||||
com_count[command][0]--; /* Must be counted explicite */
|
||||
if (result)
|
||||
com_count[command][1]--;
|
||||
}
|
||||
|
||||
if (curr_file_info)
|
||||
printf("\nWarning: %s is opened twice with same process and filenumber\n",
|
||||
printf("\nWarning: %s is opened with same process and filenumber\nMaybe you should use the -P option ?\n",
|
||||
curr_file_info->show_name);
|
||||
if (my_b_read(&cache,(byte*) head,2))
|
||||
goto err;
|
||||
|
@ -376,11 +384,17 @@ static int examine_log(my_string file_name, char **table_names)
|
|||
goto err;
|
||||
{
|
||||
uint i;
|
||||
char *pos=file_info.name,*to;
|
||||
char *pos,*to;
|
||||
|
||||
/* Fix if old DOS files to new format */
|
||||
for (pos=file_info.name; (pos=strchr(pos,'\\')) ; pos++)
|
||||
*pos= '/';
|
||||
|
||||
pos=file_info.name;
|
||||
for (i=0 ; i < prefix_remove ; i++)
|
||||
{
|
||||
char *next;
|
||||
if (!(next=strchr(pos,FN_LIBCHAR)))
|
||||
if (!(next=strchr(pos,'/')))
|
||||
break;
|
||||
pos=next+1;
|
||||
}
|
||||
|
@ -426,7 +440,7 @@ static int examine_log(my_string file_name, char **table_names)
|
|||
files_open--;
|
||||
}
|
||||
if (!(file_info.isam= nisam_open(isam_file_name,O_RDWR,
|
||||
HA_OPEN_WAIT_IF_LOCKED)))
|
||||
HA_OPEN_WAIT_IF_LOCKED)))
|
||||
goto com_err;
|
||||
if (!(file_info.record=my_malloc(file_info.isam->s->base.reclength,
|
||||
MYF(MY_WME))))
|
||||
|
@ -438,7 +452,7 @@ static int examine_log(my_string file_name, char **table_names)
|
|||
if (file_info.used)
|
||||
{
|
||||
if (verbose && !record_pos_file)
|
||||
printf_log("%s: open",file_info.show_name);
|
||||
printf_log("%s: open -> %d",file_info.show_name, file_info.filenr);
|
||||
com_count[command][0]++;
|
||||
if (result)
|
||||
com_count[command][1]++;
|
||||
|
@ -453,7 +467,6 @@ static int examine_log(my_string file_name, char **table_names)
|
|||
{
|
||||
if (!curr_file_info->closed)
|
||||
files_open--;
|
||||
file_info_free(curr_file_info);
|
||||
VOID(tree_delete(&tree,(gptr) curr_file_info));
|
||||
}
|
||||
break;
|
||||
|
@ -464,14 +477,17 @@ static int examine_log(my_string file_name, char **table_names)
|
|||
if (verbose && !record_pos_file &&
|
||||
(!table_names[0] || (curr_file_info && curr_file_info->used)))
|
||||
printf_log("%s: %s(%d) -> %d",FILENAME(curr_file_info),
|
||||
command_name[command], extra_command,result);
|
||||
command_name[command], (int) extra_command,result);
|
||||
if (update && curr_file_info && !curr_file_info->closed)
|
||||
{
|
||||
if (nisam_extra(curr_file_info->isam,extra_command) != (int) result)
|
||||
{
|
||||
fflush(stdout);
|
||||
VOID(fprintf(stderr,
|
||||
"Warning: error %d, expected %d on command %s at %lx\n",
|
||||
my_errno,result,command_name[command],isamlog_filepos));
|
||||
"Warning: error %d, expected %d on command %s at %s\n",
|
||||
my_errno,result,command_name[command],
|
||||
llstr(isamlog_filepos,llbuff)));
|
||||
fflush(stderr);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -501,6 +517,9 @@ static int examine_log(my_string file_name, char **table_names)
|
|||
goto com_err;
|
||||
if (ni_result)
|
||||
com_count[command][2]++; /* Mark error */
|
||||
if (verbose)
|
||||
printf_log("error: Got result %d from mi_delete instead of %d",
|
||||
ni_result, result);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -539,6 +558,8 @@ static int examine_log(my_string file_name, char **table_names)
|
|||
result=0;
|
||||
goto com_err;
|
||||
}
|
||||
if (verbose)
|
||||
printf_log("error: Didn't find row to update with mi_rrnd");
|
||||
if (recover == 1 || result ||
|
||||
find_record_with_key(curr_file_info,buff))
|
||||
{
|
||||
|
@ -553,6 +574,9 @@ static int examine_log(my_string file_name, char **table_names)
|
|||
{
|
||||
if (!recover)
|
||||
goto com_err;
|
||||
if (verbose)
|
||||
printf_log("error: Got result %d from mi_update instead of %d",
|
||||
ni_result, result);
|
||||
if (ni_result)
|
||||
com_count[command][2]++; /* Mark error */
|
||||
}
|
||||
|
@ -570,9 +594,10 @@ static int examine_log(my_string file_name, char **table_names)
|
|||
}
|
||||
if (! recover && filepos != curr_file_info->isam->lastpos)
|
||||
{
|
||||
printf("Warning: Wrote at position: %ld, should have been %ld",
|
||||
curr_file_info->isam->lastpos,(long) filepos);
|
||||
goto com_err;
|
||||
printf("error: Wrote at position: %s, should have been %s",
|
||||
llstr(curr_file_info->isam->lastpos,llbuff),
|
||||
llstr(filepos,llbuff2));
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -597,6 +622,7 @@ static int examine_log(my_string file_name, char **table_names)
|
|||
VOID(fprintf(stderr,
|
||||
"Error: found unknown command %d in logfile, aborted\n",
|
||||
command));
|
||||
fflush(stderr);
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
@ -609,11 +635,16 @@ static int examine_log(my_string file_name, char **table_names)
|
|||
DBUG_RETURN(0);
|
||||
|
||||
err:
|
||||
fflush(stdout);
|
||||
VOID(fprintf(stderr,"Got error %d when reading from logfile\n",my_errno));
|
||||
fflush(stderr);
|
||||
goto end;
|
||||
com_err:
|
||||
VOID(fprintf(stderr,"Got error %d, expected %d on command %s at %lx\n",
|
||||
my_errno,result,command_name[command],isamlog_filepos));
|
||||
fflush(stdout);
|
||||
VOID(fprintf(stderr,"Got error %d, expected %d on command %s at %s\n",
|
||||
my_errno,result,command_name[command],
|
||||
llstr(isamlog_filepos,llbuff)));
|
||||
fflush(stderr);
|
||||
end:
|
||||
end_key_cache();
|
||||
delete_tree(&tree);
|
||||
|
@ -625,10 +656,7 @@ static int examine_log(my_string file_name, char **table_names)
|
|||
}
|
||||
|
||||
|
||||
static int read_string(file,to,length)
|
||||
IO_CACHE *file;
|
||||
reg1 gptr *to;
|
||||
reg2 uint length;
|
||||
static int read_string(IO_CACHE *file, reg1 gptr *to, reg2 uint length)
|
||||
{
|
||||
DBUG_ENTER("read_string");
|
||||
|
||||
|
@ -647,24 +675,22 @@ reg2 uint length;
|
|||
} /* read_string */
|
||||
|
||||
|
||||
static int file_info_compare(a,b)
|
||||
void *a;
|
||||
void *b;
|
||||
static int file_info_compare(void *a, void *b)
|
||||
{
|
||||
long lint;
|
||||
|
||||
if ((lint=((struct file_info*) a)->process -
|
||||
((struct file_info*) b)->process))
|
||||
if ((lint=((struct isamlog_file_info*) a)->process -
|
||||
((struct isamlog_file_info*) b)->process))
|
||||
return lint < 0L ? -1 : 1;
|
||||
return ((struct file_info*) a)->filenr - ((struct file_info*) b)->filenr;
|
||||
return (((struct isamlog_file_info*) a)->filenr -
|
||||
((struct isamlog_file_info*) b)->filenr);
|
||||
}
|
||||
|
||||
/* ARGSUSED */
|
||||
|
||||
static int test_if_open (key,count,param)
|
||||
struct file_info *key;
|
||||
element_count count __attribute__((unused));
|
||||
struct test_if_open_param *param;
|
||||
static int test_if_open (struct isamlog_file_info *key,
|
||||
element_count count __attribute__((unused)),
|
||||
struct test_if_open_param *param)
|
||||
{
|
||||
if (!strcmp(key->name,param->name) && key->id > param->max_id)
|
||||
param->max_id=key->id;
|
||||
|
@ -672,9 +698,7 @@ struct test_if_open_param *param;
|
|||
}
|
||||
|
||||
|
||||
static void fix_blob_pointers(info,record)
|
||||
N_INFO *info;
|
||||
byte *record;
|
||||
static void fix_blob_pointers( N_INFO *info, byte *record)
|
||||
{
|
||||
byte *pos;
|
||||
N_BLOB *blob,*end;
|
||||
|
@ -689,8 +713,7 @@ byte *record;
|
|||
}
|
||||
}
|
||||
|
||||
static uint set_maximum_open_files(maximum_files)
|
||||
uint maximum_files;
|
||||
static uint set_maximum_open_files(uint maximum_files)
|
||||
{
|
||||
#if defined(HAVE_GETRUSAGE) && defined(RLIMIT_NOFILE)
|
||||
struct rlimit rlimit;
|
||||
|
@ -725,10 +748,9 @@ uint maximum_files;
|
|||
/* close the file with hasn't been accessed for the longest time */
|
||||
/* ARGSUSED */
|
||||
|
||||
static int test_when_accessed (key,count,access_param)
|
||||
struct file_info *key;
|
||||
element_count count __attribute__((unused));
|
||||
struct st_access_param *access_param;
|
||||
static int test_when_accessed (struct isamlog_file_info *key,
|
||||
element_count count __attribute__((unused)),
|
||||
struct st_access_param *access_param)
|
||||
{
|
||||
if (key->accessed < access_param->min_accessed && ! key->closed)
|
||||
{
|
||||
|
@ -739,9 +761,9 @@ struct st_access_param *access_param;
|
|||
}
|
||||
|
||||
|
||||
static void file_info_free(fileinfo)
|
||||
struct file_info *fileinfo;
|
||||
static void file_info_free(struct isamlog_file_info *fileinfo)
|
||||
{
|
||||
DBUG_ENTER("file_info_free");
|
||||
if (update)
|
||||
{
|
||||
if (!fileinfo->closed)
|
||||
|
@ -751,12 +773,12 @@ struct file_info *fileinfo;
|
|||
}
|
||||
my_free(fileinfo->name,MYF(0));
|
||||
my_free(fileinfo->show_name,MYF(0));
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static int close_some_file(tree)
|
||||
TREE *tree;
|
||||
static int close_some_file(TREE *tree)
|
||||
{
|
||||
struct st_access_param access_param;
|
||||
|
||||
|
@ -774,9 +796,7 @@ TREE *tree;
|
|||
}
|
||||
|
||||
|
||||
static int reopen_closed_file(tree,fileinfo)
|
||||
TREE *tree;
|
||||
struct file_info *fileinfo;
|
||||
static int reopen_closed_file(TREE *tree, struct isamlog_file_info *fileinfo)
|
||||
{
|
||||
char name[FN_REFLEN];
|
||||
if (close_some_file(tree))
|
||||
|
@ -794,9 +814,8 @@ struct file_info *fileinfo;
|
|||
|
||||
/* Try to find record with uniq key */
|
||||
|
||||
static int find_record_with_key(file_info,record)
|
||||
struct file_info *file_info;
|
||||
byte *record;
|
||||
static int find_record_with_key(struct isamlog_file_info *file_info,
|
||||
byte *record)
|
||||
{
|
||||
uint key;
|
||||
N_INFO *info=file_info->isam;
|
||||
|
@ -817,10 +836,11 @@ byte *record;
|
|||
|
||||
static void printf_log(const char *format,...)
|
||||
{
|
||||
char llbuff[21];
|
||||
va_list args;
|
||||
va_start(args,format);
|
||||
if (verbose > 2)
|
||||
printf("%9ld:",isamlog_filepos);
|
||||
printf("%9s:",llstr(isamlog_filepos,llbuff));
|
||||
if (verbose > 1)
|
||||
printf("%5ld ",isamlog_process); /* Write process number */
|
||||
(void) vprintf((char*) format,args);
|
||||
|
@ -829,9 +849,7 @@ static void printf_log(const char *format,...)
|
|||
}
|
||||
|
||||
|
||||
static bool cmp_filename(file_info,name)
|
||||
struct file_info *file_info;
|
||||
my_string name;
|
||||
static bool cmp_filename(struct isamlog_file_info *file_info,my_string name)
|
||||
{
|
||||
if (!file_info)
|
||||
return 1;
|
||||
|
|
|
@ -21,9 +21,7 @@ static void get_options(int argc, char *argv[]);
|
|||
static int rec_pointer_size=0,verbose=0,remove_ant=0,pack_keys=1,flags[50],
|
||||
packed_field=FIELD_SKIPP_PRESPACE;
|
||||
|
||||
int main(argc,argv)
|
||||
int argc;
|
||||
char *argv[];
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
N_INFO *file;
|
||||
int i,j,error,deleted,found;
|
||||
|
@ -145,9 +143,7 @@ err:
|
|||
/* l{ser optioner */
|
||||
/* OBS! intierar endast DEBUG - ingen debuggning h{r ! */
|
||||
|
||||
static void get_options(argc,argv)
|
||||
int argc;
|
||||
char *argv[];
|
||||
static void get_options(int argc, char *argv[])
|
||||
{
|
||||
char *pos;
|
||||
|
||||
|
|
59
isam/test2.c
59
isam/test2.c
|
@ -53,13 +53,11 @@ static char record[300],record2[300],key[100],key2[100],
|
|||
|
||||
/* Test program */
|
||||
|
||||
int main(argc,argv)
|
||||
int argc;
|
||||
char *argv[];
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
uint i;
|
||||
int j,n1,n2,n3,error,k;
|
||||
uint write_count,update,dupp_keys,delete,start,length,blob_pos,
|
||||
uint write_count,update,dupp_keys,opt_delete,start,length,blob_pos,
|
||||
reclength,ant;
|
||||
ulong lastpos,range_records,records;
|
||||
N_INFO *file;
|
||||
|
@ -138,7 +136,7 @@ char *argv[];
|
|||
else
|
||||
recinfo[6].base.type= FIELD_LAST;
|
||||
|
||||
write_count=update=dupp_keys=delete=0;
|
||||
write_count=update=dupp_keys=opt_delete=0;
|
||||
blob_buffer=0;
|
||||
|
||||
for (i=999 ; i>0 ; i--) key1[i]=0;
|
||||
|
@ -232,7 +230,7 @@ char *argv[];
|
|||
printf("error: %d; can't delete record: \"%s\"\n", my_errno,read_record);
|
||||
goto err;
|
||||
}
|
||||
delete++;
|
||||
opt_delete++;
|
||||
key1[atoi(read_record+keyinfo[0].seg[0].base.start)]--;
|
||||
key3[atoi(read_record+keyinfo[2].seg[0].base.start)]=0;
|
||||
}
|
||||
|
@ -346,9 +344,9 @@ char *argv[];
|
|||
}
|
||||
while (nisam_rnext(file,read_record3,0) == 0 && ant < write_count+10)
|
||||
ant++;
|
||||
if (ant != write_count - delete)
|
||||
if (ant != write_count - opt_delete)
|
||||
{
|
||||
printf("next: I found: %d records of %d\n",ant,write_count - delete);
|
||||
printf("next: I found: %d records of %d\n",ant,write_count - opt_delete);
|
||||
goto end;
|
||||
}
|
||||
if (nisam_rlast(file,read_record2,0) ||
|
||||
|
@ -362,7 +360,7 @@ char *argv[];
|
|||
ant=1;
|
||||
while (nisam_rprev(file,read_record3,0) == 0 && ant < write_count+10)
|
||||
ant++;
|
||||
if (ant != write_count - delete)
|
||||
if (ant != write_count - opt_delete)
|
||||
{
|
||||
printf("prev: I found: %d records of %d\n",ant,write_count);
|
||||
goto end;
|
||||
|
@ -414,7 +412,7 @@ char *argv[];
|
|||
if (nisam_rkey(file,read_record,0,key,0,HA_READ_KEY_EXACT)) goto err;
|
||||
if (nisam_rnext(file,read_record3,0)) goto err;
|
||||
if (nisam_delete(file,read_record3)) goto err;
|
||||
delete++;
|
||||
opt_delete++;
|
||||
ant=1;
|
||||
while (nisam_rnext(file,read_record3,0) == 0 &&
|
||||
bcmp(read_record3+start,key,length) == 0) ant++;
|
||||
|
@ -431,7 +429,7 @@ char *argv[];
|
|||
if (nisam_rprev(file,read_record3,0)) goto err;
|
||||
if (nisam_rprev(file,read_record3,0)) goto err;
|
||||
if (nisam_delete(file,read_record3)) goto err;
|
||||
delete++;
|
||||
opt_delete++;
|
||||
ant=1;
|
||||
while (nisam_rprev(file,read_record3,0) == 0 &&
|
||||
bcmp(read_record3+start,key,length) == 0) ant++;
|
||||
|
@ -447,7 +445,7 @@ char *argv[];
|
|||
DBUG_PRINT("progpos",("first - delete - next -> last"));
|
||||
if (nisam_rkey(file,read_record3,0,key,0,HA_READ_KEY_EXACT)) goto err;
|
||||
if (nisam_delete(file,read_record3)) goto err;
|
||||
delete++;
|
||||
opt_delete++;
|
||||
ant=1;
|
||||
if (nisam_rnext(file,read_record,0))
|
||||
goto err; /* Skall finnas poster */
|
||||
|
@ -463,7 +461,7 @@ char *argv[];
|
|||
DBUG_PRINT("progpos",("last - delete - prev -> first"));
|
||||
if (nisam_rprev(file,read_record3,0)) goto err;
|
||||
if (nisam_delete(file,read_record3)) goto err;
|
||||
delete++;
|
||||
opt_delete++;
|
||||
ant=0;
|
||||
while (nisam_rprev(file,read_record3,0) == 0 &&
|
||||
bcmp(read_record3+start,key,length) == 0) ant++;
|
||||
|
@ -555,11 +553,11 @@ char *argv[];
|
|||
|
||||
printf("- nisam_info\n");
|
||||
nisam_info(file,&info,0);
|
||||
if (info.records != write_count-delete || info.deleted > delete + update
|
||||
if (info.records != write_count-opt_delete || info.deleted > opt_delete + update
|
||||
|| info.keys != keys)
|
||||
{
|
||||
puts("Wrong info from nisam_info");
|
||||
printf("Got: records: %ld delete: %ld i_keys: %d\n",
|
||||
printf("Got: records: %ld opt_delete: %ld i_keys: %d\n",
|
||||
info.records,info.deleted,info.keys);
|
||||
}
|
||||
if (verbose)
|
||||
|
@ -591,10 +589,10 @@ char *argv[];
|
|||
while ((error=nisam_rrnd(file,record,NI_POS_ERROR)) >= 0 &&
|
||||
ant < write_count + 10)
|
||||
ant+= error ? 0 : 1;
|
||||
if (ant != write_count-delete)
|
||||
if (ant != write_count-opt_delete)
|
||||
{
|
||||
printf("rrnd with cache: I can only find: %d records of %d\n",
|
||||
ant,write_count-delete);
|
||||
ant,write_count-opt_delete);
|
||||
goto end;
|
||||
}
|
||||
if (nisam_extra(file,HA_EXTRA_NO_CACHE))
|
||||
|
@ -648,14 +646,14 @@ char *argv[];
|
|||
printf("can't delete record: %s\n",read_record);
|
||||
goto err;
|
||||
}
|
||||
delete++;
|
||||
opt_delete++;
|
||||
}
|
||||
}
|
||||
if (my_errno != HA_ERR_END_OF_FILE && my_errno != HA_ERR_RECORD_DELETED)
|
||||
printf("error: %d from nisam_rrnd\n",my_errno);
|
||||
if (write_count != delete)
|
||||
if (write_count != opt_delete)
|
||||
{
|
||||
printf("Deleted only %d of %d records\n",write_count,delete);
|
||||
printf("Deleted only %d of %d records\n",write_count,opt_delete);
|
||||
goto err;
|
||||
}
|
||||
end:
|
||||
|
@ -663,7 +661,7 @@ end:
|
|||
goto err;
|
||||
nisam_panic(HA_PANIC_CLOSE); /* Should close log */
|
||||
printf("\nFollowing test have been made:\n");
|
||||
printf("Write records: %d\nUpdate records: %d\nSame-key-read: %d\nDelete records: %d\n", write_count,update,dupp_keys,delete);
|
||||
printf("Write records: %d\nUpdate records: %d\nSame-key-read: %d\nDelete records: %d\n", write_count,update,dupp_keys,opt_delete);
|
||||
if (rec_pointer_size)
|
||||
printf("Record pointer size: %d\n",rec_pointer_size);
|
||||
if (key_cacheing)
|
||||
|
@ -692,9 +690,7 @@ err:
|
|||
/* l{ser optioner */
|
||||
/* OBS! intierar endast DEBUG - ingen debuggning h{r ! */
|
||||
|
||||
static void get_options(argc,argv)
|
||||
int argc;
|
||||
char *argv[];
|
||||
static void get_options( int argc, char *argv[])
|
||||
{
|
||||
char *pos,*progname;
|
||||
DEBUGGER_OFF;
|
||||
|
@ -785,8 +781,7 @@ char *argv[];
|
|||
|
||||
/* Ge ett randomv{rde inom ett intervall 0 <=x <= n */
|
||||
|
||||
static uint rnd(max_value)
|
||||
uint max_value;
|
||||
static uint rnd( uint max_value)
|
||||
{
|
||||
return (uint) ((rand() & 32767)/32767.0*max_value);
|
||||
} /* rnd */
|
||||
|
@ -794,9 +789,7 @@ uint max_value;
|
|||
|
||||
/* G|r en record av skiftande length */
|
||||
|
||||
static void fix_length(rec,length)
|
||||
byte *rec;
|
||||
uint length;
|
||||
static void fix_length( byte *rec, uint length)
|
||||
{
|
||||
bmove(rec+STANDAR_LENGTH,
|
||||
"0123456789012345678901234567890123456789012345678901234567890",
|
||||
|
@ -807,8 +800,7 @@ uint length;
|
|||
|
||||
/* Put maybe a blob in record */
|
||||
|
||||
static void put_blob_in_record(blob_pos,blob_buffer)
|
||||
char *blob_pos,**blob_buffer;
|
||||
static void put_blob_in_record(char *blob_pos, char **blob_buffer)
|
||||
{
|
||||
ulong i,length;
|
||||
if (use_blob)
|
||||
|
@ -836,10 +828,7 @@ char *blob_pos,**blob_buffer;
|
|||
}
|
||||
|
||||
|
||||
static void copy_key(info,inx,rec,key_buff)
|
||||
N_INFO *info;
|
||||
uint inx;
|
||||
uchar *rec,*key_buff;
|
||||
static void copy_key( N_INFO *info, uint inx, uchar *rec, uchar *key_buff)
|
||||
{
|
||||
N_KEYSEG *keyseg;
|
||||
|
||||
|
|
|
@ -11,16 +11,16 @@ test2 -L -K -W -P
|
|||
- Read key (first) - next - delete - next -> last
|
||||
- Read last of key - prev - delete - prev -> first
|
||||
- Test if: Read rrnd - same
|
||||
- Test ni_records_in_range
|
||||
- ni_info
|
||||
- ni_extra(CACHE) + ni_rrnd.... + ni_extra(NO_CACHE)
|
||||
- Test nisam_records_in_range
|
||||
- nisam_info
|
||||
- nisam_extra(CACHE) + nisam_rrnd.... + nisam_extra(NO_CACHE)
|
||||
- Removing keys
|
||||
|
||||
Following test have been made:
|
||||
Write records: 915
|
||||
Update records: 82
|
||||
Write records: 907
|
||||
Update records: 87
|
||||
Same-key-read: 6
|
||||
Delete records: 915
|
||||
Delete records: 907
|
||||
Key cacheing used
|
||||
Write cacheing used
|
||||
Locking used
|
||||
|
@ -37,16 +37,16 @@ test2 -L -K -W -P -A
|
|||
- Read key (first) - next - delete - next -> last
|
||||
- Read last of key - prev - delete - prev -> first
|
||||
- Test if: Read rrnd - same
|
||||
- Test ni_records_in_range
|
||||
- ni_info
|
||||
- ni_extra(CACHE) + ni_rrnd.... + ni_extra(NO_CACHE)
|
||||
- Test nisam_records_in_range
|
||||
- nisam_info
|
||||
- nisam_extra(CACHE) + nisam_rrnd.... + nisam_extra(NO_CACHE)
|
||||
- Removing keys
|
||||
|
||||
Following test have been made:
|
||||
Write records: 915
|
||||
Update records: 82
|
||||
Write records: 907
|
||||
Update records: 87
|
||||
Same-key-read: 6
|
||||
Delete records: 915
|
||||
Delete records: 907
|
||||
Key cacheing used
|
||||
Write cacheing used
|
||||
Asyncron io with locking used
|
||||
|
@ -62,16 +62,16 @@ test2 -L -K -W -P -S -R1 -m500
|
|||
- Test read key-part
|
||||
- Read key (first) - next - delete - next -> last
|
||||
- Test if: Read rrnd - same
|
||||
- Test ni_records_in_range
|
||||
- ni_info
|
||||
- ni_extra(CACHE) + ni_rrnd.... + ni_extra(NO_CACHE)
|
||||
- Test nisam_records_in_range
|
||||
- nisam_info
|
||||
- nisam_extra(CACHE) + nisam_rrnd.... + nisam_extra(NO_CACHE)
|
||||
- Removing keys
|
||||
|
||||
Following test have been made:
|
||||
Write records: 484
|
||||
Update records: 48
|
||||
Same-key-read: 3
|
||||
Delete records: 484
|
||||
Write records: 475
|
||||
Update records: 44
|
||||
Same-key-read: 4
|
||||
Delete records: 475
|
||||
Record pointer size: 1
|
||||
Key cacheing used
|
||||
Write cacheing used
|
||||
|
@ -79,8 +79,31 @@ Locking used
|
|||
test2 -L -K -R1 -m2000 ; Should give error 135
|
||||
- Creating isam-file
|
||||
- Writing key:s
|
||||
Error: 135 in write at record: 1122
|
||||
got error: 135 when using NISAM-database
|
||||
- Delete
|
||||
- Update
|
||||
- Same key: first - next -> last - prev -> first
|
||||
- All keys: first - next -> last - prev -> first
|
||||
- Test if: Read first - next - prev - prev - next == first
|
||||
- Test if: Read last - prev - next - next - prev == last
|
||||
- Test read key-part
|
||||
- Read key (first) - next - delete - next -> last
|
||||
- Read last of key - prev - delete - prev -> first
|
||||
- Read first - delete - next -> last
|
||||
- Read last - delete - prev -> first
|
||||
- Test if: Read rrnd - same
|
||||
- Test nisam_records_in_range
|
||||
- nisam_info
|
||||
- nisam_extra(CACHE) + nisam_rrnd.... + nisam_extra(NO_CACHE)
|
||||
- Removing keys
|
||||
|
||||
Following test have been made:
|
||||
Write records: 1647
|
||||
Update records: 125
|
||||
Same-key-read: 8
|
||||
Delete records: 1647
|
||||
Record pointer size: 1
|
||||
Key cacheing used
|
||||
Locking used
|
||||
test2 -L -K -P -S -R3 -m50 -b1000000
|
||||
- Creating isam-file
|
||||
- Writing key:s
|
||||
|
@ -92,9 +115,9 @@ test2 -L -K -P -S -R3 -m50 -b1000000
|
|||
- Test if: Read last - prev - next - next - prev == last
|
||||
- Test read key-part
|
||||
- Test if: Read rrnd - same
|
||||
- Test ni_records_in_range
|
||||
- ni_info
|
||||
- ni_extra(CACHE) + ni_rrnd.... + ni_extra(NO_CACHE)
|
||||
- Test nisam_records_in_range
|
||||
- nisam_info
|
||||
- nisam_extra(CACHE) + nisam_rrnd.... + nisam_extra(NO_CACHE)
|
||||
- Removing keys
|
||||
|
||||
Following test have been made:
|
||||
|
@ -118,16 +141,16 @@ test2 -L -B
|
|||
- Read key (first) - next - delete - next -> last
|
||||
- Read last of key - prev - delete - prev -> first
|
||||
- Test if: Read rrnd - same
|
||||
- Test ni_records_in_range
|
||||
- ni_info
|
||||
- ni_extra(CACHE) + ni_rrnd.... + ni_extra(NO_CACHE)
|
||||
- Test nisam_records_in_range
|
||||
- nisam_info
|
||||
- nisam_extra(CACHE) + nisam_rrnd.... + nisam_extra(NO_CACHE)
|
||||
- Removing keys
|
||||
|
||||
Following test have been made:
|
||||
Write records: 912
|
||||
Update records: 81
|
||||
Write records: 903
|
||||
Update records: 86
|
||||
Same-key-read: 5
|
||||
Delete records: 912
|
||||
Delete records: 903
|
||||
Locking used
|
||||
blobs used
|
||||
test2 -L -K -W -P -m50 -l
|
||||
|
@ -141,9 +164,9 @@ test2 -L -K -W -P -m50 -l
|
|||
- Test if: Read last - prev - next - next - prev == last
|
||||
- Test read key-part
|
||||
- Test if: Read rrnd - same
|
||||
- Test ni_records_in_range
|
||||
- ni_info
|
||||
- ni_extra(CACHE) + ni_rrnd.... + ni_extra(NO_CACHE)
|
||||
- Test nisam_records_in_range
|
||||
- nisam_info
|
||||
- nisam_extra(CACHE) + nisam_rrnd.... + nisam_extra(NO_CACHE)
|
||||
- Removing keys
|
||||
|
||||
Following test have been made:
|
||||
|
@ -155,13 +178,13 @@ Key cacheing used
|
|||
Write cacheing used
|
||||
Locking used
|
||||
Commands Used count Errors Recover errors
|
||||
open 3 0 0
|
||||
write 150 0 0
|
||||
update 15 0 0
|
||||
delete 150 0 0
|
||||
close 3 0 0
|
||||
extra 18 0 0
|
||||
Total 339 0 0
|
||||
open 14 0 0
|
||||
write 700 0 0
|
||||
update 70 0 0
|
||||
delete 700 0 0
|
||||
close 14 0 0
|
||||
extra 84 0 0
|
||||
Total 1582 0 0
|
||||
test2 -L -K -W -P -m50 -l -b100
|
||||
- Creating isam-file
|
||||
- Writing key:s
|
||||
|
@ -173,9 +196,9 @@ test2 -L -K -W -P -m50 -l -b100
|
|||
- Test if: Read last - prev - next - next - prev == last
|
||||
- Test read key-part
|
||||
- Test if: Read rrnd - same
|
||||
- Test ni_records_in_range
|
||||
- ni_info
|
||||
- ni_extra(CACHE) + ni_rrnd.... + ni_extra(NO_CACHE)
|
||||
- Test nisam_records_in_range
|
||||
- nisam_info
|
||||
- nisam_extra(CACHE) + nisam_rrnd.... + nisam_extra(NO_CACHE)
|
||||
- Removing keys
|
||||
|
||||
Following test have been made:
|
||||
|
@ -187,13 +210,13 @@ Key cacheing used
|
|||
Write cacheing used
|
||||
Locking used
|
||||
Commands Used count Errors Recover errors
|
||||
open 4 0 0
|
||||
write 200 0 0
|
||||
update 20 0 0
|
||||
delete 200 0 0
|
||||
close 4 0 0
|
||||
extra 24 0 0
|
||||
Total 452 0 0
|
||||
open 15 0 0
|
||||
write 750 0 0
|
||||
update 75 0 0
|
||||
delete 750 0 0
|
||||
close 15 0 0
|
||||
extra 90 0 0
|
||||
Total 1695 0 0
|
||||
time test2
|
||||
- Creating isam-file
|
||||
- Writing key:s
|
||||
|
@ -207,18 +230,16 @@ time test2
|
|||
- Read key (first) - next - delete - next -> last
|
||||
- Read last of key - prev - delete - prev -> first
|
||||
- Test if: Read rrnd - same
|
||||
- Test ni_records_in_range
|
||||
- ni_info
|
||||
- ni_extra(CACHE) + ni_rrnd.... + ni_extra(NO_CACHE)
|
||||
- Test nisam_records_in_range
|
||||
- nisam_info
|
||||
- nisam_extra(CACHE) + nisam_rrnd.... + nisam_extra(NO_CACHE)
|
||||
- Removing keys
|
||||
|
||||
Following test have been made:
|
||||
Write records: 915
|
||||
Update records: 82
|
||||
Write records: 907
|
||||
Update records: 87
|
||||
Same-key-read: 6
|
||||
Delete records: 915
|
||||
4.77user 6.81system 0:15.07elapsed 76%CPU (0avgtext+0avgdata 0maxresident)k
|
||||
0inputs+0outputs (0major+0minor)pagefaults 0swaps
|
||||
Delete records: 907
|
||||
time test2 -K
|
||||
- Creating isam-file
|
||||
- Writing key:s
|
||||
|
@ -232,19 +253,17 @@ time test2 -K
|
|||
- Read key (first) - next - delete - next -> last
|
||||
- Read last of key - prev - delete - prev -> first
|
||||
- Test if: Read rrnd - same
|
||||
- Test ni_records_in_range
|
||||
- ni_info
|
||||
- ni_extra(CACHE) + ni_rrnd.... + ni_extra(NO_CACHE)
|
||||
- Test nisam_records_in_range
|
||||
- nisam_info
|
||||
- nisam_extra(CACHE) + nisam_rrnd.... + nisam_extra(NO_CACHE)
|
||||
- Removing keys
|
||||
|
||||
Following test have been made:
|
||||
Write records: 915
|
||||
Update records: 82
|
||||
Write records: 907
|
||||
Update records: 87
|
||||
Same-key-read: 6
|
||||
Delete records: 915
|
||||
Delete records: 907
|
||||
Key cacheing used
|
||||
6.09user 4.33system 0:11.66elapsed 89%CPU (0avgtext+0avgdata 0maxresident)k
|
||||
0inputs+0outputs (0major+0minor)pagefaults 0swaps
|
||||
time test2 -L
|
||||
- Creating isam-file
|
||||
- Writing key:s
|
||||
|
@ -258,19 +277,17 @@ time test2 -L
|
|||
- Read key (first) - next - delete - next -> last
|
||||
- Read last of key - prev - delete - prev -> first
|
||||
- Test if: Read rrnd - same
|
||||
- Test ni_records_in_range
|
||||
- ni_info
|
||||
- ni_extra(CACHE) + ni_rrnd.... + ni_extra(NO_CACHE)
|
||||
- Test nisam_records_in_range
|
||||
- nisam_info
|
||||
- nisam_extra(CACHE) + nisam_rrnd.... + nisam_extra(NO_CACHE)
|
||||
- Removing keys
|
||||
|
||||
Following test have been made:
|
||||
Write records: 915
|
||||
Update records: 82
|
||||
Write records: 907
|
||||
Update records: 87
|
||||
Same-key-read: 6
|
||||
Delete records: 915
|
||||
Delete records: 907
|
||||
Locking used
|
||||
5.01user 5.20system 0:10.86elapsed 94%CPU (0avgtext+0avgdata 0maxresident)k
|
||||
0inputs+0outputs (0major+0minor)pagefaults 0swaps
|
||||
time test2 -L -K
|
||||
- Creating isam-file
|
||||
- Writing key:s
|
||||
|
@ -284,20 +301,18 @@ time test2 -L -K
|
|||
- Read key (first) - next - delete - next -> last
|
||||
- Read last of key - prev - delete - prev -> first
|
||||
- Test if: Read rrnd - same
|
||||
- Test ni_records_in_range
|
||||
- ni_info
|
||||
- ni_extra(CACHE) + ni_rrnd.... + ni_extra(NO_CACHE)
|
||||
- Test nisam_records_in_range
|
||||
- nisam_info
|
||||
- nisam_extra(CACHE) + nisam_rrnd.... + nisam_extra(NO_CACHE)
|
||||
- Removing keys
|
||||
|
||||
Following test have been made:
|
||||
Write records: 915
|
||||
Update records: 82
|
||||
Write records: 907
|
||||
Update records: 87
|
||||
Same-key-read: 6
|
||||
Delete records: 915
|
||||
Delete records: 907
|
||||
Key cacheing used
|
||||
Locking used
|
||||
5.63user 0.97system 0:07.85elapsed 84%CPU (0avgtext+0avgdata 0maxresident)k
|
||||
0inputs+0outputs (0major+0minor)pagefaults 0swaps
|
||||
time test2 -L -K -W
|
||||
- Creating isam-file
|
||||
- Writing key:s
|
||||
|
@ -311,21 +326,19 @@ time test2 -L -K -W
|
|||
- Read key (first) - next - delete - next -> last
|
||||
- Read last of key - prev - delete - prev -> first
|
||||
- Test if: Read rrnd - same
|
||||
- Test ni_records_in_range
|
||||
- ni_info
|
||||
- ni_extra(CACHE) + ni_rrnd.... + ni_extra(NO_CACHE)
|
||||
- Test nisam_records_in_range
|
||||
- nisam_info
|
||||
- nisam_extra(CACHE) + nisam_rrnd.... + nisam_extra(NO_CACHE)
|
||||
- Removing keys
|
||||
|
||||
Following test have been made:
|
||||
Write records: 915
|
||||
Update records: 82
|
||||
Write records: 907
|
||||
Update records: 87
|
||||
Same-key-read: 6
|
||||
Delete records: 915
|
||||
Delete records: 907
|
||||
Key cacheing used
|
||||
Write cacheing used
|
||||
Locking used
|
||||
5.28user 1.32system 0:08.86elapsed 74%CPU (0avgtext+0avgdata 0maxresident)k
|
||||
0inputs+0outputs (0major+0minor)pagefaults 0swaps
|
||||
time test2 -L -K -W -S
|
||||
- Creating isam-file
|
||||
- Writing key:s
|
||||
|
@ -339,18 +352,16 @@ time test2 -L -K -W -S
|
|||
- Read key (first) - next - delete - next -> last
|
||||
- Read last of key - prev - delete - prev -> first
|
||||
- Test if: Read rrnd - same
|
||||
- Test ni_records_in_range
|
||||
- ni_info
|
||||
- ni_extra(CACHE) + ni_rrnd.... + ni_extra(NO_CACHE)
|
||||
- Test nisam_records_in_range
|
||||
- nisam_info
|
||||
- nisam_extra(CACHE) + nisam_rrnd.... + nisam_extra(NO_CACHE)
|
||||
- Removing keys
|
||||
|
||||
Following test have been made:
|
||||
Write records: 915
|
||||
Update records: 82
|
||||
Write records: 907
|
||||
Update records: 87
|
||||
Same-key-read: 6
|
||||
Delete records: 915
|
||||
Delete records: 907
|
||||
Key cacheing used
|
||||
Write cacheing used
|
||||
Locking used
|
||||
5.32user 0.62system 0:06.13elapsed 96%CPU (0avgtext+0avgdata 0maxresident)k
|
||||
0inputs+0outputs (0major+0minor)pagefaults 0swaps
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
#include <pwd.h>
|
||||
#endif /* HAVE_PWD_H */
|
||||
#else /* ! HAVE_GETPASS */
|
||||
#ifndef __WIN__
|
||||
#if !defined( __WIN__) && !defined(OS2)
|
||||
#include <sys/ioctl.h>
|
||||
#ifdef HAVE_TERMIOS_H /* For tty-password */
|
||||
#include <termios.h>
|
||||
|
@ -62,9 +62,8 @@
|
|||
#define getpass(A) getpassphrase(A)
|
||||
#endif
|
||||
|
||||
#ifdef __WIN__
|
||||
/* were just going to fake it here and get input from
|
||||
the keyboard */
|
||||
#if defined( __WIN__) || defined(OS2)
|
||||
/* were just going to fake it here and get input from the keyboard */
|
||||
|
||||
char *get_tty_password(char *opt_message)
|
||||
{
|
||||
|
|
|
@ -77,8 +77,7 @@ my_string mysql_unix_port=0;
|
|||
#include <errno.h>
|
||||
#define ERRNO errno
|
||||
#define SOCKET_ERROR -1
|
||||
#define closesocket(A) close(A)
|
||||
#endif
|
||||
#endif /* __WIN__ */
|
||||
|
||||
static void mysql_once_init(void);
|
||||
static MYSQL_DATA *read_rows (MYSQL *mysql,MYSQL_FIELD *fields,
|
||||
|
@ -121,7 +120,7 @@ static ulong mysql_sub_escape_string(CHARSET_INFO *charset_info, char *to,
|
|||
static int connect2(my_socket s, const struct sockaddr *name, uint namelen,
|
||||
uint timeout)
|
||||
{
|
||||
#if defined(__WIN__)
|
||||
#if defined(__WIN__) || defined(OS2)
|
||||
return connect(s, (struct sockaddr*) name, namelen);
|
||||
#else
|
||||
int flags, res, s_err;
|
||||
|
@ -490,7 +489,7 @@ struct passwd *getpwuid(uid_t);
|
|||
char* getlogin(void);
|
||||
#endif
|
||||
|
||||
#if !defined(MSDOS) && ! defined(VMS) && !defined(__WIN__)
|
||||
#if !defined(MSDOS) && ! defined(VMS) && !defined(__WIN__) && !defined(OS2)
|
||||
static void read_user_name(char *name)
|
||||
{
|
||||
DBUG_ENTER("read_user_name");
|
||||
|
|
|
@ -34,6 +34,7 @@
|
|||
#include <signal.h>
|
||||
#include <errno.h>
|
||||
#include <sys/types.h>
|
||||
#include <violite.h>
|
||||
|
||||
#ifdef MYSQL_SERVER
|
||||
ulong max_allowed_packet=65536;
|
||||
|
@ -67,13 +68,19 @@ void sql_print_error(const char *format,...);
|
|||
#define RETRY_COUNT mysqld_net_retry_count
|
||||
extern ulong mysqld_net_retry_count;
|
||||
#else
|
||||
|
||||
#ifdef OS2 /* avoid name conflict */
|
||||
#define thr_alarm_t thr_alarm_t_net
|
||||
#define ALARM ALARM_net
|
||||
#endif
|
||||
|
||||
typedef my_bool thr_alarm_t;
|
||||
typedef my_bool ALARM;
|
||||
#define thr_alarm_init(A) (*A)=0
|
||||
#define thr_alarm_init(A) (*(A))=0
|
||||
#define thr_alarm_in_use(A) (*(A))
|
||||
#define thr_end_alarm(A)
|
||||
#define thr_alarm(A,B,C) local_thr_alarm((A),(B),(C))
|
||||
static inline int local_thr_alarm(my_bool *A,int B __attribute__((unused)),ALARM *C __attribute__((unused)))
|
||||
inline int local_thr_alarm(my_bool *A,int B __attribute__((unused)),ALARM *C __attribute__((unused)))
|
||||
{
|
||||
*A=1;
|
||||
return 0;
|
||||
|
@ -123,7 +130,7 @@ int my_net_init(NET *net, Vio* vio)
|
|||
if (vio != 0) /* If real connection */
|
||||
{
|
||||
net->fd = vio_fd(vio); /* For perl DBI/DBD */
|
||||
#if defined(MYSQL_SERVER) && !defined(___WIN__) && !defined(__EMX__)
|
||||
#if defined(MYSQL_SERVER) && !defined(___WIN__) && !defined(__EMX__) && !defined(OS2)
|
||||
if (!(test_flags & TEST_BLOCKING))
|
||||
vio_blocking(vio, FALSE);
|
||||
#endif
|
||||
|
@ -270,7 +277,7 @@ net_real_write(NET *net,const char *packet,ulong len)
|
|||
int length;
|
||||
char *pos,*end;
|
||||
thr_alarm_t alarmed;
|
||||
#if !defined(__WIN__) && !defined(__EMX__)
|
||||
#if !defined(__WIN__) && !defined(__EMX__) && !defined(OS2)
|
||||
ALARM alarm_buff;
|
||||
#endif
|
||||
uint retry_count=0;
|
||||
|
@ -328,7 +335,7 @@ net_real_write(NET *net,const char *packet,ulong len)
|
|||
if ((int) (length=vio_write(net->vio,pos,(int) (end-pos))) <= 0)
|
||||
{
|
||||
my_bool interrupted = vio_should_retry(net->vio);
|
||||
#if (!defined(__WIN__) && !defined(__EMX__))
|
||||
#if (!defined(__WIN__) && !defined(__EMX__) && !defined(OS2))
|
||||
if ((interrupted || length==0) && !thr_alarm_in_use(&alarmed))
|
||||
{
|
||||
if (!thr_alarm(&alarmed,(uint) net_write_timeout,&alarm_buff))
|
||||
|
@ -425,7 +432,7 @@ static void my_net_skip_rest(NET *net, ulong remain, thr_alarm_t *alarmed)
|
|||
if ((int) (length=vio_read(net->vio,(char*) net->buff,remain)) <= 0L)
|
||||
{
|
||||
my_bool interrupted = vio_should_retry(net->vio);
|
||||
if (!thr_got_alarm(&alarmed) && interrupted)
|
||||
if (!thr_got_alarm(alarmed) && interrupted)
|
||||
{ /* Probably in MIT threads */
|
||||
if (retry_count++ < RETRY_COUNT)
|
||||
continue;
|
||||
|
@ -447,7 +454,7 @@ my_real_read(NET *net, ulong *complen)
|
|||
uint i,retry_count=0;
|
||||
ulong len=packet_error;
|
||||
thr_alarm_t alarmed;
|
||||
#if (!defined(__WIN__) && !defined(__EMX__)) || defined(MYSQL_SERVER)
|
||||
#if (!defined(__WIN__) && !defined(__EMX__) && !defined(OS2)) || defined(MYSQL_SERVER)
|
||||
ALARM alarm_buff;
|
||||
#endif
|
||||
my_bool net_blocking=vio_is_blocking(net->vio);
|
||||
|
@ -474,7 +481,7 @@ my_real_read(NET *net, ulong *complen)
|
|||
|
||||
DBUG_PRINT("info",("vio_read returned %d, errno: %d",
|
||||
length, vio_errno(net->vio)));
|
||||
#if (!defined(__WIN__) && !defined(__EMX__)) || defined(MYSQL_SERVER)
|
||||
#if (!defined(__WIN__) && !defined(__EMX__) && !defined(OS2)) || defined(MYSQL_SERVER)
|
||||
/*
|
||||
We got an error that there was no data on the socket. We now set up
|
||||
an alarm to not 'read forever', change the socket to non blocking
|
||||
|
|
|
@ -35,11 +35,13 @@
|
|||
#ifdef HAVE_POLL
|
||||
#include <sys/poll.h>
|
||||
#endif
|
||||
|
||||
#if defined(__EMX__)
|
||||
#ifdef HAVE_SYS_IOCTL_H
|
||||
#include <sys/ioctl.h>
|
||||
#endif
|
||||
|
||||
#if defined(__EMX__) || defined(OS2)
|
||||
#define ioctlsocket ioctl
|
||||
#endif /* defined(__EMX__) */
|
||||
#endif /* defined(__EMX__) */
|
||||
|
||||
#if defined(MSDOS) || defined(__WIN__)
|
||||
#ifdef __WIN__
|
||||
|
@ -103,9 +105,12 @@ Vio *vio_new(my_socket sd, enum enum_vio_type type, my_bool localhost)
|
|||
sprintf(vio->desc,
|
||||
(vio->type == VIO_TYPE_SOCKET ? "socket (%d)" : "TCP/IP (%d)"),
|
||||
vio->sd);
|
||||
#if !defined(___WIN__) && !defined(__EMX__)
|
||||
#if !defined(___WIN__) && !defined(__EMX__) && !defined(OS2)
|
||||
#if !defined(NO_FCNTL_NONBLOCK)
|
||||
vio->fcntl_mode = fcntl(sd, F_GETFL);
|
||||
#elif defined(HAVE_SYS_IOCTL_H) /* hpux */
|
||||
/* Non blocking sockets doesn't work good on HPUX 11.0 */
|
||||
(void) ioctl(sd,FIOSNBIO,0);
|
||||
#endif
|
||||
#else /* !defined(__WIN__) && !defined(__EMX__) */
|
||||
{
|
||||
|
@ -149,7 +154,7 @@ void vio_delete(Vio * vio)
|
|||
|
||||
int vio_errno(Vio *vio __attribute__((unused)))
|
||||
{
|
||||
return errno; /* On Win32 this mapped to WSAGetLastError() */
|
||||
return socket_errno; /* On Win32 this mapped to WSAGetLastError() */
|
||||
}
|
||||
|
||||
|
||||
|
@ -158,12 +163,17 @@ int vio_read(Vio * vio, gptr buf, int size)
|
|||
int r;
|
||||
DBUG_ENTER("vio_read");
|
||||
DBUG_PRINT("enter", ("sd=%d, buf=%p, size=%d", vio->sd, buf, size));
|
||||
#ifdef __WIN__
|
||||
#if defined( __WIN__) || defined(OS2)
|
||||
if (vio->type == VIO_TYPE_NAMEDPIPE)
|
||||
{
|
||||
DWORD length;
|
||||
#ifdef OS2
|
||||
if (!DosRead((HFILE)vio->hPipe, buf, size, &length))
|
||||
DBUG_RETURN(-1);
|
||||
#else
|
||||
if (!ReadFile(vio->hPipe, buf, size, &length, NULL))
|
||||
DBUG_RETURN(-1);
|
||||
#endif
|
||||
DBUG_RETURN(length);
|
||||
}
|
||||
r = recv(vio->sd, buf, size,0);
|
||||
|
@ -174,7 +184,7 @@ int vio_read(Vio * vio, gptr buf, int size)
|
|||
#ifndef DBUG_OFF
|
||||
if (r < 0)
|
||||
{
|
||||
DBUG_PRINT("error", ("Got error %d during read",errno));
|
||||
DBUG_PRINT("vio_error", ("Got error %d during read",socket_errno));
|
||||
}
|
||||
#endif /* DBUG_OFF */
|
||||
DBUG_PRINT("exit", ("%d", r));
|
||||
|
@ -187,12 +197,17 @@ int vio_write(Vio * vio, const gptr buf, int size)
|
|||
int r;
|
||||
DBUG_ENTER("vio_write");
|
||||
DBUG_PRINT("enter", ("sd=%d, buf=%p, size=%d", vio->sd, buf, size));
|
||||
#ifdef __WIN__
|
||||
#if defined( __WIN__) || defined(OS2)
|
||||
if ( vio->type == VIO_TYPE_NAMEDPIPE)
|
||||
{
|
||||
DWORD length;
|
||||
#ifdef OS2
|
||||
if (!DosWrite((HFILE)vio->hPipe, (char*) buf, size, &length))
|
||||
DBUG_RETURN(-1);
|
||||
#else
|
||||
if (!WriteFile(vio->hPipe, (char*) buf, size, &length, NULL))
|
||||
DBUG_RETURN(-1);
|
||||
#endif
|
||||
DBUG_RETURN(length);
|
||||
}
|
||||
r = send(vio->sd, buf, size,0);
|
||||
|
@ -202,7 +217,7 @@ int vio_write(Vio * vio, const gptr buf, int size)
|
|||
#ifndef DBUG_OFF
|
||||
if (r < 0)
|
||||
{
|
||||
DBUG_PRINT("error", ("Got error on write: %d",errno));
|
||||
DBUG_PRINT("vio_error", ("Got error on write: %d",socket_errno));
|
||||
}
|
||||
#endif /* DBUG_OFF */
|
||||
DBUG_PRINT("exit", ("%d", r));
|
||||
|
@ -216,7 +231,7 @@ int vio_blocking(Vio * vio, my_bool set_blocking_mode)
|
|||
DBUG_ENTER("vio_blocking");
|
||||
DBUG_PRINT("enter", ("set_blocking_mode: %d", (int) set_blocking_mode));
|
||||
|
||||
#if !defined(___WIN__) && !defined(__EMX__)
|
||||
#if !defined(___WIN__) && !defined(__EMX__) && !defined(OS2)
|
||||
#if !defined(NO_FCNTL_NONBLOCK)
|
||||
|
||||
if (vio->sd >= 0)
|
||||
|
@ -341,7 +356,7 @@ int vio_close(Vio * vio)
|
|||
}
|
||||
if (r)
|
||||
{
|
||||
DBUG_PRINT("error", ("close() failed, error: %d",errno));
|
||||
DBUG_PRINT("vio_error", ("close() failed, error: %d",socket_errno));
|
||||
/* FIXME: error handling (not critical for MySQL) */
|
||||
}
|
||||
vio->type= VIO_CLOSED;
|
||||
|
@ -380,7 +395,7 @@ my_bool vio_peer_addr(Vio * vio, char *buf)
|
|||
if (getpeername(vio->sd, (struct sockaddr *) (& (vio->remote)),
|
||||
&addrLen) != 0)
|
||||
{
|
||||
DBUG_PRINT("exit", ("getpeername, error: %d", errno));
|
||||
DBUG_PRINT("exit", ("getpeername, error: %d", socket_errno));
|
||||
DBUG_RETURN(1);
|
||||
}
|
||||
my_inet_ntoa(vio->remote.sin_addr,buf);
|
||||
|
|
|
@ -20,9 +20,7 @@
|
|||
|
||||
#include "mrgdef.h"
|
||||
|
||||
int mrg_lock_database(info,lock_type)
|
||||
MRG_INFO *info;
|
||||
int lock_type;
|
||||
int mrg_lock_database(MRG_INFO *info,int lock_type)
|
||||
{
|
||||
int error,new_error;
|
||||
MRG_TABLE *file;
|
||||
|
|
|
@ -18,8 +18,7 @@
|
|||
|
||||
#include "mrgdef.h"
|
||||
|
||||
int mrg_close(info)
|
||||
register MRG_INFO *info;
|
||||
int mrg_close(register MRG_INFO *info)
|
||||
{
|
||||
int error=0,new_error;
|
||||
MRG_TABLE *file;
|
||||
|
|
|
@ -23,8 +23,7 @@
|
|||
a NULL-pointer last
|
||||
*/
|
||||
|
||||
int mrg_create(name,table_names)
|
||||
const char *name,**table_names;
|
||||
int mrg_create(const char *name, const char**table_names)
|
||||
{
|
||||
int save_errno;
|
||||
uint errpos;
|
||||
|
|
|
@ -22,9 +22,9 @@
|
|||
|
||||
#include "mrgdef.h"
|
||||
|
||||
int mrg_extra(info,function)
|
||||
MRG_INFO *info;
|
||||
enum ha_extra_function function;
|
||||
int mrg_extra(
|
||||
MRG_INFO *info,
|
||||
enum ha_extra_function function)
|
||||
{
|
||||
MRG_TABLE *file;
|
||||
|
||||
|
|
|
@ -30,10 +30,10 @@
|
|||
*/
|
||||
|
||||
|
||||
MRG_INFO *mrg_open(name,mode,handle_locking)
|
||||
const char *name;
|
||||
int mode;
|
||||
int handle_locking;
|
||||
MRG_INFO *mrg_open(
|
||||
const char *name,
|
||||
int mode,
|
||||
int handle_locking)
|
||||
{
|
||||
int save_errno,i,errpos;
|
||||
uint files,dir_length,length;
|
||||
|
|
|
@ -24,8 +24,8 @@
|
|||
done for all single user files to get changes in database */
|
||||
|
||||
|
||||
int mrg_panic(flag)
|
||||
enum ha_panic_function flag;
|
||||
int mrg_panic(
|
||||
enum ha_panic_function flag)
|
||||
{
|
||||
int error=0;
|
||||
LIST *list_element,*next_open;
|
||||
|
|
|
@ -17,10 +17,10 @@
|
|||
#include "mrgdef.h"
|
||||
|
||||
|
||||
int mrg_rsame(info,record,inx)
|
||||
MRG_INFO *info;
|
||||
byte *record;
|
||||
int inx; /* not used, should be 0 */
|
||||
int mrg_rsame(
|
||||
MRG_INFO *info,
|
||||
byte *record,
|
||||
int inx) /* not used, should be 0 */
|
||||
{
|
||||
if (inx)
|
||||
{
|
||||
|
|
|
@ -18,9 +18,9 @@
|
|||
|
||||
#include "mrgdef.h"
|
||||
|
||||
int mrg_update(info,oldrec,newrec)
|
||||
register MRG_INFO *info;
|
||||
const byte *oldrec,*newrec;
|
||||
int mrg_update(
|
||||
register MRG_INFO *info,
|
||||
const byte *oldrec, const byte *newrec)
|
||||
{
|
||||
if (!info->current_table)
|
||||
{
|
||||
|
|
|
@ -19,6 +19,8 @@
|
|||
#include <getopt.h>
|
||||
|
||||
static void print_error(int exit_code, const char *fmt,...);
|
||||
static void get_options(int argc, char *argv[]);
|
||||
static int create_record(char *pos, FILE *file);
|
||||
|
||||
int main(int argc,char *argv[])
|
||||
{
|
||||
|
@ -123,7 +125,7 @@ void get_options(int argc,char *argv[])
|
|||
{
|
||||
FILE *f; char s[HA_FT_MAXLEN]; int i=0,n=SWL_INIT;
|
||||
|
||||
if(!(stopwordlist=malloc(n*sizeof(char *))))
|
||||
if(!(stopwordlist=(const char**) malloc(n*sizeof(char *))))
|
||||
print_error(1,"malloc(%d)",n*sizeof(char *));
|
||||
if(!(f=fopen(optarg,"r")))
|
||||
print_error(1,"fopen(%s)",optarg);
|
||||
|
|
|
@ -211,7 +211,7 @@ err:
|
|||
|
||||
int ft_read_next(FT_DOCLIST *handler, char *record)
|
||||
{
|
||||
MI_INFO *info=handler->info;
|
||||
MI_INFO *info= (MI_INFO *) handler->info;
|
||||
|
||||
if (++handler->curdoc >= handler->ndocs)
|
||||
{
|
||||
|
|
|
@ -32,6 +32,8 @@ static char record[MAX_REC_LENGTH],read_record[MAX_REC_LENGTH];
|
|||
|
||||
void get_options(int argc,char *argv[]);
|
||||
static int run_test(const char *filename);
|
||||
static void get_options(int argc, char *argv[]);
|
||||
static void create_record(char *, int);
|
||||
|
||||
int main(int argc,char *argv[])
|
||||
{
|
||||
|
@ -46,8 +48,6 @@ static MI_COLUMNDEF recinfo[3];
|
|||
static MI_KEYDEF keyinfo[2];
|
||||
static MI_KEYSEG keyseg[10];
|
||||
|
||||
void create_record(char *, int);
|
||||
|
||||
static int run_test(const char *filename)
|
||||
{
|
||||
MI_INFO *file;
|
||||
|
|
|
@ -45,7 +45,7 @@
|
|||
#define LWS_TF (count)
|
||||
#define LWS_BINARY (count>0)
|
||||
#define LWS_SQUARE (count*count)
|
||||
#define LWS_LOG (count?(log(count)+1):0)
|
||||
#define LWS_LOG (count?(log( (double) count)+1):0)
|
||||
/*--------------------------------------------------------------*/
|
||||
#define PRENORM_NONE (p->weight)
|
||||
#define PRENORM_MAX (p->weight/docstat.max)
|
||||
|
|
|
@ -458,7 +458,7 @@ int chk_key(MI_CHECK *param, register MI_INFO *info)
|
|||
/* Check that there isn't a row with auto_increment = 0 in the table */
|
||||
mi_extra(info,HA_EXTRA_KEYREAD);
|
||||
bzero(info->lastkey,keyinfo->seg->length);
|
||||
if (!mi_rkey(info, info->rec_buff, key, info->lastkey,
|
||||
if (!mi_rkey(info, info->rec_buff, key, (const byte*) info->lastkey,
|
||||
keyinfo->seg->length, HA_READ_KEY_EXACT))
|
||||
{
|
||||
/* Don't count this as a real warning, as myisamchk can't correct it */
|
||||
|
@ -2075,7 +2075,7 @@ static int sort_key_read(SORT_INFO *sort_info, void *key)
|
|||
"Found too many records; Can`t continue");
|
||||
DBUG_RETURN(1);
|
||||
}
|
||||
(void) _mi_make_key(info,sort_info->key,key,sort_info->record,
|
||||
(void) _mi_make_key(info,sort_info->key,(uchar*)key,sort_info->record,
|
||||
sort_info->filepos);
|
||||
DBUG_RETURN(sort_write_record(sort_info));
|
||||
} /* sort_key_read */
|
||||
|
|
|
@ -18,8 +18,7 @@
|
|||
|
||||
#include "myisam.h"
|
||||
#include <getopt.h>
|
||||
#include <m_ctype.h>
|
||||
|
||||
#include <m_string.h>
|
||||
|
||||
#define MAX_REC_LENGTH 1024
|
||||
|
||||
|
|
|
@ -59,11 +59,11 @@ static MI_KEYSEG glob_keyseg[MYISAM_KEYS][MAX_PARTS];
|
|||
|
||||
/* Test program */
|
||||
|
||||
int main(int argc, char **argv)
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
uint i;
|
||||
int j,n1,n2,n3,error,k;
|
||||
uint write_count,update,dupp_keys,delete,start,length,blob_pos,
|
||||
uint write_count,update,dupp_keys,opt_delete,start,length,blob_pos,
|
||||
reclength,ant,found_parts;
|
||||
my_off_t lastpos;
|
||||
ha_rows range_records,records;
|
||||
|
@ -180,7 +180,7 @@ int main(int argc, char **argv)
|
|||
recinfo[6].null_pos=0;
|
||||
}
|
||||
|
||||
write_count=update=dupp_keys=delete=0;
|
||||
write_count=update=dupp_keys=opt_delete=0;
|
||||
blob_buffer=0;
|
||||
|
||||
for (i=1000 ; i>0 ; i--) key1[i]=0;
|
||||
|
@ -280,14 +280,14 @@ int main(int argc, char **argv)
|
|||
printf("can't find key1: \"%s\"\n",key);
|
||||
goto err;
|
||||
}
|
||||
if (delete == (uint) remove_count) /* While testing */
|
||||
if (opt_delete == (uint) remove_count) /* While testing */
|
||||
goto end;
|
||||
if (mi_delete(file,read_record))
|
||||
{
|
||||
printf("error: %d; can't delete record: \"%s\"\n", my_errno,read_record);
|
||||
goto err;
|
||||
}
|
||||
delete++;
|
||||
opt_delete++;
|
||||
key1[atoi(read_record+keyinfo[0].seg[0].start)]--;
|
||||
key3[atoi(read_record+keyinfo[2].seg[0].start)]=0;
|
||||
}
|
||||
|
@ -418,10 +418,10 @@ int main(int argc, char **argv)
|
|||
}
|
||||
while ((error=mi_rnext(file,read_record3,0)) == 0 && ant < write_count+10)
|
||||
ant++;
|
||||
if (ant != write_count - delete || error != HA_ERR_END_OF_FILE)
|
||||
if (ant != write_count - opt_delete || error != HA_ERR_END_OF_FILE)
|
||||
{
|
||||
printf("next: I found: %d records of %d (error: %d)\n",
|
||||
ant, write_count - delete, error);
|
||||
ant, write_count - opt_delete, error);
|
||||
goto end;
|
||||
}
|
||||
if (mi_rlast(file,read_record2,0) ||
|
||||
|
@ -435,7 +435,7 @@ int main(int argc, char **argv)
|
|||
ant=1;
|
||||
while (mi_rprev(file,read_record3,0) == 0 && ant < write_count+10)
|
||||
ant++;
|
||||
if (ant != write_count - delete)
|
||||
if (ant != write_count - opt_delete)
|
||||
{
|
||||
printf("prev: I found: %d records of %d\n",ant,write_count);
|
||||
goto end;
|
||||
|
@ -495,7 +495,7 @@ int main(int argc, char **argv)
|
|||
if (mi_rkey(file,read_record,0,key,0,HA_READ_KEY_EXACT)) goto err;
|
||||
if (mi_rnext(file,read_record3,0)) goto err;
|
||||
if (mi_delete(file,read_record3)) goto err;
|
||||
delete++;
|
||||
opt_delete++;
|
||||
ant=1;
|
||||
while (mi_rnext(file,read_record3,0) == 0 &&
|
||||
bcmp(read_record3+start,key,length) == 0) ant++;
|
||||
|
@ -513,7 +513,7 @@ int main(int argc, char **argv)
|
|||
if (mi_rprev(file,read_record3,0)) goto err;
|
||||
if (mi_rprev(file,read_record3,0)) goto err;
|
||||
if (mi_delete(file,read_record3)) goto err;
|
||||
delete++;
|
||||
opt_delete++;
|
||||
ant=1;
|
||||
while (mi_rprev(file,read_record3,0) == 0 &&
|
||||
bcmp(read_record3+start,key,length) == 0) ant++;
|
||||
|
@ -530,7 +530,7 @@ int main(int argc, char **argv)
|
|||
DBUG_PRINT("progpos",("first - delete - next -> last"));
|
||||
if (mi_rkey(file,read_record3,0,key,0,HA_READ_KEY_EXACT)) goto err;
|
||||
if (mi_delete(file,read_record3)) goto err;
|
||||
delete++;
|
||||
opt_delete++;
|
||||
ant=1;
|
||||
if (mi_rnext(file,read_record,0))
|
||||
goto err; /* Skall finnas poster */
|
||||
|
@ -547,7 +547,7 @@ int main(int argc, char **argv)
|
|||
DBUG_PRINT("progpos",("last - delete - prev -> first"));
|
||||
if (mi_rprev(file,read_record3,0)) goto err;
|
||||
if (mi_delete(file,read_record3)) goto err;
|
||||
delete++;
|
||||
opt_delete++;
|
||||
ant=0;
|
||||
while (mi_rprev(file,read_record3,0) == 0 &&
|
||||
bcmp(read_record3+start,key,length) == 0) ant++;
|
||||
|
@ -641,7 +641,7 @@ int main(int argc, char **argv)
|
|||
if (!silent)
|
||||
printf("- mi_info\n");
|
||||
mi_status(file,&info,HA_STATUS_VARIABLE | HA_STATUS_CONST);
|
||||
if (info.records != write_count-delete || info.deleted > delete + update
|
||||
if (info.records != write_count-opt_delete || info.deleted > opt_delete + update
|
||||
|| info.keys != keys)
|
||||
{
|
||||
puts("Wrong info from mi_info");
|
||||
|
@ -678,10 +678,10 @@ int main(int argc, char **argv)
|
|||
while ((error=mi_rrnd(file,record,HA_OFFSET_ERROR)) != HA_ERR_END_OF_FILE &&
|
||||
ant < write_count + 10)
|
||||
ant+= error ? 0 : 1;
|
||||
if (ant != write_count-delete)
|
||||
if (ant != write_count-opt_delete)
|
||||
{
|
||||
printf("rrnd with cache: I can only find: %d records of %d\n",
|
||||
ant,write_count-delete);
|
||||
ant,write_count-opt_delete);
|
||||
goto end;
|
||||
}
|
||||
if (mi_extra(file,HA_EXTRA_NO_CACHE))
|
||||
|
@ -695,10 +695,10 @@ int main(int argc, char **argv)
|
|||
while ((error=mi_scan(file,record)) != HA_ERR_END_OF_FILE &&
|
||||
ant < write_count + 10)
|
||||
ant+= error ? 0 : 1;
|
||||
if (ant != write_count-delete)
|
||||
if (ant != write_count-opt_delete)
|
||||
{
|
||||
printf("scan with cache: I can only find: %d records of %d\n",
|
||||
ant,write_count-delete);
|
||||
ant,write_count-opt_delete);
|
||||
goto end;
|
||||
}
|
||||
|
||||
|
@ -724,7 +724,7 @@ int main(int argc, char **argv)
|
|||
lastpos=info.recpos;
|
||||
if (error == 0)
|
||||
{
|
||||
if (delete == (uint) remove_count) /* While testing */
|
||||
if (opt_delete == (uint) remove_count) /* While testing */
|
||||
goto end;
|
||||
if (mi_rsame(file,read_record,-1))
|
||||
{
|
||||
|
@ -751,19 +751,19 @@ int main(int argc, char **argv)
|
|||
if (mi_delete(file,read_record))
|
||||
{
|
||||
printf("can't delete record: %6.6s, delete_count: %d\n",
|
||||
read_record, delete);
|
||||
read_record, opt_delete);
|
||||
goto err;
|
||||
}
|
||||
delete++;
|
||||
opt_delete++;
|
||||
}
|
||||
else
|
||||
found_parts++;
|
||||
}
|
||||
if (my_errno != HA_ERR_END_OF_FILE && my_errno != HA_ERR_RECORD_DELETED)
|
||||
printf("error: %d from mi_rrnd\n",my_errno);
|
||||
if (write_count != delete)
|
||||
if (write_count != opt_delete)
|
||||
{
|
||||
printf("Deleted only %d of %d records (%d parts)\n",delete,write_count,
|
||||
printf("Deleted only %d of %d records (%d parts)\n",opt_delete,write_count,
|
||||
found_parts);
|
||||
goto err;
|
||||
}
|
||||
|
@ -774,7 +774,7 @@ end:
|
|||
if (!silent)
|
||||
{
|
||||
printf("\nFollowing test have been made:\n");
|
||||
printf("Write records: %d\nUpdate records: %d\nSame-key-read: %d\nDelete records: %d\n", write_count,update,dupp_keys,delete);
|
||||
printf("Write records: %d\nUpdate records: %d\nSame-key-read: %d\nDelete records: %d\n", write_count,update,dupp_keys,opt_delete);
|
||||
if (rec_pointer_size)
|
||||
printf("Record pointer size: %d\n",rec_pointer_size);
|
||||
if (key_cacheing)
|
||||
|
|
|
@ -1,5 +1,10 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# Execute some simple basic test on MyISAM libary to check if things
|
||||
# works at all.
|
||||
|
||||
silent="-s"
|
||||
suffix=$MACH
|
||||
if test -f mi_test1$MACH ; then suffix=$MACH else suffix=""; fi
|
||||
mi_test1$suffix $silent
|
||||
myisamchk$suffix -se test1
|
||||
mi_test1$suffix $silent -N -S
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
#endif
|
||||
|
||||
#include "myisamdef.h"
|
||||
#include "my_tree.h"
|
||||
#include <my_tree.h>
|
||||
#include <stdarg.h>
|
||||
#ifdef HAVE_GETRUSAGE
|
||||
#include <sys/resource.h>
|
||||
|
@ -251,12 +251,12 @@ static void get_options(register int *argc, register char ***argv)
|
|||
/* Fall through */
|
||||
case 'I':
|
||||
case '?':
|
||||
printf("%s Ver 1.3 for %s at %s\n",my_progname,SYSTEM_TYPE,
|
||||
printf("%s Ver 1.4 for %s at %s\n",my_progname,SYSTEM_TYPE,
|
||||
MACHINE_TYPE);
|
||||
puts("By Monty, for your professional use\n");
|
||||
if (version)
|
||||
break;
|
||||
puts("Write info about whats in a myisam log file.");
|
||||
puts("Write info about whats in a MyISAM log file.");
|
||||
printf("If no file name is given %s is used\n",log_filename);
|
||||
puts("");
|
||||
printf(usage,my_progname);
|
||||
|
@ -266,7 +266,7 @@ static void get_options(register int *argc, register char ***argv)
|
|||
puts(" -o \"offset\" -p # \"remove # components from path\"");
|
||||
puts(" -r \"recover\" -R \"file recordposition\"");
|
||||
puts(" -u \"update\" -v \"verbose\" -w \"write file\"");
|
||||
puts(" -D \"myisam compileled with DBUG\" -P \"processes\"");
|
||||
puts(" -D \"myisam compiled with DBUG\" -P \"processes\"");
|
||||
puts("\nOne can give a second and a third '-v' for more verbose.");
|
||||
puts("Normaly one does a update (-u).");
|
||||
puts("If a recover is done all writes and all possibly updates and deletes is done\nand errors are only counted.");
|
||||
|
@ -376,10 +376,8 @@ static int examine_log(my_string file_name, char **table_names)
|
|||
}
|
||||
|
||||
if (curr_file_info)
|
||||
{
|
||||
printf("\nWarning: %s is opened with same process and filenumber\nMaybe you should use the -P option ?\n",
|
||||
curr_file_info->show_name);
|
||||
}
|
||||
if (my_b_read(&cache,(byte*) head,2))
|
||||
goto err;
|
||||
file_info.name=0;
|
||||
|
|
|
@ -229,12 +229,12 @@ int main(int argc, char **argv)
|
|||
#endif
|
||||
}
|
||||
|
||||
enum options {OPT_CHARSETS_DIR=256};
|
||||
enum options {OPT_CHARSETS_DIR_MP=256};
|
||||
|
||||
static struct option long_options[] =
|
||||
{
|
||||
{"backup", no_argument, 0, 'b'},
|
||||
{"character-sets-dir",required_argument,0, OPT_CHARSETS_DIR},
|
||||
{"character-sets-dir",required_argument,0, OPT_CHARSETS_DIR_MP},
|
||||
{"debug", optional_argument, 0, '#'},
|
||||
{"force", no_argument, 0, 'f'},
|
||||
{"join", required_argument, 0, 'j'},
|
||||
|
@ -334,7 +334,7 @@ static void get_options(int *argc,char ***argv)
|
|||
case '#':
|
||||
DBUG_PUSH(optarg ? optarg : "d:t:o");
|
||||
break;
|
||||
case OPT_CHARSETS_DIR:
|
||||
case OPT_CHARSETS_DIR_MP:
|
||||
charsets_dir = optarg;
|
||||
break;
|
||||
case 'V': print_version(); exit(0);
|
||||
|
@ -1167,7 +1167,7 @@ static int make_huff_tree(HUFF_TREE *huff_tree, HUFF_COUNTS *huff_counts)
|
|||
{
|
||||
uint i,found,bits_packed,first,last;
|
||||
my_off_t bytes_packed;
|
||||
HUFF_ELEMENT *a,*b,*new;
|
||||
HUFF_ELEMENT *a,*b,*new_huff_el;
|
||||
|
||||
first=last=0;
|
||||
if (huff_counts->tree_buff)
|
||||
|
@ -1247,23 +1247,23 @@ static int make_huff_tree(HUFF_TREE *huff_tree, HUFF_COUNTS *huff_counts)
|
|||
{
|
||||
if (huff_counts->counts[i])
|
||||
{
|
||||
new=huff_tree->element_buffer+(found++);
|
||||
new->count=huff_counts->counts[i];
|
||||
new->a.leaf.null=0;
|
||||
new->a.leaf.element_nr=i;
|
||||
queue.root[found]=(byte*) new;
|
||||
new_huff_el=huff_tree->element_buffer+(found++);
|
||||
new_huff_el->count=huff_counts->counts[i];
|
||||
new_huff_el->a.leaf.null=0;
|
||||
new_huff_el->a.leaf.element_nr=i;
|
||||
queue.root[found]=(byte*) new_huff_el;
|
||||
}
|
||||
}
|
||||
while (found < 2)
|
||||
{ /* Our huff_trees request at least 2 elements */
|
||||
new=huff_tree->element_buffer+(found++);
|
||||
new->count=0;
|
||||
new->a.leaf.null=0;
|
||||
new_huff_el=huff_tree->element_buffer+(found++);
|
||||
new_huff_el->count=0;
|
||||
new_huff_el->a.leaf.null=0;
|
||||
if (last)
|
||||
new->a.leaf.element_nr=huff_tree->min_chr=last-1;
|
||||
new_huff_el->a.leaf.element_nr=huff_tree->min_chr=last-1;
|
||||
else
|
||||
new->a.leaf.element_nr=huff_tree->max_chr=last+1;
|
||||
queue.root[found]=(byte*) new;
|
||||
new_huff_el->a.leaf.element_nr=huff_tree->max_chr=last+1;
|
||||
queue.root[found]=(byte*) new_huff_el;
|
||||
}
|
||||
}
|
||||
queue.elements=found;
|
||||
|
@ -1275,13 +1275,13 @@ static int make_huff_tree(HUFF_TREE *huff_tree, HUFF_COUNTS *huff_counts)
|
|||
{
|
||||
a=(HUFF_ELEMENT*) queue_remove(&queue,0);
|
||||
b=(HUFF_ELEMENT*) queue.root[1];
|
||||
new=huff_tree->element_buffer+found+i;
|
||||
new->count=a->count+b->count;
|
||||
bits_packed+=(uint) (new->count & 7);
|
||||
bytes_packed+=new->count/8;
|
||||
new->a.nod.left=a; /* lesser in left */
|
||||
new->a.nod.right=b;
|
||||
queue.root[1]=(byte*) new;
|
||||
new_huff_el=huff_tree->element_buffer+found+i;
|
||||
new_huff_el->count=a->count+b->count;
|
||||
bits_packed+=(uint) (new_huff_el->count & 7);
|
||||
bytes_packed+=new_huff_el->count/8;
|
||||
new_huff_el->a.nod.left=a; /* lesser in left */
|
||||
new_huff_el->a.nod.right=b;
|
||||
queue.root[1]=(byte*) new_huff_el;
|
||||
queue_replaced(&queue);
|
||||
}
|
||||
huff_tree->root=(HUFF_ELEMENT*) queue.root[1];
|
||||
|
@ -1303,14 +1303,14 @@ static int compare_tree(register const uchar *s, register const uchar *t)
|
|||
static int save_counts_in_queue(byte *key, element_count count,
|
||||
HUFF_TREE *tree)
|
||||
{
|
||||
HUFF_ELEMENT *new;
|
||||
HUFF_ELEMENT *new_huff_el;
|
||||
|
||||
new=tree->element_buffer+(tree->elements++);
|
||||
new->count=count;
|
||||
new->a.leaf.null=0;
|
||||
new->a.leaf.element_nr= (uint) (key- tree->counts->tree_buff) /
|
||||
new_huff_el=tree->element_buffer+(tree->elements++);
|
||||
new_huff_el->count=count;
|
||||
new_huff_el->a.leaf.null=0;
|
||||
new_huff_el->a.leaf.element_nr= (uint) (key- tree->counts->tree_buff) /
|
||||
tree->counts->field_length;
|
||||
queue.root[tree->elements]=(byte*) new;
|
||||
queue.root[tree->elements]=(byte*) new_huff_el;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -1352,14 +1352,14 @@ static my_off_t calc_packed_length(HUFF_COUNTS *huff_counts,
|
|||
_downheap(&queue,i);
|
||||
for (i=0 ; i < found-1 ; i++)
|
||||
{
|
||||
HUFF_ELEMENT *a,*b,*new;
|
||||
HUFF_ELEMENT *a,*b,*new_huff_el;
|
||||
a=(HUFF_ELEMENT*) queue_remove(&queue,0);
|
||||
b=(HUFF_ELEMENT*) queue.root[1];
|
||||
new=element_buffer+i;
|
||||
new->count=a->count+b->count;
|
||||
bits_packed+=(uint) (new->count & 7);
|
||||
bytes_packed+=new->count/8;
|
||||
queue.root[1]=(byte*) new;
|
||||
new_huff_el=element_buffer+i;
|
||||
new_huff_el->count=a->count+b->count;
|
||||
bits_packed+=(uint) (new_huff_el->count & 7);
|
||||
bytes_packed+=new_huff_el->count/8;
|
||||
queue.root[1]=(byte*) new_huff_el;
|
||||
queue_replaced(&queue);
|
||||
}
|
||||
DBUG_RETURN(bytes_packed+(bits_packed+7)/8);
|
||||
|
|
|
@ -28,6 +28,9 @@
|
|||
#include <queues.h>
|
||||
|
||||
/* static variabels */
|
||||
#undef MIN_SORT_MEMORY
|
||||
#undef MYF_RW
|
||||
#undef DISK_BUFFER_SIZE
|
||||
|
||||
#define MERGEBUFF 15
|
||||
#define MERGEBUFF2 31
|
||||
|
@ -36,10 +39,10 @@
|
|||
#define DISK_BUFFER_SIZE (IO_SIZE*16)
|
||||
|
||||
typedef struct st_buffpek {
|
||||
my_off_t file_pos; /* position to buffer */
|
||||
ha_rows count; /* keys in buffer */
|
||||
uchar *base,*key; /* Pekare inom sort_key - indexdel */
|
||||
uint mem_count; /* keys left in memory */
|
||||
my_off_t file_pos; /* Where we are in the sort file */
|
||||
ha_rows count; /* Number of rows in table */
|
||||
uchar *base,*key; /* Key pointers */
|
||||
uint mem_count; /* numbers of keys in memory */
|
||||
uint max_keys; /* Max keys in buffert */
|
||||
} BUFFPEK;
|
||||
|
||||
|
@ -361,7 +364,7 @@ merge_buffers(MI_SORT_PARAM *info, uint keys, IO_CACHE *from_file,
|
|||
sort_length));
|
||||
if (error == -1)
|
||||
goto err; /* purecov: inspected */
|
||||
queue_insert(&queue,(void*) buffpek);
|
||||
queue_insert(&queue,(char*) buffpek);
|
||||
}
|
||||
|
||||
while (queue.elements > 1)
|
||||
|
|
|
@ -18,9 +18,9 @@
|
|||
|
||||
#include "mymrgdef.h"
|
||||
|
||||
int myrg_delete(info,record)
|
||||
MYRG_INFO *info;
|
||||
const byte *record;
|
||||
int myrg_delete(
|
||||
MYRG_INFO *info,
|
||||
const byte *record)
|
||||
{
|
||||
if (!info->current_table)
|
||||
{
|
||||
|
|
|
@ -20,9 +20,9 @@
|
|||
|
||||
#include "mymrgdef.h"
|
||||
|
||||
int myrg_lock_database(info,lock_type)
|
||||
MYRG_INFO *info;
|
||||
int lock_type;
|
||||
int myrg_lock_database(
|
||||
MYRG_INFO *info,
|
||||
int lock_type)
|
||||
{
|
||||
int error,new_error;
|
||||
MYRG_TABLE *file;
|
||||
|
|
|
@ -30,10 +30,10 @@
|
|||
*/
|
||||
|
||||
|
||||
MYRG_INFO *myrg_open(name,mode,handle_locking)
|
||||
const char *name;
|
||||
int mode;
|
||||
int handle_locking;
|
||||
MYRG_INFO *myrg_open(
|
||||
const char *name,
|
||||
int mode,
|
||||
int handle_locking)
|
||||
{
|
||||
int save_errno,i,errpos;
|
||||
uint files,dir_length,length;
|
||||
|
|
|
@ -24,8 +24,7 @@
|
|||
done for all single user files to get changes in database */
|
||||
|
||||
|
||||
int myrg_panic(flag)
|
||||
enum ha_panic_function flag;
|
||||
int myrg_panic(enum ha_panic_function flag)
|
||||
{
|
||||
int error=0;
|
||||
LIST *list_element,*next_open;
|
||||
|
|
|
@ -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"
|
||||
--replace_result "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;
|
||||
|
|
|
@ -9,7 +9,7 @@ optimize table t1;
|
|||
check table t1,t2;
|
||||
repair table t1,t2;
|
||||
check table t2,t1;
|
||||
lock tables t1 read;
|
||||
lock tables t1 write;
|
||||
check table t2,t1;
|
||||
show columns from t1;
|
||||
show full columns from t1;
|
||||
|
|
|
@ -393,16 +393,16 @@ CHARSET_INFO *get_charset(uint cs_number, myf flags)
|
|||
|
||||
my_bool set_default_charset(uint cs, myf flags)
|
||||
{
|
||||
CHARSET_INFO *new;
|
||||
CHARSET_INFO *new_charset;
|
||||
DBUG_ENTER("set_default_charset");
|
||||
DBUG_PRINT("enter",("character set: %d",(int) cs));
|
||||
new = get_charset(cs, flags);
|
||||
if (!new)
|
||||
new_charset = get_charset(cs, flags);
|
||||
if (!new_charset)
|
||||
{
|
||||
DBUG_PRINT("error",("Couldn't set default character set"));
|
||||
DBUG_RETURN(TRUE); /* error */
|
||||
}
|
||||
default_charset_info = new;
|
||||
default_charset_info = new_charset;
|
||||
DBUG_RETURN(FALSE);
|
||||
}
|
||||
|
||||
|
@ -424,17 +424,17 @@ CHARSET_INFO *get_charset_by_name(const char *cs_name, myf flags)
|
|||
|
||||
my_bool set_default_charset_by_name(const char *cs_name, myf flags)
|
||||
{
|
||||
CHARSET_INFO *new;
|
||||
CHARSET_INFO *new_charset;
|
||||
DBUG_ENTER("set_default_charset_by_name");
|
||||
DBUG_PRINT("enter",("character set: %s", cs_name));
|
||||
new = get_charset_by_name(cs_name, flags);
|
||||
if (!new)
|
||||
new_charset = get_charset_by_name(cs_name, flags);
|
||||
if (!new_charset)
|
||||
{
|
||||
DBUG_PRINT("error",("Couldn't set default character set"));
|
||||
DBUG_RETURN(TRUE); /* error */
|
||||
}
|
||||
|
||||
default_charset_info = new;
|
||||
default_charset_info = new_charset;
|
||||
DBUG_RETURN(FALSE);
|
||||
}
|
||||
|
||||
|
|
|
@ -146,7 +146,7 @@ void load_defaults(const char *conf_file, const char **groups,
|
|||
&group))
|
||||
goto err;
|
||||
#endif
|
||||
#ifdef __EMX__
|
||||
#if defined(__EMX__) || defined(OS2)
|
||||
if (getenv("ETC") &&
|
||||
search_default_file(&args, &alloc, getenv("ETC"), conf_file,
|
||||
default_ext, &group))
|
||||
|
@ -363,7 +363,7 @@ void print_defaults(const char *conf_file, const char **groups)
|
|||
GetWindowsDirectory(name,sizeof(name));
|
||||
printf("%s\\%s%s ",name,conf_file,have_ext ? "" : windows_ext);
|
||||
#endif
|
||||
#ifdef __EMX__
|
||||
#if defined(__EMX__) || defined(OS2)
|
||||
if (getenv("ETC"))
|
||||
printf("%s\\%s%s ", getenv("ETC"), conf_file, default_ext);
|
||||
#endif
|
||||
|
|
|
@ -38,7 +38,7 @@ Cambridge, MA 02139, USA. */
|
|||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#if (!defined (__STDC__) || !__STDC__) && !defined(MSDOS)
|
||||
#if (!defined (__STDC__) || !__STDC__) && !defined(MSDOS) && !defined(OS2)
|
||||
/* This is a separate conditional since some stdc systems
|
||||
reject `defined (const)'. */
|
||||
#ifndef const
|
||||
|
@ -176,7 +176,9 @@ static char *posixly_correct;
|
|||
/* Avoid depending on library functions or files
|
||||
whose names are inconsistent. */
|
||||
|
||||
#ifndef OS2
|
||||
char *getenv (const char *);
|
||||
#endif
|
||||
|
||||
static char *
|
||||
my_index (const char *str, int chr)
|
||||
|
|
|
@ -27,7 +27,7 @@ Cambridge, MA 02139, USA. */
|
|||
#include <global.h>
|
||||
#include "getopt.h"
|
||||
|
||||
#if (!defined (__STDC__) || !__STDC__) && !defined(MSDOS)
|
||||
#if (!defined (__STDC__) || !__STDC__) && !defined(MSDOS) && !defined(OS2)
|
||||
/* This is a separate conditional since some stdc systems
|
||||
reject `defined (const)'. */
|
||||
#ifndef const
|
||||
|
|
|
@ -72,11 +72,11 @@ void list_free(LIST *root, pbool free_data)
|
|||
|
||||
LIST *list_cons(void *data, LIST *list)
|
||||
{
|
||||
LIST *new=(LIST*) my_malloc(sizeof(LIST),MYF(MY_FAE));
|
||||
if (!new)
|
||||
LIST *new_charset=(LIST*) my_malloc(sizeof(LIST),MYF(MY_FAE));
|
||||
if (!new_charset)
|
||||
return 0;
|
||||
new->data=data;
|
||||
return list_add(list,new);
|
||||
new_charset->data=data;
|
||||
return list_add(list,new_charset);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ uint dirname_length(const char *name)
|
|||
{
|
||||
register my_string pos,gpos;
|
||||
#ifdef FN_DEVCHAR
|
||||
if ((pos=strrchr(name,FN_DEVCHAR)) == 0)
|
||||
if ((pos=(char*)strrchr(name,FN_DEVCHAR)) == 0)
|
||||
#endif
|
||||
pos=(char*) name-1;
|
||||
|
||||
|
|
|
@ -65,7 +65,7 @@ my_string fn_format(my_string to, const char *name, const char *dsk,
|
|||
pack_dirname(dev,dev); /* Put in ./.. and ~/.. */
|
||||
if (flag & 4)
|
||||
(void) unpack_dirname(dev,dev); /* Replace ~/.. with dir */
|
||||
if ((pos=strchr(name,FN_EXTCHAR)) != NullS)
|
||||
if ((pos=(char*)strchr(name,FN_EXTCHAR)) != NullS)
|
||||
{
|
||||
if ((flag & 2) == 0) /* Skall vi byta extension ? */
|
||||
{
|
||||
|
|
|
@ -74,7 +74,7 @@ my_string my_path(my_string to, const char *progname,
|
|||
/* test if file without filename is found in path */
|
||||
/* Returns to if found and to has dirpart if found, else NullS */
|
||||
|
||||
#if defined(MSDOS) || defined(__WIN__) || defined(__EMX__)
|
||||
#if defined(MSDOS) || defined(__WIN__) || defined(__EMX__) || defined(OS2)
|
||||
#define F_OK 0
|
||||
#define PATH_SEP ';'
|
||||
#define PROGRAM_EXTENSION ".exe"
|
||||
|
|
|
@ -52,7 +52,7 @@
|
|||
#define MAX_THRESH 8
|
||||
|
||||
/* Stack node declarations used to store unfulfilled partition obligations. */
|
||||
typedef struct
|
||||
typedef struct _qsort_stack_node
|
||||
{
|
||||
char *lo;
|
||||
char *hi;
|
||||
|
@ -109,7 +109,7 @@ qsort_t qsort(void *base_ptr, size_t total_elems, size_t size, qsort_cmp cmp)
|
|||
|
||||
if (total_elems > MAX_THRESH)
|
||||
{
|
||||
char *lo = base_ptr;
|
||||
char *lo = (char*) base_ptr;
|
||||
char *hi = &lo[size * (total_elems - 1)];
|
||||
stack_node stack[STACK_SIZE]; /* Largest size needed for 32-bit int!!! */
|
||||
stack_node *top = stack + 1;
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
#endif
|
||||
|
||||
#ifdef HAVE_TEMPNAM
|
||||
#ifndef MSDOS
|
||||
#if !defined( MSDOS) && !defined(OS2)
|
||||
extern char **environ;
|
||||
#endif
|
||||
#endif
|
||||
|
@ -122,12 +122,19 @@ File create_temp_file(char *to, const char *dir, const char *prefix,
|
|||
to[1]= 0;
|
||||
dir=to;
|
||||
}
|
||||
old_env=environ;
|
||||
#ifdef OS2
|
||||
// changing environ variable doesn't work with VACPP
|
||||
char buffer[256];
|
||||
sprintf( buffer, "TMP=%s", dir);
|
||||
putenv( buffer);
|
||||
#else
|
||||
old_env= (char**) environ;
|
||||
if (dir)
|
||||
{ /* Don't use TMPDIR if dir is given */
|
||||
environ=temp_env;
|
||||
environ=(const char**) temp_env;
|
||||
temp_env[0]=0;
|
||||
}
|
||||
#endif
|
||||
if ((res=tempnam((char*) dir, (char*) prefix)))
|
||||
{
|
||||
strmake(to,res,FN_REFLEN-1);
|
||||
|
@ -142,7 +149,9 @@ File create_temp_file(char *to, const char *dir, const char *prefix,
|
|||
{
|
||||
DBUG_PRINT("error",("Got error: %d from tempnam",errno));
|
||||
}
|
||||
environ=old_env;
|
||||
#ifndef OS2
|
||||
environ=(const char**) old_env;
|
||||
#endif
|
||||
}
|
||||
#else
|
||||
{
|
||||
|
|
|
@ -18,14 +18,14 @@
|
|||
#define USES_TYPES
|
||||
#include "global.h"
|
||||
|
||||
#if !defined(_MSC_VER) && !defined(__BORLANDC__)
|
||||
#if !defined(_MSC_VER) && !defined(__BORLANDC__) && !defined(OS2)
|
||||
#include "mysys_priv.h"
|
||||
#include <sys/times.h>
|
||||
#endif
|
||||
|
||||
long my_clock(void)
|
||||
{
|
||||
#if !defined(MSDOS) && !defined(__WIN__)
|
||||
#if !defined(MSDOS) && !defined(__WIN__) && !defined(OS2)
|
||||
struct tms tmsbuf;
|
||||
VOID(times(&tmsbuf));
|
||||
return (tmsbuf.tms_utime + tmsbuf.tms_stime);
|
||||
|
|
|
@ -81,7 +81,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__)
|
||||
#if !defined(MSDOS) && !defined(__WIN__) && !defined(__EMX__) && !defined(OS2)
|
||||
VOID(chown(to, stat_buff.st_uid,stat_buff.st_gid)); /* Copy ownership */
|
||||
#endif
|
||||
#if !defined(VMS) && !defined(__ZTC__)
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
#include <my_dir.h>
|
||||
#include "mysys_err.h"
|
||||
#include <errno.h>
|
||||
#if defined(MSDOS) || defined(__WIN__) || defined(__EMX__)
|
||||
#if defined(MSDOS) || defined(__WIN__) || defined(__EMX__) || defined(OS2)
|
||||
#include <share.h>
|
||||
#endif
|
||||
|
||||
|
@ -48,7 +48,7 @@ File my_create(const char *FileName, int CreateFlags, int access_flags,
|
|||
#elif defined(VMS)
|
||||
fd = open((my_string) FileName, access_flags | O_CREAT, 0,
|
||||
"ctx=stm","ctx=bin");
|
||||
#elif defined(MSDOS) || defined(__WIN__) || defined(__EMX__)
|
||||
#elif defined(MSDOS) || defined(__WIN__) || defined(__EMX__) || defined(OS2)
|
||||
if (access_flags & O_SHARE)
|
||||
fd = sopen((my_string) FileName, access_flags | O_CREAT | O_BINARY,
|
||||
SH_DENYNO, MY_S_IREAD | MY_S_IWRITE);
|
||||
|
|
|
@ -28,6 +28,9 @@
|
|||
#include <dos.h>
|
||||
#include <direct.h>
|
||||
#endif
|
||||
#if defined(OS2)
|
||||
#include <direct.h>
|
||||
#endif
|
||||
|
||||
#ifdef __EMX__
|
||||
// chdir2 support also drive change
|
||||
|
@ -93,16 +96,16 @@ int my_setwd(const char *dir, myf MyFlags)
|
|||
int res;
|
||||
size_s length;
|
||||
my_string start,pos;
|
||||
#if defined(VMS) || defined(MSDOS)
|
||||
#if defined(VMS) || defined(MSDOS) || defined(OS2)
|
||||
char buff[FN_REFLEN];
|
||||
#endif
|
||||
DBUG_ENTER("my_setwd");
|
||||
DBUG_PRINT("my",("dir: '%s' MyFlags %d", dir, MyFlags));
|
||||
|
||||
start=(my_string) dir;
|
||||
#if defined(MSDOS) /* MSDOS chdir can't change drive */
|
||||
#if defined(MSDOS) || defined(OS2) /* OS2/MSDOS chdir can't change drive */
|
||||
#if !defined(_DDL) && !defined(WIN32)
|
||||
if ((pos=strchr(dir,FN_DEVCHAR)) != 0)
|
||||
if ((pos=(char*) strchr(dir,FN_DEVCHAR)) != 0)
|
||||
{
|
||||
uint drive,drives;
|
||||
|
||||
|
@ -110,8 +113,13 @@ int my_setwd(const char *dir, myf MyFlags)
|
|||
drive=(uint) (toupper(dir[0])-'A'+1); drives= (uint) -1;
|
||||
if ((pos-(byte*) dir) == 2 && drive > 0 && drive < 32)
|
||||
{
|
||||
#ifdef OS2
|
||||
_chdrive(drive);
|
||||
drives = _getdrive();
|
||||
#else
|
||||
_dos_setdrive(drive,&drives);
|
||||
_dos_getdrive(&drives);
|
||||
#endif
|
||||
}
|
||||
if (drive != drives)
|
||||
{
|
||||
|
|
|
@ -74,7 +74,7 @@ void my_init(void)
|
|||
pthread_init(); /* Must be called before DBUG_ENTER */
|
||||
#endif
|
||||
my_thread_global_init();
|
||||
#ifndef __WIN__
|
||||
#if !defined( __WIN__) && !defined(OS2)
|
||||
sigfillset(&my_signals); /* signals blocked by mf_brkhant */
|
||||
#endif
|
||||
#endif /* THREAD */
|
||||
|
|
|
@ -27,7 +27,9 @@
|
|||
# include <dirent.h>
|
||||
# define NAMLEN(dirent) strlen((dirent)->d_name)
|
||||
#else
|
||||
#ifndef OS2
|
||||
# define dirent direct
|
||||
#endif
|
||||
# define NAMLEN(dirent) (dirent)->d_namlen
|
||||
# if defined(HAVE_SYS_NDIR_H)
|
||||
# include <sys/ndir.h>
|
||||
|
@ -50,6 +52,11 @@
|
|||
#include <iodef.h>
|
||||
#include <descrip.h>
|
||||
#endif
|
||||
|
||||
#ifdef OS2
|
||||
#include "my_os2dirsrch.h"
|
||||
#endif
|
||||
|
||||
#if defined(THREAD) && defined(HAVE_READDIR_R)
|
||||
#define READDIR(A,B,C) ((errno=readdir_r(A,B,&C)) != 0 || !C)
|
||||
#else
|
||||
|
@ -337,9 +344,7 @@ my_string directory_file_name (my_string dst, const char *src)
|
|||
*****************************************************************************
|
||||
*/
|
||||
|
||||
MY_DIR *my_dir(path, MyFlags)
|
||||
const char *path;
|
||||
myf MyFlags;
|
||||
MY_DIR *my_dir(const char *path, myf MyFlags)
|
||||
{
|
||||
struct fileinfo *fnames;
|
||||
char *buffer, *obuffer, *tempptr;
|
||||
|
@ -475,9 +480,7 @@ error:
|
|||
** At MSDOS you always get stat of files, but time is in packed MSDOS-format
|
||||
******************************************************************************/
|
||||
|
||||
MY_DIR *my_dir(path, MyFlags)
|
||||
const char *path;
|
||||
myf MyFlags;
|
||||
MY_DIR *my_dir(const char* path, myf MyFlags)
|
||||
{
|
||||
struct fileinfo *fnames;
|
||||
char *buffer, *obuffer, *tempptr;
|
||||
|
|
|
@ -38,12 +38,6 @@
|
|||
int my_lock(File fd, int locktype, my_off_t start, my_off_t length,
|
||||
myf MyFlags)
|
||||
{
|
||||
#ifdef __EMX__
|
||||
FILELOCK LockArea = {0,0}, UnlockArea = {0,0};
|
||||
APIRET rc = 0;
|
||||
fpos_t oldpos;
|
||||
int lockflags = 0;
|
||||
#endif
|
||||
#ifdef HAVE_FCNTL
|
||||
int value;
|
||||
ALARM_VARIABLES;
|
||||
|
@ -56,54 +50,12 @@ int my_lock(File fd, int locktype, my_off_t start, my_off_t length,
|
|||
#else
|
||||
if (my_disable_locking)
|
||||
DBUG_RETURN(0);
|
||||
#if defined(__EMX__)
|
||||
if (locktype == F_UNLCK) {
|
||||
UnlockArea.lOffset = start;
|
||||
if (length)
|
||||
UnlockArea.lRange = length;
|
||||
else
|
||||
UnlockArea.lRange = 0x7FFFFFFFL;
|
||||
} else
|
||||
if (locktype == F_RDLCK || locktype == F_WRLCK) {
|
||||
if (locktype == F_RDLCK) lockflags |= 1;
|
||||
LockArea.lOffset = start;
|
||||
if (length)
|
||||
LockArea.lRange = length;
|
||||
else
|
||||
LockArea.lRange = 0x7FFFFFFFL;
|
||||
} else {
|
||||
my_errno = EINVAL;
|
||||
DBUG_RETURN(-1);
|
||||
}
|
||||
if (!LockArea.lRange && !UnlockArea.lRange)
|
||||
|
||||
#if defined(__EMX__) || defined(OS2)
|
||||
|
||||
if (!_lock64( fd, locktype, start, length, MyFlags))
|
||||
DBUG_RETURN(0);
|
||||
if (MyFlags & MY_DONT_WAIT) {
|
||||
if (!(rc = DosSetFileLocks(fd,&UnlockArea,&LockArea,0,lockflags)))
|
||||
DBUG_RETURN(0); /* Lock was OK */
|
||||
if (rc == 175 && locktype == F_RDLCK) {
|
||||
lockflags &= ~1;
|
||||
rc = DosSetFileLocks(fd,&UnlockArea,&LockArea,0,lockflags);
|
||||
}
|
||||
if (rc == 33) { /* Lock Violation */
|
||||
DBUG_PRINT("info",("Was locked, trying with timeout"));
|
||||
rc = DosSetFileLocks(fd,&UnlockArea,&LockArea,MY_HOW_OFTEN_TO_ALARM * 1000,lockflags);
|
||||
}
|
||||
if (!rc) DBUG_RETURN(0);
|
||||
if (rc == 33) errno = EAGAIN;
|
||||
else {
|
||||
errno = EINVAL;
|
||||
printf("Error: DosSetFileLocks() == %d\n",rc);
|
||||
}
|
||||
} else {
|
||||
while (rc = DosSetFileLocks(fd,&UnlockArea,&LockArea,
|
||||
MY_HOW_OFTEN_TO_ALARM * 1000,lockflags) && (rc == 33 || rc == 175)) {
|
||||
printf(".");
|
||||
if (rc == 175) lockflags &= ~1;
|
||||
}
|
||||
if (!rc) DBUG_RETURN(0);
|
||||
errno = EINVAL;
|
||||
printf("Error: DosSetFileLocks() == %d\n",rc);
|
||||
}
|
||||
|
||||
#elif defined(HAVE_LOCKING)
|
||||
/* Windows */
|
||||
{
|
||||
|
|
|
@ -33,7 +33,7 @@ gptr my_malloc(unsigned int Size, myf MyFlags)
|
|||
|
||||
if (!Size)
|
||||
Size=1; /* Safety */
|
||||
if ((point = malloc(Size)) == NULL)
|
||||
if ((point = (char*)malloc(Size)) == NULL)
|
||||
{
|
||||
my_errno=errno;
|
||||
if (MyFlags & MY_FAE)
|
||||
|
|
|
@ -28,8 +28,8 @@ int my_mkdir(const char *dir, int Flags, myf MyFlags)
|
|||
DBUG_ENTER("my_dir");
|
||||
DBUG_PRINT("enter",("dir: %s",dir));
|
||||
|
||||
#ifdef __WIN__
|
||||
if (mkdir(dir))
|
||||
#if defined(__WIN__) || defined(OS2)
|
||||
if (mkdir((char*) dir))
|
||||
#else
|
||||
if (mkdir((char*) dir, Flags & my_umask_dir))
|
||||
#endif
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
#include "mysys_err.h"
|
||||
#include <my_dir.h>
|
||||
#include <errno.h>
|
||||
#if defined(MSDOS) || defined(__WIN__) || defined(__EMX__)
|
||||
#if defined(MSDOS) || defined(__WIN__) || defined(__EMX__) || defined(OS2)
|
||||
#include <share.h>
|
||||
#endif
|
||||
|
||||
|
@ -35,7 +35,7 @@ File my_open(const char *FileName, int Flags, myf MyFlags)
|
|||
DBUG_ENTER("my_open");
|
||||
DBUG_PRINT("my",("Name: '%s' Flags: %d MyFlags: %d",
|
||||
FileName, Flags, MyFlags));
|
||||
#if defined(MSDOS) || defined(__WIN__) || defined(__EMX__)
|
||||
#if defined(MSDOS) || defined(__WIN__) || defined(__EMX__) || defined(OS2)
|
||||
if (Flags & O_SHARE)
|
||||
fd = sopen((my_string) FileName, (Flags & ~O_SHARE) | O_BINARY, SH_DENYNO,
|
||||
MY_S_IREAD | MY_S_IWRITE);
|
||||
|
|
188
mysys/my_os2cond.c
Normal file
188
mysys/my_os2cond.c
Normal file
|
@ -0,0 +1,188 @@
|
|||
/* Copyright (C) Yuri Dario & 2000 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.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library 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
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
|
||||
MA 02111-1307, USA */
|
||||
|
||||
/*****************************************************************************
|
||||
** The following is a simple implementation of posix conditions
|
||||
*****************************************************************************/
|
||||
|
||||
#undef SAFE_MUTEX /* Avoid safe_mutex redefinitions */
|
||||
#include "mysys_priv.h"
|
||||
#if defined(THREAD) && defined(OS2)
|
||||
#include <m_string.h>
|
||||
//#undef getpid
|
||||
#include <process.h>
|
||||
#include <sys/timeb.h>
|
||||
|
||||
int pthread_cond_init(pthread_cond_t *cond, const pthread_condattr_t *attr)
|
||||
{
|
||||
APIRET rc = 0;
|
||||
HEV event;
|
||||
cond->waiting=0;
|
||||
/* Warp3 FP29 or Warp4 FP4 or better required */
|
||||
rc = DosCreateEventSem( NULL, &cond->semaphore, 0x0800, 0);
|
||||
if (rc)
|
||||
return ENOMEM;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int pthread_cond_destroy(pthread_cond_t *cond)
|
||||
{
|
||||
APIRET rc;
|
||||
|
||||
do {
|
||||
rc = DosCloseEventSem(cond->semaphore);
|
||||
if (rc == 301) DosPostEventSem(cond->semaphore);
|
||||
} while (rc == 301);
|
||||
if (rc)
|
||||
return EINVAL;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int pthread_cond_wait(pthread_cond_t *cond, pthread_mutex_t *mutex)
|
||||
{
|
||||
APIRET rc;
|
||||
int rval;
|
||||
|
||||
rval = 0;
|
||||
cond->waiting++;
|
||||
|
||||
if (mutex) pthread_mutex_unlock(mutex);
|
||||
|
||||
rc = DosWaitEventSem(cond->semaphore,SEM_INDEFINITE_WAIT);
|
||||
if (rc != 0)
|
||||
rval = EINVAL;
|
||||
|
||||
if (mutex) pthread_mutex_lock(mutex);
|
||||
|
||||
cond->waiting--;
|
||||
|
||||
return rval;
|
||||
}
|
||||
|
||||
int pthread_cond_timedwait(pthread_cond_t *cond, pthread_mutex_t *mutex,
|
||||
struct timespec *abstime)
|
||||
{
|
||||
struct timeb curtime;
|
||||
int result;
|
||||
long timeout;
|
||||
APIRET rc;
|
||||
int rval;
|
||||
|
||||
_ftime(&curtime);
|
||||
timeout= ((long) (abstime->ts_sec - curtime.time)*1000L +
|
||||
(long)((abstime->ts_nsec/1000) - curtime.millitm)/1000L);
|
||||
if (timeout < 0) /* Some safety */
|
||||
timeout = 0L;
|
||||
|
||||
rval = 0;
|
||||
cond->waiting++;
|
||||
|
||||
if (mutex) pthread_mutex_unlock(mutex);
|
||||
|
||||
rc = DosWaitEventSem(cond->semaphore, timeout);
|
||||
if (rc != 0)
|
||||
rval = ETIME;
|
||||
|
||||
if (mutex) pthread_mutex_lock(mutex);
|
||||
|
||||
cond->waiting--;
|
||||
|
||||
return rval;
|
||||
}
|
||||
|
||||
|
||||
int pthread_cond_signal(pthread_cond_t *cond)
|
||||
{
|
||||
APIRET rc;
|
||||
|
||||
/* Bring the next thread off the condition queue: */
|
||||
rc = DosPostEventSem(cond->semaphore);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int pthread_cond_broadcast(pthread_cond_t *cond)
|
||||
{
|
||||
int i;
|
||||
APIRET rc;
|
||||
|
||||
/*
|
||||
* Enter a loop to bring all threads off the
|
||||
* condition queue:
|
||||
*/
|
||||
i = cond->waiting;
|
||||
while (i--) rc = DosPostEventSem(cond->semaphore);
|
||||
|
||||
return 0 ;
|
||||
}
|
||||
|
||||
|
||||
int pthread_attr_init(pthread_attr_t *connect_att)
|
||||
{
|
||||
connect_att->dwStackSize = 0;
|
||||
connect_att->dwCreatingFlag = 0;
|
||||
connect_att->priority = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int pthread_attr_setstacksize(pthread_attr_t *connect_att,DWORD stack)
|
||||
{
|
||||
connect_att->dwStackSize=stack;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int pthread_attr_setprio(pthread_attr_t *connect_att,int priority)
|
||||
{
|
||||
connect_att->priority=priority;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int pthread_attr_destroy(pthread_attr_t *connect_att)
|
||||
{
|
||||
bzero((gptr) connect_att,sizeof(*connect_att));
|
||||
return 0;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
** Fix localtime_r() to be a bit safer
|
||||
****************************************************************************/
|
||||
|
||||
struct tm *localtime_r(const time_t *timep,struct tm *tmp)
|
||||
{
|
||||
if (*timep == (time_t) -1) /* This will crash win32 */
|
||||
{
|
||||
bzero(tmp,sizeof(*tmp));
|
||||
}
|
||||
else
|
||||
{
|
||||
struct tm *res=localtime(timep);
|
||||
if (!res) /* Wrong date */
|
||||
{
|
||||
bzero(tmp,sizeof(*tmp)); /* Keep things safe */
|
||||
return 0;
|
||||
}
|
||||
*tmp= *res;
|
||||
}
|
||||
return tmp;
|
||||
}
|
||||
#endif /* __WIN__ */
|
182
mysys/my_os2dirsrch.c
Normal file
182
mysys/my_os2dirsrch.c
Normal file
|
@ -0,0 +1,182 @@
|
|||
/* Copyright (C) Yuri Dario & 2000 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.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library 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
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
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;
|
||||
|
||||
#ifdef _DEBUG
|
||||
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. */
|
||||
|
||||
#ifdef _DEBUG
|
||||
printf( "_findfirst rc=%d hdir=%d entries=%d->%s\n", rc, hdir, entries, buf3.achName);
|
||||
#endif
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
long _findnext( long hdir, struct _finddata_t* dos_file)
|
||||
{
|
||||
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: */
|
||||
|
||||
#ifdef _DEBUG
|
||||
printf( "_findnext rc=%d hdir=%d entries=%d->%s\n", rc, hdir, entries, buf3.achName);
|
||||
#endif
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
void _findclose( long hdir)
|
||||
{
|
||||
APIRET rc;
|
||||
|
||||
rc = DosFindClose( hdir);
|
||||
#ifdef _DEBUG
|
||||
printf( "_findclose rc=%d hdir=%d\n", rc, hdir);
|
||||
#endif
|
||||
}
|
||||
|
||||
DIR* opendir( char* path)
|
||||
{
|
||||
DIR* dir = (DIR*) calloc( 1, sizeof( DIR));
|
||||
char buffer[260];
|
||||
APIRET rc;
|
||||
ULONG entries = 1;
|
||||
|
||||
strcpy( buffer, path);
|
||||
strcat( buffer, "*.*");
|
||||
|
||||
#ifdef _DEBUG
|
||||
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. */
|
||||
|
||||
#ifdef _DEBUG
|
||||
printf( "opendir rc=%d hdir=%d entries=%d->%s\n", rc, dir->hdir, entries, dir->buf3.achName);
|
||||
#endif
|
||||
|
||||
if (rc /* && entries == 0 */)
|
||||
return NULL;
|
||||
|
||||
return dir;
|
||||
}
|
||||
|
||||
struct dirent* readdir( DIR* dir)
|
||||
{
|
||||
APIRET rc;
|
||||
//FILEFINDBUF3 buf3;
|
||||
ULONG entries = 1;
|
||||
|
||||
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);
|
||||
|
||||
// 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: */
|
||||
|
||||
#ifdef _DEBUG
|
||||
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
|
||||
|
||||
return &dir->ent;
|
||||
}
|
||||
|
||||
int closedir (DIR *dir)
|
||||
{
|
||||
APIRET rc;
|
||||
|
||||
rc = DosFindClose( dir->hdir);
|
||||
#ifdef _DEBUG
|
||||
printf( "_findclose rc=%d hdir=%d\n", rc, dir->hdir);
|
||||
#endif
|
||||
free(dir);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
#endif // OS2
|
77
mysys/my_os2dirsrch.h
Normal file
77
mysys/my_os2dirsrch.h
Normal file
|
@ -0,0 +1,77 @@
|
|||
/* Copyright (C) Yuri Dario & 2000 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.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library 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
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
|
||||
MA 02111-1307, USA */
|
||||
|
||||
/* Win32 directory search emulation */
|
||||
|
||||
#ifndef __MY_OS2DIRSRCH2_H__
|
||||
#define __MY_OS2DIRSRCH2_H__
|
||||
|
||||
#ifdef __cplusplus_00
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
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;
|
||||
};
|
||||
|
||||
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;
|
||||
};
|
||||
|
||||
struct DIR
|
||||
{
|
||||
HDIR hdir;
|
||||
FILEFINDBUF3 buf3;
|
||||
struct dirent ent;
|
||||
};
|
||||
|
||||
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
|
||||
|
||||
//long _findfirst( char*, struct _finddata_t*);
|
||||
//long _findnext( long, struct _finddata_t*);
|
||||
//void _findclose( long);
|
||||
|
||||
#ifdef __cplusplus_00
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // __MY_OS2DIRSRCH2_H__
|
74
mysys/my_os2dlfcn.c
Normal file
74
mysys/my_os2dlfcn.c
Normal file
|
@ -0,0 +1,74 @@
|
|||
/* Copyright (C) Yuri Dario & 2000 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.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library 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
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
|
||||
MA 02111-1307, USA */
|
||||
|
||||
/*
|
||||
* dlfcn::Unix dynamic loading for OS/2
|
||||
*
|
||||
* Compatibility layer for dynamic loading.
|
||||
* Only minimal implementation
|
||||
*
|
||||
*/
|
||||
|
||||
#define RTLD_LAZY 0
|
||||
#define RTLD_NOW 0
|
||||
|
||||
void* dlopen( char* path, int flag);
|
||||
char* dlerror( void);
|
||||
void* dlsym( void* hmod, char* fn);
|
||||
void dlclose( void* hmod);
|
||||
|
||||
char fail[ 256];
|
||||
|
||||
void* dlopen( char* path, int flag)
|
||||
{
|
||||
APIRET rc;
|
||||
HMODULE hmod;
|
||||
|
||||
rc = DosLoadModule( fail, sizeof( fail), path, &hmod);
|
||||
if (rc)
|
||||
return NULL;
|
||||
|
||||
return (void*) hmod;
|
||||
}
|
||||
|
||||
char* dlerror( void)
|
||||
{
|
||||
return fail;
|
||||
}
|
||||
|
||||
void* dlsym( void* hmod, char* fn)
|
||||
{
|
||||
APIRET rc;
|
||||
PFN addr;
|
||||
|
||||
rc = DosQueryProcAddr( (HMODULE) hmod, 0l, fn, &addr);
|
||||
if (rc)
|
||||
return NULL;
|
||||
|
||||
return (void*) addr;
|
||||
}
|
||||
|
||||
void dlclose( void* hmod)
|
||||
{
|
||||
APIRET rc;
|
||||
|
||||
rc = DosFreeModule( (HMODULE) hmod);
|
||||
|
||||
}
|
39
mysys/my_os2dlfcn.h0
Normal file
39
mysys/my_os2dlfcn.h0
Normal file
|
@ -0,0 +1,39 @@
|
|||
/* Copyright (C) Yuri Dario & 2000 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.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library 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
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
|
||||
MA 02111-1307, USA */
|
||||
/*
|
||||
* dlfcn::Unix dynamic loading for OS/2
|
||||
*
|
||||
* Compatibility layer for dynamic loading.
|
||||
* Only minimal implementation
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __DLFCN_H__
|
||||
#define __DLFCN_H__
|
||||
|
||||
#define RTLD_LAZY 0
|
||||
#define RTLD_NOW 0
|
||||
|
||||
void* dlopen( char* path, int flag);
|
||||
char* dlerror( void);
|
||||
void* dlsym( void* hmod, char* fn);
|
||||
void dlclose( void* hmod);
|
||||
|
||||
#endif
|
341
mysys/my_os2file64.c
Normal file
341
mysys/my_os2file64.c
Normal file
|
@ -0,0 +1,341 @@
|
|||
/* Copyright (C) Yuri Dario & 2000 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.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library 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
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
|
||||
MA 02111-1307, USA */
|
||||
|
||||
void _OS2errno( APIRET rc);
|
||||
longlong _lseek64( int fd, longlong offset, int seektype);
|
||||
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.
|
||||
//
|
||||
class File64bit
|
||||
{
|
||||
public:
|
||||
File64bit(); /* default constructor */
|
||||
} initFile64bit;
|
||||
|
||||
static APIRET (* APIENTRY _DosOpenL)(PCSZ pszFileName,
|
||||
PHFILE phf,
|
||||
PULONG pulAction,
|
||||
LONGLONG cbFile,
|
||||
ULONG ulAttribute,
|
||||
ULONG fsOpenFlags,
|
||||
ULONG fsOpenMode,
|
||||
PEAOP2 peaop2);
|
||||
static APIRET (* APIENTRY _DosSetFilePtrL)(HFILE hFile,
|
||||
LONGLONG ib,
|
||||
ULONG method,
|
||||
PLONGLONG ibActual);
|
||||
static APIRET (* APIENTRY _DosSetFileLocksL)(HFILE hFile,
|
||||
PFILELOCKL pflUnlock,
|
||||
PFILELOCKL pflLock,
|
||||
ULONG timeout,
|
||||
ULONG flags);
|
||||
|
||||
#define EIO EINVAL
|
||||
#define ESPIPE EBADSEEK
|
||||
|
||||
|
||||
static unsigned char const errno_tab[] =
|
||||
{
|
||||
0 , EINVAL, ENOENT, ENOENT, EMFILE, /* 0..4 */
|
||||
EACCES, EBADF, EIO, ENOMEM, EIO, /* 5..9 */
|
||||
EINVAL, ENOEXEC,EINVAL, EINVAL, EINVAL, /* 10..14 */
|
||||
ENOENT, EBUSY, EXDEV, ENOENT, EROFS, /* 15..19 */
|
||||
EIO, EIO, EIO, EIO, EIO, /* 20..24 */
|
||||
EIO, EIO, EIO, ENOSPC, EIO, /* 25..29 */
|
||||
EIO, EIO, EACCES, EACCES, EIO, /* 30..34 */
|
||||
EIO, EIO, EIO, EIO, ENOSPC, /* 35..39 */
|
||||
EIO, EIO, EIO, EIO, EIO, /* 40..44 */
|
||||
EIO, EIO, EIO, EIO, EIO, /* 45..49 */
|
||||
EIO, EIO, EIO, EIO, EBUSY, /* 50..54 */
|
||||
EIO, EIO, EIO, EIO, EIO, /* 55..59 */
|
||||
EIO, ENOSPC, ENOSPC, EIO, EIO, /* 60..64 */
|
||||
EACCES, EIO, EIO, EIO, EIO, /* 65..69 */
|
||||
EIO, EIO, EIO, EROFS, EIO, /* 70..74 */
|
||||
EIO, EIO, EIO, EIO, EIO, /* 75..79 */
|
||||
EEXIST, EIO, ENOENT, EIO, EIO, /* 80..84 */
|
||||
EIO, EIO, EINVAL, EIO, EAGAIN, /* 85..89 */
|
||||
EIO, EIO, EIO, EIO, EIO, /* 90..94 */
|
||||
EINTR, EIO, EIO, EIO, EACCES, /* 95..99 */
|
||||
ENOMEM, EINVAL, EINVAL, ENOMEM, EINVAL, /* 100..104 */
|
||||
EINVAL, ENOMEM, EIO, EACCES, EPIPE, /* 105..109 */
|
||||
ENOENT, E2BIG, ENOSPC, ENOMEM, EBADF, /* 110..114 */
|
||||
EINVAL, EINVAL, EINVAL, EINVAL, EINVAL, /* 115..119 */
|
||||
EINVAL, EINVAL, EINVAL, ENOENT, EINVAL, /* 120..124 */
|
||||
ENOENT, ENOENT, ENOENT, ECHILD, ECHILD, /* 125..129 */
|
||||
EACCES, EINVAL, ESPIPE, EINVAL, EINVAL, /* 130..134 */
|
||||
EINVAL, EINVAL, EINVAL, EINVAL, EINVAL, /* 135..139 */
|
||||
EINVAL, EINVAL, EBUSY, EINVAL, EINVAL, /* 140..144 */
|
||||
EINVAL, EINVAL, EINVAL, EBUSY, EINVAL, /* 145..149 */
|
||||
EINVAL, EINVAL, ENOMEM, EINVAL, EINVAL, /* 150..154 */
|
||||
EINVAL, EINVAL, EINVAL, EINVAL, EINVAL, /* 155..159 */
|
||||
EINVAL, EINVAL, EINVAL, EINVAL, EAGAIN, /* 160..164 */
|
||||
EINVAL, EINVAL, EACCES, EINVAL, EINVAL, /* 165..169 */
|
||||
EBUSY, EINVAL, EINVAL, EINVAL, EINVAL, /* 170..174 */
|
||||
EINVAL, EINVAL, EINVAL, EINVAL, EINVAL, /* 175..179 */
|
||||
EINVAL, EINVAL, EINVAL, EINVAL, ECHILD, /* 180..184 */
|
||||
EINVAL, EINVAL, ENOENT, EINVAL, EINVAL, /* 185..189 */
|
||||
ENOEXEC,ENOEXEC,ENOEXEC,ENOEXEC,ENOEXEC, /* 190..194 */
|
||||
ENOEXEC,ENOEXEC,ENOEXEC,ENOEXEC,ENOEXEC, /* 195..199 */
|
||||
ENOEXEC,ENOEXEC,ENOEXEC,ENOENT, EINVAL, /* 200..204 */
|
||||
EINVAL, ENAMETOOLONG, EINVAL, EINVAL, EINVAL, /* 205..209 */
|
||||
EINVAL, EINVAL, EACCES, ENOEXEC,ENOEXEC, /* 210..214 */
|
||||
EINVAL, EINVAL, EINVAL, EINVAL, EINVAL, /* 215..219 */
|
||||
EINVAL, EINVAL, EINVAL, EINVAL, EINVAL, /* 220..224 */
|
||||
EINVAL, EINVAL, EINVAL, ECHILD, EINVAL, /* 225..229 */
|
||||
EINVAL, EBUSY, EAGAIN, ENOTCONN, EINVAL, /* 230..234 */
|
||||
EINVAL, EINVAL, EINVAL, EINVAL, EINVAL, /* 235..239 */
|
||||
EINVAL, EINVAL, EINVAL, EINVAL, EINVAL, /* 240..244 */
|
||||
EINVAL, EINVAL, EINVAL, EINVAL, EINVAL, /* 245..249 */
|
||||
EACCES, EACCES, EINVAL, ENOENT, EINVAL, /* 250..254 */
|
||||
EINVAL, EINVAL, EINVAL, EINVAL, EINVAL, /* 255..259 */
|
||||
EINVAL, EINVAL, EINVAL, EINVAL, EINVAL, /* 260..264 */
|
||||
EINVAL, EINVAL, EINVAL, EINVAL, EINVAL, /* 265..269 */
|
||||
EINVAL, EINVAL, EINVAL, EINVAL, EINVAL, /* 270..274 */
|
||||
EINVAL, EINVAL, EINVAL, EINVAL, EINVAL, /* 275..279 */
|
||||
EINVAL, EINVAL, EINVAL, EINVAL, EEXIST, /* 280..284 */
|
||||
EEXIST, EINVAL, EINVAL, EINVAL, EINVAL, /* 285..289 */
|
||||
ENOMEM, EMFILE, EINVAL, EINVAL, EINVAL, /* 290..294 */
|
||||
EINVAL, EINVAL, EINVAL, EINVAL, EINVAL, /* 295..299 */
|
||||
EINVAL, EBUSY, EINVAL, ESRCH, EINVAL, /* 300..304 */
|
||||
ESRCH, EINVAL, EINVAL, EINVAL, ESRCH, /* 305..309 */
|
||||
EINVAL, ENOMEM, EINVAL, EINVAL, EINVAL, /* 310..314 */
|
||||
EINVAL, E2BIG, ENOENT, EIO, EIO, /* 315..319 */
|
||||
EINVAL, EINVAL, EINVAL, EINVAL, EAGAIN, /* 320..324 */
|
||||
EINVAL, EINVAL, EINVAL, EIO, ENOENT, /* 325..329 */
|
||||
EACCES, EACCES, EACCES, ENOENT, ENOMEM /* 330..334 */
|
||||
};
|
||||
|
||||
/*
|
||||
* Initialize 64bit file access: dynamic load of WSeB API
|
||||
*/
|
||||
File64bit :: File64bit()
|
||||
{
|
||||
HMODULE hDoscalls;
|
||||
|
||||
if (DosQueryModuleHandle("DOSCALLS", &hDoscalls) != NO_ERROR)
|
||||
return;
|
||||
|
||||
if (DosQueryProcAddr(hDoscalls, 981, NULL, (PFN *)&_DosOpenL) != NO_ERROR)
|
||||
return;
|
||||
|
||||
if (DosQueryProcAddr(hDoscalls, 988, NULL, (PFN *)&_DosSetFilePtrL) != NO_ERROR) {
|
||||
_DosOpenL = NULL;
|
||||
return;
|
||||
}
|
||||
|
||||
if (DosQueryProcAddr(hDoscalls, 986, NULL, (PFN *)&_DosSetFileLocksL) != NO_ERROR) {
|
||||
_DosOpenL = NULL;
|
||||
_DosSetFilePtrL = NULL;
|
||||
return;
|
||||
}
|
||||
// notify success
|
||||
#ifdef MYSQL_SERVER
|
||||
printf( "WSeB 64bit file API loaded.\n");
|
||||
#endif
|
||||
}
|
||||
|
||||
void _OS2errno( APIRET rc)
|
||||
{
|
||||
if (rc >= sizeof (errno_tab))
|
||||
errno = EINVAL;
|
||||
else
|
||||
errno = errno_tab[rc];
|
||||
}
|
||||
|
||||
longlong _lseek64( int fd, longlong offset, int seektype)
|
||||
{
|
||||
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 (!rc)
|
||||
return( actual);/* NO_ERROR */
|
||||
|
||||
// set errno
|
||||
_OS2errno( rc);
|
||||
// seek failed
|
||||
return(-1);
|
||||
}
|
||||
|
||||
inline _SetFileLocksL(HFILE hFile,
|
||||
PFILELOCKL pflUnlock,
|
||||
PFILELOCKL pflLock,
|
||||
ULONG timeout,
|
||||
ULONG flags)
|
||||
{
|
||||
if (_DosSetFileLocksL)
|
||||
return _DosSetFileLocksL( hFile, pflUnlock, pflLock, 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)
|
||||
{
|
||||
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;
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
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 */
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
int _sopen64( 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;
|
||||
|
||||
/* 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;
|
||||
|
||||
/* 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 (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;
|
||||
|
||||
/* 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;
|
||||
}
|
||||
|
||||
inline int open( const char *name, int oflag)
|
||||
{
|
||||
return _sopen64( name, oflag, OPEN_SHARE_DENYNONE, S_IREAD | S_IWRITE);
|
||||
}
|
||||
|
||||
inline int open( const char *name, int oflag, int mask)
|
||||
{
|
||||
return _sopen64( name, oflag, OPEN_SHARE_DENYNONE, mask);
|
||||
}
|
||||
|
||||
inline int sopen( const char *name, int oflag, int shflag, int mask)
|
||||
{
|
||||
return _sopen64( name, oflag, shflag, mask);
|
||||
}
|
98
mysys/my_os2mutex.c
Normal file
98
mysys/my_os2mutex.c
Normal file
|
@ -0,0 +1,98 @@
|
|||
/*
|
||||
* Copyright (c) 1995 John Birrell <jb@cimlogic.com.au>.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Modified and extended by Antony T Curtis <antony.curtis@olcs.net>
|
||||
* for use with OS/2.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by John Birrell.
|
||||
* 4. Neither the name of the author nor the names of any co-contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
#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);
|
||||
}
|
||||
|
||||
int
|
||||
pthread_mutex_destroy(pthread_mutex_t * mutex)
|
||||
{
|
||||
APIRET rc = 0;
|
||||
|
||||
|
||||
do {
|
||||
rc = DosCloseMutexSem(*mutex);
|
||||
if (rc == 301) DosReleaseMutexSem(*mutex);
|
||||
} while (rc == 301);
|
||||
|
||||
*mutex = 0;
|
||||
|
||||
/* Return the completion status: */
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
pthread_mutex_lock(pthread_mutex_t * mutex)
|
||||
{
|
||||
int ret = 0;
|
||||
int status = 0;
|
||||
APIRET rc = 0;
|
||||
|
||||
rc = DosRequestMutexSem(*mutex,SEM_INDEFINITE_WAIT);
|
||||
if (rc)
|
||||
return(EINVAL);
|
||||
/* Return the completion status: */
|
||||
return (0);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
#endif
|
126
mysys/my_os2thread.c
Normal file
126
mysys/my_os2thread.c
Normal file
|
@ -0,0 +1,126 @@
|
|||
/* Copyright (C) Yuri Dario & 2000 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.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library 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
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
|
||||
MA 02111-1307, USA */
|
||||
|
||||
/*****************************************************************************
|
||||
** Simulation of posix threads calls for OS/2
|
||||
*****************************************************************************/
|
||||
|
||||
#include "mysys_priv.h"
|
||||
#if defined(THREAD) && defined(OS2)
|
||||
#include <m_string.h>
|
||||
#include <process.h>
|
||||
|
||||
static pthread_mutex_t THR_LOCK_thread;
|
||||
|
||||
struct pthread_map
|
||||
{
|
||||
HANDLE pthreadself;
|
||||
pthread_handler func;
|
||||
void * param;
|
||||
};
|
||||
|
||||
void win_pthread_init(void)
|
||||
{
|
||||
pthread_mutex_init(&THR_LOCK_thread,NULL);
|
||||
}
|
||||
|
||||
/*
|
||||
** We have tried to use '_beginthreadex' instead of '_beginthread' here
|
||||
** but in this case the program leaks about 512 characters for each
|
||||
** created thread !
|
||||
** As we want to save the created thread handler for other threads to
|
||||
** use and to be returned by pthread_self() (instead of the Win32 pseudo
|
||||
** handler), we have to go trough pthread_start() to catch the returned handler
|
||||
** in the new thread.
|
||||
*/
|
||||
|
||||
static pthread_handler_decl(pthread_start,param)
|
||||
{
|
||||
pthread_handler func=((struct pthread_map *) param)->func;
|
||||
void *func_param=((struct pthread_map *) param)->param;
|
||||
my_thread_init(); /* Will always succeed in windows */
|
||||
pthread_mutex_lock(&THR_LOCK_thread); /* Wait for beginthread to return */
|
||||
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));
|
||||
return 0; /* Safety */
|
||||
}
|
||||
|
||||
|
||||
int pthread_create(pthread_t *thread_id, pthread_attr_t *attr,
|
||||
pthread_handler func, void *param)
|
||||
{
|
||||
HANDLE hThread;
|
||||
struct pthread_map *map;
|
||||
DBUG_ENTER("pthread_create");
|
||||
|
||||
if (!(map=(struct pthread_map *)malloc(sizeof(*map))))
|
||||
DBUG_RETURN(-1);
|
||||
map->func=func;
|
||||
map->param=param;
|
||||
pthread_mutex_lock(&THR_LOCK_thread);
|
||||
#ifdef __BORLANDC__
|
||||
hThread=(HANDLE)_beginthread((void(_USERENTRY *)(void *)) pthread_start,
|
||||
attr->dwStackSize ? attr->dwStackSize :
|
||||
65535, (void*) map);
|
||||
#elif defined( OS2)
|
||||
hThread=(HANDLE)_beginthread((void( _Optlink *)(void *)) pthread_start, NULL,
|
||||
attr->dwStackSize ? attr->dwStackSize :
|
||||
65535, (void*) map);
|
||||
#else
|
||||
hThread=(HANDLE)_beginthread((void( __cdecl *)(void *)) pthread_start,
|
||||
attr->dwStackSize ? attr->dwStackSize :
|
||||
65535, (void*) map);
|
||||
#endif
|
||||
DBUG_PRINT("info", ("hThread=%lu",(long) hThread));
|
||||
*thread_id=map->pthreadself=hThread;
|
||||
pthread_mutex_unlock(&THR_LOCK_thread);
|
||||
|
||||
if (hThread == (HANDLE) -1)
|
||||
{
|
||||
int error=errno;
|
||||
DBUG_PRINT("error",
|
||||
("Can't create thread to handle request (error %d)",error));
|
||||
DBUG_RETURN(error ? error : -1);
|
||||
}
|
||||
#ifdef OS2
|
||||
my_pthread_setprio(hThread, attr->priority);
|
||||
#else
|
||||
VOID(SetThreadPriority(hThread, attr->priority)) ;
|
||||
#endif
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
|
||||
|
||||
void pthread_exit(void *a)
|
||||
{
|
||||
_endthread();
|
||||
}
|
||||
|
||||
/* This is neaded to get the macro pthread_setspecific to work */
|
||||
|
||||
int win_pthread_setspecific(void *a,void *b,uint length)
|
||||
{
|
||||
memcpy(a,b,length);
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
144
mysys/my_os2tls.c
Normal file
144
mysys/my_os2tls.c
Normal file
|
@ -0,0 +1,144 @@
|
|||
/* Copyright (C) Yuri Dario & 2000 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.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library 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
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
|
||||
MA 02111-1307, USA */
|
||||
|
||||
DWORD TlsAlloc( void);
|
||||
BOOL TlsFree( DWORD);
|
||||
PVOID TlsGetValue( DWORD);
|
||||
BOOL TlsSetValue( DWORD, PVOID);
|
||||
|
||||
#define TLS_MINIMUM_AVAILABLE 64
|
||||
|
||||
|
||||
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;
|
||||
|
||||
if (tls_storage == NULL) {
|
||||
|
||||
APIRET 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");
|
||||
}
|
||||
|
||||
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;
|
||||
pthread_mutex_unlock( &tls_mutex);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
pthread_mutex_unlock( &tls_mutex);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
|
@ -145,7 +145,7 @@ struct tm *localtime_r(const time_t *clock, struct tm *res)
|
|||
** Author: Gary Wisniewski <garyw@spidereye.com.au>, much modified by Monty
|
||||
****************************************************************************/
|
||||
|
||||
#if !defined(HAVE_SIGWAIT) && !defined(HAVE_mit_thread) && !defined(sigwait) && !defined(__WIN__) && !defined(HAVE_rts_threads) && !defined(HAVE_NONPOSIX_SIGWAIT) && !defined(HAVE_DEC_3_2_THREADS)
|
||||
#if !defined(HAVE_SIGWAIT) && !defined(HAVE_mit_thread) && !defined(sigwait) && !defined(__WIN__) && !defined(HAVE_rts_threads) && !defined(HAVE_NONPOSIX_SIGWAIT) && !defined(HAVE_DEC_3_2_THREADS) && !defined(OS2)
|
||||
|
||||
#if !defined(DONT_USE_SIGSUSPEND)
|
||||
|
||||
|
|
|
@ -49,7 +49,7 @@ gptr my_realloc(gptr oldpoint, uint Size, myf MyFlags)
|
|||
free(oldpoint);
|
||||
}
|
||||
#else
|
||||
if ((point = realloc(oldpoint,Size)) == NULL)
|
||||
if ((point = (char*)realloc(oldpoint,Size)) == NULL)
|
||||
{
|
||||
if (MyFlags & MY_FREE_ON_ERROR)
|
||||
my_free(oldpoint,MyFLAGS);
|
||||
|
|
|
@ -91,7 +91,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__)
|
||||
#if !defined(MSDOS) && !defined(__WIN__) && !defined(__EMX__) && !defined(OS2)
|
||||
if (statbuf.st_nlink > 1 && MyFlags & MY_LINK_WARNING)
|
||||
{
|
||||
if (MyFlags & MY_LINK_WARNING)
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
a shared library
|
||||
*/
|
||||
|
||||
#ifndef stdin
|
||||
#if !defined(stdin) || defined(OS2)
|
||||
#include "mysys_priv.h"
|
||||
#include "my_static.h"
|
||||
#include "my_alarm.h"
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
#endif
|
||||
|
||||
#ifdef HAVE_TEMPNAM
|
||||
#ifndef MSDOS
|
||||
#if !defined( MSDOS) && !defined(OS2)
|
||||
extern char **environ;
|
||||
#endif
|
||||
#endif
|
||||
|
@ -91,14 +91,23 @@ my_string my_tempnam(const char *dir, const char *pfx,
|
|||
temp[1]= 0;
|
||||
dir=temp;
|
||||
}
|
||||
old_env=environ;
|
||||
#ifdef OS2
|
||||
// changing environ variable doesn't work with VACPP
|
||||
char buffer[256];
|
||||
sprintf( buffer, "TMP=%s", dir);
|
||||
putenv( buffer);
|
||||
#else
|
||||
old_env=(char**)environ;
|
||||
if (dir)
|
||||
{ /* Don't use TMPDIR if dir is given */
|
||||
environ=temp_env;
|
||||
environ=(const char**)temp_env;
|
||||
temp_env[0]=0;
|
||||
}
|
||||
#endif
|
||||
res=tempnam((char*) dir,(my_string) pfx); /* Use stand. dir with prefix */
|
||||
environ=old_env;
|
||||
#ifndef OS2
|
||||
environ=(const char**)old_env;
|
||||
#endif
|
||||
if (!res)
|
||||
DBUG_PRINT("error",("Got error: %d from tempnam",errno));
|
||||
return res;
|
||||
|
|
|
@ -72,7 +72,7 @@ my_bool my_thread_global_init(void)
|
|||
pthread_mutex_init(&THR_LOCK_heap,MY_MUTEX_INIT_FAST);
|
||||
pthread_mutex_init(&THR_LOCK_net,MY_MUTEX_INIT_FAST);
|
||||
pthread_mutex_init(&THR_LOCK_charset,MY_MUTEX_INIT_FAST);
|
||||
#ifdef __WIN__
|
||||
#if defined( __WIN__) || defined(OS2)
|
||||
win_pthread_init();
|
||||
#endif
|
||||
#ifndef HAVE_LOCALTIME_R
|
||||
|
@ -160,11 +160,11 @@ void my_thread_end(void)
|
|||
pthread_cond_destroy(&tmp->suspend);
|
||||
#endif
|
||||
pthread_mutex_destroy(&tmp->mutex);
|
||||
#if !defined(__WIN__) || defined(USE_TLS)
|
||||
#if (!defined(__WIN__) && !defined(OS2)) || defined(USE_TLS)
|
||||
free(tmp);
|
||||
#endif
|
||||
}
|
||||
#if !defined(__WIN__) || defined(USE_TLS)
|
||||
#if (!defined(__WIN__) && !defined(OS2)) || defined(USE_TLS)
|
||||
pthread_setspecific(THR_KEY_mysys,0);
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -19,6 +19,46 @@
|
|||
#include "mysys_err.h"
|
||||
#include <errno.h>
|
||||
|
||||
#ifdef OS2
|
||||
|
||||
int _write64( int fd, const void *buffer, unsigned int count)
|
||||
{
|
||||
APIRET rc;
|
||||
ULONG actual;
|
||||
|
||||
rc = DosWrite( fd, (PVOID) buffer, count, &actual);
|
||||
|
||||
switch (rc) {
|
||||
case 0: /* NO_ERROR */
|
||||
errno = 0;
|
||||
return( actual);
|
||||
break;
|
||||
case ERROR_INVALID_FUNCTION:
|
||||
errno = EPERM;
|
||||
break;
|
||||
case ERROR_ACCESS_DENIED:
|
||||
errno = EACCESS;
|
||||
break;
|
||||
case ERROR_INVALID_HANDLE:
|
||||
errno = EBADF;
|
||||
break;
|
||||
case ERROR_DISK_FULL:
|
||||
errno = ENOSPC;
|
||||
break;
|
||||
default:
|
||||
errno = EINVAL;
|
||||
break;
|
||||
}
|
||||
// write failed
|
||||
return(-1);
|
||||
}
|
||||
|
||||
// redirect call
|
||||
#define write _write64
|
||||
|
||||
#endif // OS2
|
||||
|
||||
|
||||
/* Write a chunk of bytes to a file */
|
||||
|
||||
uint my_write(int Filedes, const byte *Buffer, uint Count, myf MyFlags)
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
#include <stdio.h>
|
||||
|
||||
extern void _print_csinfo();
|
||||
extern void _print_csinfo(CHARSET_INFO *cs);
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
const char *the_set = MYSQL_CHARSET;
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
static my_bool alarm_aborted=1;
|
||||
my_bool thr_alarm_inited=0;
|
||||
|
||||
#if !defined(__WIN__) && !defined(__EMX__)
|
||||
#if !defined(__WIN__) && !defined(__EMX__) && !defined(OS2)
|
||||
|
||||
static pthread_mutex_t LOCK_alarm;
|
||||
static sigset_t full_signal_set;
|
||||
|
@ -460,7 +460,7 @@ static void *alarm_handler(void *arg __attribute__((unused)))
|
|||
** thr_alarm for OS/2
|
||||
*****************************************************************************/
|
||||
|
||||
#elif defined(__EMX__)
|
||||
#elif defined(__EMX__) || defined(OS2)
|
||||
|
||||
#define INCL_BASE
|
||||
#define INCL_NOPMAPI
|
||||
|
@ -775,8 +775,10 @@ static sig_handler print_signal_warning(int sig)
|
|||
#ifdef DONT_REMEMBER_SIGNAL
|
||||
sigset(sig,print_signal_warning); /* int. thread system calls */
|
||||
#endif
|
||||
#ifndef OS2
|
||||
if (sig == SIGALRM)
|
||||
alarm(2); /* reschedule alarm */
|
||||
#endif
|
||||
}
|
||||
#endif /* USE_ONE_SIGNAL_HAND */
|
||||
|
||||
|
@ -793,6 +795,7 @@ static void *signal_hand(void *arg __attribute__((unused)))
|
|||
VOID(pthread_cond_signal(&COND_thread_count)); /* Tell main we are ready */
|
||||
pthread_mutex_unlock(&LOCK_thread_count);
|
||||
|
||||
#ifndef OS2
|
||||
sigemptyset(&set); /* Catch all signals */
|
||||
sigaddset(&set,SIGINT);
|
||||
sigaddset(&set,SIGQUIT);
|
||||
|
@ -809,6 +812,7 @@ static void *signal_hand(void *arg __attribute__((unused)))
|
|||
#else
|
||||
puts("Starting signal handling thread");
|
||||
#endif
|
||||
#endif /* OS2 */
|
||||
printf("server alarm: %d thread alarm: %d\n",
|
||||
THR_SERVER_ALARM,THR_CLIENT_ALARM);
|
||||
DBUG_PRINT("info",("Starting signal and alarm handling thread"));
|
||||
|
@ -831,7 +835,9 @@ static void *signal_hand(void *arg __attribute__((unused)))
|
|||
case SIGINT:
|
||||
case SIGQUIT:
|
||||
case SIGTERM:
|
||||
#ifndef OS2
|
||||
case SIGHUP:
|
||||
#endif
|
||||
printf("Aborting nicely\n");
|
||||
end_thr_alarm();
|
||||
break;
|
||||
|
@ -841,11 +847,13 @@ static void *signal_hand(void *arg __attribute__((unused)))
|
|||
exit(1);
|
||||
return 0; /* Keep some compilers happy */
|
||||
#endif
|
||||
#ifndef OS2
|
||||
#ifdef USE_ONE_SIGNAL_HAND
|
||||
case THR_SERVER_ALARM:
|
||||
process_alarm(sig);
|
||||
break;
|
||||
#endif
|
||||
#endif /* OS2 */
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -866,6 +874,7 @@ int main(int argc __attribute__((unused)),char **argv __attribute__((unused)))
|
|||
pthread_cond_init(&COND_thread_count,NULL);
|
||||
|
||||
/* Start a alarm handling thread */
|
||||
#ifndef OS2
|
||||
sigemptyset(&set);
|
||||
sigaddset(&set,SIGINT);
|
||||
sigaddset(&set,SIGQUIT);
|
||||
|
@ -883,6 +892,7 @@ int main(int argc __attribute__((unused)),char **argv __attribute__((unused)))
|
|||
sigaddset(&set,THR_CLIENT_ALARM);
|
||||
VOID(pthread_sigmask(SIG_UNBLOCK, &set, (sigset_t*) 0));
|
||||
#endif
|
||||
#endif /* OS2 */
|
||||
|
||||
pthread_attr_init(&thr_attr);
|
||||
pthread_attr_setscope(&thr_attr,PTHREAD_SCOPE_PROCESS);
|
||||
|
|
|
@ -133,7 +133,7 @@ static void delete_tree_element(TREE *tree, TREE_ELEMENT *element)
|
|||
if (tree->free)
|
||||
(*tree->free)(ELEMENT_KEY(tree,element));
|
||||
if (tree->with_delete)
|
||||
my_free((void*) element,MYF(0));
|
||||
my_free((char*) element,MYF(0));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
23
os2/ChangeLog.os2
Normal file
23
os2/ChangeLog.os2
Normal file
|
@ -0,0 +1,23 @@
|
|||
|
||||
2001/06/12
|
||||
- fixed support for > 2GB file size, needs also DosOpenL
|
||||
- mixed 64bit/32bit file size support, dinamic loading of
|
||||
64bit API.
|
||||
|
||||
2001/06/03
|
||||
- added support for > 2GB file size
|
||||
|
||||
2001/06/02
|
||||
- fixed file locking code
|
||||
|
||||
2001/05/29
|
||||
- 3.23.38 build
|
||||
|
||||
2001/05/20
|
||||
- rint fix
|
||||
- isam O_RDONLY table handled fix
|
||||
|
||||
2001/05/19
|
||||
- new TLS code, fixed parser crashes and many other problems.
|
||||
- fixed pthread_cond_timedwait, now handle manager expires
|
||||
|
13
os2/MySQL-All.icc
Normal file
13
os2/MySQL-All.icc
Normal file
|
@ -0,0 +1,13 @@
|
|||
|
||||
// create directories
|
||||
for dir in "..\\bin", "..\\lib", "..\\obj", "..\\obj\\zlib", "..\\obj\\readline" {
|
||||
run "if not exist "dir" mkdir "dir
|
||||
}
|
||||
|
||||
// build sequence
|
||||
run "vacbld MySQL-Lib.icc -showprogress=10 -showwarning"
|
||||
run "vacbld MySQL-Client.icc -showprogress=10 -showwarning"
|
||||
run "vacbld MySQL-Sql.icc -showprogress=10 -showwarning"
|
||||
|
||||
// need only for utilities and test applications
|
||||
run "vacbld MySQL-Util.icc -showprogress=10 -showwarning"
|
87
os2/MySQL-Client.icc
Normal file
87
os2/MySQL-Client.icc
Normal file
|
@ -0,0 +1,87 @@
|
|||
// disable code inlining when building static libs
|
||||
InlineCode = "no"
|
||||
|
||||
// include common options
|
||||
include "MySQL-Opt.icc"
|
||||
include "MySQL-Source.icc"
|
||||
|
||||
option ProjectOptions = MySQLOptions
|
||||
//, link(defaultlibsname, "readline.lib")
|
||||
{
|
||||
|
||||
option file(genobject, "..\\OBJ\\ZLIB\\")
|
||||
{
|
||||
target "..\\bin\\mysql.dll"
|
||||
{
|
||||
// optimized precompiled headers
|
||||
option macros('global', 'yes')
|
||||
{
|
||||
source type('cpp') client_pch
|
||||
}
|
||||
// target source files
|
||||
source zlib
|
||||
if debug_build {
|
||||
source type('cpp') dbug
|
||||
}
|
||||
source type('cpp') my_sys
|
||||
source type('cpp') my_sys_cli
|
||||
source type('cpp') strings
|
||||
source type('cpp') mysqlclientlib
|
||||
}
|
||||
}
|
||||
|
||||
option file(genobject, "..\\OBJ\\READLINE\\")
|
||||
{
|
||||
target "..\\bin\\mysql.exe"
|
||||
{
|
||||
// optimized precompiled headers
|
||||
option macros('global', 'yes')
|
||||
{
|
||||
source type('cpp') client_pch //, 'sql_string.h'
|
||||
}
|
||||
// target source files
|
||||
//source readline
|
||||
source type('cpp') "..\\client\\mysql.cc"
|
||||
}
|
||||
}
|
||||
|
||||
target "..\\bin\\mysqladmin.exe"
|
||||
{
|
||||
// optimized precompiled headers
|
||||
option macros('global', 'yes')
|
||||
{
|
||||
source type('cpp') client_pch //, 'sql_string.h'
|
||||
}
|
||||
// target source files
|
||||
source type('cpp') "..\\client\\mysqladmin.c"
|
||||
}
|
||||
|
||||
target "..\\bin\\mysqldump.exe"
|
||||
{
|
||||
// optimized precompiled headers
|
||||
option macros('global', 'yes')
|
||||
{
|
||||
source type('cpp') client_pch
|
||||
}
|
||||
// target source files
|
||||
source type('cpp') "..\\client\\mysqldump.c"
|
||||
}
|
||||
|
||||
target "..\\bin\\mysqlshow.exe"
|
||||
{
|
||||
// target source files
|
||||
source type('cpp') "..\\client\\mysqlshow.c"
|
||||
}
|
||||
|
||||
target "..\\bin\\mysqlimport.exe"
|
||||
{
|
||||
// target source files
|
||||
source type('cpp') "..\\client\\mysqlimport.c"
|
||||
}
|
||||
|
||||
target "..\\bin\\mysqltest.exe"
|
||||
{
|
||||
source type('cpp') "..\\client\\mysqltest.c"
|
||||
}
|
||||
|
||||
}
|
2335
os2/MySQL-Client.irs
Normal file
2335
os2/MySQL-Client.irs
Normal file
File diff suppressed because it is too large
Load diff
72
os2/MySQL-Lib.icc
Normal file
72
os2/MySQL-Lib.icc
Normal file
|
@ -0,0 +1,72 @@
|
|||
// disable code inlining when building static libs
|
||||
InlineCode = "no"
|
||||
|
||||
// include common options
|
||||
include "MySQL-Opt.icc"
|
||||
include "MySQL-Source.icc"
|
||||
|
||||
option ProjectOptions = MySQLOptions
|
||||
{
|
||||
|
||||
option file(genobject, "..\\OBJ\\ZLIB\\")
|
||||
{
|
||||
target "..\\lib\\common.lib"
|
||||
{
|
||||
// optimized precompiled headers
|
||||
option macros('global', 'yes')
|
||||
{
|
||||
source type('cpp') client_pch //, 'sql_string.h'
|
||||
}
|
||||
// target source files
|
||||
source zlib
|
||||
if debug_build {
|
||||
source type('cpp') dbug
|
||||
}
|
||||
source type('cpp') heap
|
||||
//source type('cpp') merge
|
||||
source type('cpp') my_sys
|
||||
source type('cpp') my_sys_cli
|
||||
source type('cpp') my_sys_sql
|
||||
source type('cpp') strings
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
option file(genobject, "..\\OBJ\\READLINE\\")
|
||||
{
|
||||
target "..\\lib\\readline.lib"
|
||||
{
|
||||
// optimized precompiled headers
|
||||
option macros('global', 'yes')
|
||||
{
|
||||
source type('cpp') client_pch //, 'sql_string.h'
|
||||
}
|
||||
// target source files
|
||||
source readline
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
target "..\\lib\\myisam.lib"
|
||||
{
|
||||
// optimized precompiled headers
|
||||
option macros('global', 'yes')
|
||||
{
|
||||
source type('cpp') client_pch //, 'sql_string.h'
|
||||
}
|
||||
// target source files
|
||||
source type('cpp') myisam
|
||||
}
|
||||
|
||||
target "..\\lib\\isam.lib"
|
||||
{
|
||||
// optimized precompiled headers
|
||||
option macros('global', 'yes')
|
||||
{
|
||||
source type('cpp') client_pch //, 'sql_string.h'
|
||||
}
|
||||
// target source files
|
||||
source type('cpp') isam
|
||||
}
|
||||
|
||||
}
|
53
os2/MySQL-Opt.icc
Normal file
53
os2/MySQL-Opt.icc
Normal file
|
@ -0,0 +1,53 @@
|
|||
// set to 1 to enable debug code
|
||||
debug_build = 0
|
||||
|
||||
// common options
|
||||
option BaseOptions = link(defaultlibsname, "tcpip32.lib")
|
||||
,link(libsearchpath, "..\\lib\\")
|
||||
,link(libsearchpath, "..\\bin\\")
|
||||
,link(pmtype, vio)
|
||||
,link(linkwithmultithreadlib, "yes")
|
||||
,link(linkwithsharedlib, "no")
|
||||
,gen(initauto, "yes")
|
||||
,define("__MT__", )
|
||||
,define("HAVE_BSD_SIGNALS", )
|
||||
,define("INCL_DOS", )
|
||||
,define("INCL_DOSERRORS", )
|
||||
,define("INCL_LONGLONG", )
|
||||
,define("OS2", )
|
||||
,define("USE_TLS", )
|
||||
,lang(signedchars, yes)
|
||||
,incl(searchpath, "..")
|
||||
,incl(searchpath, "..\\include")
|
||||
,incl(searchpath, "..\\my_sys")
|
||||
,incl(searchpath, "..\\regex")
|
||||
,incl(searchpath, "..\\sql")
|
||||
,incl(searchpath, "\\rd\\mysql\\zlib-1.1.3")
|
||||
,incl(searchpath, "\\rd\\mysql\\ufc")
|
||||
,incl(searchpath, "..\\os2")
|
||||
|
||||
option ReleaseOptions = link(debug, "no")
|
||||
, define("DBUG_OFF", )
|
||||
, gen(arch, "pentium")
|
||||
, opt(tune, "pentium2")
|
||||
, opt(level, "0")
|
||||
, opt(stackchaining, no)
|
||||
, opt(size, yes)
|
||||
, opt(autoinline, InlineCode)
|
||||
, opt(inline, InlineCode)
|
||||
, opt(schedule, no)
|
||||
|
||||
option DebugOptions = link(debug, "yes")
|
||||
, gen(debug, "yes")
|
||||
, define("DBUG_ON", )
|
||||
|
||||
|
||||
if debug_build {
|
||||
|
||||
option MySQLOptions = BaseOptions, DebugOptions
|
||||
|
||||
} else {
|
||||
|
||||
option MySQLOptions = BaseOptions, ReleaseOptions
|
||||
|
||||
}
|
27
os2/MySQL-ReadLine.icc
Normal file
27
os2/MySQL-ReadLine.icc
Normal file
|
@ -0,0 +1,27 @@
|
|||
// disable code inlining when building static libs
|
||||
InlineCode = "no"
|
||||
|
||||
// include common options
|
||||
include "MySQL-Opt.icc"
|
||||
include "MySQL-Source.icc"
|
||||
|
||||
option ProjectOptions = MySQLOptions
|
||||
{
|
||||
|
||||
|
||||
|
||||
option file(genobject, "..\\OBJ\\READLINE\\")
|
||||
{
|
||||
target "..\\lib\\readline.lib"
|
||||
{
|
||||
// optimized precompiled headers
|
||||
option macros('global', 'yes')
|
||||
{
|
||||
source type('cpp') client_pch //, 'sql_string.h'
|
||||
}
|
||||
// target source files
|
||||
source readline
|
||||
}
|
||||
}
|
||||
|
||||
}
|
298
os2/MySQL-Source.icc
Normal file
298
os2/MySQL-Source.icc
Normal file
|
@ -0,0 +1,298 @@
|
|||
group client_pch =
|
||||
'os2.h',
|
||||
'assert.h', 'direct.h', 'errno.h', 'nerrno.h',
|
||||
'limits.h', 'io.h', 'math.h',
|
||||
'stdio.h', 'stdlib.h', 'stddef.h',
|
||||
'sys/stat.h', 'sys/types.h', 'sys/time.h',
|
||||
'types.h', 'string.h', 'stdarg.h',
|
||||
|
||||
'my_base.h', 'config-os2.h', 'my_dir.h',
|
||||
'global.h', 'thr_alarm.h', 'm_string.h',
|
||||
'mysql.h', 'zconf.h', 'zlib.h', 'mysys_err.h',
|
||||
//'my_os2dirsrch.h',
|
||||
'm_ctype.h',
|
||||
'mysqld_error.h',
|
||||
'my_list.h', 'my_sys.h', 'my_net.h',
|
||||
'myisam.h', 'myisampack.h', '.\myisam\myisamdef.h'
|
||||
|
||||
group mysqlclientlib =
|
||||
"..\\client\\readline.cc",
|
||||
"..\\client\\sql_string.cc",
|
||||
"..\\client\\completion_hash.cc",
|
||||
//"..\\libmysql\\dll.c",
|
||||
"..\\libmysql\\libmysql.c",
|
||||
"..\\libmysql\\errmsg.c",
|
||||
"..\\libmysql\\get_password.c",
|
||||
"..\\libmysql\\net.c",
|
||||
"..\\libmysql\\password.c",
|
||||
"..\\libmysql\\violite.c"
|
||||
|
||||
group zlib =
|
||||
"\\rd\\mysql\\zlib-1.1.3\\compress.c", "\\rd\\mysql\\zlib-1.1.3\\crc32.c",
|
||||
"\\rd\\mysql\\zlib-1.1.3\\deflate.c", "\\rd\\mysql\\zlib-1.1.3\\gzio.c", "\\rd\\mysql\\zlib-1.1.3\\infblock.c",
|
||||
"\\rd\\mysql\\zlib-1.1.3\\infcodes.c", "\\rd\\mysql\\zlib-1.1.3\\inffast.c",
|
||||
"\\rd\\mysql\\zlib-1.1.3\\inflate.c", "\\rd\\mysql\\zlib-1.1.3\\inftrees.c",
|
||||
"\\rd\\mysql\\zlib-1.1.3\\infutil.c", "\\rd\\mysql\\zlib-1.1.3\\trees.c", "\\rd\\mysql\\zlib-1.1.3\\uncompr.c",
|
||||
"\\rd\\mysql\\zlib-1.1.3\\zutil.c", "\\rd\\mysql\\zlib-1.1.3\\adler32.c"
|
||||
|
||||
group ufc =
|
||||
"\\rd\\mysql\\ufc\\crypt.c",
|
||||
"\\rd\\mysql\\ufc\\crypt_util.c",
|
||||
"\\rd\\mysql\\ufc\\crypt-entry.c"
|
||||
|
||||
group sql =
|
||||
"..\\sql\\convert.cc",
|
||||
"..\\sql\\derror.cc",
|
||||
"..\\sql\\field.cc",
|
||||
"..\\sql\\field_conv.cc",
|
||||
"..\\sql\\filesort.cc",
|
||||
"..\\sql\\ha_heap.cc",
|
||||
"..\\sql\\ha_isam.cc",
|
||||
"..\\sql\\ha_isammrg.cc",
|
||||
"..\\sql\\ha_myisam.cc",
|
||||
"..\\sql\\ha_myisammrg.cc",
|
||||
"..\\sql\\handler.cc",
|
||||
"..\\sql\\hash_filo.cc",
|
||||
"..\\sql\\hostname.cc",
|
||||
"..\\sql\\init.cc",
|
||||
"..\\sql\\item.cc",
|
||||
"..\\sql\\item_buff.cc",
|
||||
"..\\sql\\item_cmpfunc.cc",
|
||||
"..\\sql\\item_create.cc",
|
||||
"..\\sql\\item_func.cc",
|
||||
"..\\sql\\item_strfunc.cc",
|
||||
"..\\sql\\item_sum.cc",
|
||||
"..\\sql\\item_timefunc.cc",
|
||||
"..\\sql\\item_uniq.cc",
|
||||
"..\\sql\\key.cc",
|
||||
"..\\sql\\lock.cc",
|
||||
"..\\sql\\log.cc",
|
||||
"..\\sql\\log_event.cc",
|
||||
"..\\sql\\md5.c",
|
||||
"..\\sql\\mf_iocache.cc",
|
||||
"..\\sql\\mini_client.cc",
|
||||
"..\\sql\\mini_client_errors.c",
|
||||
"..\\sql\\mysqld.cc",
|
||||
"..\\sql\\net_pkg.cc",
|
||||
"..\\sql\\net_serv.cc",
|
||||
"..\\sql\\opt_ft.cc",
|
||||
"..\\sql\\opt_range.cc",
|
||||
"..\\sql\\OPT_SUM.cc",
|
||||
"..\\sql\\password.c",
|
||||
"..\\sql\\procedure.cc",
|
||||
"..\\sql\\records.cc",
|
||||
"..\\sql\\slave.cc",
|
||||
"..\\sql\\sql_acl.cc",
|
||||
"..\\sql\\sql_analyse.cc",
|
||||
"..\\sql\\sql_base.cc",
|
||||
"..\\sql\\sql_cache.cc",
|
||||
"..\\sql\\sql_class.cc",
|
||||
"..\\sql\\sql_crypt.cc",
|
||||
"..\\sql\\sql_db.cc",
|
||||
"..\\sql\\sql_delete.cc",
|
||||
"..\\sql\\sql_insert.cc",
|
||||
"..\\sql\\sql_lex.cc",
|
||||
"..\\sql\\sql_list.cc",
|
||||
"..\\sql\\sql_load.cc",
|
||||
"..\\sql\\sql_manager.cc",
|
||||
"..\\sql\\sql_map.cc",
|
||||
"..\\sql\\sql_parse.cc",
|
||||
"..\\sql\\sql_rename.cc",
|
||||
"..\\sql\\sql_repl.cc",
|
||||
"..\\sql\\sql_select.cc",
|
||||
"..\\sql\\sql_show.cc",
|
||||
"..\\sql\\sql_string.cc",
|
||||
"..\\sql\\sql_table.cc",
|
||||
"..\\sql\\sql_test.cc",
|
||||
"..\\sql\\sql_update.cc",
|
||||
"..\\sql\\sql_udf.cc",
|
||||
"..\\sql\\sql_yacc.cc",
|
||||
"..\\sql\\table.cc",
|
||||
"..\\sql\\thr_malloc.cc",
|
||||
"..\\sql\\time.cc",
|
||||
"..\\sql\\unireg.cc",
|
||||
"..\\sql\\violite.c"
|
||||
|
||||
group isam =
|
||||
"..\\isam\\changed.c", "..\\isam\\close.c",
|
||||
"..\\isam\\create.c", "..\\isam\\delete.c", "..\\isam\\extra.c",
|
||||
"..\\isam\\info.c", "..\\isam\\log.c", "..\\isam\\open.c",
|
||||
"..\\isam\\panic.c", "..\\isam\\range.c",
|
||||
"..\\isam\\rfirst.c", "..\\isam\\rkey.c", "..\\isam\\rlast.c",
|
||||
"..\\isam\\rnext.c", "..\\isam\\rprev.c", "..\\isam\\rrnd.c",
|
||||
"..\\isam\\rsame.c", "..\\isam\\rsamepos.c",
|
||||
"..\\isam\\static.c", "..\\isam\\update.c",
|
||||
"..\\isam\\write.c", "..\\isam\\_cache.c",
|
||||
"..\\isam\\_dbug.c", "..\\isam\\_dynrec.c",
|
||||
"..\\isam\\_key.c", "..\\isam\\_locking.c",
|
||||
"..\\isam\\_packrec.c", "..\\isam\\_page.c",
|
||||
"..\\isam\\_search.c", "..\\isam\\_statrec.c"
|
||||
|
||||
group strings =
|
||||
"..\\strings\\bchange.c",
|
||||
"..\\strings\\bmove.c",
|
||||
"..\\strings\\bmove_upp.c",
|
||||
"..\\strings\\ctype-big5.c",
|
||||
"..\\strings\\ctype-czech.c",
|
||||
"..\\strings\\ctype-euc_kr.c",
|
||||
"..\\strings\\ctype-gb2312.c",
|
||||
"..\\strings\\ctype-gbk.c",
|
||||
"..\\strings\\ctype-sjis.c",
|
||||
"..\\strings\\ctype-tis620.c",
|
||||
"..\\strings\\ctype-ujis.c",
|
||||
"..\\strings\\ctype_extra_sources.c",
|
||||
"..\\strings\\ctype_autoconf.c",
|
||||
"..\\strings\\ctype.c",
|
||||
"..\\strings\\int2str.c",
|
||||
"..\\strings\\is_prefix.c",
|
||||
"..\\strings\\llstr.c",
|
||||
"..\\strings\\longlong2str.c",
|
||||
"..\\strings\\str2int.c",
|
||||
"..\\strings\\strappend.c",
|
||||
"..\\strings\\strcend.c",
|
||||
"..\\strings\\strcont.c",
|
||||
"..\\strings\\strend.c",
|
||||
"..\\strings\\strfill.c",
|
||||
"..\\strings\\strinstr.c",
|
||||
"..\\strings\\strmake.c",
|
||||
"..\\strings\\strmov.c",
|
||||
"..\\strings\\strnlen.c",
|
||||
"..\\strings\\strnmov.c",
|
||||
"..\\strings\\strtoull.c",
|
||||
"..\\strings\\strxmov.c",
|
||||
"..\\strings\\strxnmov.c"
|
||||
|
||||
|
||||
group heap = "..\\heap\\hp_block.c", "..\\heap\\hp_clear.c",
|
||||
"..\\heap\\hp_close.c", "..\\heap\\hp_create.c", "..\\heap\\hp_delete.c",
|
||||
"..\\heap\\hp_extra.c", "..\\heap\\hp_hash.c",
|
||||
"..\\heap\\hp_info.c", "..\\heap\\hp_open.c",
|
||||
"..\\heap\\hp_panic.c", "..\\heap\\hp_rename.c",
|
||||
"..\\heap\\hp_rfirst.c", "..\\heap\\hp_rkey.c",
|
||||
"..\\heap\\hp_rlast.c", "..\\heap\\hp_rnext.c",
|
||||
"..\\heap\\hp_rprev.c", "..\\heap\\hp_rrnd.c",
|
||||
"..\\heap\\hp_rsame.c", "..\\heap\\hp_scan.c",
|
||||
"..\\heap\\hp_static.c", "..\\heap\\hp_update.c",
|
||||
"..\\heap\\hp_write.c", "..\\heap\\_check.c", "..\\heap\\_rectest.c"
|
||||
|
||||
|
||||
group merge = "..\\merge\\close.c", "..\\merge\\create.c", "..\\merge\\delete.c",
|
||||
"..\\merge\\extra.c", "..\\merge\\info.c", "..\\merge\\open.c",
|
||||
"..\\merge\\panic.c", "..\\merge\\rrnd.c", "..\\merge\\rsame.c",
|
||||
"..\\merge\\static.c", "..\\merge\\update.c",
|
||||
"..\\merge\\_locking.c"
|
||||
|
||||
|
||||
group myisammrg = "..\\myisammrg\\myrg_close.c",
|
||||
"..\\myisammrg\\myrg_create.c", "..\\myisammrg\\myrg_delete.c",
|
||||
"..\\myisammrg\\myrg_extra.c", "..\\myisammrg\\myrg_info.c",
|
||||
"..\\myisammrg\\myrg_locking.c",
|
||||
"..\\myisammrg\\myrg_open.c", "..\\myisammrg\\myrg_panic.c",
|
||||
"..\\myisammrg\\myrg_queue.c",
|
||||
"..\\myisammrg\\myrg_rfirst.c", "..\\myisammrg\\myrg_rkey.c",
|
||||
"..\\myisammrg\\myrg_rlast.c", "..\\myisammrg\\myrg_rnext.c",
|
||||
"..\\myisammrg\\myrg_rprev.c", "..\\myisammrg\\myrg_rrnd.c",
|
||||
"..\\myisammrg\\myrg_rsame.c",
|
||||
"..\\myisammrg\\myrg_static.c",
|
||||
"..\\myisammrg\\myrg_update.c"
|
||||
|
||||
group my_sys = "..\\mysys\\array.c", "..\\mysys\\charset.c",
|
||||
"..\\mysys\\checksum.c", "..\\mysys\\default.c", "..\\mysys\\errors.c",
|
||||
"..\\mysys\\getopt.c", "..\\mysys\\getopt1.c",
|
||||
"..\\mysys\\getvar.c", "..\\mysys\\hash.c", "..\\mysys\\list.c",
|
||||
"..\\mysys\\mf_brkhant.c", "..\\mysys\\mf_cache.c",
|
||||
"..\\mysys\\mf_casecnv.c", "..\\mysys\\mf_dirname.c",
|
||||
"..\\mysys\\mf_fn_ext.c", "..\\mysys\\mf_format.c",
|
||||
"..\\mysys\\mf_getdate.c",
|
||||
"..\\mysys\\mf_iocache2.c", "..\\mysys\\mf_keycache.c",
|
||||
"..\\mysys\\mf_loadpath.c", "..\\mysys\\mf_pack.c",
|
||||
"..\\mysys\\mf_pack2.c", "..\\mysys\\mf_path.c",
|
||||
"..\\mysys\\mf_qsort2.c",
|
||||
//"..\\mysys\\mf_qsort.c",
|
||||
"..\\mysys\\mf_radix.c", "..\\mysys\\mf_same.c",
|
||||
"..\\mysys\\mf_sort.c", "..\\mysys\\mf_soundex.c",
|
||||
"..\\mysys\\mf_stripp.c", "..\\mysys\\mf_tempfile.c",
|
||||
"..\\mysys\\mf_unixpath.c", "..\\mysys\\mf_wcomp.c",
|
||||
"..\\mysys\\mf_wfile.c", "..\\mysys\\mulalloc.c",
|
||||
"..\\mysys\\my_alarm.c", "..\\mysys\\my_alloc.c",
|
||||
"..\\mysys\\my_append.c", "..\\mysys\\my_bitmap.c",
|
||||
"..\\mysys\\my_chsize.c", "..\\mysys\\my_clock.c",
|
||||
"..\\mysys\\my_compress.c", "..\\mysys\\my_copy.c",
|
||||
"..\\mysys\\my_create.c", "..\\mysys\\my_delete.c",
|
||||
"..\\mysys\\my_div.c", "..\\mysys\\my_error.c",
|
||||
"..\\mysys\\my_fopen.c", "..\\mysys\\my_fstream.c",
|
||||
"..\\mysys\\my_getwd.c", "..\\mysys\\my_init.c",
|
||||
"..\\mysys\\my_lib.c", "..\\mysys\\my_lock.c",
|
||||
"..\\mysys\\my_lockmem.c", "..\\mysys\\my_lread.c",
|
||||
"..\\mysys\\my_lwrite.c", "..\\mysys\\my_malloc.c",
|
||||
"..\\mysys\\my_messnc.c", "..\\mysys\\my_mkdir.c",
|
||||
"..\\mysys\\my_net.c", "..\\mysys\\my_once.c",
|
||||
"..\\mysys\\my_open.c",
|
||||
"..\\mysys\\my_os2cond.c",
|
||||
"..\\mysys\\my_os2dlfcn.c",
|
||||
"..\\mysys\\my_os2dirsrch.c",
|
||||
"..\\mysys\\my_os2mutex.c", "..\\mysys\\my_os2thread.c",
|
||||
"..\\mysys\\my_os2tls.c",
|
||||
"..\\mysys\\my_os2file64.c",
|
||||
"..\\mysys\\my_pread.c", "..\\mysys\\my_pthread.c",
|
||||
"..\\mysys\\my_quick.c", "..\\mysys\\my_read.c",
|
||||
"..\\mysys\\my_realloc.c", "..\\mysys\\my_redel.c",
|
||||
"..\\mysys\\my_rename.c", "..\\mysys\\my_seek.c",
|
||||
"..\\mysys\\my_static.c", "..\\mysys\\my_tempnam.c",
|
||||
"..\\mysys\\my_thr_init.c", "..\\mysys\\my_vsnprintf.c",
|
||||
"..\\mysys\\my_write.c", "..\\mysys\\ptr_cmp.c",
|
||||
"..\\mysys\\queues.c", "..\\mysys\\raid.cc",
|
||||
"..\\mysys\\safemalloc.c", "..\\mysys\\string.c",
|
||||
"..\\mysys\\thr_alarm.c",
|
||||
"..\\mysys\\thr_mutex.c", "..\\mysys\\thr_rwlock.c",
|
||||
"..\\mysys\\tree.c", "..\\mysys\\typelib.c"
|
||||
|
||||
group my_sys_cli = "..\\mysys\\mf_iocache.c"
|
||||
group my_sys_sql = "..\\mysys\\thr_lock.c"
|
||||
|
||||
group myisam = "..\\myisam\\ft_parser.c",
|
||||
"..\\myisam\\ft_search.c", "..\\myisam\\ft_static.c",
|
||||
"..\\myisam\\ft_stopwords.c", "..\\myisam\\ft_update.c",
|
||||
"..\\myisam\\mi_cache.c", "..\\myisam\\mi_changed.c",
|
||||
"..\\myisam\\mi_check.c", "..\\myisam\\mi_checksum.c",
|
||||
"..\\myisam\\mi_close.c", "..\\myisam\\mi_create.c",
|
||||
"..\\myisam\\mi_dbug.c", "..\\myisam\\mi_delete.c",
|
||||
"..\\myisam\\mi_delete_all.c", "..\\myisam\\mi_delete_table.c",
|
||||
"..\\myisam\\mi_dynrec.c", "..\\myisam\\mi_extra.c",
|
||||
"..\\myisam\\mi_info.c", "..\\myisam\\mi_key.c",
|
||||
"..\\myisam\\mi_locking.c", "..\\myisam\\mi_log.c",
|
||||
"..\\myisam\\mi_open.c", "..\\myisam\\mi_packrec.c",
|
||||
"..\\myisam\\mi_page.c", "..\\myisam\\mi_panic.c",
|
||||
"..\\myisam\\mi_range.c", "..\\myisam\\mi_rename.c",
|
||||
"..\\myisam\\mi_rfirst.c", "..\\myisam\\mi_rkey.c",
|
||||
"..\\myisam\\mi_rlast.c", "..\\myisam\\mi_rnext.c",
|
||||
"..\\myisam\\mi_rnext_same.c", "..\\myisam\\mi_rprev.c",
|
||||
"..\\myisam\\mi_rrnd.c", "..\\myisam\\mi_rsame.c",
|
||||
"..\\myisam\\mi_rsamepos.c", "..\\myisam\\mi_scan.c",
|
||||
"..\\myisam\\mi_search.c", "..\\myisam\\mi_static.c",
|
||||
"..\\myisam\\mi_statrec.c", "..\\myisam\\mi_unique.c",
|
||||
"..\\myisam\\mi_update.c", "..\\myisam\\mi_write.c",
|
||||
"..\\myisam\\sort.c"
|
||||
|
||||
group dbug = "..\\dbug\\dbug.c", "..\\dbug\\factorial.c", "..\\dbug\\sanity.c"
|
||||
|
||||
group readline = "..\\readline\\bind.c", "..\\readline\\callback.c",
|
||||
"..\\readline\\complete.c", "..\\readline\\display.c",
|
||||
//"..\\readline\\emacs_keymap.c",
|
||||
"..\\readline\\funmap.c", "..\\readline\\histexpand.c",
|
||||
"..\\readline\\histfile.c", "..\\readline\\history.c",
|
||||
"..\\readline\\histsearch.c", "..\\readline\\input.c",
|
||||
"..\\readline\\isearch.c", "..\\readline\\keymaps.c",
|
||||
"..\\readline\\kill.c", "..\\readline\\macro.c",
|
||||
"..\\readline\\nls.c", "..\\readline\\parens.c",
|
||||
"..\\readline\\readline.c", "..\\readline\\rltty.c",
|
||||
"..\\readline\\search.c", "..\\readline\\shell.c",
|
||||
"..\\readline\\signals.c", "..\\readline\\terminal.c",
|
||||
"..\\readline\\tilde.c", "..\\readline\\undo.c",
|
||||
"..\\readline\\util.c",
|
||||
//"..\\readline\\vi_keymap.c",
|
||||
"..\\readline\\vi_mode.c", "..\\readline\\xmalloc.c"
|
||||
|
||||
group regex = "..\\regex\\regcomp.c", "..\\regex\\regerror.c",
|
||||
"..\\regex\\regexec.c", "..\\regex\\regfree.c", "..\\regex\\reginit.c"
|
||||
|
117
os2/MySQL-Sql.icc
Normal file
117
os2/MySQL-Sql.icc
Normal file
|
@ -0,0 +1,117 @@
|
|||
// disable code inlining when building static libs
|
||||
InlineCode = "no"
|
||||
|
||||
// include common options
|
||||
include "MySQL-Opt.icc"
|
||||
include "MySQL-Source.icc"
|
||||
|
||||
option ProjectOptions = MySQLOptions
|
||||
, define( "MYSQL_SERVER", "")
|
||||
{
|
||||
|
||||
option file(genobject, "..\\OBJ\\ZLIB\\")
|
||||
{
|
||||
target "..\\bin\\mysqld.exe"
|
||||
{
|
||||
// optimized precompiled headers
|
||||
option macros('global', 'yes')
|
||||
{
|
||||
//source type('cpp') gpch
|
||||
source type('cpp') 'os2.h'
|
||||
source type('cpp')
|
||||
//'ctype.h',
|
||||
'string.h', 'assert.h', 'share.h', 'stdarg.h', 'stdio.h',
|
||||
'stdlib.h', 'stddef.h', 'math.h', 'io.h', 'limits.h',
|
||||
'process.h', 'errno.h', 'nerrno.h', 'sys/types.h',
|
||||
'sys/time.h', 'sys/stat.h', 'sys/param.h', 'sys/ioccom.h',
|
||||
'sys/filio.h', 'sys/sockio.h', 'sys/ioctlos2.h','sys/ioctl.h', 'types.h'
|
||||
|
||||
source type('cpp')
|
||||
'global.h', 'my_base.h', 'config-os2.h',
|
||||
'my_dir.h', 'my_sys.h', 'mysql.h',
|
||||
'my_bitmap.h', 'violite.h', 'mysql_priv.h',
|
||||
'm_string.h', 'm_ctype.h'
|
||||
|
||||
source type('cpp') 'myisam.h'
|
||||
source type('cpp') 'myisampack.h'
|
||||
source type('cpp') '.\myisam\myisamdef.h'
|
||||
|
||||
source type('cpp') 'sql_string.h'
|
||||
source type('cpp') 'item.h'
|
||||
source type('cpp') 'unireg.h'
|
||||
source type('cpp') 'field.h'
|
||||
source type('cpp') 'sql_lex.h'
|
||||
source type('cpp') 'sql_list.h'
|
||||
source type('cpp') 'md5.h'
|
||||
source type('cpp') 'sql_acl.h'
|
||||
source type('cpp') 'slave.h'
|
||||
source type('cpp') 'ha_myisam.h'
|
||||
source type('cpp') 'procedure.h'
|
||||
source type('cpp') 'sql_select.h'
|
||||
source type('cpp') 'errmsg.h'
|
||||
source type('cpp') 't_ctype.h'
|
||||
source type('cpp') 'direct.h'
|
||||
source type('cpp') 'mysys_err.h'
|
||||
source type('cpp') 'zconf.h'
|
||||
source type('cpp') 'zlib.h'
|
||||
source type('cpp') 'my_tree.h'
|
||||
source type('cpp') '..\mysys\my_static.h'
|
||||
source type('cpp') 'netdb.h'
|
||||
source type('cpp') 'thr_alarm.h'
|
||||
source type('cpp') 'heap.h'
|
||||
source type('cpp') '..\myisam\fulltext.h'
|
||||
source type('cpp') '..\myisam\ftdefs.h'
|
||||
source type('cpp') 'myisammrg.h'
|
||||
|
||||
}
|
||||
source type('cpp') 'sys/un.h'
|
||||
source type('cpp') 'ha_heap.h'
|
||||
source type('cpp') 'ha_myisammrg.h'
|
||||
source type('cpp') 'opt_ft.h'
|
||||
source type('cpp') 'hash_filo.h'
|
||||
source type('cpp') 'mini_client.h'
|
||||
source type('cpp') 'sql_repl.h'
|
||||
source type('cpp') 'netinet/in_systm.h'
|
||||
source type('cpp') 'netinet/tcp.h'
|
||||
source type('cpp') 'sql_analyse.h'
|
||||
source type('cpp') 'item_create.h'
|
||||
source type('cpp') '..\mysys\mysys_priv.h'
|
||||
source type('cpp') 'sys/utime.h'
|
||||
source type('cpp') 'sys/select.h'
|
||||
|
||||
// target source files
|
||||
source "rint.obj"
|
||||
source zlib, ufc, regex
|
||||
if debug_build {
|
||||
source type('cpp') dbug
|
||||
}
|
||||
source type('cpp') heap
|
||||
source type('cpp') isam
|
||||
source type('cpp') merge
|
||||
source type('cpp') myisam
|
||||
source type('cpp') myisammrg
|
||||
source type('cpp') my_sys
|
||||
source type('cpp') my_sys_sql
|
||||
source type('cpp') strings
|
||||
source type('cpp') sql
|
||||
}
|
||||
}
|
||||
/*
|
||||
option define( "MYSQL_SERVER", "")
|
||||
{
|
||||
target "..\\bin\\mysqlbinlog.exe"
|
||||
{
|
||||
// optimized precompiled headers
|
||||
option macros('global', 'yes')
|
||||
{
|
||||
//source type('cpp') client_pch //, 'sql_string.h'
|
||||
}
|
||||
// target source files
|
||||
source type('cpp')
|
||||
"..\\sql\\mysqlbinlog.cc",
|
||||
"..\\sql\\mini_client.cc",
|
||||
"..\\sql\\net_serv.cc"
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
134
os2/MySQL-Util.icc
Normal file
134
os2/MySQL-Util.icc
Normal file
|
@ -0,0 +1,134 @@
|
|||
// disable code inlining when building static libs
|
||||
InlineCode = "no"
|
||||
|
||||
// include common options
|
||||
include "MySQL-Opt.icc"
|
||||
include "MySQL-Source.icc"
|
||||
|
||||
option ProjectOptions = MySQLOptions
|
||||
, link(defaultlibsname, "common.lib")
|
||||
, link(defaultlibsname, "myisam.lib")
|
||||
, link(defaultlibsname, "isam.lib")
|
||||
, link(defaultlibsname, "mysql.lib")
|
||||
{
|
||||
|
||||
target "..\\bin\\myisamchk.exe"
|
||||
{
|
||||
// optimized precompiled headers
|
||||
option macros('global', 'yes')
|
||||
{
|
||||
source type('cpp') client_pch
|
||||
}
|
||||
source type('cpp') "..\\myisam\\myisamchk.c"
|
||||
}
|
||||
|
||||
target "..\\bin\\myisamlog.exe"
|
||||
{
|
||||
// optimized precompiled headers
|
||||
option macros('global', 'yes')
|
||||
{
|
||||
source type('cpp') client_pch
|
||||
}
|
||||
|
||||
// target source files
|
||||
source type('cpp') "..\\myisam\\myisamlog.c"
|
||||
}
|
||||
|
||||
target "..\\bin\\myisampack.exe"
|
||||
{
|
||||
// optimized precompiled headers
|
||||
option macros('global', 'yes')
|
||||
{
|
||||
source type('cpp') client_pch
|
||||
}
|
||||
// target source files
|
||||
source type('cpp') "..\\myisam\\myisampack.c"
|
||||
}
|
||||
|
||||
target "..\\bin\\test\\is_test1.exe"
|
||||
{
|
||||
// target source files
|
||||
source type('cpp') "..\\isam\\test1.c"
|
||||
}
|
||||
target "..\\bin\\test\\is_test2.exe"
|
||||
{
|
||||
// target source files
|
||||
source type('cpp') "..\\isam\\test2.c"
|
||||
}
|
||||
target "..\\bin\\test\\mi_test1.exe"
|
||||
{
|
||||
// target source files
|
||||
source type('cpp') "..\\myisam\\mi_test1.c"
|
||||
}
|
||||
target "..\\bin\\test\\mi_test2.exe"
|
||||
{
|
||||
// target source files
|
||||
source type('cpp') "..\\myisam\\mi_test2.c"
|
||||
}
|
||||
target "..\\bin\\test\\ft_eval.exe"
|
||||
{
|
||||
// target source files
|
||||
source type('cpp') "..\\myisam\\ft_eval.c"
|
||||
}
|
||||
target "..\\bin\\test\\ft_test1.exe"
|
||||
{
|
||||
// target source files
|
||||
source type('cpp') "..\\myisam\\ft_test1.c"
|
||||
}
|
||||
|
||||
//target "..\\bin\\test\\testhash.exe"
|
||||
{
|
||||
// target source files
|
||||
//source type('cpp') "..\\mysys\\testhash.c"
|
||||
}
|
||||
|
||||
target "..\\bin\\test\\test_charset.exe"
|
||||
{
|
||||
// target source files
|
||||
source type('cpp') "..\\mysys\\test_charset.c"
|
||||
}
|
||||
|
||||
target "..\\bin\\test\\hp_test1.exe"
|
||||
{
|
||||
// target source files
|
||||
source type('cpp') "..\\heap\\hp_test1.c"
|
||||
}
|
||||
target "..\\bin\\test\\hp_test2.exe"
|
||||
{
|
||||
// target source files
|
||||
source type('cpp') "..\\heap\\hp_test2.c"
|
||||
}
|
||||
|
||||
option define( "MAIN", "")
|
||||
{
|
||||
target "..\\bin\\test\\thr_lock.exe"
|
||||
{
|
||||
// target source files
|
||||
source type('cpp') "..\\mysys\\thr_lock.c"
|
||||
}
|
||||
}
|
||||
|
||||
target "..\\bin\\test\\insert_test.exe"
|
||||
{
|
||||
// optimized precompiled headers
|
||||
option macros('global', 'yes')
|
||||
{
|
||||
source type('cpp') client_pch
|
||||
}
|
||||
source type('cpp') "..\\client\\insert_test.c"
|
||||
}
|
||||
target "..\\bin\\test\\select_test.exe"
|
||||
{
|
||||
source type('cpp') "..\\client\\select_test.c"
|
||||
}
|
||||
target "..\\bin\\test\\thread_test.exe"
|
||||
{
|
||||
// optimized precompiled headers
|
||||
option macros('global', 'yes')
|
||||
{
|
||||
source type('cpp') client_pch
|
||||
}
|
||||
source type('cpp') "..\\client\\thread_test.c"
|
||||
}
|
||||
|
||||
}
|
3067
os2/MySQL-Util.irs
Normal file
3067
os2/MySQL-Util.irs
Normal file
File diff suppressed because it is too large
Load diff
68
os2/MySQL-binlog.icc
Normal file
68
os2/MySQL-binlog.icc
Normal file
|
@ -0,0 +1,68 @@
|
|||
// disable code inlining when building static libs
|
||||
InlineCode = "no"
|
||||
|
||||
// include common options
|
||||
include "MySQL-Opt.icc"
|
||||
include "MySQL-Source.icc"
|
||||
|
||||
option ProjectOptions = MySQLOptions
|
||||
, define( "MYSQL_SERVER", "")
|
||||
, link(defaultlibsname, "common.lib")
|
||||
, link(defaultlibsname, "myisam.lib")
|
||||
, link(defaultlibsname, "isam.lib")
|
||||
, link(defaultlibsname, "mysql.lib")
|
||||
{
|
||||
option define( "MYSQL_SERVER", "")
|
||||
{
|
||||
target "..\\bin\\mysqlbinlog.exe"
|
||||
{
|
||||
// optimized precompiled headers
|
||||
option macros('global', 'yes')
|
||||
{
|
||||
source type('cpp') 'os2.h'
|
||||
source type('cpp') 'errno.h', 'nerrno.h'
|
||||
source type('cpp') 'config-os2.h', 'mysql_com.h'
|
||||
/*
|
||||
source type('cpp')
|
||||
'global.h', 'my_base.h', 'config-os2.h',
|
||||
'my_dir.h', 'my_sys.h', 'mysql.h',
|
||||
'my_bitmap.h', 'violite.h',
|
||||
'mysql_priv.h',
|
||||
'm_string.h'
|
||||
*/
|
||||
}
|
||||
// target source files
|
||||
source type('cpp')
|
||||
"..\\sql\\mysqlbinlog.cc"
|
||||
option macros('global', 'yes')
|
||||
{
|
||||
source type('cpp') 'sys/stat.h'
|
||||
}
|
||||
source type('cpp') "..\\sql\\mini_client.cc"
|
||||
option macros('global', 'yes')
|
||||
{
|
||||
source type('cpp') 'os2.h'
|
||||
source type('cpp') 'math.h'
|
||||
source type('cpp') 'stdio.h'
|
||||
source type('cpp') 'stdlib.h'
|
||||
source type('cpp') 'stddef.h'
|
||||
source type('cpp') 'limits.h'
|
||||
source type('cpp') 'sys/types.h'
|
||||
source type('cpp') 'sys/time.h'
|
||||
source type('cpp') 'types.h'
|
||||
source type('cpp') 'stdarg.h'
|
||||
source type('cpp') 'string.h'
|
||||
}
|
||||
source type('cpp') "..\\sql\\net_serv.cc",
|
||||
"..\\sql\\mini_client_errors.c"
|
||||
option macros('global', 'yes')
|
||||
{
|
||||
source type('cpp') 'assert.h'
|
||||
}
|
||||
source type('cpp') "..\\sql\\violite.c",
|
||||
"..\\sql\\password.c"
|
||||
//"..\\sql\\thr_malloc.cc"
|
||||
}
|
||||
}
|
||||
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue