Commit 4acaca02 authored by Vladislav Vaintroub's avatar Vladislav Vaintroub

backport of

Revision: 
2597.72.1 revid:sp1r-Reggie@core.-20080403153947-15243
removed instances of __NT__ from code. We now only build "NT" binaries
parent 14c2cfb5
...@@ -62,9 +62,6 @@ CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/support-files/my-medium.cnf.sh ...@@ -62,9 +62,6 @@ CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/support-files/my-medium.cnf.sh
CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/support-files/my-small.cnf.sh CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/support-files/my-small.cnf.sh
${CMAKE_SOURCE_DIR}/support-files/my-small.ini @ONLY) ${CMAKE_SOURCE_DIR}/support-files/my-small.ini @ONLY)
ADD_DEFINITIONS(-D__NT__)
IF(CYBOZU) IF(CYBOZU)
ADD_DEFINITIONS(-DCYBOZU) ADD_DEFINITIONS(-DCYBOZU)
ENDIF(CYBOZU) ENDIF(CYBOZU)
......
...@@ -177,7 +177,7 @@ typedef uint rf_SetTimer; ...@@ -177,7 +177,7 @@ typedef uint rf_SetTimer;
#define SIZEOF_CHARP 4 #define SIZEOF_CHARP 4
#endif #endif
#define HAVE_BROKEN_NETINET_INCLUDES #define HAVE_BROKEN_NETINET_INCLUDES
#ifdef __NT__ #ifdef _WIN32
#define HAVE_NAMED_PIPE /* We can only create pipes on NT */ #define HAVE_NAMED_PIPE /* We can only create pipes on NT */
#endif #endif
...@@ -290,11 +290,6 @@ inline ulonglong double2ulonglong(double d) ...@@ -290,11 +290,6 @@ inline ulonglong double2ulonglong(double d)
#define strcasecmp stricmp #define strcasecmp stricmp
#define strncasecmp strnicmp #define strncasecmp strnicmp
#ifndef __NT__
#undef FILE_SHARE_DELETE
#define FILE_SHARE_DELETE 0 /* Not implemented on Win 98/ME */
#endif
#ifdef NOT_USED #ifdef NOT_USED
#define HAVE_SNPRINTF /* Gave link error */ #define HAVE_SNPRINTF /* Gave link error */
#define _snprintf snprintf #define _snprintf snprintf
...@@ -344,7 +339,7 @@ inline ulonglong double2ulonglong(double d) ...@@ -344,7 +339,7 @@ inline ulonglong double2ulonglong(double d)
#define thread_safe_increment(V,L) InterlockedIncrement((long*) &(V)) #define thread_safe_increment(V,L) InterlockedIncrement((long*) &(V))
#define thread_safe_decrement(V,L) InterlockedDecrement((long*) &(V)) #define thread_safe_decrement(V,L) InterlockedDecrement((long*) &(V))
/* The following is only used for statistics, so it should be good enough */ /* The following is only used for statistics, so it should be good enough */
#ifdef __NT__ /* This should also work on Win98 but .. */ #ifdef _WIN32
#define thread_safe_add(V,C,L) InterlockedExchangeAdd((long*) &(V),(C)) #define thread_safe_add(V,C,L) InterlockedExchangeAdd((long*) &(V),(C))
#define thread_safe_sub(V,C,L) InterlockedExchangeAdd((long*) &(V),-(long) (C)) #define thread_safe_sub(V,C,L) InterlockedExchangeAdd((long*) &(V),-(long) (C))
#endif #endif
......
...@@ -640,7 +640,7 @@ extern int my_access(const char *path, int amode); ...@@ -640,7 +640,7 @@ extern int my_access(const char *path, int amode);
extern int check_if_legal_filename(const char *path); extern int check_if_legal_filename(const char *path);
extern int check_if_legal_tablename(const char *path); extern int check_if_legal_tablename(const char *path);
#if defined(__WIN__) && defined(__NT__) #ifdef _WIN32
extern int nt_share_delete(const char *name,myf MyFlags); extern int nt_share_delete(const char *name,myf MyFlags);
#define my_delete_allow_opened(fname,flags) nt_share_delete((fname),(flags)) #define my_delete_allow_opened(fname,flags) nt_share_delete((fname),(flags))
#else #else
......
...@@ -36,7 +36,7 @@ int my_delete(const char *name, myf MyFlags) ...@@ -36,7 +36,7 @@ int my_delete(const char *name, myf MyFlags)
DBUG_RETURN(err); DBUG_RETURN(err);
} /* my_delete */ } /* my_delete */
#if defined(__WIN__) && defined(__NT__) #if defined(__WIN__)
/* /*
Delete file which is possibly not closed. Delete file which is possibly not closed.
......
...@@ -267,6 +267,11 @@ my_bool my_thread_init(void) ...@@ -267,6 +267,11 @@ my_bool my_thread_init(void)
#endif #endif
goto end; goto end;
} }
#ifdef _MSC_VER
install_sigabrt_handler();
#endif
if (!(tmp= (struct st_my_thread_var *) calloc(1, sizeof(*tmp)))) if (!(tmp= (struct st_my_thread_var *) calloc(1, sizeof(*tmp))))
{ {
error= 1; error= 1;
......
...@@ -314,10 +314,10 @@ size_t my_win_pread(File Filedes, uchar *Buffer, size_t Count, my_off_t offset) ...@@ -314,10 +314,10 @@ size_t my_win_pread(File Filedes, uchar *Buffer, size_t Count, my_off_t offset)
if(!ReadFile(hFile, Buffer, (DWORD)Count, &nBytesRead, &ov)) if(!ReadFile(hFile, Buffer, (DWORD)Count, &nBytesRead, &ov))
{ {
DWORD lastError= GetLastError(); DWORD lastError= GetLastError();
/* /*
ERROR_BROKEN_PIPE is returned when no more data coming ERROR_BROKEN_PIPE is returned when no more data coming
through e.g. a command pipe in windows : see MSDN on ReadFile. through e.g. a command pipe in windows : see MSDN on ReadFile.
*/ */
if(lastError == ERROR_HANDLE_EOF || lastError == ERROR_BROKEN_PIPE) if(lastError == ERROR_HANDLE_EOF || lastError == ERROR_BROKEN_PIPE)
DBUG_RETURN(0); /*return 0 at EOF*/ DBUG_RETURN(0); /*return 0 at EOF*/
my_osmaperr(lastError); my_osmaperr(lastError);
...@@ -367,8 +367,8 @@ size_t my_win_pwrite(File Filedes, const uchar *Buffer, size_t Count, ...@@ -367,8 +367,8 @@ size_t my_win_pwrite(File Filedes, const uchar *Buffer, size_t Count,
LARGE_INTEGER li; LARGE_INTEGER li;
DBUG_ENTER("my_win_pwrite"); DBUG_ENTER("my_win_pwrite");
DBUG_PRINT("my",("Filedes: %d, Buffer: %p, Count: %zd, offset: %llu", DBUG_PRINT("my",("Filedes: %d, Buffer: %p, Count: %llu, offset: %llu",
Filedes, Buffer, Count, (ulonglong)offset)); Filedes, Buffer, (ulonglong)Count, (ulonglong)offset));
if(!Count) if(!Count)
DBUG_RETURN(0); DBUG_RETURN(0);
...@@ -425,7 +425,8 @@ size_t my_win_write(File fd, const uchar *Buffer, size_t Count) ...@@ -425,7 +425,8 @@ size_t my_win_write(File fd, const uchar *Buffer, size_t Count)
HANDLE hFile; HANDLE hFile;
DBUG_ENTER("my_win_write"); DBUG_ENTER("my_win_write");
DBUG_PRINT("my",("Filedes: %d, Buffer: %p, Count %zd", fd, Buffer, Count)); DBUG_PRINT("my",("Filedes: %d, Buffer: %p, Count %llu", fd, Buffer,
(ulonglong)Count));
if(my_get_open_flags(fd) & _O_APPEND) if(my_get_open_flags(fd) & _O_APPEND)
{ {
/* /*
......
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
#include <stdarg.h> #include <stdarg.h>
#include <m_ctype.h> // For test_if_number #include <m_ctype.h> // For test_if_number
#ifdef __NT__ #ifdef _WIN32
#include "message.h" #include "message.h"
#endif #endif
...@@ -1794,7 +1794,7 @@ File open_binlog(IO_CACHE *log, const char *log_file_name, const char **errmsg) ...@@ -1794,7 +1794,7 @@ File open_binlog(IO_CACHE *log, const char *log_file_name, const char **errmsg)
DBUG_RETURN(-1); DBUG_RETURN(-1);
} }
#ifdef __NT__ #ifdef _WIN32
static int eventSource = 0; static int eventSource = 0;
static void setup_windows_event_source() static void setup_windows_event_source()
...@@ -1829,7 +1829,7 @@ static void setup_windows_event_source() ...@@ -1829,7 +1829,7 @@ static void setup_windows_event_source()
RegCloseKey(hRegKey); RegCloseKey(hRegKey);
} }
#endif /* __NT__ */ #endif /* _WIN32 */
/** /**
...@@ -1960,7 +1960,7 @@ bool MYSQL_LOG::open(const char *log_name, enum_log_type log_type_arg, ...@@ -1960,7 +1960,7 @@ bool MYSQL_LOG::open(const char *log_name, enum_log_type log_type_arg,
#ifdef EMBEDDED_LIBRARY #ifdef EMBEDDED_LIBRARY
"embedded library\n", "embedded library\n",
my_progname, server_version, MYSQL_COMPILATION_COMMENT my_progname, server_version, MYSQL_COMPILATION_COMMENT
#elif __NT__ #elif _WIN32
"started with:\nTCP Port: %d, Named Pipe: %s\n", "started with:\nTCP Port: %d, Named Pipe: %s\n",
my_progname, server_version, MYSQL_COMPILATION_COMMENT, my_progname, server_version, MYSQL_COMPILATION_COMMENT,
mysqld_port, mysqld_unix_port mysqld_port, mysqld_unix_port
...@@ -4851,7 +4851,7 @@ void MYSQL_BIN_LOG::signal_update() ...@@ -4851,7 +4851,7 @@ void MYSQL_BIN_LOG::signal_update()
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
} }
#ifdef __NT__ #ifdef _WIN32
static void print_buffer_to_nt_eventlog(enum loglevel level, char *buff, static void print_buffer_to_nt_eventlog(enum loglevel level, char *buff,
size_t length, size_t buffLen) size_t length, size_t buffLen)
{ {
...@@ -4884,7 +4884,7 @@ static void print_buffer_to_nt_eventlog(enum loglevel level, char *buff, ...@@ -4884,7 +4884,7 @@ static void print_buffer_to_nt_eventlog(enum loglevel level, char *buff,
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
} }
#endif /* __NT__ */ #endif /* _WIN32 */
/** /**
...@@ -4946,7 +4946,7 @@ int vprint_msg_to_log(enum loglevel level, const char *format, va_list args) ...@@ -4946,7 +4946,7 @@ int vprint_msg_to_log(enum loglevel level, const char *format, va_list args)
length= my_vsnprintf(buff, sizeof(buff), format, args); length= my_vsnprintf(buff, sizeof(buff), format, args);
print_buffer_to_file(level, buff); print_buffer_to_file(level, buff);
#ifdef __NT__ #ifdef _WIN32
print_buffer_to_nt_eventlog(level, buff, length, sizeof(buff)); print_buffer_to_nt_eventlog(level, buff, length, sizeof(buff));
#endif #endif
......
...@@ -732,7 +732,7 @@ static NTService Service; ///< Service object for WinNT ...@@ -732,7 +732,7 @@ static NTService Service; ///< Service object for WinNT
#endif /* EMBEDDED_LIBRARY */ #endif /* EMBEDDED_LIBRARY */
#endif /* __WIN__ */ #endif /* __WIN__ */
#ifdef __NT__ #ifdef _WIN32
static char pipe_name[512]; static char pipe_name[512];
static SECURITY_ATTRIBUTES saPipeSecurity; static SECURITY_ATTRIBUTES saPipeSecurity;
static SECURITY_DESCRIPTOR sdPipeDescriptor; static SECURITY_DESCRIPTOR sdPipeDescriptor;
...@@ -812,7 +812,7 @@ pthread_handler_t handle_connections_sockets_thread(void *arg); ...@@ -812,7 +812,7 @@ pthread_handler_t handle_connections_sockets_thread(void *arg);
pthread_handler_t kill_server_thread(void *arg); pthread_handler_t kill_server_thread(void *arg);
static void bootstrap(FILE *file); static void bootstrap(FILE *file);
static bool read_init_file(char *file_name); static bool read_init_file(char *file_name);
#ifdef __NT__ #ifdef _WIN32
pthread_handler_t handle_connections_namedpipes(void *arg); pthread_handler_t handle_connections_namedpipes(void *arg);
#endif #endif
#ifdef HAVE_SMEM #ifdef HAVE_SMEM
...@@ -898,7 +898,7 @@ static void close_connections(void) ...@@ -898,7 +898,7 @@ static void close_connections(void)
ip_sock= INVALID_SOCKET; ip_sock= INVALID_SOCKET;
} }
} }
#ifdef __NT__ #ifdef _WIN32
if (hPipe != INVALID_HANDLE_VALUE && opt_enable_named_pipe) if (hPipe != INVALID_HANDLE_VALUE && opt_enable_named_pipe)
{ {
HANDLE temp; HANDLE temp;
...@@ -1690,7 +1690,7 @@ static void network_init(void) ...@@ -1690,7 +1690,7 @@ static void network_init(void)
} }
} }
#ifdef __NT__ #ifdef _WIN32
/* create named pipe */ /* create named pipe */
if (Service.IsNT() && mysqld_unix_port[0] && !opt_bootstrap && if (Service.IsNT() && mysqld_unix_port[0] && !opt_bootstrap &&
opt_enable_named_pipe) opt_enable_named_pipe)
...@@ -4124,12 +4124,11 @@ static void create_shutdown_thread() ...@@ -4124,12 +4124,11 @@ static void create_shutdown_thread()
#endif /* EMBEDDED_LIBRARY */ #endif /* EMBEDDED_LIBRARY */
#if (defined(__NT__) || defined(HAVE_SMEM)) && !defined(EMBEDDED_LIBRARY) #if (defined(_WIN32) || defined(HAVE_SMEM)) && !defined(EMBEDDED_LIBRARY)
static void handle_connections_methods() static void handle_connections_methods()
{ {
pthread_t hThread; pthread_t hThread;
DBUG_ENTER("handle_connections_methods"); DBUG_ENTER("handle_connections_methods");
#ifdef __NT__
if (hPipe == INVALID_HANDLE_VALUE && if (hPipe == INVALID_HANDLE_VALUE &&
(!have_tcpip || opt_disable_networking) && (!have_tcpip || opt_disable_networking) &&
!opt_enable_shared_memory) !opt_enable_shared_memory)
...@@ -4137,12 +4136,10 @@ static void handle_connections_methods() ...@@ -4137,12 +4136,10 @@ static void handle_connections_methods()
sql_print_error("TCP/IP, --shared-memory, or --named-pipe should be configured on NT OS"); sql_print_error("TCP/IP, --shared-memory, or --named-pipe should be configured on NT OS");
unireg_abort(1); // Will not return unireg_abort(1); // Will not return
} }
#endif
pthread_mutex_lock(&LOCK_thread_count); pthread_mutex_lock(&LOCK_thread_count);
(void) pthread_cond_init(&COND_handler_count,NULL); (void) pthread_cond_init(&COND_handler_count,NULL);
handler_count=0; handler_count=0;
#ifdef __NT__
if (hPipe != INVALID_HANDLE_VALUE) if (hPipe != INVALID_HANDLE_VALUE)
{ {
handler_count++; handler_count++;
...@@ -4153,7 +4150,6 @@ static void handle_connections_methods() ...@@ -4153,7 +4150,6 @@ static void handle_connections_methods()
handler_count--; handler_count--;
} }
} }
#endif /* __NT__ */
if (have_tcpip && !opt_disable_networking) if (have_tcpip && !opt_disable_networking)
{ {
handler_count++; handler_count++;
...@@ -4193,7 +4189,7 @@ void decrement_handler_count() ...@@ -4193,7 +4189,7 @@ void decrement_handler_count()
} }
#else #else
#define decrement_handler_count() #define decrement_handler_count()
#endif /* defined(__NT__) || defined(HAVE_SMEM) */ #endif /* defined(_WIN32) || defined(HAVE_SMEM) */
#ifndef EMBEDDED_LIBRARY #ifndef EMBEDDED_LIBRARY
...@@ -5261,7 +5257,7 @@ pthread_handler_t handle_connections_namedpipes(void *arg) ...@@ -5261,7 +5257,7 @@ pthread_handler_t handle_connections_namedpipes(void *arg)
decrement_handler_count(); decrement_handler_count();
DBUG_RETURN(0); DBUG_RETURN(0);
} }
#endif /* __NT__ */ #endif /* _WIN32 */
#ifdef HAVE_SMEM #ifdef HAVE_SMEM
...@@ -5837,7 +5833,7 @@ struct my_option my_long_options[] = ...@@ -5837,7 +5833,7 @@ struct my_option my_long_options[] =
"Deprecated option, use --external-locking instead.", "Deprecated option, use --external-locking instead.",
(uchar**) &opt_external_locking, (uchar**) &opt_external_locking, (uchar**) &opt_external_locking, (uchar**) &opt_external_locking,
0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
#ifdef __NT__ #ifdef _WIN32
{"enable-named-pipe", OPT_HAVE_NAMED_PIPE, "Enable the named pipe (NT).", {"enable-named-pipe", OPT_HAVE_NAMED_PIPE, "Enable the named pipe (NT).",
(uchar**) &opt_enable_named_pipe, (uchar**) &opt_enable_named_pipe, 0, GET_BOOL, (uchar**) &opt_enable_named_pipe, (uchar**) &opt_enable_named_pipe, 0, GET_BOOL,
NO_ARG, 0, 0, 0, 0, 0, 0}, NO_ARG, 0, 0, 0, 0, 0, 0},
......
...@@ -434,7 +434,7 @@ static sys_var_thd_enum sys_myisam_stats_method(&vars, "myisam_stats_met ...@@ -434,7 +434,7 @@ static sys_var_thd_enum sys_myisam_stats_method(&vars, "myisam_stats_met
&myisam_stats_method_typelib, &myisam_stats_method_typelib,
NULL); NULL);
#ifdef __NT__ #ifdef _WIN32
/* purecov: begin inspected */ /* purecov: begin inspected */
static sys_var_const sys_named_pipe(&vars, "named_pipe", static sys_var_const sys_named_pipe(&vars, "named_pipe",
OPT_GLOBAL, SHOW_MY_BOOL, OPT_GLOBAL, SHOW_MY_BOOL,
......
...@@ -949,7 +949,7 @@ static bool login_connection(THD *thd) ...@@ -949,7 +949,7 @@ static bool login_connection(THD *thd)
if (error) if (error)
{ // Wrong permissions { // Wrong permissions
#ifdef __NT__ #ifdef _WIN32
if (vio_type(net->vio) == VIO_TYPE_NAMEDPIPE) if (vio_type(net->vio) == VIO_TYPE_NAMEDPIPE)
my_sleep(1000); /* must wait after eof() */ my_sleep(1000); /* must wait after eof() */
#endif #endif
......
...@@ -264,7 +264,7 @@ int vio_close(Vio * vio) ...@@ -264,7 +264,7 @@ int vio_close(Vio * vio)
#ifdef __WIN__ #ifdef __WIN__
if (vio->type == VIO_TYPE_NAMEDPIPE) if (vio->type == VIO_TYPE_NAMEDPIPE)
{ {
#if defined(__NT__) && defined(MYSQL_SERVER) #if defined(MYSQL_SERVER)
CancelIo(vio->hPipe); CancelIo(vio->hPipe);
DisconnectNamedPipe(vio->hPipe); DisconnectNamedPipe(vio->hPipe);
#endif #endif
...@@ -450,7 +450,7 @@ int vio_close_pipe(Vio * vio) ...@@ -450,7 +450,7 @@ int vio_close_pipe(Vio * vio)
{ {
int r; int r;
DBUG_ENTER("vio_close_pipe"); DBUG_ENTER("vio_close_pipe");
#if defined(__NT__) && defined(MYSQL_SERVER) #if defined(MYSQL_SERVER)
CancelIo(vio->hPipe); CancelIo(vio->hPipe);
DisconnectNamedPipe(vio->hPipe); DisconnectNamedPipe(vio->hPipe);
#endif #endif
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment