View Issue Details

IDProjectCategoryView StatusLast Update
0000692MySQL v5 for OS/2 & eComStationBugpublic2019-07-19 19:30
ReporterIgor VaskovAssigned ToSteven Levine 
PrioritynormalSeveritycrashReproducibilityrandom
Status assignedResolutionopen 
PlatformOS/2OSECSOS Version2.2
Product Version 
Target VersionFixed in Version 
Summary0000692: MySQL 5.5.62 Unstable working and traps.
DescriptionRandom traps in PTHR01.DLL. Error log include the traps attached.
TagsNo tags attached.

Activities

Igor Vaskov

2019-06-19 22:10

reporter  

mysql55.log (136,753 bytes)

Igor Vaskov

2019-06-20 22:32

reporter  

003D_04.TRP (61,426 bytes)

Igor Vaskov

2019-06-20 22:38

reporter   ~0003307

Latest trap.

05C1_05.TRP (55,088 bytes)

psmedley

2019-06-23 18:55

administrator   ~0003308

Will try and look at this when I have time, busy on some non-OS/2 related home automation stuff right now

psmedley

2019-07-06 07:21

administrator   ~0003309

Last edited: 2019-07-06 15:25

View 2 revisions

diff of mysql 5.1.62 added. Will add a build log after it rebuilds



mysql-5.5.62.diff (84,417 bytes)
Only in mysql-5.5.62: build.log
Only in mysql-5.5.62/client: cmake_install.cmake
Only in mysql-5.5.62/client: CMakeFiles
Only in mysql-5.5.62/client: CTestTestfile.cmake
Only in mysql-5.5.62/client: mysql_plugin.exe
Only in mysql-5.5.62/client: mysql_plugin.map
diff -ur mysql-5.5.62-o/client/mysql_upgrade.c mysql-5.5.62/client/mysql_upgrade.c
--- mysql-5.5.62-o/client/mysql_upgrade.c	2018-08-29 06:42:50.000000000 +0930
+++ mysql-5.5.62/client/mysql_upgrade.c	2019-06-16 09:13:26.000000000 +0930
@@ -472,7 +472,11 @@
                "--no-defaults",
                "--help",
                "2>&1",
+#ifndef __OS2__
                IF_WIN("> NUL", "> /dev/null"),
+#else
+		"> NUL",
+#endif
                NULL))
     die("Can't execute '%s'", tool_executable_name);
 
@@ -501,6 +505,21 @@
                             "sql", O_CREAT | O_SHARE | O_RDWR,
                             MYF(MY_WME))) < 0)
     die("Failed to create temporary file for defaults");
+#ifdef __OS2__
+    int i = 0;
+
+    /* Run till end of string */
+    while(query_file_path[i] != '\0')
+    {
+        /* If occurrence of character is found */
+        if(query_file_path[i] == '\\')
+        {
+            query_file_path[i] = '/';
+        }
+
+        i++;
+    }
+#endif
 
   /*
     Master and slave should be upgraded separately. All statements executed
@@ -939,12 +958,20 @@
   dynstr_append(&ds_args, " ");
 
   /* Find mysql */
+#ifndef __OS2__
   find_tool(mysql_path, IF_WIN("mysql.exe", "mysql"), self_name);
+#else
+  find_tool(mysql_path, "mysql.exe", self_name);
+#endif
 
   if (!opt_systables_only)
   {
     /* Find mysqlcheck */
+#ifndef __OS2__
     find_tool(mysqlcheck_path, IF_WIN("mysqlcheck.exe", "mysqlcheck"), self_name);
+#else
+    find_tool(mysqlcheck_path, "mysqlcheck.exe", self_name);
+#endif
   }
   else
   {
Only in mysql-5.5.62/client: mysql_upgrade.exe
Only in mysql-5.5.62/client: mysql_upgrade.map
diff -ur mysql-5.5.62-o/client/mysql.cc mysql-5.5.62/client/mysql.cc
--- mysql-5.5.62-o/client/mysql.cc	2018-08-29 06:42:50.000000000 +0930
+++ mysql-5.5.62/client/mysql.cc	2019-06-16 15:54:02.000000000 +0930
@@ -89,7 +89,9 @@
 #include <conio.h>
 #else
 #include <readline/readline.h>
+//#include <readline/history.h>
 #define HAVE_READLINE
+#define USE_NEW_READLINE_INTERFACE
 #define USE_POPEN
 #endif
   //int vidattr(long unsigned int attrs);	// Was missing in sun curses
@@ -1032,7 +1034,7 @@
  HIST_ENTRY is defined for libedit, but not for the real readline
  Need to redefine it for real readline to find it
 */
-#if !defined(HAVE_HIST_ENTRY)
+#if !defined(HAVE_HIST_ENTRY) || defined(__OS2__)
 typedef struct _hist_entry {
   const char      *line;
   const char      *data;
@@ -1496,7 +1498,7 @@
   {"password", 'p',
    "Password to use when connecting to server. If password is not given it's asked from the tty.",
    0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
-#ifdef __WIN__
+#if defined(__WIN__) || defined(__OS2__)
   {"pipe", 'W', "Use named pipes to connect to server.", 0, 0, 0, GET_NO_ARG,
    NO_ARG, 0, 0, 0, 0, 0, 0},
 #endif
@@ -1774,7 +1776,7 @@
     set_if_bigger(opt_silent,1);                         // more silent
     break;
   case 'W':
-#ifdef __WIN__
+#if defined(__WIN__) || defined(__OS2__)
     opt_protocol = MYSQL_PROTOCOL_PIPE;
 #endif
     break;
@@ -4851,6 +4853,9 @@
 
   va_start(args, fmt);
   (void) vfprintf(file, fmt, args);
+#ifdef __OS2__
+  fflush( file);
+#endif
   va_end(args);
 
   if (opt_outfile)
@@ -4865,6 +4870,9 @@
 void tee_fputs(const char *s, FILE *file)
 {
   fputs(s, file);
+#ifdef __OS2__
+  fflush( file);
+#endif
   if (opt_outfile)
     fputs(s, OUTFILE);
 }
@@ -4874,6 +4882,9 @@
 {
   fputs(s, file);
   fputc('\n', file);
+#ifdef __OS2__
+  fflush( file);
+#endif
   if (opt_outfile)
   {
     fputs(s, OUTFILE);
@@ -4884,6 +4895,9 @@
 void tee_putc(int c, FILE *file)
 {
   putc(c, file);
+#ifdef __OS2__
+  fflush( file);
+#endif
   if (opt_outfile)
     putc(c, OUTFILE);
 }
Only in mysql-5.5.62/client: mysql.exe
Only in mysql-5.5.62/client: mysql.map
diff -ur mysql-5.5.62-o/client/mysqladmin.cc mysql-5.5.62/client/mysqladmin.cc
--- mysql-5.5.62-o/client/mysqladmin.cc	2018-08-29 06:42:50.000000000 +0930
+++ mysql-5.5.62/client/mysqladmin.cc	2019-06-16 09:13:26.000000000 +0930
@@ -157,7 +157,7 @@
   {"password", 'p',
    "Password to use when connecting to server. If password is not given it's asked from the tty.",
    0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
-#ifdef __WIN__
+#if defined(__WIN__) || defined(__OS2__)
   {"pipe", 'W', "Use named pipes to connect to server.", 0, 0, 0, GET_NO_ARG,
    NO_ARG, 0, 0, 0, 0, 0, 0},
 #endif
Only in mysql-5.5.62/client: mysqladmin.exe
Only in mysql-5.5.62/client: mysqladmin.map
Only in mysql-5.5.62/client: mysqlbinlog.exe
Only in mysql-5.5.62/client: mysqlbinlog.map
diff -ur mysql-5.5.62-o/client/mysqlcheck.c mysql-5.5.62/client/mysqlcheck.c
--- mysql-5.5.62-o/client/mysqlcheck.c	2018-08-29 06:42:50.000000000 +0930
+++ mysql-5.5.62/client/mysqlcheck.c	2019-06-16 09:13:26.000000000 +0930
@@ -149,7 +149,7 @@
   {"password", 'p',
    "Password to use when connecting to server. If password is not given, it's solicited on the tty.",
    0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
-#ifdef __WIN__
+#if defined(__WIN__) || defined(__OS2__)
   {"pipe", 'W', "Use named pipes to connect to server.", 0, 0, 0, GET_NO_ARG,
    NO_ARG, 0, 0, 0, 0, 0, 0},
 #endif
Only in mysql-5.5.62/client: mysqlcheck.exe
Only in mysql-5.5.62/client: mysqlcheck.map
diff -ur mysql-5.5.62-o/client/mysqldump.c mysql-5.5.62/client/mysqldump.c
--- mysql-5.5.62-o/client/mysqldump.c	2018-08-29 06:42:50.000000000 +0930
+++ mysql-5.5.62/client/mysqldump.c	2019-06-16 09:13:26.000000000 +0930
@@ -420,7 +420,7 @@
   {"password", 'p',
    "Password to use when connecting to server. If password is not given it's solicited on the tty.",
    0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
-#ifdef __WIN__
+#if defined(__WIN__) || defined(__OS2__)
   {"pipe", 'W', "Use named pipes to connect to server.", 0, 0, 0, GET_NO_ARG,
    NO_ARG, 0, 0, 0, 0, 0, 0},
 #endif
Only in mysql-5.5.62/client: mysqldump.exe
Only in mysql-5.5.62/client: mysqldump.map
diff -ur mysql-5.5.62-o/client/mysqlimport.c mysql-5.5.62/client/mysqlimport.c
--- mysql-5.5.62-o/client/mysqlimport.c	2018-08-29 06:42:50.000000000 +0930
+++ mysql-5.5.62/client/mysqlimport.c	2019-06-16 09:13:26.000000000 +0930
@@ -138,7 +138,7 @@
   {"password", 'p',
    "Password to use when connecting to server. If password is not given it's asked from the tty.",
    0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
-#ifdef __WIN__
+#if defined(__WIN__) || defined(__OS2__)
   {"pipe", 'W', "Use named pipes to connect to server.", 0, 0, 0, GET_NO_ARG,
    NO_ARG, 0, 0, 0, 0, 0, 0},
 #endif
Only in mysql-5.5.62/client: mysqlimport.exe
Only in mysql-5.5.62/client: mysqlimport.map
diff -ur mysql-5.5.62-o/client/mysqlshow.c mysql-5.5.62/client/mysqlshow.c
--- mysql-5.5.62-o/client/mysqlshow.c	2018-08-29 06:42:50.000000000 +0930
+++ mysql-5.5.62/client/mysqlshow.c	2019-06-16 09:13:26.000000000 +0930
@@ -230,7 +230,7 @@
    &opt_mysql_port,
    &opt_mysql_port, 0, GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0,
    0},
-#ifdef __WIN__
+#if defined(__WIN__) || defined(__EMX__)
   {"pipe", 'W', "Use named pipes to connect to server.", 0, 0, 0, GET_NO_ARG,
    NO_ARG, 0, 0, 0, 0, 0, 0},
 #endif
Only in mysql-5.5.62/client: mysqlshow.exe
Only in mysql-5.5.62/client: mysqlshow.map
Only in mysql-5.5.62/client: mysqlslap.exe
Only in mysql-5.5.62/client: mysqlslap.map
Only in mysql-5.5.62/client: mysqltest.exe
Only in mysql-5.5.62/client: mysqltest.map
Only in mysql-5.5.62/client: Makefile
diff -ur mysql-5.5.62-o/cmake/mysql_version.cmake mysql-5.5.62/cmake/mysql_version.cmake
--- mysql-5.5.62-o/cmake/mysql_version.cmake	2018-08-29 06:42:50.000000000 +0930
+++ mysql-5.5.62/cmake/mysql_version.cmake	2019-06-16 09:13:26.000000000 +0930
@@ -83,7 +83,11 @@
 
 
 IF(NOT MYSQL_UNIX_ADDR)
+IF (NOT OS2)
   SET(MYSQL_UNIX_ADDR "/tmp/mysql.sock")
+ELSE()
+  SET(MYSQL_UNIX_ADDR "\\\\socket\\\\mysql")
+ENDIF()
 ENDIF()
 IF(NOT COMPILATION_COMMENT)
   SET(COMPILATION_COMMENT "Source distribution")
diff -ur mysql-5.5.62-o/cmake/ssl.cmake mysql-5.5.62/cmake/ssl.cmake
--- mysql-5.5.62-o/cmake/ssl.cmake	2018-08-29 06:42:50.000000000 +0930
+++ mysql-5.5.62/cmake/ssl.cmake	2019-06-16 09:13:26.000000000 +0930
@@ -82,11 +82,17 @@
       SET(SSL_INTERNAL_INCLUDE_DIRS "")
       SET(SSL_DEFINES "-DHAVE_OPENSSL")
       CHANGE_SSL_SETTINGS("system")
-    ELSE()
-      IF(WITH_SSL STREQUAL "system")
-        MESSAGE(SEND_ERROR "Cannot find appropriate system libraries for SSL. Use WITH_SSL=bundled to enable SSL support")
-      ENDIF()
-      MYSQL_USE_BUNDLED_SSL()
+#    ELSE()
+#      IF(WITH_SSL STREQUAL "system")
+#        MESSAGE(SEND_ERROR "Cannot find appropriate system libraries for SSL. Use WITH_SSL=bundled to enable SSL support")
+#      ENDIF()
+#      MYSQL_USE_BUNDLED_SSL()
+      SET(SSL_SOURCES "")
+      SET(SSL_LIBRARIES ${OPENSSL_LIBRARIES} ${CRYPTO_LIBRARY})
+      SET(SSL_INCLUDE_DIRS ${OPENSSL_INCLUDE_DIR})
+      SET(SSL_INTERNAL_INCLUDE_DIRS "")
+      SET(SSL_DEFINES "-DHAVE_OPENSSL")
+      CHANGE_SSL_SETTINGS("system")
     ENDIF()
   ELSE()
     MESSAGE(SEND_ERROR "Wrong option for WITH_SSL. "
Only in mysql-5.5.62: cmake_install.cmake
diff -ur mysql-5.5.62-o/cmd-line-utils/libedit/chartype.h mysql-5.5.62/cmd-line-utils/libedit/chartype.h
--- mysql-5.5.62-o/cmd-line-utils/libedit/chartype.h	2018-08-29 06:42:50.000000000 +0930
+++ mysql-5.5.62/cmd-line-utils/libedit/chartype.h	2019-06-16 09:13:26.000000000 +0930
@@ -49,7 +49,7 @@
   TODO : Verify if FreeBSD & AIX stores ISO 10646 in wchar_t. */
 #if !defined(__NetBSD__) && !defined(__sun) \
   && !(defined(__APPLE__) && defined(__MACH__)) \
-  && !defined(__FreeBSD__) && !defined(_AIX)
+  && !defined(__FreeBSD__) && !defined(_AIX) && !defined(__KLIBC__)
 #ifndef __STDC_ISO_10646__
 /* In many places it is assumed that the first 127 code points are ASCII
  * compatible, so ensure wchar_t indeed does ISO 10646 and not some other
Only in mysql-5.5.62/cmd-line-utils/libedit: cmake_install.cmake
Only in mysql-5.5.62/cmd-line-utils/libedit: common.h
Only in mysql-5.5.62/cmd-line-utils/libedit: CMakeFiles
Only in mysql-5.5.62/cmd-line-utils/libedit: emacs.h
Only in mysql-5.5.62/cmd-line-utils/libedit: fcns.c
Only in mysql-5.5.62/cmd-line-utils/libedit: fcns.h
Only in mysql-5.5.62/cmd-line-utils/libedit: help.c
Only in mysql-5.5.62/cmd-line-utils/libedit: help.h
diff -ur mysql-5.5.62-o/cmd-line-utils/libedit/history.c mysql-5.5.62/cmd-line-utils/libedit/history.c
--- mysql-5.5.62-o/cmd-line-utils/libedit/history.c	2018-08-29 06:42:50.000000000 +0930
+++ mysql-5.5.62/cmd-line-utils/libedit/history.c	2019-06-16 09:13:26.000000000 +0930
@@ -805,8 +805,10 @@
 	if ((fp = fopen(fname, "w")) == NULL)
 		return -1;
 
-	if (fchmod(fileno(fp), S_IRUSR|S_IWUSR) == -1)
-		goto done;
+#ifndef __EMX__
+ 	if (fchmod(fileno(fp), S_IRUSR|S_IWUSR) == -1)
+ 		goto done;
+#endif
 	if (fputs(hist_cookie, fp) == EOF)
 		goto done;
 	ptr = h_malloc((max_size = 1024) * sizeof(*ptr));
Only in mysql-5.5.62/cmd-line-utils/libedit: libedit.a
Only in mysql-5.5.62/cmd-line-utils/libedit: makelist
Only in mysql-5.5.62/cmd-line-utils/libedit: Makefile
diff -ur mysql-5.5.62-o/cmd-line-utils/libedit/np/vis.c mysql-5.5.62/cmd-line-utils/libedit/np/vis.c
--- mysql-5.5.62-o/cmd-line-utils/libedit/np/vis.c	2018-08-29 06:42:50.000000000 +0930
+++ mysql-5.5.62/cmd-line-utils/libedit/np/vis.c	2019-06-16 09:13:26.000000000 +0930
@@ -75,6 +75,9 @@
 #include "np/vis.h"
 #include <errno.h>
 #include <stdlib.h>
+#ifdef __KLIBC__
+typedef __uint32_t	u_int32_t;
+#endif
 
 #ifdef __weak_alias
 __weak_alias(strvisx,_strvisx)
diff -ur mysql-5.5.62-o/cmd-line-utils/libedit/read.c mysql-5.5.62/cmd-line-utils/libedit/read.c
--- mysql-5.5.62-o/cmd-line-utils/libedit/read.c	2018-08-29 06:42:50.000000000 +0930
+++ mysql-5.5.62/cmd-line-utils/libedit/read.c	2019-06-16 09:13:26.000000000 +0930
@@ -50,6 +50,9 @@
 #include <stdlib.h>
 #include <limits.h>
 #include "el.h"
+#ifdef __KLIBC__
+#define SIGCONT  19     /** POSIX: Continue a stopped process. */
+#endif
 
 #define OKCMD	-1	/* must be -1! */
 
diff -ur mysql-5.5.62-o/cmd-line-utils/libedit/readline/readline.h mysql-5.5.62/cmd-line-utils/libedit/readline/readline.h
--- mysql-5.5.62-o/cmd-line-utils/libedit/readline/readline.h	2018-08-29 06:42:50.000000000 +0930
+++ mysql-5.5.62/cmd-line-utils/libedit/readline/readline.h	2019-06-16 09:13:26.000000000 +0930
@@ -75,7 +75,7 @@
 
 #ifndef CTRL
 #include <sys/ioctl.h>
-#if !defined(__sun) && !defined(__hpux) && !defined(_AIX) && !defined(__QNXNTO__) && !defined(__USLC__)
+#if !defined(__sun) && !defined(__hpux) && !defined(_AIX) && !defined(__QNXNTO__) && !defined(__USLC__) && !defined(__OS2__)
 #include <sys/ttydefaults.h>
 #endif
 #ifndef CTRL
diff -ur mysql-5.5.62-o/cmd-line-utils/libedit/readline.c mysql-5.5.62/cmd-line-utils/libedit/readline.c
--- mysql-5.5.62-o/cmd-line-utils/libedit/readline.c	2018-08-29 06:42:50.000000000 +0930
+++ mysql-5.5.62/cmd-line-utils/libedit/readline.c	2019-06-16 09:13:26.000000000 +0930
@@ -56,6 +56,10 @@
 #include "fcns.h"		/* for EL_NUM_FCNS */
 #include "histedit.h"
 #include "filecomplete.h"
+#ifdef __KLIBC__
+#define PATH_MAX        260
+#define SIGTSTP  18     /** POSIX: Stop signal from tty. */
+#endif
 
 void rl_prep_terminal(int);
 void rl_deprep_terminal(void);
diff -ur mysql-5.5.62-o/cmd-line-utils/libedit/sig.c mysql-5.5.62/cmd-line-utils/libedit/sig.c
--- mysql-5.5.62-o/cmd-line-utils/libedit/sig.c	2018-08-29 06:42:50.000000000 +0930
+++ mysql-5.5.62/cmd-line-utils/libedit/sig.c	2019-06-16 09:13:26.000000000 +0930
@@ -77,13 +77,14 @@
 	sel->el_signal->sig_no = signo;
 
 	switch (signo) {
+#ifndef __EMX__
 	case SIGCONT:
 		tty_rawmode(sel);
 		if (ed_redisplay(sel, 0) == CC_REFRESH)
 			re_refresh(sel);
 		terminal__flush(sel);
 		break;
-
+#endif
 	case SIGWINCH:
 		el_resize(sel);
 		break;
diff -ur mysql-5.5.62-o/cmd-line-utils/libedit/sig.h mysql-5.5.62/cmd-line-utils/libedit/sig.h
--- mysql-5.5.62-o/cmd-line-utils/libedit/sig.h	2018-08-29 06:42:50.000000000 +0930
+++ mysql-5.5.62/cmd-line-utils/libedit/sig.h	2019-06-16 09:13:26.000000000 +0930
@@ -48,6 +48,14 @@
  * Define here all the signals we are going to handle
  * The _DO macro is used to iterate in the source code
  */
+#ifdef __EMX__
+#define	ALLSIGS		\
+	_DO(SIGINT)	\
+	_DO(SIGQUIT)	\
+	_DO(SIGHUP)	\
+	_DO(SIGTERM)	\
+	_DO(SIGWINCH)
+#else
 #define	ALLSIGS		\
 	_DO(SIGINT)	\
 	_DO(SIGTSTP)	\
@@ -56,6 +64,7 @@
 	_DO(SIGTERM)	\
 	_DO(SIGCONT)	\
 	_DO(SIGWINCH)
+#endif
 #define ALLSIGSNO	7
 
 typedef struct {
Only in mysql-5.5.62/cmd-line-utils/libedit: vi.h
Only in mysql-5.5.62: conf.cmd
diff -ur mysql-5.5.62-o/configure.cmake mysql-5.5.62/configure.cmake
--- mysql-5.5.62-o/configure.cmake	2018-08-29 06:42:50.000000000 +0930
+++ mysql-5.5.62/configure.cmake	2019-06-16 09:13:26.000000000 +0930
@@ -790,7 +790,7 @@
   SET(C_INLINE __inline)
 ENDIF()
 
-IF(NOT CMAKE_CROSSCOMPILING AND NOT MSVC)
+IF(NOT CMAKE_CROSSCOMPILING AND NOT MSVC AND NOT OS2)
   STRING(TOLOWER ${CMAKE_SYSTEM_PROCESSOR}  processor)
   IF(processor MATCHES "86" OR processor MATCHES "amd64" OR processor MATCHES "x64")
   #Check for x86 PAUSE instruction
Only in mysql-5.5.62: configure.log
Only in mysql-5.5.62: CMakeCache.txt
Only in mysql-5.5.62: CMakeFiles
Only in mysql-5.5.62: CPackConfig.cmake
Only in mysql-5.5.62: CPackSourceConfig.cmake
Only in mysql-5.5.62: CTestTestfile.cmake
Only in mysql-5.5.62/dbug: cmake_install.cmake
Only in mysql-5.5.62/dbug: CMakeFiles
Only in mysql-5.5.62/dbug: libdbug.a
Only in mysql-5.5.62/dbug: Makefile
Only in mysql-5.5.62/Docs: INFO_BIN
Only in mysql-5.5.62/extra: cmake_install.cmake
Only in mysql-5.5.62/extra: comp_err.exe
Only in mysql-5.5.62/extra: comp_err.map
Only in mysql-5.5.62/extra: CMakeFiles
Only in mysql-5.5.62/extra: CTestTestfile.cmake
Only in mysql-5.5.62/extra: my_print_defaults.exe
Only in mysql-5.5.62/extra: my_print_defaults.map
Only in mysql-5.5.62/extra: Makefile
Only in mysql-5.5.62/extra: perror.exe
Only in mysql-5.5.62/extra: perror.map
Only in mysql-5.5.62/extra: replace.exe
Only in mysql-5.5.62/extra: replace.map
Only in mysql-5.5.62/extra: resolveip.exe
Only in mysql-5.5.62/extra: resolveip.map
Only in mysql-5.5.62/include: cmake_install.cmake
Only in mysql-5.5.62/include: config.h
Only in mysql-5.5.62/include: CMakeFiles
diff -ur mysql-5.5.62-o/include/m_ctype.h mysql-5.5.62/include/m_ctype.h
--- mysql-5.5.62-o/include/m_ctype.h	2018-08-29 06:42:50.000000000 +0930
+++ mysql-5.5.62/include/m_ctype.h	2019-06-16 09:13:26.000000000 +0930
@@ -23,6 +23,10 @@
 #include <my_attribute.h>
 #include "my_global.h"                          /* uint16, uchar */
 
+#ifndef MAX_INDEXES
+#define MAX_INDEXES 64
+#endif
+
 #ifdef	__cplusplus
 extern "C" {
 #endif
Only in mysql-5.5.62/include: my_config.h
diff -ur mysql-5.5.62-o/include/my_global.h mysql-5.5.62/include/my_global.h
--- mysql-5.5.62-o/include/my_global.h	2018-08-29 06:42:50.000000000 +0930
+++ mysql-5.5.62/include/my_global.h	2019-06-16 09:13:26.000000000 +0930
@@ -35,6 +35,21 @@
 */
 #define INNODB_COMPATIBILITY_HOOKS
 
+#if defined( __EMX__) && !defined( MYSQL_SERVER)
+/* moved here to use below VOID macro redefinition */
+#define INCL_BASE
+#define INCL_NOPMAPI
+#define PREV_POLYGON POLYGON
+#undef POLYGON
+#define POLYGON POLYGON_OS2
+#define INCL_DOSEXCEPTIONS
+#define INCL_DOSPROCESS
+#include <os2.h>
+#undef POLYGON
+#define POLYGON PREV_POLYGON
+#undef VOID
+#endif /* __EMX__ */
+
 #ifdef __CYGWIN__
 /* We use a Unix API, so pretend it's not Windows */
 #undef WIN
@@ -609,6 +624,23 @@
 #define FN_DEVCHAR	':'
 #define FN_NETWORK_DRIVES	/* Uses \\ to indicate network drives */
 #define FN_NO_CASE_SENCE	/* Files are not case-sensitive */
+#elif defined(__EMX__)
+#define DWORD			ULONG
+#define HANDLE                     HPIPE
+#define CANT_DELETE_OPEN_FILES	/* saves open files in a list, for delayed delete */
+#define FN_NETWORK_DRIVES       /* Uses \\ to indicate network drives */
+#define FN_NO_CASE_SENCE        /* Files are not case-sensitive */
+#define FN_LIBCHAR	'\\'
+#define FN_LIBCHAR2	'/'
+#define FN_ROOTDIR	"\\"
+#define FN_DEVCHAR	':'
+#define FN_DIRSEP       "/\\"               /* Valid directory separators */
+#define FN_EXEEXT   ".exe"
+#define FN_SOEXT    ".dll"
+#undef MYSQL_DATADIR			/* undef compiler command line flag */
+#define MYSQL_DATADIR		"data/"
+#define _commit(A)	fsync(A)
+#define my_sigset(A,B) signal((A),(B))
 #else
 #define FN_LIBCHAR	'/'
 #define FN_LIBCHAR2	'/'
@@ -907,6 +939,10 @@
 #error Neither int or long is of 4 bytes width
 #endif
 
+#if defined(__EMX__)
+typedef unsigned long	ulong;		  /* Short for unsigned long */
+#endif
+
 #if !defined(HAVE_ULONG) && !defined(__USE_MISC)
 typedef unsigned long	ulong;		  /* Short for unsigned long */
 #endif
diff -ur mysql-5.5.62-o/include/my_net.h mysql-5.5.62/include/my_net.h
--- mysql-5.5.62-o/include/my_net.h	2018-08-29 06:42:50.000000000 +0930
+++ mysql-5.5.62/include/my_net.h	2019-06-16 09:13:26.000000000 +0930
@@ -52,6 +52,12 @@
 #endif
 #endif
 
+#if defined(__EMX__)
+//#define ioctlsocket os2_ioctl
+#include <sys/ioctl.h>
+#define ioctlsocket(A,B,C) ioctl((A),(B),(void *)(C),sizeof(*(C)))
+#endif	/* defined(__EMX__) */
+
 #if defined(__WIN__)
 #define O_NONBLOCK 1    /* For emulation of fcntl() */
 
diff -ur mysql-5.5.62-o/include/my_pthread.h mysql-5.5.62/include/my_pthread.h
--- mysql-5.5.62-o/include/my_pthread.h	2018-08-29 06:42:50.000000000 +0930
+++ mysql-5.5.62/include/my_pthread.h	2019-06-16 16:05:46.000000000 +0930
@@ -24,6 +24,10 @@
 #define ETIME ETIMEDOUT				/* For FreeBSD */
 #endif
 
+#ifdef __INNOTEK_LIBC__
+#include <pthread.h>
+#endif
+
 #ifdef  __cplusplus
 #define EXTERNC extern "C"
 extern "C" {
@@ -223,7 +227,9 @@
 #define my_pthread_setspecific_ptr(T,V) pthread_setspecific(T,(void*) (V))
 #define pthread_detach_this_thread()
 #define pthread_handler_t EXTERNC void *
+#ifndef __OS2__
 typedef void *(* pthread_handler)(void *);
+#endif
 
 #define my_pthread_once_t pthread_once_t
 #if defined(PTHREAD_ONCE_INITIALIZER)
diff -ur mysql-5.5.62-o/include/myisam.h mysql-5.5.62/include/myisam.h
--- mysql-5.5.62-o/include/myisam.h	2018-08-29 06:42:50.000000000 +0930
+++ mysql-5.5.62/include/myisam.h	2019-06-16 09:13:28.000000000 +0930
@@ -286,6 +286,7 @@
 extern int mi_write(struct st_myisam_info *file,uchar *buff);
 extern my_off_t mi_position(struct st_myisam_info *file);
 extern int mi_status(struct st_myisam_info *info, MI_ISAMINFO *x, uint flag);
+//extern int mi_status(MI_INFO *info, MI_ISAMINFO *x, uint flag);
 extern int mi_lock_database(struct st_myisam_info *file,int lock_type);
 extern int mi_create(const char *name,uint keys,MI_KEYDEF *keydef,
 		     uint columns, MI_COLUMNDEF *columndef,
Only in mysql-5.5.62/include: mysql_version.h
diff -ur mysql-5.5.62-o/include/mysql.h mysql-5.5.62/include/mysql.h
--- mysql-5.5.62-o/include/mysql.h	2018-08-29 06:42:50.000000000 +0930
+++ mysql-5.5.62/include/mysql.h	2019-06-16 09:13:28.000000000 +0930
@@ -53,10 +53,15 @@
 #if (defined(_WIN32) || defined(_WIN64)) && !defined(__WIN__)
 #define __WIN__
 #endif
-#if !defined(__WIN__)
-#define STDCALL
-#else
+
+/* keep in sync with my_global.h */
+#if defined(__EMX__) 
+//#define STDCALL _System
+#define STDCALL 
+#elif defined(__WIN__)
 #define STDCALL __stdcall
+#elif !defined( STDCALL)
+#define STDCALL
 #endif
 
 #ifndef my_socket_defined
Only in mysql-5.5.62/include: mysqld_ername.h
Only in mysql-5.5.62/include: mysqld_error.h
Only in mysql-5.5.62/include: Makefile
Only in mysql-5.5.62/include: sql_state.h
diff -ur mysql-5.5.62-o/include/violite.h mysql-5.5.62/include/violite.h
--- mysql-5.5.62-o/include/violite.h	2018-08-29 06:42:50.000000000 +0930
+++ mysql-5.5.62/include/violite.h	2019-06-16 09:13:28.000000000 +0930
@@ -23,6 +23,9 @@
 
 #include "my_net.h"			/* needed because of struct in_addr */
 
+#ifdef __OS2__
+typedef unsigned long     HANDLE;
+#endif
 
 /* Simple vio interface in C;  The functions are implemented in violite.c */
 
@@ -46,7 +49,7 @@
 #define VIO_READ_BUFFER_SIZE 16384              /* size of read buffer */
 
 Vio*	vio_new(my_socket sd, enum enum_vio_type type, uint flags);
-#ifdef __WIN__
+#if defined(__WIN__) || defined(__EMX__)
 Vio* vio_new_win32pipe(HANDLE hPipe);
 Vio* vio_new_win32shared_memory(HANDLE handle_file_map,
                                 HANDLE handle_map,
Only in mysql-5.5.62: info_macros.cmake
Only in mysql-5.5.62: install_manifest.txt
Only in mysql-5.5.62: KLIBCFG.INI
Only in mysql-5.5.62/libmysql: cmake_install.cmake
Only in mysql-5.5.62/libmysql: CMakeFiles
diff -ur mysql-5.5.62-o/libmysql/get_password.c mysql-5.5.62/libmysql/get_password.c
--- mysql-5.5.62-o/libmysql/get_password.c	2018-08-29 06:42:50.000000000 +0930
+++ mysql-5.5.62/libmysql/get_password.c	2019-06-16 09:13:28.000000000 +0930
@@ -35,7 +35,7 @@
 #include <pwd.h>
 #endif /* HAVE_PWD_H */
 #else /* ! HAVE_GETPASS */
-#if !defined(__WIN__)
+#if !defined(__WIN__) && !defined(__OS2__)
 #include <sys/ioctl.h>
 #ifdef HAVE_TERMIOS_H				/* For tty-password */
 #include	<termios.h>
@@ -62,7 +62,7 @@
 #define getpass(A) getpassphrase(A)
 #endif
 
-#if defined(__WIN__)
+#if defined(__WIN__) /*|| defined(__OS2__)*/
 /* were just going to fake it here and get input from the keyboard */
 char *get_tty_password(const char *opt_message)
 {
@@ -148,7 +148,7 @@
 #endif /* ! HAVE_GETPASS */
 
 
-char *get_tty_password(const char *opt_message)
+char * STDCALL get_tty_password(const char *opt_message)
 {
 #ifdef HAVE_GETPASS
   char *passbuff;
Only in mysql-5.5.62/libmysql: libclientlib.a
diff -ur mysql-5.5.62-o/libmysql/libmysql.c mysql-5.5.62/libmysql/libmysql.c
--- mysql-5.5.62-o/libmysql/libmysql.c	2018-08-29 06:42:50.000000000 +0930
+++ mysql-5.5.62/libmysql/libmysql.c	2019-06-16 09:13:28.000000000 +0930
@@ -405,7 +405,7 @@
 char* getlogin(void);
 #endif
 
-#if !defined(__WIN__)
+#if !defined(__WIN__) && !defined(__OS2__)
 
 void read_user_name(char *name)
 {
Only in mysql-5.5.62/libmysql: libmysqlclient.a
Only in mysql-5.5.62/libmysql: merge_archives_mysqlclient.cmake
Only in mysql-5.5.62/libmysql: mysqlclient_depends.c
Only in mysql-5.5.62/libmysql: Makefile
diff -ur mysql-5.5.62-o/libmysqld/lib_sql.cc mysql-5.5.62/libmysqld/lib_sql.cc
--- mysql-5.5.62-o/libmysqld/lib_sql.cc	2018-08-29 06:42:50.000000000 +0930
+++ mysql-5.5.62/libmysqld/lib_sql.cc	2019-06-16 09:13:28.000000000 +0930
@@ -554,7 +554,7 @@
 
   /* Get default temporary directory */
   opt_mysql_tmpdir=getenv("TMPDIR");	/* Use this if possible */
-#if defined(__WIN__)
+#if defined(__WIN__) || defined(__OS2__)
   if (!opt_mysql_tmpdir)
     opt_mysql_tmpdir=getenv("TEMP");
   if (!opt_mysql_tmpdir)
Only in mysql-5.5.62/libservices: cmake_install.cmake
Only in mysql-5.5.62/libservices: CMakeFiles
Only in mysql-5.5.62/libservices: CTestTestfile.cmake
Only in mysql-5.5.62/libservices: libmysqlservices.a
Only in mysql-5.5.62/libservices: Makefile
Only in mysql-5.5.62: make_dist.cmake
Only in mysql-5.5.62/mysql-test: cmake_install.cmake
Only in mysql-5.5.62/mysql-test: CMakeFiles
Only in mysql-5.5.62/mysql-test: CTestTestfile.cmake
Only in mysql-5.5.62/mysql-test/lib/My/SafeProcess: cmake_install.cmake
Only in mysql-5.5.62/mysql-test/lib/My/SafeProcess: CMakeFiles
Only in mysql-5.5.62/mysql-test/lib/My/SafeProcess: CTestTestfile.cmake
Only in mysql-5.5.62/mysql-test/lib/My/SafeProcess: my_safe_process.exe
Only in mysql-5.5.62/mysql-test/lib/My/SafeProcess: my_safe_process.map
Only in mysql-5.5.62/mysql-test/lib/My/SafeProcess: Makefile
Only in mysql-5.5.62/mysql-test: Makefile
Only in mysql-5.5.62/mysys: cmake_install.cmake
Only in mysql-5.5.62/mysys: CMakeFiles
diff -ur mysql-5.5.62-o/mysys/default.c mysql-5.5.62/mysys/default.c
--- mysql-5.5.62-o/mysys/default.c	2018-08-29 06:42:50.000000000 +0930
+++ mysql-5.5.62/mysys/default.c	2019-06-16 09:13:28.000000000 +0930
@@ -781,7 +781,7 @@
     strmov(name,config_file);
   }
   fn_format(name,name,"","",4);
-#if !defined(__WIN__)
+#if !defined(__WIN__) && !defined(__EMX__) 
   {
     MY_STAT stat_info;
     if (!my_stat(name,&stat_info,MYF(0)))
@@ -1225,7 +1225,10 @@
   errors += add_directory(alloc, "/etc/", dirs);
   errors += add_directory(alloc, "/etc/mysql/", dirs);
 
-#if defined(DEFAULT_SYSCONFDIR)
+#if defined(__EMX__) 
+  if ((env= getenv("ETC")))
+    errors += add_directory(alloc, env, dirs);
+#elif defined(DEFAULT_SYSCONFDIR)
   if (DEFAULT_SYSCONFDIR[0])
     errors += add_directory(alloc, DEFAULT_SYSCONFDIR, dirs);
 #endif /* DEFAULT_SYSCONFDIR */
Only in mysql-5.5.62/mysys: libmysys.a
diff -ur mysql-5.5.62-o/mysys/mf_pack.c mysql-5.5.62/mysys/mf_pack.c
--- mysql-5.5.62-o/mysys/mf_pack.c	2018-08-29 06:42:50.000000000 +0930
+++ mysql-5.5.62/mysys/mf_pack.c	2019-06-16 09:13:28.000000000 +0930
@@ -160,6 +160,11 @@
 #endif
     if (*pos == '/')
       *pos = FN_LIBCHAR;
+#ifdef __OS2__
+    if (*pos == '\\')
+      *pos = '/';
+
+#endif
     if (*pos == FN_LIBCHAR)
     {
       if ((size_t) (pos-start) > length && memcmp(pos-length,parent,length) == 0)
diff -ur mysql-5.5.62-o/mysys/mf_path.c mysql-5.5.62/mysys/mf_path.c
--- mysql-5.5.62-o/mysys/mf_path.c	2018-08-29 06:42:50.000000000 +0930
+++ mysql-5.5.62/mysys/mf_path.c	2019-06-16 09:13:28.000000000 +0930
@@ -74,7 +74,7 @@
 	/* test if file without filename is found in path */
 	/* Returns to if found and to has dirpart if found, else NullS */
 
-#if defined(__WIN__)
+#if defined(__WIN__) || defined(__EMX__)
 #define F_OK 0
 #define PATH_SEP ';'
 #define PROGRAM_EXTENSION ".exe"
@@ -107,7 +107,7 @@
       }
     }
   }
-#ifdef __WIN__
+#if defined(__WIN__) || defined(__EMX__)
   to[0]=FN_CURLIB;
   strxmov(to+1,dir,name,ext,NullS);
   if (!access(to,F_OK))			/* Test in current dir */
diff -ur mysql-5.5.62-o/mysys/mf_tempdir.c mysql-5.5.62/mysys/mf_tempdir.c
--- mysql-5.5.62-o/mysys/mf_tempdir.c	2018-08-29 06:42:50.000000000 +0930
+++ mysql-5.5.62/mysys/mf_tempdir.c	2019-06-16 09:13:28.000000000 +0930
@@ -16,7 +16,7 @@
 #include "mysys_priv.h"
 #include <m_string.h>
 
-#if defined(__WIN__)
+#if defined(__WIN__) || defined(__EMX__)
 #define DELIM ';'
 #else
 #define DELIM ':'
@@ -36,7 +36,7 @@
   {
     /* Get default temporary directory */
     pathlist=getenv("TMPDIR");	/* Use this if possible */
-#if defined(__WIN__)
+#if defined(__WIN__) || defined(__EMX__)
     if (!pathlist)
       pathlist=getenv("TEMP");
     if (!pathlist)
diff -ur mysql-5.5.62-o/mysys/mf_tempfile.c mysql-5.5.62/mysys/mf_tempfile.c
--- mysql-5.5.62-o/mysys/mf_tempfile.c	2018-08-29 06:42:50.000000000 +0930
+++ mysql-5.5.62/mysys/mf_tempfile.c	2019-06-16 09:13:28.000000000 +0930
@@ -100,7 +100,7 @@
     my_errno= tmp;
   }
 
-#elif defined(HAVE_MKSTEMP)
+#elif defined(HAVE_MKSTEMP) && !defined(__OS2__)
   {
     char prefix_buff[30];
     uint pfx_len;
@@ -137,6 +137,11 @@
     extern char **environ;
 
     char *res,**old_env,*temp_env[1];
+#ifdef __OS2__
+    // YD FIXME tempnam() will change current dir!!
+    char* cwd = getcwd(NULL,0);
+#endif
+
     if (dir && !dir[0])
     {				/* Change empty string to current dir */
       to[0]= FN_CURLIB;
@@ -165,7 +170,11 @@
     {
       DBUG_PRINT("error",("Got error: %d from tempnam",errno));
     }
-
+#ifdef __OS2__
+     // YD FIXME tempnam() will change current dir!!
+     _chdir2(cwd);
+     free(cwd);
+#endif
     environ=(const char**) old_env;
   }
 #else
diff -ur mysql-5.5.62-o/mysys/my_access.c mysql-5.5.62/mysys/my_access.c
--- mysql-5.5.62-o/mysys/my_access.c	2018-08-29 06:42:50.000000000 +0930
+++ mysql-5.5.62/mysys/my_access.c	2019-06-16 09:13:28.000000000 +0930
@@ -217,7 +217,7 @@
 #endif
 } /* is_filename_allowed */
 
-#if defined(__WIN__) || defined(__EMX__)
+#if defined(__WIN__)
 
 
 /*
@@ -263,4 +263,11 @@
   DBUG_RETURN(0);
 }
 
-#endif /* defined(__WIN__) || defined(__EMX__) */
+#endif /* defined(__WIN__) */
+
+#ifdef __EMX__
+int check_if_legal_filename(const char *path)
+{
+  return 0;
+}
+#endif /* __EMX__ */
diff -ur mysql-5.5.62-o/mysys/my_copy.c mysql-5.5.62/mysys/my_copy.c
--- mysql-5.5.62-o/mysys/my_copy.c	2018-08-29 06:42:50.000000000 +0930
+++ mysql-5.5.62/mysys/my_copy.c	2019-06-16 09:13:28.000000000 +0930
@@ -110,7 +110,7 @@
         my_error(EE_CHANGE_PERMISSIONS, MYF(ME_BELL+ME_WAITTANG), from, errno);
       goto err;
     }
-#if !defined(__WIN__)
+#if !defined(__WIN__) && !defined(__OS2__)
     /* Copy ownership */
     if (chown(to, stat_buff.st_uid, stat_buff.st_gid))
     {
diff -ur mysql-5.5.62-o/mysys/my_create.c mysql-5.5.62/mysys/my_create.c
--- mysql-5.5.62-o/mysys/my_create.c	2018-08-29 06:42:50.000000000 +0930
+++ mysql-5.5.62/mysys/my_create.c	2019-06-16 09:13:28.000000000 +0930
@@ -19,7 +19,7 @@
 #include "mysys_err.h"
 #include <errno.h>
 #include <my_sys.h>
-#if defined(_WIN32)
+#if defined(_WIN32) || defined(__OS2__)
 #include <share.h>
 #endif
 
@@ -42,6 +42,13 @@
 		   FileName, CreateFlags, access_flags, MyFlags));
 #if defined(_WIN32)
   fd= my_win_open(FileName, access_flags | O_CREAT);
+#elif defined(__OS2__) || defined(OS2)
+  if (access_flags & O_SHARE)
+    fd = open((char *) FileName, access_flags | O_CREAT | O_BINARY,
+	       SH_DENYNO, MY_S_IREAD | MY_S_IWRITE);
+  else
+    fd =  open((char *) FileName, access_flags | O_CREAT | O_BINARY,
+	       MY_S_IREAD | MY_S_IWRITE);
 #else
   fd= open((char *) FileName, access_flags | O_CREAT,
 	    CreateFlags ? CreateFlags : my_umask);
diff -ur mysql-5.5.62-o/mysys/my_file.c mysql-5.5.62/mysys/my_file.c
--- mysql-5.5.62-o/mysys/my_file.c	2018-08-29 06:42:50.000000000 +0930
+++ mysql-5.5.62/mysys/my_file.c	2019-06-16 09:13:28.000000000 +0930
@@ -71,6 +71,24 @@
   DBUG_RETURN(max_file_limit);
 }
 
+#elif defined (OS2)
+
+static uint set_max_open_files(uint max_file_limit)
+{
+  LONG     cbReqCount;
+  ULONG    cbCurMaxFH0;
+  APIRET   ulrc;
+  DBUG_ENTER("set_max_open_files");
+
+  /* get current limit */
+  cbReqCount = 0;
+  DosSetRelMaxFH( &cbReqCount, &cbCurMaxFH0);
+
+  /* set new limit */
+  if ((cbReqCount = max_file_limit - cbCurMaxFH0) > 0)
+    ulrc = DosSetRelMaxFH( &cbReqCount, &cbCurMaxFH0);
+  DBUG_RETURN(cbCurMaxFH0);
+}
 #else
 static uint set_max_open_files(uint max_file_limit)
 {
diff -ur mysql-5.5.62-o/mysys/my_getwd.c mysql-5.5.62/mysys/my_getwd.c
--- mysql-5.5.62-o/mysys/my_getwd.c	2018-08-29 06:42:50.000000000 +0930
+++ mysql-5.5.62/mysys/my_getwd.c	2019-06-16 09:13:28.000000000 +0930
@@ -26,6 +26,9 @@
 #include <dos.h>
 #include <direct.h>
 #endif
+#if defined(OS2)
+#include <direct.h>
+#endif
 
 /* Gets current working directory in buff.
 
@@ -134,6 +137,12 @@
     return (home_dir != NullS && test_if_hard_path(home_dir));
   if (dir_name[0] == FN_LIBCHAR)
     return (TRUE);
+#ifdef __EMX__
+  if ((dir_name[1] == FN_DEVCHAR)&&(dir_name[2] == FN_LIBCHAR))
+    return (TRUE);
+  if (dir_name[0] == "/")
+    return (TRUE);
+#endif
 #ifdef FN_DEVCHAR
   return (strchr(dir_name,FN_DEVCHAR) != 0);
 #else
diff -ur mysql-5.5.62-o/mysys/my_lib.c mysql-5.5.62/mysys/my_lib.c
--- mysql-5.5.62-o/mysys/my_lib.c	2018-08-29 06:42:50.000000000 +0930
+++ mysql-5.5.62/mysys/my_lib.c	2019-06-16 09:13:28.000000000 +0930
@@ -24,7 +24,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>
diff -ur mysql-5.5.62-o/mysys/my_open.c mysql-5.5.62/mysys/my_open.c
--- mysql-5.5.62-o/mysys/my_open.c	2018-08-29 06:42:50.000000000 +0930
+++ mysql-5.5.62/mysys/my_open.c	2019-06-16 09:13:28.000000000 +0930
@@ -43,6 +43,8 @@
 		   FileName, Flags, MyFlags));
 #if defined(_WIN32)
   fd= my_win_open(FileName, Flags);
+#elif defined(__OS2__)
+  fd = open((char *) FileName, Flags | O_BINARY | MY_S_IREAD | MY_S_IWRITE);
 #elif !defined(NO_OPEN_3)
   fd = open(FileName, Flags, my_umask);	/* Normal unix */
 #else
diff -ur mysql-5.5.62-o/mysys/my_pthread.c mysql-5.5.62/mysys/my_pthread.c
--- mysql-5.5.62-o/mysys/my_pthread.c	2018-08-29 06:42:50.000000000 +0930
+++ mysql-5.5.62/mysys/my_pthread.c	2019-06-16 09:13:28.000000000 +0930
@@ -117,7 +117,7 @@
 ** Author: Gary Wisniewski <garyw@spidereye.com.au>, much modified by Monty
 ****************************************************************************/
 
-#if !defined(HAVE_SIGWAIT) && !defined(sigwait) && !defined(__WIN__) && !defined(HAVE_rts_threads) && !defined(HAVE_NONPOSIX_SIGWAIT) && !defined(HAVE_DEC_3_2_THREADS)
+#if !defined(HAVE_SIGWAIT) && !defined(sigwait) && !defined(__WIN__) && !defined(OS2) && !defined(HAVE_rts_threads) && !defined(HAVE_NONPOSIX_SIGWAIT) && !defined(HAVE_DEC_3_2_THREADS)
 
 #if !defined(DONT_USE_SIGSUSPEND)
 
diff -ur mysql-5.5.62-o/mysys/my_redel.c mysql-5.5.62/mysys/my_redel.c
--- mysql-5.5.62-o/mysys/my_redel.c	2018-08-29 06:42:50.000000000 +0930
+++ mysql-5.5.62/mysys/my_redel.c	2019-06-16 09:13:28.000000000 +0930
@@ -102,7 +102,7 @@
     return -1;
   }
 
-#if !defined(__WIN__)
+#if !defined(__WIN__) && !defined(__EMX__)
   if (statbuf.st_nlink > 1 && MyFlags & MY_LINK_WARNING)
   {
     if (MyFlags & MY_LINK_WARNING)
diff -ur mysql-5.5.62-o/mysys/my_rename.c mysql-5.5.62/mysys/my_rename.c
--- mysql-5.5.62-o/mysys/my_rename.c	2018-08-29 06:42:50.000000000 +0930
+++ mysql-5.5.62/mysys/my_rename.c	2019-06-16 09:13:28.000000000 +0930
@@ -44,7 +44,7 @@
   }
 #endif
 #if defined(HAVE_RENAME)
-#if defined(__WIN__)
+#if defined(__WIN__) || defined(__EMX__)
   /*
     On windows we can't rename over an existing file:
     Remove any conflicting files:
diff -ur mysql-5.5.62-o/mysys/my_symlink.c mysql-5.5.62/mysys/my_symlink.c
--- mysql-5.5.62-o/mysys/my_symlink.c	2018-08-29 06:42:50.000000000 +0930
+++ mysql-5.5.62/mysys/my_symlink.c	2019-06-16 09:13:28.000000000 +0930
@@ -45,7 +45,11 @@
   if ((length=readlink(filename, to, FN_REFLEN-1)) < 0)
   {
     /* Don't give an error if this wasn't a symlink */
-    if ((my_errno=errno) == EINVAL)
+    my_errno=errno;
+    if (my_errno == EINVAL
+ || my_errno == EACCES 
+                            )
+
     {
       result= 1;
       strmov(to,filename);
diff -ur mysql-5.5.62-o/mysys/my_thr_init.c mysql-5.5.62/mysys/my_thr_init.c
--- mysql-5.5.62-o/mysys/my_thr_init.c	2018-08-29 06:42:50.000000000 +0930
+++ mysql-5.5.62/mysys/my_thr_init.c	2019-06-16 09:13:28.000000000 +0930
@@ -251,6 +251,10 @@
         fprintf(stderr,
                 "Error in my_thread_global_end(): %d threads didn't exit\n",
                 THR_thread_count);
+#ifdef __OS2__
+	if (getenv("DIEDIEDIE"))
+		*(char *)0 = 0;
+#endif
 #endif
       all_threads_killed= 0;
       break;
Only in mysql-5.5.62/mysys: Makefile
diff -ur mysql-5.5.62-o/mysys/string.c mysql-5.5.62/mysys/string.c
--- mysql-5.5.62-o/mysys/string.c	2018-08-29 06:42:50.000000000 +0930
+++ mysql-5.5.62/mysys/string.c	2019-06-16 09:13:28.000000000 +0930
@@ -140,7 +140,7 @@
 
 my_bool dynstr_append_os_quoted(DYNAMIC_STRING *str, const char *append, ...)
 {
-#ifdef __WIN__
+#if defined(__WIN__) || defined(__OS2__)
   const char *quote_str= "\"";
   const uint  quote_len= 1;
 #else
diff -ur mysql-5.5.62-o/mysys/thr_alarm.c mysql-5.5.62/mysys/thr_alarm.c
--- mysql-5.5.62-o/mysys/thr_alarm.c	2018-08-29 06:42:50.000000000 +0930
+++ mysql-5.5.62/mysys/thr_alarm.c	2019-06-16 09:13:28.000000000 +0930
@@ -847,7 +847,9 @@
     case SIGINT:
     case SIGQUIT:
     case SIGTERM:
+#ifndef OS2
     case SIGHUP:
+#endif
       printf("Aborting nicely\n");
       end_thr_alarm(0);
       break;
@@ -857,11 +859,13 @@
       exit(1);
       return 0;					/* Keep some compilers happy */
 #endif
+#ifndef OS2x
 #ifdef USE_ONE_SIGNAL_HAND
      case THR_SERVER_ALARM:
        process_alarm(sig);
       break;
 #endif
+#endif /* OS2 */
     }
   }
 }
Only in mysql-5.5.62/mysys: thr_lock.exe
Only in mysql-5.5.62/mysys: thr_lock.map
Only in mysql-5.5.62: Makefile
Only in mysql-5.5.62/packaging/rpm-docker: cmake_install.cmake
Only in mysql-5.5.62/packaging/rpm-docker: CMakeFiles
Only in mysql-5.5.62/packaging/rpm-docker: CTestTestfile.cmake
Only in mysql-5.5.62/packaging/rpm-docker: Makefile
Only in mysql-5.5.62/packaging/rpm-oel: cmake_install.cmake
Only in mysql-5.5.62/packaging/rpm-oel: CMakeFiles
Only in mysql-5.5.62/packaging/rpm-oel: CTestTestfile.cmake
Only in mysql-5.5.62/packaging/rpm-oel: Makefile
Only in mysql-5.5.62/packaging/rpm-sles: cmake_install.cmake
Only in mysql-5.5.62/packaging/rpm-sles: CMakeFiles
Only in mysql-5.5.62/packaging/rpm-sles: CTestTestfile.cmake
Only in mysql-5.5.62/packaging/rpm-sles: Makefile
Only in mysql-5.5.62/packaging/solaris: cmake_install.cmake
Only in mysql-5.5.62/packaging/solaris: CMakeFiles
Only in mysql-5.5.62/packaging/solaris: CTestTestfile.cmake
Only in mysql-5.5.62/packaging/solaris: Makefile
Only in mysql-5.5.62/packaging/WiX: cmake_install.cmake
Only in mysql-5.5.62/packaging/WiX: CMakeFiles
Only in mysql-5.5.62/packaging/WiX: CTestTestfile.cmake
Only in mysql-5.5.62/packaging/WiX: Makefile
Only in mysql-5.5.62: patch.log
Only in mysql-5.5.62/plugin/audit_null: cmake_install.cmake
Only in mysql-5.5.62/plugin/audit_null: CMakeFiles
Only in mysql-5.5.62/plugin/audit_null: Makefile
Only in mysql-5.5.62/plugin/auth: cmake_install.cmake
Only in mysql-5.5.62/plugin/auth: CMakeFiles
Only in mysql-5.5.62/plugin/auth: Makefile
Only in mysql-5.5.62/plugin/daemon_example: cmake_install.cmake
Only in mysql-5.5.62/plugin/daemon_example: CMakeFiles
diff -ur mysql-5.5.62-o/plugin/daemon_example/daemon_example.cc mysql-5.5.62/plugin/daemon_example/daemon_example.cc
--- mysql-5.5.62-o/plugin/daemon_example/daemon_example.cc	2018-08-29 06:42:50.000000000 +0930
+++ mysql-5.5.62/plugin/daemon_example/daemon_example.cc	2019-06-16 09:13:28.000000000 +0930
@@ -160,7 +160,9 @@
   time_t result= time(NULL);
   struct tm tm_tmp;
 
+#ifndef __OS2__
   pthread_cancel(con->heartbeat_thread);
+#endif
 
   localtime_r(&result, &tm_tmp);
   my_snprintf(buffer, sizeof(buffer),
Only in mysql-5.5.62/plugin/daemon_example: Makefile
Only in mysql-5.5.62/plugin/fulltext: cmake_install.cmake
Only in mysql-5.5.62/plugin/fulltext: CMakeFiles
Only in mysql-5.5.62/plugin/fulltext: Makefile
Only in mysql-5.5.62/plugin/semisync: cmake_install.cmake
Only in mysql-5.5.62/plugin/semisync: CMakeFiles
Only in mysql-5.5.62/plugin/semisync: Makefile
Only in mysql-5.5.62/regex: cmake_install.cmake
Only in mysql-5.5.62/regex: CMakeFiles
Only in mysql-5.5.62/regex: libregex.a
Only in mysql-5.5.62/regex: Makefile
Only in mysql-5.5.62/scripts: cmake_install.cmake
Only in mysql-5.5.62/scripts: comp_sql.exe
Only in mysql-5.5.62/scripts: comp_sql.map
Only in mysql-5.5.62/scripts: CMakeFiles
Only in mysql-5.5.62/scripts: CTestTestfile.cmake
Only in mysql-5.5.62/scripts: msql2mysql
Only in mysql-5.5.62/scripts: mysql_config
Only in mysql-5.5.62/scripts: mysql_config.pl
Only in mysql-5.5.62/scripts: mysql_convert_table_format
Only in mysql-5.5.62/scripts: mysql_find_rows
Only in mysql-5.5.62/scripts: mysql_fix_extensions
Only in mysql-5.5.62/scripts: mysql_fix_privilege_tables_sql.c
Only in mysql-5.5.62/scripts: mysql_fix_privilege_tables.sql
Only in mysql-5.5.62/scripts: mysql_install_db.pl
Only in mysql-5.5.62/scripts: mysql_secure_installation
Only in mysql-5.5.62/scripts: mysql_setpermission
Only in mysql-5.5.62/scripts: mysql_zap
Only in mysql-5.5.62/scripts: mysqlaccess
Only in mysql-5.5.62/scripts: mysqld_multi
Only in mysql-5.5.62/scripts: mysqld_safe
Only in mysql-5.5.62/scripts: mysqldumpslow
Only in mysql-5.5.62/scripts: mysqlhotcopy
Only in mysql-5.5.62/scripts: Makefile
Only in mysql-5.5.62/sql: cmake_install.cmake
Only in mysql-5.5.62/sql: CMakeFiles
Only in mysql-5.5.62/sql: CTestTestfile.cmake
Only in mysql-5.5.62/sql: gen_lex_hash.exe
Only in mysql-5.5.62/sql: gen_lex_hash.map
diff -ur mysql-5.5.62-o/sql/hostname.cc mysql-5.5.62/sql/hostname.cc
--- mysql-5.5.62-o/sql/hostname.cc	2018-08-29 06:42:50.000000000 +0930
+++ mysql-5.5.62/sql/hostname.cc	2019-06-16 10:17:00.000000000 +0930
@@ -30,6 +30,11 @@
 #ifndef __WIN__
 #include <netdb.h>        // getservbyname, servent
 #endif
+#ifdef __EMX__
+//#include <lwres/netdb.h>
+//#include <lwres/lwres.h>
+#define INET6_ADDRSTRLEN	(48)
+#endif
 #include "hash_filo.h"
 #include <m_ctype.h>
 #include "log.h"                                // sql_print_warning,
Only in mysql-5.5.62/sql: lex_hash.h
Only in mysql-5.5.62/sql: libpartition.a
Only in mysql-5.5.62/sql: libsql.a
diff -ur mysql-5.5.62-o/sql/log_event.h mysql-5.5.62/sql/log_event.h
--- mysql-5.5.62-o/sql/log_event.h	2018-08-29 06:42:50.000000000 +0930
+++ mysql-5.5.62/sql/log_event.h	2019-06-16 09:13:28.000000000 +0930
@@ -28,6 +28,10 @@
 #ifndef _log_event_h
 #define _log_event_h
 
+#ifdef __EMX__
+#undef write  // remove pthread.h macro definition, conflict with write() class member
+#endif
+
 #if defined(USE_PRAGMA_INTERFACE) && defined(MYSQL_SERVER)
 #pragma interface			/* gcc class implementation */
 #endif
diff -ur mysql-5.5.62-o/sql/log.cc mysql-5.5.62/sql/log.cc
--- mysql-5.5.62-o/sql/log.cc	2018-08-29 06:42:50.000000000 +0930
+++ mysql-5.5.62/sql/log.cc	2019-06-16 09:13:28.000000000 +0930
@@ -6093,6 +6093,15 @@
 }
 
 
+#if 0
+/*****************************************************************************
+** Instantiate templates
+*****************************************************************************/
+
+#ifdef __GNUC__
+template class I_List<i_string>;
+#endif
+#endif
 /********* transaction coordinator log for 2pc - mmap() based solution *******/
 
 /*
Only in mysql-5.5.62/sql: mysql_tzinfo_to_sql.exe
Only in mysql-5.5.62/sql: mysql_tzinfo_to_sql.map
diff -ur mysql-5.5.62-o/sql/mysqld.cc mysql-5.5.62/sql/mysqld.cc
--- mysql-5.5.62-o/sql/mysqld.cc	2018-08-29 06:42:50.000000000 +0930
+++ mysql-5.5.62/sql/mysqld.cc	2019-06-16 10:17:12.000000000 +0930
@@ -79,6 +79,14 @@
 #include "set_var.h"
 
 #include "rpl_injector.h"
+#ifdef __OS2__
+#define SHUT_RDWR 2
+#define INET6_ADDRSTRLEN	(48)
+// for win32 compatibility
+static int have_tcpip = 1;
+//#include <lwres/netdb.h>
+//#include <lwres/lwres.h>
+#endif
 
 #include "rpl_handler.h"
 
@@ -910,6 +918,10 @@
 static HANDLE hPipe = INVALID_HANDLE_VALUE;
 #endif
 
+#if defined(__OS2__) 
+pthread_cond_t eventShutdown;
+#endif
+
 #ifndef EMBEDDED_LIBRARY
 bool mysqld_embedded=0;
 #else
@@ -1026,7 +1038,7 @@
   flush_thread_cache();
 
   /* kill connection thread */
-#if !defined(__WIN__)
+#if !defined(__WIN__) && !defined(__OS2__)
   DBUG_PRINT("quit", ("waiting for select thread: 0x%lx",
                       (ulong) select_thread));
   mysql_mutex_lock(&LOCK_thread_count);
@@ -1246,6 +1258,11 @@
     */
   }
 #endif
+#elif defined(__OS2__)
+  // VAC++, IGCC have a per-thread signal model (instead of emx per-process)
+  // so cannot send (receive) signals to thread1 from thread>1
+  pthread_cond_signal(&eventShutdown);		// post semaphore
+
 #elif defined(HAVE_PTHREAD_KILL)
   if (pthread_kill(signal_thread, MYSQL_KILL_SIGNAL))
   {
@@ -1282,7 +1299,10 @@
     or stop, we just want to kill the server.
 */
 
-#if !defined(__WIN__)
+#ifdef __OS2__
+extern "C" void kill_server(int sig_ptr)
+#define RETURN_FROM_KILL_SERVER return
+#elif !defined(__WIN__)
 static void *kill_server(void *sig_ptr)
 #define RETURN_FROM_KILL_SERVER return 0
 #else
@@ -1301,8 +1321,10 @@
   }
   kill_in_progress=TRUE;
   abort_loop=1;					// This should be set
+#ifndef __OS2__
   if (sig != 0) // 0 is not a valid signal number
     my_sigset(sig, SIG_IGN);                    /* purify inspected */
+#endif
   if (sig == MYSQL_KILL_SIGNAL || sig == 0)
     sql_print_information(ER_DEFAULT(ER_NORMAL_SHUTDOWN),my_progname);
   else
@@ -1366,7 +1388,11 @@
   if (global_system_variables.log_warnings)
     sql_print_warning("Got signal %d from thread %ld", sig,my_thread_id());
 #ifdef SIGNAL_HANDLER_RESET_ON_DELIVERY
+#ifndef __OS2__
   my_sigset(sig,print_signal_warning);		/* int. thread system calls */
+#else
+  signal(sig, SIG_ACK);
+#endif
 #endif
 #if !defined(__WIN__)
   if (sig == SIGALRM)
@@ -1662,7 +1688,7 @@
 
 static struct passwd *check_user(const char *user)
 {
-#if !defined(__WIN__)
+#if !defined(__WIN__) && !defined(__OS2__)
   struct passwd *tmp_user_info;
   uid_t user_id= geteuid();
 
@@ -1727,7 +1753,7 @@
 static void set_user(const char *user, struct passwd *user_info_arg)
 {
   /* purecov: begin tested */
-#if !defined(__WIN__)
+#if !defined(__WIN__) && !defined(__OS2__)
   DBUG_ASSERT(user_info_arg != 0);
 #ifdef HAVE_INITGROUPS
   /*
@@ -1757,7 +1783,7 @@
 
 static void set_effective_user(struct passwd *user_info_arg)
 {
-#if !defined(__WIN__)
+#if !defined(__WIN__) && !defined(__OS2__)
   DBUG_ASSERT(user_info_arg != 0);
   if (setregid((gid_t)-1, user_info_arg->pw_gid) == -1)
   {
@@ -1776,7 +1802,7 @@
 /** Change root user if started with @c --chroot . */
 static void set_root(const char *path)
 {
-#if !defined(__WIN__)
+#if !defined(__WIN__) && !defined(__OS2__)
   if (chroot(path) == -1)
   {
     sql_perror("chroot");
@@ -2028,13 +2054,36 @@
   }
 #endif
 
-#if defined(HAVE_SYS_UN_H)
+#ifdef __OS2__00 
+  /* create named pipe */
+  if (!opt_bootstrap && opt_enable_named_pipe)
+  {
+    APIRET rc;
+    sprintf( szPipeName, "\\pipe\\%s", MYSQL_NAMEDPIPE);
+    rc = DosCreateNPipe(
+		      (PSZ)szPipeName,             // pipe name
+		      &hPipe,
+		      NP_ACCESS_DUPLEX,       // read/write access
+		      NP_WAIT | NP_READMODE_BYTE | NP_TYPE_BYTE |
+		      NP_UNLIMITED_INSTANCES,
+		      global_system_variables.net_buffer_length, // output buffer size
+		      global_system_variables.net_buffer_length, // input buffer size
+		      NP_INDEFINITE_WAIT);
+    if (rc != 0) {
+      printf( "server_init DosCreateNPipe failed with rc=%d", rc);
+   	unireg_abort(1);
+    }
+  }
+#endif
+
+#if defined(HAVE_SYS_UN_H) 
   /*
   ** Create the UNIX socket
   */
   if (mysqld_unix_port[0] && !opt_bootstrap)
   {
     DBUG_PRINT("general",("UNIX Socket is %s",mysqld_unix_port));
+printf("UNIX Socket is %s\n",mysqld_unix_port);
 
     if (strlen(mysqld_unix_port) > (sizeof(UNIXaddr.sun_path) - 1))
     {
@@ -2050,7 +2099,9 @@
     bzero((char*) &UNIXaddr, sizeof(UNIXaddr));
     UNIXaddr.sun_family = AF_UNIX;
     strmov(UNIXaddr.sun_path, mysqld_unix_port);
+#ifndef __OS2__
     (void) unlink(mysqld_unix_port);
+#endif
     arg= 1;
     (void) setsockopt(unix_sock,SOL_SOCKET,SO_REUSEADDR,(char*)&arg,
 		      sizeof(arg));
@@ -2509,7 +2560,67 @@
 static void check_data_home(const char *path)
 {}
 
-#endif /* __WIN__ */
+#elif defined(__OS2__)
+static void sig_reload(int signo)
+{
+
+
+	// Flush everything
+//  bool not_used;
+	reload_acl_and_cache((THD*) 0,
+			     (REFRESH_LOG | REFRESH_TABLES | REFRESH_FAST |
+			      REFRESH_STATUS | REFRESH_GRANT |
+			      REFRESH_THREADS | REFRESH_HOSTS),
+			     (TABLE_LIST*) 0, NULL); // Flush logs
+//	mysql_print_status((THD*) 0);		// Send debug some info - removed PS
+	signal(signo, SIG_ACK);
+}
+
+static void sig_kill(int signo)
+{
+  if (!kill_in_progress)
+  {
+    abort_loop=1;				// mark abort for threads
+    kill_server(signo);
+  }
+  signal(signo, SIG_ACK);
+}
+
+static void init_signals(void)
+{
+  signal(SIGQUIT, sig_kill);
+  signal(SIGKILL, sig_kill);
+  signal(SIGTERM, sig_kill);
+  signal(SIGINT,  sig_kill);
+  signal(SIGHUP,  sig_reload);	// Flush everything
+  signal(SIGALRM, SIG_IGN);
+  signal(SIGBREAK,SIG_IGN);
+  signal_thread = pthread_self();
+// new 2014-02-09
+  my_sigset(SIGPIPE,SIG_IGN);
+}
+
+static void start_signal_handler(void)
+{
+  // Save vm id of this process
+  if (!opt_bootstrap)
+    create_pid_file();
+
+  // YD FIXME: fast hack, will need to examine unix code better
+  /*
+    Setup alarm handler
+    This should actually be '+ max_number_of_slaves' instead of +10,
+    but the +10 should be quite safe.
+  */
+  init_thr_alarm(max_connections+global_system_variables.max_insert_delayed_threads+10);
+  // no signal handler
+}
+
+
+static void check_data_home(const char *path)
+{}
+ 
+#endif /* __WIN__ || __OS2__ */
 
 
 #if BACKTRACE_DEMANGLE
@@ -2522,7 +2633,7 @@
 
 
 
-#if !defined(__WIN__)
+#if !defined(__WIN__) && !defined(__OS2__)
 #ifndef SA_RESETHAND
 #define SA_RESETHAND 0
 #endif
@@ -2880,6 +2991,36 @@
 }
 #endif
 
+#if defined(__OS2__)
+// starts shutdown sequence: done with semaphore because signals are sent to thread handler
+// in VAC++ and Innotek GCC (beta3/4) instead of process signal handler (EMX)
+//
+extern "C" pthread_handler_decl(handle_shutdown,arg) // OS2
+{
+  my_thread_init();
+
+  // wait semaphore post for starting shutdown
+  pthread_cond_wait( &eventShutdown, NULL);
+
+  // close semaphore and kill server
+  //pthread_cond_destroy( &eventShutdown);
+
+  // Exit main loop on socket&namedpipe threads, so kill will be done from
+  // main thread (this is thread 2)
+  //abort_loop = 1;
+
+  // unblock select()
+  //so_cancel(ip_sock);
+  //so_cancel(unix_sock);
+
+  // call kill_server: previously I was invoking it from thread1 to avoid a crash in TCP32.DLL
+  // now (tcpip 4.3.2) it seems gone (or my code is better)
+  kill_server(MYSQL_KILL_SIGNAL);
+
+  return 0;
+}
+#endif
+
 const char *load_default_groups[]= {
 #ifdef WITH_NDBCLUSTER_STORAGE_ENGINE
 "mysql_cluster",
@@ -4211,6 +4352,12 @@
   // On "Stop Service" we have to do regular shutdown
   Service.SetShutdownEvent(hEventShutdown);
 #endif /* __WIN__ */
+#ifdef __OS2__
+   pthread_cond_init(&eventShutdown, NULL);
+   pthread_t hThread;
+   if (pthread_create(&hThread,&connection_attrib,handle_shutdown,0))
+     sql_print_warning("Can't create thread to handle shutdown requests");
+#endif
 }
 
 #endif /* EMBEDDED_LIBRARY */
@@ -4761,6 +4908,7 @@
       CloseHandle(hEventShutdown);
   }
 #endif
+
   clean_up(1);
   mysqld_exit(0);
 }
@@ -7006,10 +7154,11 @@
   shared_memory_base_name= default_shared_memory_base_name;
 #endif
 
-#if defined(__WIN__)
+#if defined(__WIN__) || defined(__OS2__)
   /* Allow Win32 users to move MySQL anywhere */
   {
     char prg_dev[LIBLEN];
+#if defined __WIN__
     char executing_path_name[LIBLEN];
     if (!test_if_hard_path(my_progname))
     {
@@ -7020,6 +7169,7 @@
       my_path(prg_dev, executing_path_name, NULL);
     }
     else
+#endif
       my_path(prg_dev, my_progname, "mysql/bin");
     strcat(prg_dev,"/../");			// Remove 'bin' to get base dir
     cleanup_dirname(mysql_home,prg_dev);
@@ -7563,9 +7713,14 @@
 
 static char *get_relative_path(const char *path)
 {
+#ifndef __OS2__
   if (test_if_hard_path(path) &&
       is_prefix(path,DEFAULT_MYSQL_HOME) &&
       strcmp(DEFAULT_MYSQL_HOME,FN_ROOTDIR))
+#else
+  if (is_prefix(path,DEFAULT_MYSQL_HOME) &&
+      (strcmp(DEFAULT_MYSQL_HOME,"/")||strcmp(DEFAULT_MYSQL_HOME,FN_ROOTDIR)))
+#endif
   {
     path+=(uint) strlen(DEFAULT_MYSQL_HOME);
     while (*path == FN_LIBCHAR || *path == FN_LIBCHAR2)
Only in mysql-5.5.62/sql: mysqld.exe
Only in mysql-5.5.62/sql: mysqld.map
Only in mysql-5.5.62/sql: Makefile
diff -ur mysql-5.5.62-o/sql/net_serv.cc mysql-5.5.62/sql/net_serv.cc
--- mysql-5.5.62-o/sql/net_serv.cc	2018-08-29 06:42:50.000000000 +0930
+++ mysql-5.5.62/sql/net_serv.cc	2019-06-16 09:13:28.000000000 +0930
@@ -133,7 +133,7 @@
   if (vio != 0)					/* If real connection */
   {
     net->fd  = vio_fd(vio);			/* For perl DBI/DBD */
-#if defined(MYSQL_SERVER) && !defined(__WIN__)
+#if defined(MYSQL_SERVER) && !defined(__WIN__) && !defined(__OS2__) 
     if (!(test_flags & TEST_BLOCKING))
     {
       my_bool old_mode;
@@ -636,7 +636,7 @@
     if ((long) (length= vio_write(net->vio,pos,(size_t) (end-pos))) <= 0)
     {
       my_bool interrupted = vio_should_retry(net->vio);
-#if !defined(__WIN__)
+#if (!defined(__WIN__) && !defined(__OS2__))
       if ((interrupted || length == 0) && !thr_alarm_in_use(&alarmed))
       {
         if (!thr_alarm(&alarmed, net->write_timeout, &alarm_buff))
@@ -663,7 +663,7 @@
 	}
       }
       else
-#endif /* !defined(__WIN__) */
+#endif /* (!defined(__WIN__) */
 	if (thr_alarm_in_use(&alarmed) && !thr_got_alarm(&alarmed) &&
 	    interrupted)
       {
@@ -838,7 +838,7 @@
 
 	  DBUG_PRINT("info",("vio_read returned %ld  errno: %d",
 			     (long) length, vio_errno(net->vio)));
-#if !defined(__WIN__) || defined(MYSQL_SERVER)
+#if (!defined(__WIN__) && !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
@@ -874,7 +874,7 @@
 	      continue;
 	    }
 	  }
-#endif /* (!defined(__WIN__) || defined(MYSQL_SERVER) */
+#endif /* (!defined(__WIN__) && !defined(__OS2__)) || defined(MYSQL_SERVER) */
 	  if (thr_alarm_in_use(&alarmed) && !thr_got_alarm(&alarmed) &&
 	      interrupted)
 	  {					/* Probably in MIT threads */
Only in mysql-5.5.62/sql/share: cmake_install.cmake
Only in mysql-5.5.62/sql/share: czech
Only in mysql-5.5.62/sql/share: CMakeFiles
Only in mysql-5.5.62/sql/share: CTestTestfile.cmake
Only in mysql-5.5.62/sql/share: danish
Only in mysql-5.5.62/sql/share: dutch
Only in mysql-5.5.62/sql/share: english
Only in mysql-5.5.62/sql/share: estonian
Only in mysql-5.5.62/sql/share: french
Only in mysql-5.5.62/sql/share: german
Only in mysql-5.5.62/sql/share: greek
Only in mysql-5.5.62/sql/share: hungarian
Only in mysql-5.5.62/sql/share: italian
Only in mysql-5.5.62/sql/share: japanese
Only in mysql-5.5.62/sql/share: japanese-sjis
Only in mysql-5.5.62/sql/share: korean
Only in mysql-5.5.62/sql/share: Makefile
Only in mysql-5.5.62/sql/share: norwegian
Only in mysql-5.5.62/sql/share: norwegian-ny
Only in mysql-5.5.62/sql/share: polish
Only in mysql-5.5.62/sql/share: portuguese
Only in mysql-5.5.62/sql/share: romanian
Only in mysql-5.5.62/sql/share: russian
Only in mysql-5.5.62/sql/share: serbian
Only in mysql-5.5.62/sql/share: slovak
Only in mysql-5.5.62/sql/share: spanish
Only in mysql-5.5.62/sql/share: swedish
Only in mysql-5.5.62/sql/share: ukrainian
diff -ur mysql-5.5.62-o/sql/spatial.cc mysql-5.5.62/sql/spatial.cc
--- mysql-5.5.62-o/sql/spatial.cc	2018-08-29 06:42:50.000000000 +0930
+++ mysql-5.5.62/sql/spatial.cc	2019-06-16 09:13:28.000000000 +0930
@@ -1986,4 +1986,13 @@
   return &geometrycollection_class;
 }
 
+#if 0
+/*****************************************************************************
+** Instantiate templates
+*****************************************************************************/
+
+#ifdef __GNUC__
+template class I_List<i_string>;
+#endif
+#endif
 #endif /*HAVE_SPATIAL*/
diff -ur mysql-5.5.62-o/sql/sql_acl.cc mysql-5.5.62/sql/sql_acl.cc
--- mysql-5.5.62-o/sql/sql_acl.cc	2018-08-29 06:42:50.000000000 +0930
+++ mysql-5.5.62/sql/sql_acl.cc	2019-06-16 10:54:34.000000000 +0930
@@ -51,6 +51,11 @@
 #include "sql_db.h"
 #include "sql_array.h"
 #include "debug_sync.h"
+#ifdef __OS2__
+extern "C" {
+size_t   strnlen(const char *, size_t);
+}
+#endif
 
 bool mysql_user_table_is_in_short_password_format= false;
 
Only in mysql-5.5.62/sql: sql_builtin.cc
diff -ur mysql-5.5.62-o/sql/sql_connect.cc mysql-5.5.62/sql/sql_connect.cc
--- mysql-5.5.62-o/sql/sql_connect.cc	2018-08-29 06:42:50.000000000 +0930
+++ mysql-5.5.62/sql/sql_connect.cc	2019-06-16 10:17:26.000000000 +0930
@@ -37,7 +37,10 @@
                       // reset_host_errors
 #include "sql_acl.h"  // acl_getroot, NO_ACCESS, SUPER_ACL
 #include "sql_callback.h"
-
+#ifdef __OS2__
+//#include <lwres/netdb.h>
+//#include <lwres/lwres.h>
+#endif
 
 #if defined(HAVE_OPENSSL) && !defined(EMBEDDED_LIBRARY)
 /*
diff -ur mysql-5.5.62-o/sql/sql_lex.cc mysql-5.5.62/sql/sql_lex.cc
--- mysql-5.5.62-o/sql/sql_lex.cc	2018-08-29 06:42:50.000000000 +0930
+++ mysql-5.5.62/sql/sql_lex.cc	2019-06-16 09:13:28.000000000 +0930
@@ -16,6 +16,7 @@
 
 
 /* A lexical scanner on a temporary buffer with a yacc interface */
+#define INCL_NOPMAPI
 
 #define MYSQL_LEX 1
 #include "sql_priv.h"
diff -ur mysql-5.5.62-o/sql/sql_load.cc mysql-5.5.62/sql/sql_load.cc
--- mysql-5.5.62-o/sql/sql_load.cc	2018-08-29 06:42:50.000000000 +0930
+++ mysql-5.5.62/sql/sql_load.cc	2019-06-16 09:13:28.000000000 +0930
@@ -430,7 +430,7 @@
       DBUG_RETURN(TRUE);
     }
 
-#if !defined(__WIN__) && ! defined(__NETWARE__)
+#if !defined(__WIN__) && ! defined(__NETWARE__) && !defined(OS2)
     MY_STAT stat_info;
     if (!my_stat(name, &stat_info, MYF(MY_WME)))
       DBUG_RETURN(TRUE);
diff -ur mysql-5.5.62-o/sql/sql_show.cc mysql-5.5.62/sql/sql_show.cc
--- mysql-5.5.62-o/sql/sql_show.cc	2018-08-29 06:42:50.000000000 +0930
+++ mysql-5.5.62/sql/sql_show.cc	2019-06-16 09:13:28.000000000 +0930
@@ -1064,6 +1064,8 @@
   if (filename && !(thd->variables.sql_mode & MODE_NO_DIR_IN_CREATE))
   {
     uint length= dirname_length(filename);
+    if (length>0)
+    {
     packet->append(' ');
     packet->append(dir_type);
     packet->append(STRING_WITH_LEN(" DIRECTORY='"));
@@ -1080,6 +1082,7 @@
 #endif
     packet->append(filename, length);
     packet->append('\'');
+    }
   }
 }
 
Only in mysql-5.5.62/sql-bench: bench-count-distinct
Only in mysql-5.5.62/sql-bench: bench-init.pl
Only in mysql-5.5.62/sql-bench: cmake_install.cmake
Only in mysql-5.5.62/sql-bench: compare-results
Only in mysql-5.5.62/sql-bench: copy-db
Only in mysql-5.5.62/sql-bench: crash-me
Only in mysql-5.5.62/sql-bench: CMakeFiles
Only in mysql-5.5.62/sql-bench: CTestTestfile.cmake
Only in mysql-5.5.62/sql-bench: graph-compare-results
Only in mysql-5.5.62/sql-bench: innotest1
Only in mysql-5.5.62/sql-bench: innotest1a
Only in mysql-5.5.62/sql-bench: innotest1b
Only in mysql-5.5.62/sql-bench: innotest2
Only in mysql-5.5.62/sql-bench: innotest2a
Only in mysql-5.5.62/sql-bench: innotest2b
Only in mysql-5.5.62/sql-bench: Makefile
Only in mysql-5.5.62/sql-bench: run-all-tests
Only in mysql-5.5.62/sql-bench: server-cfg
Only in mysql-5.5.62/sql-bench: test-alter-table
Only in mysql-5.5.62/sql-bench: test-ATIS
Only in mysql-5.5.62/sql-bench: test-big-tables
Only in mysql-5.5.62/sql-bench: test-connect
Only in mysql-5.5.62/sql-bench: test-create
Only in mysql-5.5.62/sql-bench: test-insert
Only in mysql-5.5.62/sql-bench: test-select
Only in mysql-5.5.62/sql-bench: test-transactions
Only in mysql-5.5.62/sql-bench: test-wisconsin
diff -ur mysql-5.5.62-o/sql-common/client.c mysql-5.5.62/sql-common/client.c
--- mysql-5.5.62-o/sql-common/client.c	2018-08-29 06:42:50.000000000 +0930
+++ mysql-5.5.62/sql-common/client.c	2019-06-16 10:16:40.000000000 +0930
@@ -129,7 +129,7 @@
 static void mysql_close_free(MYSQL *mysql);
 static void mysql_prune_stmt_list(MYSQL *mysql);
 
-#if !defined(__WIN__)
+#if !defined(__WIN__) && !defined(__OS2__)
 static int wait_for_data(my_socket fd, uint timeout);
 #endif
 
@@ -151,7 +151,7 @@
 int my_connect(my_socket fd, const struct sockaddr *name, uint namelen,
 	       uint timeout)
 {
-#if defined(__WIN__)
+#if defined(__WIN__) || defined(__OS2__)
   DBUG_ENTER("my_connect");
   DBUG_RETURN(connect(fd, (struct sockaddr*) name, namelen));
 #else
@@ -196,7 +196,7 @@
   If not, we will use select()
 */
 
-#if !defined(__WIN__)
+#if !defined(__WIN__) && !defined(__OS2__)
 
 static int wait_for_data(my_socket fd, uint timeout)
 {
@@ -319,7 +319,7 @@
   DBUG_RETURN(0);					/* ok */
 #endif /* HAVE_POLL */
 }
-#endif /* !defined(__WIN__) */
+#endif /* !defined(__WIN__) && !defined(__OS2__) */
 
 /**
   Set the internal error message to mysql handler
Only in mysql-5.5.62/storage/archive: cmake_install.cmake
Only in mysql-5.5.62/storage/archive: CMakeFiles
Only in mysql-5.5.62/storage/archive: Makefile
Only in mysql-5.5.62/storage/blackhole: cmake_install.cmake
Only in mysql-5.5.62/storage/blackhole: CMakeFiles
Only in mysql-5.5.62/storage/blackhole: Makefile
Only in mysql-5.5.62/storage/csv: cmake_install.cmake
Only in mysql-5.5.62/storage/csv: CMakeFiles
diff -ur mysql-5.5.62-o/storage/csv/ha_tina.cc mysql-5.5.62/storage/csv/ha_tina.cc
--- mysql-5.5.62-o/storage/csv/ha_tina.cc	2018-08-29 06:42:50.000000000 +0930
+++ mysql-5.5.62/storage/csv/ha_tina.cc	2019-06-16 09:13:28.000000000 +0930
@@ -41,6 +41,12 @@
  -Brian
 */
 
+#ifdef __OS2__
+#define WITH_CSV_STORAGE_ENGINE 1
+#endif
+
+#ifdef WITH_CSV_STORAGE_ENGINE
+
 #ifdef USE_PRAGMA_IMPLEMENTATION
 #pragma implementation        // gcc: Class implementation
 #endif
@@ -1771,3 +1777,4 @@
 }
 mysql_declare_plugin_end;
 
+#endif /* WITH_CSV_STORAGE_ENGINE */
\ No newline at end of file
Only in mysql-5.5.62/storage/csv: libcsv.a
Only in mysql-5.5.62/storage/csv: Makefile
Only in mysql-5.5.62/storage/example: cmake_install.cmake
Only in mysql-5.5.62/storage/example: CMakeFiles
Only in mysql-5.5.62/storage/example: Makefile
Only in mysql-5.5.62/storage/federated: cmake_install.cmake
Only in mysql-5.5.62/storage/federated: CMakeFiles
Only in mysql-5.5.62/storage/federated: Makefile
Only in mysql-5.5.62/storage/heap: cmake_install.cmake
Only in mysql-5.5.62/storage/heap: CMakeFiles
Only in mysql-5.5.62/storage/heap: hp_test1.exe
Only in mysql-5.5.62/storage/heap: hp_test1.map
Only in mysql-5.5.62/storage/heap: hp_test2.exe
Only in mysql-5.5.62/storage/heap: hp_test2.map
Only in mysql-5.5.62/storage/heap: libheap.a
Only in mysql-5.5.62/storage/heap: Makefile
diff -ur mysql-5.5.62-o/storage/innobase/buf/buf0buf.c mysql-5.5.62/storage/innobase/buf/buf0buf.c
--- mysql-5.5.62-o/storage/innobase/buf/buf0buf.c	2018-08-29 06:42:50.000000000 +0930
+++ mysql-5.5.62/storage/innobase/buf/buf0buf.c	2019-06-16 09:13:28.000000000 +0930
@@ -1293,6 +1293,11 @@
 	ulint		i;
 	const ulint	size	= total_size / n_instances;
 
+#ifdef __OS2__x
+  max_size = min(6144, max_size); 
+  curr_size = min(6144, curr_size); 
+  n_frames = min(6144, n_frames); 
+#endif
 	ut_ad(n_instances > 0);
 	ut_ad(n_instances <= MAX_BUFFER_POOLS);
 	ut_ad(n_instances == srv_buf_pool_instances);
Only in mysql-5.5.62/storage/innobase: cmake_install.cmake
Only in mysql-5.5.62/storage/innobase: CMakeFiles
diff -ur mysql-5.5.62-o/storage/innobase/dict/dict0dict.c mysql-5.5.62/storage/innobase/dict/dict0dict.c
--- mysql-5.5.62-o/storage/innobase/dict/dict0dict.c	2018-08-29 06:42:50.000000000 +0930
+++ mysql-5.5.62/storage/innobase/dict/dict0dict.c	2019-06-16 09:13:28.000000000 +0930
@@ -3333,7 +3333,7 @@
 		memcpy(ref + database_name_len + 1, table_name, table_name_len + 1);
 
 	} else {
-#ifndef __WIN__
+#if !defined(__WIN__) && !defined(__EMX__)
 		if (innobase_get_lower_case_table_names() == 1) {
 			innobase_casedn_str(ref);
 		}
diff -ur mysql-5.5.62-o/storage/innobase/fil/fil0fil.c mysql-5.5.62/storage/innobase/fil/fil0fil.c
--- mysql-5.5.62-o/storage/innobase/fil/fil0fil.c	2018-08-29 06:42:50.000000000 +0930
+++ mysql-5.5.62/storage/innobase/fil/fil0fil.c	2019-06-16 09:13:28.000000000 +0930
@@ -3387,7 +3387,7 @@
 	sprintf(filepath, "%s/%s/%s", fil_path_to_mysql_datadir, dbname,
 		filename);
 	srv_normalize_path_for_win(filepath);
-#ifdef __WIN__
+#if defined(__WIN__) || defined(__EMX__)
 # ifndef UNIV_HOTBACKUP
 	/* If lower_case_table_names is 0 or 2, then MySQL allows database
 	directory names with upper case letters. On Windows, all table and
@@ -4790,7 +4790,7 @@
 				fil_n_pending_log_flushes++;
 				fil_n_log_flushes++;
 			}
-#ifdef __WIN__
+#if defined(__WIN__) || defined(__EMX__)
 			if (node->is_raw_disk) {
 
 				goto skip_flush;
diff -ur mysql-5.5.62-o/storage/innobase/handler/ha_innodb.cc mysql-5.5.62/storage/innobase/handler/ha_innodb.cc
--- mysql-5.5.62-o/storage/innobase/handler/ha_innodb.cc	2018-08-29 06:42:50.000000000 +0930
+++ mysql-5.5.62/storage/innobase/handler/ha_innodb.cc	2019-06-16 09:13:28.000000000 +0930
@@ -1901,7 +1901,7 @@
 	norm_name[strlen(norm_name)] = '/'; /* InnoDB uses '/' as the
 					    separator between db and table */
 	norm_name[full_name_len] = '\0';
-#ifdef __WIN__
+#if defined(__WIN__) || defined(__EMX__)
 	innobase_casedn_str(norm_name);
 #endif
 
@@ -3298,7 +3298,7 @@
 }
 
 /** Always normalize table name to lower case on Windows */
-#ifdef __WIN__
+#if defined(__WIN__) || defined(__EMX__)
 #define normalize_table_name(norm_name, name)		\
 	normalize_table_name_low(norm_name, name, TRUE)
 #else
@@ -3864,7 +3864,7 @@
 
 	/* We look for pattern #P# to see if the table is partitioned
 	MySQL table. */
-#ifdef __WIN__
+#if defined(__WIN__) || defined(__EMX__)
 	is_part = strstr(norm_name, "#p#");
 #else
 	is_part = strstr(norm_name, "#P#");
@@ -3902,7 +3902,7 @@
 			if (innobase_get_lower_case_table_names() == 1) {
 
 				if (!par_case_name_set) {
-#ifndef __WIN__
+#if !defined(__WIN__) && !defined(__EMX__)
 					/* Check for the table using lower
 					case name, including the partition
 					separator "P" */
@@ -3925,7 +3925,7 @@
 					par_case_name, FALSE, ignore_err);
 			}
 			if (ib_table) {
-#ifndef __WIN__
+#if !defined(__WIN__) && !defined(__EMX__)
 				sql_print_warning("Partition table %s opened "
 						  "after converting to lower "
 						  "case. The table may have "
@@ -7594,7 +7594,7 @@
 	memcpy(namebuf, ptr, len);
 	namebuf[len] = '/';
 	namebuf[len + 1] = '\0';
-#ifdef	__WIN__
+#if defined(__WIN__) || defined(__OS2__)
 	innobase_casedn_str(namebuf);
 #endif
 #if defined __WIN__ && !defined MYSQL_SERVER
diff -ur mysql-5.5.62-o/storage/innobase/include/os0thread.h mysql-5.5.62/storage/innobase/include/os0thread.h
--- mysql-5.5.62-o/storage/innobase/include/os0thread.h	2018-08-29 06:42:50.000000000 +0930
+++ mysql-5.5.62/storage/innobase/include/os0thread.h	2019-06-16 09:13:28.000000000 +0930
@@ -35,7 +35,6 @@
 
 #define	OS_THREAD_MAX_N		srv_max_n_threads
 
-
 /* Possible fixed priorities for threads */
 #define OS_THREAD_PRIORITY_NONE		100
 #define OS_THREAD_PRIORITY_BACKGROUND	1
diff -ur mysql-5.5.62-o/storage/innobase/include/univ.i mysql-5.5.62/storage/innobase/include/univ.i
--- mysql-5.5.62-o/storage/innobase/include/univ.i	2018-08-29 06:42:50.000000000 +0930
+++ mysql-5.5.62/storage/innobase/include/univ.i	2019-06-16 09:13:28.000000000 +0930
@@ -389,7 +389,7 @@
 typedef unsigned long long int	ullint;
 #endif /* UNIV_HOTBACKUP */
 
-#ifndef __WIN__
+#if !defined(__WIN__) && !defined(__OS2__x)
 #if SIZEOF_LONG != SIZEOF_VOIDP
 #error "Error: InnoDB's ulint must be of the same size as void*"
 #endif
Only in mysql-5.5.62/storage/innobase: libinnobase.a
Only in mysql-5.5.62/storage/innobase: Makefile
diff -ur mysql-5.5.62-o/storage/innobase/os/os0file.c mysql-5.5.62/storage/innobase/os/os0file.c
--- mysql-5.5.62-o/storage/innobase/os/os0file.c	2018-08-29 06:42:50.000000000 +0930
+++ mysql-5.5.62/storage/innobase/os/os0file.c	2019-06-16 09:13:28.000000000 +0930
@@ -659,7 +659,7 @@
 
 #undef USE_FILE_LOCK
 #define USE_FILE_LOCK
-#if defined(UNIV_HOTBACKUP) || defined(__WIN__)
+#if defined(UNIV_HOTBACKUP) || defined(__WIN__) || defined(__OS2__)
 /* InnoDB Hot Backup does not lock the data files.
  * On Windows, mandatory locking is used.
  */
@@ -1171,6 +1171,10 @@
 		ut_error;
 	}
 
+#if defined(__EMX__)
+       create_flag |= O_BINARY;
+#endif
+
 	if (create_mode == OS_FILE_CREATE) {
 		file = open(name, create_flag, S_IRUSR | S_IWUSR
 			    | S_IRGRP | S_IWGRP);
@@ -1572,6 +1576,10 @@
 	}
 #endif /* O_SYNC */
 
+#if defined(__EMX__)
+       create_flag |= O_BINARY;
+#endif
+
 	file = open(name, create_flag, os_innodb_umask);
 
 	if (file == -1) {
@@ -3037,7 +3045,7 @@
 }
 
 /* path name separator character */
-#ifdef __WIN__
+#if defined(__WIN__) || defined(__EMX__)
 #  define OS_FILE_PATH_SEPARATOR	'\\'
 #else
 #  define OS_FILE_PATH_SEPARATOR	'/'
diff -ur mysql-5.5.62-o/storage/innobase/os/os0thread.c mysql-5.5.62/storage/innobase/os/os0thread.c
--- mysql-5.5.62-o/storage/innobase/os/os0thread.c	2018-08-29 06:42:50.000000000 +0930
+++ mysql-5.5.62/storage/innobase/os/os0thread.c	2019-06-16 09:13:28.000000000 +0930
@@ -250,6 +250,8 @@
 {
 #ifdef __WIN__
 	Sleep((DWORD) tm / 1000);
+#elif defined(__EMX__)
+	DosSleep(tm / 1000);
 #else
 	struct timeval	t;
 
diff -ur mysql-5.5.62-o/storage/innobase/srv/srv0srv.c mysql-5.5.62/storage/innobase/srv/srv0srv.c
--- mysql-5.5.62-o/storage/innobase/srv/srv0srv.c	2018-08-29 06:42:50.000000000 +0930
+++ mysql-5.5.62/storage/innobase/srv/srv0srv.c	2019-06-16 09:13:28.000000000 +0930
@@ -600,7 +600,7 @@
 priority, so that they are always in background. Some of them
 may dynamically boost their priority by the pri_adjust function,
 even to higher than normal priority, if their task becomes urgent.
-The running of utilities is controlled by high- and low-water marks
+The running off utilities is controlled by high- and low-water marks
 of urgency. The urgency may be measured by the number of dirty blocks
 in the buffer pool, in the case of the flush thread, for example.
 When the high-water mark is exceeded, an utility starts running, until
@@ -1447,7 +1447,11 @@
 	srv_log_buffer_size = srv_log_buffer_size / UNIV_PAGE_SIZE;
 
 	srv_lock_table_size = 5 * (srv_buf_pool_size / UNIV_PAGE_SIZE);
-
+#ifdef __OS2__
+	if (srv_lock_table_size > 30000){
+		srv_lock_table_size = 30000;
+	}
+#endif
 	return(DB_SUCCESS);
 }
 
diff -ur mysql-5.5.62-o/storage/innobase/srv/srv0start.c mysql-5.5.62/storage/innobase/srv/srv0start.c
--- mysql-5.5.62-o/storage/innobase/srv/srv0start.c	2018-08-29 06:42:50.000000000 +0930
+++ mysql-5.5.62/storage/innobase/srv/srv0start.c	2019-06-16 09:13:28.000000000 +0930
@@ -497,7 +497,7 @@
 }
 #endif /* !UNIV_HOTBACKUP */
 
-#ifdef __WIN__
+#if defined(__WIN__) || defined(__EMX__)
 #define SRV_PATH_SEPARATOR	'\\'
 #else
 #define SRV_PATH_SEPARATOR	'/'
@@ -1285,6 +1285,11 @@
 	maximum number of threads that can wait in the 'srv_conc array' for
 	their time to enter InnoDB. */
 
+#if defined(__OS2__)
+	/* too many threads causes crashes on OS/2 */
+	srv_buf_pool_instances = 1;
+        srv_max_n_threads = 500;
+#else
 	if (srv_buf_pool_size >= 1000 * 1024 * 1024) {
 		/* If buffer pool is less than 1000 MB,
 		assume fewer threads. Also use only one
@@ -1301,7 +1306,7 @@
 						especially in 64-bit
 						computers */
 	}
-
+#endif
 	err = srv_boot();
 
 	if (err != DB_SUCCESS) {
Only in mysql-5.5.62/storage/myisam: cmake_install.cmake
Only in mysql-5.5.62/storage/myisam: CMakeFiles
Only in mysql-5.5.62/storage/myisam: libmyisam.a
diff -ur mysql-5.5.62-o/storage/myisam/mi_extra.c mysql-5.5.62/storage/myisam/mi_extra.c
--- mysql-5.5.62-o/storage/myisam/mi_extra.c	2018-08-29 06:42:50.000000000 +0930
+++ mysql-5.5.62/storage/myisam/mi_extra.c	2019-06-16 09:13:28.000000000 +0930
@@ -259,7 +259,7 @@
   case HA_EXTRA_PREPARE_FOR_DROP:
     mysql_mutex_lock(&THR_LOCK_myisam);
     share->last_version= 0L;			/* Impossible version */
-#ifdef __WIN__REMOVE_OBSOLETE_WORKAROUND
+#if defined(__WIN__REMOVE_OBSOLETE_WORKAROUND) || defined(__EMX__)
     /* Close the isam and data files as Win32 can't drop an open table */
     mysql_mutex_lock(&share->intern_lock);
     if (flush_key_blocks(share->key_cache, share->kfile,
diff -ur mysql-5.5.62-o/storage/myisam/mi_locking.c mysql-5.5.62/storage/myisam/mi_locking.c
--- mysql-5.5.62-o/storage/myisam/mi_locking.c	2018-08-29 06:42:50.000000000 +0930
+++ mysql-5.5.62/storage/myisam/mi_locking.c	2019-06-16 09:13:28.000000000 +0930
@@ -453,7 +453,7 @@
       share->state.update_count= info->last_loop= ++info->this_loop;
       if ((error=mi_state_info_write(share->kfile, &share->state, 1)))
 	olderror=my_errno;
-#ifdef _WIN32
+#if defined(__WIN__) || defined(__EMX__)
       if (myisam_flush)
       {
         if (share->file_map)
Only in mysql-5.5.62/storage/myisam: mi_locking.c.orig
Only in mysql-5.5.62/storage/myisam: myisam_ftdump.exe
Only in mysql-5.5.62/storage/myisam: myisam_ftdump.map
diff -ur mysql-5.5.62-o/storage/myisam/myisamchk.c mysql-5.5.62/storage/myisam/myisamchk.c
--- mysql-5.5.62-o/storage/myisam/myisamchk.c	2018-08-29 06:42:50.000000000 +0930
+++ mysql-5.5.62/storage/myisam/myisamchk.c	2019-06-16 09:13:28.000000000 +0930
@@ -28,6 +28,10 @@
 #include <sys/mman.h>
 #endif
 
+#ifdef __EMX__
+#define _sanity(a,b)
+#endif
+
 static uint decode_bits;
 static char **default_argv;
 static const char *load_default_groups[]= { "myisamchk", 0 };
@@ -82,6 +86,10 @@
   MY_INIT(argv[0]);
   my_progname_short= my_progname+dirname_length(my_progname);
 
+#ifdef __EMX__
+  _wildcard (&argc, &argv);
+#endif
+
   myisamchk_init(&check_param);
   check_param.opt_lock_memory=1;		/* Lock memory if possible */
   check_param.using_global_keycache = 0;
@@ -358,7 +366,7 @@
   -?, --help          Display this help and exit.\n\
   -t, --tmpdir=path   Path for temporary files. Multiple paths can be\n\
                       specified, separated by ");
-#if defined( __WIN__)
+#if defined( __WIN__) || defined(__OS2__)
    printf("semicolon (;)");
 #else
    printf("colon (:)");
Only in mysql-5.5.62/storage/myisam: myisamchk.exe
Only in mysql-5.5.62/storage/myisam: myisamchk.map
Only in mysql-5.5.62/storage/myisam: myisamlog.exe
Only in mysql-5.5.62/storage/myisam: myisamlog.map
Only in mysql-5.5.62/storage/myisam: myisampack.exe
Only in mysql-5.5.62/storage/myisam: myisampack.map
Only in mysql-5.5.62/storage/myisam: Makefile
Only in mysql-5.5.62/storage/myisammrg: cmake_install.cmake
Only in mysql-5.5.62/storage/myisammrg: CMakeFiles
Only in mysql-5.5.62/storage/myisammrg: libmyisammrg.a
Only in mysql-5.5.62/storage/myisammrg: Makefile
Only in mysql-5.5.62/storage/perfschema: cmake_install.cmake
Only in mysql-5.5.62/storage/perfschema: CMakeFiles
Only in mysql-5.5.62/storage/perfschema: CTestTestfile.cmake
Only in mysql-5.5.62/storage/perfschema: libperfschema.a
Only in mysql-5.5.62/storage/perfschema: Makefile
Only in mysql-5.5.62/storage/perfschema/unittest: cmake_install.cmake
Only in mysql-5.5.62/storage/perfschema/unittest: CMakeFiles
Only in mysql-5.5.62/storage/perfschema/unittest: CTestTestfile.cmake
Only in mysql-5.5.62/storage/perfschema/unittest: Makefile
Only in mysql-5.5.62/storage/perfschema/unittest: pfs_instr_class-oom-t.exe
Only in mysql-5.5.62/storage/perfschema/unittest: pfs_instr_class-oom-t.map
Only in mysql-5.5.62/storage/perfschema/unittest: pfs_instr_class-t.exe
Only in mysql-5.5.62/storage/perfschema/unittest: pfs_instr_class-t.map
Only in mysql-5.5.62/storage/perfschema/unittest: pfs_instr-oom-t.exe
Only in mysql-5.5.62/storage/perfschema/unittest: pfs_instr-oom-t.map
Only in mysql-5.5.62/storage/perfschema/unittest: pfs_instr-t.exe
Only in mysql-5.5.62/storage/perfschema/unittest: pfs_instr-t.map
Only in mysql-5.5.62/storage/perfschema/unittest: pfs-t.exe
Only in mysql-5.5.62/storage/perfschema/unittest: pfs-t.map
Only in mysql-5.5.62/strings: cmake_install.cmake
Only in mysql-5.5.62/strings: CMakeFiles
Only in mysql-5.5.62/strings: libstrings.a
Only in mysql-5.5.62/strings: Makefile
Only in mysql-5.5.62/support-files: cmake_install.cmake
Only in mysql-5.5.62/support-files: CMakeFiles
Only in mysql-5.5.62/support-files: CTestTestfile.cmake
Only in mysql-5.5.62/support-files: my-huge.cnf
Only in mysql-5.5.62/support-files: my-innodb-heavy-4G.cnf
Only in mysql-5.5.62/support-files: my-large.cnf
Only in mysql-5.5.62/support-files: my-medium.cnf
Only in mysql-5.5.62/support-files: my-small.cnf
Only in mysql-5.5.62/support-files: Makefile
Only in mysql-5.5.62/tests: bug25714.exe
Only in mysql-5.5.62/tests: bug25714.map
Only in mysql-5.5.62/tests: cmake_install.cmake
Only in mysql-5.5.62/tests: CMakeFiles
Only in mysql-5.5.62/tests: CTestTestfile.cmake
Only in mysql-5.5.62/tests: mysql_client_test.exe
Only in mysql-5.5.62/tests: mysql_client_test.map
Only in mysql-5.5.62/tests: Makefile
Only in mysql-5.5.62/unittest/my_decimal: cmake_install.cmake
Only in mysql-5.5.62/unittest/my_decimal: CMakeFiles
Only in mysql-5.5.62/unittest/my_decimal: CTestTestfile.cmake
Only in mysql-5.5.62/unittest/my_decimal: my_decimal-t.exe
Only in mysql-5.5.62/unittest/my_decimal: my_decimal-t.map
Only in mysql-5.5.62/unittest/my_decimal: Makefile
Only in mysql-5.5.62/unittest/mysys: base64-t.exe
Only in mysql-5.5.62/unittest/mysys: base64-t.map
Only in mysql-5.5.62/unittest/mysys: bitmap-t.exe
Only in mysql-5.5.62/unittest/mysys: bitmap-t.map
Only in mysql-5.5.62/unittest/mysys: cmake_install.cmake
Only in mysql-5.5.62/unittest/mysys: CMakeFiles
Only in mysql-5.5.62/unittest/mysys: CTestTestfile.cmake
Only in mysql-5.5.62/unittest/mysys: explain_filename-t.exe
Only in mysql-5.5.62/unittest/mysys: explain_filename-t.map
Only in mysql-5.5.62/unittest/mysys: lf-t.exe
Only in mysql-5.5.62/unittest/mysys: lf-t.map
Only in mysql-5.5.62/unittest/mysys: my_atomic-t.exe
Only in mysql-5.5.62/unittest/mysys: my_atomic-t.map
Only in mysql-5.5.62/unittest/mysys: my_malloc-t.exe
Only in mysql-5.5.62/unittest/mysys: my_malloc-t.map
Only in mysql-5.5.62/unittest/mysys: my_rdtsc-t.exe
Only in mysql-5.5.62/unittest/mysys: my_rdtsc-t.map
Only in mysql-5.5.62/unittest/mysys: my_vsnprintf-t.exe
Only in mysql-5.5.62/unittest/mysys: my_vsnprintf-t.map
Only in mysql-5.5.62/unittest/mysys: Makefile
Only in mysql-5.5.62/unittest/mytap: cmake_install.cmake
Only in mysql-5.5.62/unittest/mytap: CMakeFiles
Only in mysql-5.5.62/unittest/mytap: CTestTestfile.cmake
Only in mysql-5.5.62/unittest/mytap: libmytap.a
Only in mysql-5.5.62/unittest/mytap: Makefile
Only in mysql-5.5.62/vio: cmake_install.cmake
Only in mysql-5.5.62/vio: CMakeFiles
Only in mysql-5.5.62/vio: libvio.a
Only in mysql-5.5.62/vio: Makefile
diff -ur mysql-5.5.62-o/vio/vio.c mysql-5.5.62/vio/vio.c
--- mysql-5.5.62-o/vio/vio.c	2018-08-29 06:42:50.000000000 +0930
+++ mysql-5.5.62/vio/vio.c	2019-06-16 09:13:28.000000000 +0930
@@ -192,7 +192,7 @@
     sprintf(vio->desc,
 	    (vio->type == VIO_TYPE_SOCKET ? "socket (%d)" : "TCP/IP (%d)"),
 	    vio->sd);
-#if !defined(__WIN__)
+#if !defined(__WIN__) && !defined(__EMX__)
 #if !defined(NO_FCNTL_NONBLOCK)
     /*
       We call fcntl() to set the flags and then immediately read them back
@@ -211,7 +211,7 @@
     (void) ioctl(sd,FIOSNBIO,0);
     vio->fcntl_mode &= ~O_NONBLOCK;
 #endif
-#else /* !defined(__WIN__) */
+#else /* !defined(__WIN__) && !defined(__EMX__) */
     {
       /* set to blocking mode by default */
       ulong arg=0, r;
diff -ur mysql-5.5.62-o/vio/viosocket.c mysql-5.5.62/vio/viosocket.c
--- mysql-5.5.62-o/vio/viosocket.c	2018-08-29 06:42:50.000000000 +0930
+++ mysql-5.5.62/vio/viosocket.c	2019-06-16 09:46:36.000000000 +0930
@@ -34,6 +34,12 @@
 # include <sys/filio.h>
 #endif
 
+#ifdef __EMX__
+#define SHUT_RDWR 2
+//#include <lwres/netdb.h>
+//#include <lwres/lwres.h>
+#endif
+
 int vio_errno(Vio *vio __attribute__((unused)))
 {
   return socket_errno;		/* On Win32 this mapped to WSAGetLastError() */
@@ -146,7 +152,7 @@
   DBUG_PRINT("enter", ("set_blocking_mode: %d  old_mode: %d",
 		       (int) set_blocking_mode, (int) *old_mode));
 
-#if !defined(__WIN__)
+#if !defined(__WIN__) && !defined(__EMX__)
 #if !defined(NO_FCNTL_NONBLOCK)
   if (vio->sd >= 0)
   {
@@ -168,8 +174,10 @@
 #else
   r= set_blocking_mode ? 0 : 1;
 #endif /* !defined(NO_FCNTL_NONBLOCK) */
-#else /* !defined(__WIN__) */
+#else /* !defined(__WIN__) && !defined(__EMX__) */
+#ifndef __EMX__
   if (vio->type != VIO_TYPE_NAMEDPIPE && vio->type != VIO_TYPE_SHARED_MEMORY)
+#endif
   { 
     ulong arg;
     int old_fcntl=vio->fcntl_mode;
@@ -186,9 +194,11 @@
     if (old_fcntl != vio->fcntl_mode)
       r = ioctlsocket(vio->sd,FIONBIO,(void*) &arg);
   }
+#ifndef __EMX__
   else
     r=  test(!(vio->fcntl_mode & O_NONBLOCK)) != set_blocking_mode;
-#endif /* !defined(__WIN__) */
+#endif /* __EMX__ */
+#endif /* !defined(__WIN__) && !defined(__EMX__) */
   DBUG_PRINT("exit", ("%d", r));
   DBUG_RETURN(r);
 }
@@ -209,12 +219,12 @@
   int r=0;
   DBUG_ENTER("vio_fastsend");
 
-#if defined(IPTOS_THROUGHPUT)
+#if defined(IPTOS_THROUGHPUT) && !defined(__EMX__)
   {
     int tos = IPTOS_THROUGHPUT;
     r= setsockopt(vio->sd, IPPROTO_IP, IP_TOS, (void *) &tos, sizeof(tos));
   }
-#endif                                    /* IPTOS_THROUGHPUT */
+#endif                                    /* IPTOS_THROUGHPUT && !defined(__EMX__) */
   if (!r)
   {
 #ifdef __WIN__
Only in mysql-5.5.62: VERSION.dep
Only in mysql-5.5.62/zlib: cmake_install.cmake
Only in mysql-5.5.62/zlib: CMakeFiles
Only in mysql-5.5.62/zlib: libzlib.a
Only in mysql-5.5.62/zlib: Makefile
Only in mysql-5.5.62/zlib: zconf.h
mysql-5.5.62.diff (84,417 bytes)

Steven Levine

2019-07-07 11:13

manager   ~0003310

A few comments for posterity.

The trap is at:

    i = cv->waiting;

because my_rw_unlock() has called

   pthread_cond_signal( &rwp->writers );

and part or all of the rwp structure has been corrupted pr possibly freed and reused. An annotated .trp file is attached.

One thing stands out in the .trp file. There are no accessible DLLs listed. This cannot be true, since exceptq was able to read and disassemble the content of PTHR01.DLL

003D_04.TRP-annotated (62,138 bytes)

Igor Vaskov

2019-07-10 05:49

reporter   ~0003313

I think it would be interesting to compare the way to implement the error-causing functionality without pthr01.dll and with it. Since previous versions not using pthr01 did not contain this error.

psmedley

2019-07-10 19:00

administrator   ~0003314

Last edited: 2019-07-10 20:39

View 2 revisions

@Igor you mean static linking pthreads? I can try that.

http://smedley.id.au/tmp/mysqld-20190710.zip

Igor Vaskov

2019-07-11 06:03

reporter   ~0003315

Yes. This version looks more stable. Uptime more than 8 hours. Previous did not work more than 2 hours without a trap. I continue testing the latest version.

Igor Vaskov

2019-07-11 10:01

reporter   ~0003316

More stable. More than 10 hours of uptime, but the trap is in the same place.

1e95_05.trp (62,778 bytes)

psmedley

2019-07-11 19:11

administrator   ~0003317

are you sure that's the right trp file?
 Process: E:\APPS\MYSQL55\BIN\MYSQLD.EXE (06/16/2019 10:51:24 30,006,313)

Igor Vaskov

2019-07-11 21:09

reporter   ~0003318

Sorry. This trp file incorrect. This is old verson.

Igor Vaskov

2019-07-11 21:44

reporter   ~0003319

Once again, I apologize for the incorrect file. I have not updated the demon to the new version. However, the placebo effect and my belief in the best did the impossible. So the version that did not work before and two hours surpassed itself and worked 11 hours.
Now I updated everything correctly and continue testing.

Igor Vaskov

2019-07-12 06:52

reporter   ~0003320

It is correct trp file from latest version. The trap is in the same place...

0044_05.trp (60,159 bytes)

Igor Vaskov

2019-07-12 20:57

reporter   ~0003321

In version 5.1.17 before the build 20140725 this trap was not. In build 2014072 ptpr01.dll appeared and an error appeared.
In version 5.1.17 prior to build 20140725, another method for treating threads was used, and there was no such error there.
Is it possible to use the old method of processing threads in the new version?

psmedley

2019-07-13 17:51

administrator   ~0003322

Last edited: 2019-07-13 17:51

View 2 revisions

The 'old' method was an older version of the pthreads library. Not sure I can even find an old copy of this lib.... of course, best solution is to fix pthreads...

PS what kernel do you use?

Igor Vaskov

2019-07-16 04:55

reporter   ~0003324

I use the OS / 4 core.

Igor Vaskov

2019-07-16 05:05

reporter   ~0003325

Perhaps this error does not contain pthreads, but the code that refers to an already destroyed thread. Unfortunately, I do not have the opportunity to test this system with a different kernel (
Judging by the error, the function is called with a pointer to a non-allocated area of memory or already freed ... Perhaps this is a multitasking error. And so it appears at an arbitrary point in time.

Steven Levine

2019-07-17 05:27

manager   ~0003326

Have you tested with

 PSD=ACPI.PSD /MAXCPU=1

IMO, this looks more like a possible SMP serialization issue, so running an a single CPU is a useful test.

Does running on a single CPU make the trap go away?

Another IMO, The actual failure has nothing to do with pthreads. There is some sort of buffer overflow or reuse of already freed memory in sql_parse. It just so happens to corrupt the pthreads mutex data structure.

Also, there is something strange going on with the OS4 kernel. Note that the .trp files list not DLLs in the

  DLLs accessible from this process

This is very unusual.

Igor Vaskov

2019-07-17 21:33

reporter   ~0003327

Is it possible to run only MySQL in single-process mode? This is a production server, I can not reduce performance as much.

Igor Vaskov

2019-07-18 02:04

reporter   ~0003328

I launched MySQL in single-processor mode (execmode.exe -sp). Waiting for results.

Igor Vaskov

2019-07-18 07:24

reporter   ~0003329

The single-processor mode of the MySQL application did not lead to success.

0B76_03.trp (60,641 bytes)

Igor Vaskov

2019-07-18 21:55

reporter   ~0003330

Steven,
I do not agree with the fact that this error has no relation to pthreads because it first appeared when a stable working version 5.1.17 was compiled with this library. There is nothing changed except the assembly with a newer libs. And the error occurred after that.

Igor Vaskov

2019-07-19 06:53

reporter   ~0003331

I found that the dll files in the ANPM repository and in the netlabs zip archive differ in size and compile time. I installed the library from a zip archive and returned a version that uses external dll. And I'm testing again.

Igor Vaskov

2019-07-19 19:30

reporter   ~0003334

Unfortunately... The trap is in the same place...

mysql55-2.log (64,972 bytes)

Issue History

Date Modified Username Field Change
2019-06-19 22:10 Igor Vaskov New Issue
2019-06-19 22:10 Igor Vaskov File Added: mysql55.log
2019-06-20 22:32 Igor Vaskov File Added: 003D_04.TRP
2019-06-20 22:38 Igor Vaskov File Added: 05C1_05.TRP
2019-06-20 22:38 Igor Vaskov Note Added: 0003307
2019-06-23 18:55 psmedley Note Added: 0003308
2019-07-06 07:21 psmedley File Added: mysql-5.5.62.diff
2019-07-06 07:21 psmedley Note Added: 0003309
2019-07-06 15:25 psmedley Note Edited: 0003309 View Revisions
2019-07-07 11:13 Steven Levine File Added: 003D_04.TRP-annotated
2019-07-07 11:13 Steven Levine Note Added: 0003310
2019-07-10 05:49 Igor Vaskov Note Added: 0003313
2019-07-10 19:00 psmedley Note Added: 0003314
2019-07-10 20:39 psmedley Note Edited: 0003314 View Revisions
2019-07-11 06:03 Igor Vaskov Note Added: 0003315
2019-07-11 10:01 Igor Vaskov File Added: 1e95_05.trp
2019-07-11 10:01 Igor Vaskov Note Added: 0003316
2019-07-11 19:11 psmedley Note Added: 0003317
2019-07-11 21:09 Igor Vaskov Note Added: 0003318
2019-07-11 21:44 Igor Vaskov Note Added: 0003319
2019-07-12 06:52 Igor Vaskov File Added: 0044_05.trp
2019-07-12 06:52 Igor Vaskov Note Added: 0003320
2019-07-12 20:57 Igor Vaskov Note Added: 0003321
2019-07-13 17:51 psmedley Note Added: 0003322
2019-07-13 17:51 psmedley Note Edited: 0003322 View Revisions
2019-07-16 04:55 Igor Vaskov Note Added: 0003324
2019-07-16 05:05 Igor Vaskov Note Added: 0003325
2019-07-17 05:27 Steven Levine Assigned To => Steven Levine
2019-07-17 05:27 Steven Levine Status new => feedback
2019-07-17 05:27 Steven Levine Note Added: 0003326
2019-07-17 21:33 Igor Vaskov Note Added: 0003327
2019-07-17 21:33 Igor Vaskov Status feedback => assigned
2019-07-18 02:04 Igor Vaskov Note Added: 0003328
2019-07-18 07:24 Igor Vaskov File Added: 0B76_03.trp
2019-07-18 07:24 Igor Vaskov Note Added: 0003329
2019-07-18 21:55 Igor Vaskov Note Added: 0003330
2019-07-19 06:53 Igor Vaskov Note Added: 0003331
2019-07-19 19:30 Igor Vaskov File Added: mysql55-2.log
2019-07-19 19:30 Igor Vaskov Note Added: 0003334