MDEV-25602 get rid of __WIN__ in favor of standard _WIN32

This fixed the MySQL bug# 20338 about misuse of double underscore
prefix __WIN__, which was old MySQL's idea of identifying Windows
Replace it by _WIN32 standard symbol for targeting Windows OS
(both 32 and 64 bit)

Not that connect storage engine is not fixed in this patch (must be
fixed in "upstream" branch)
This commit is contained in:
Vladislav Vaintroub 2021-06-06 13:21:03 +02:00
parent 06dd151bb8
commit 3d6eb7afcf
132 changed files with 303 additions and 379 deletions

View file

@ -16,7 +16,7 @@
*/
#ifndef __WIN__
#ifndef _WIN32
#include <poll.h>
#else
#include <WinSock2.h>
@ -33,7 +33,7 @@ static const char *my_groups[]= { "client", NULL };
static int
wait_for_mysql(MYSQL *mysql, int status)
{
#ifdef __WIN__
#ifdef _WIN32
fd_set rs, ws, es;
int res;
struct timeval tv, *timeout;

View file

@ -27,7 +27,7 @@
#include <mysql_version.h>
#ifndef WEXITSTATUS
# ifdef __WIN__
# ifdef _WIN32
# define WEXITSTATUS(stat_val) (stat_val)
# else
# define WEXITSTATUS(stat_val) ((unsigned)(stat_val) >> 8)

View file

@ -88,7 +88,7 @@ extern "C" {
#endif /* defined(HAVE_CURSES_H) && defined(HAVE_TERM_H) */
#undef bcmp // Fix problem with new readline
#if defined(__WIN__)
#if defined(_WIN32)
#include <conio.h>
#else
#include <readline.h>
@ -1587,7 +1587,7 @@ static struct my_option my_long_options[] =
{"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__
#ifdef _WIN32
{"pipe", 'W', "Use named pipes to connect to server.", 0, 0, 0, GET_NO_ARG,
NO_ARG, 0, 0, 0, 0, 0, 0},
#endif
@ -1893,7 +1893,7 @@ get_one_option(const struct my_option *opt, const char *argument, const char *fi
set_if_bigger(opt_silent,1); // more silent
break;
case 'W':
#ifdef __WIN__
#ifdef _WIN32
opt_protocol = MYSQL_PROTOCOL_PIPE;
opt_protocol_type= "pipe";
@ -2026,7 +2026,7 @@ static int get_options(int argc, char **argv)
static int read_and_execute(bool interactive)
{
#if defined(__WIN__)
#if defined(_WIN32)
String tmpbuf;
String buffer;
#endif
@ -2106,7 +2106,7 @@ static int read_and_execute(bool interactive)
if (opt_outfile && glob_buffer.is_empty())
fflush(OUTFILE);
#if defined(__WIN__)
#if defined(_WIN32)
tee_fputs(prompt, stdout);
if (!tmpbuf.is_alloced())
tmpbuf.alloc(65535);
@ -2139,7 +2139,7 @@ static int read_and_execute(bool interactive)
if (line)
free(line);
line= readline(prompt);
#endif /* defined(__WIN__) */
#endif /* defined(_WIN32) */
/*
When Ctrl+d or Ctrl+z is pressed, the line may be NULL on some OS
@ -2194,7 +2194,7 @@ static int read_and_execute(bool interactive)
}
}
#if defined(__WIN__)
#if defined(_WIN32)
buffer.free();
tmpbuf.free();
#else

View file

@ -233,7 +233,7 @@ static int run_command(char* cmd, const char *mode)
}
#ifdef __WIN__
#ifdef _WIN32
/**
Check to see if there are spaces in a path.
@ -329,7 +329,7 @@ static int get_default_values()
if ((error= make_tempfile(defaults_file, "txt")))
goto exit;
#ifdef __WIN__
#ifdef _WIN32
{
char *format_str= 0;
@ -860,7 +860,7 @@ static int process_options(int argc, char *argv[], char *operation)
memset(buff, 0, sizeof(buff));
strncpy(buff, opt_basedir, sizeof(buff) - 1);
#ifdef __WIN__
#ifdef _WIN32
strncat(buff, "/", sizeof(buff) - strlen(buff) - 1);
#else
strncat(buff, FN_DIRSEP, sizeof(buff) - strlen(buff) - 1);
@ -1175,7 +1175,7 @@ static int bootstrap_server(char *server_path, char *bootstrap_file)
char bootstrap_cmd[FN_REFLEN];
int error= 0;
#ifdef __WIN__
#ifdef _WIN32
char *format_str= 0;
const char *verbose_str= NULL;

View file

@ -29,7 +29,7 @@
#endif
#ifndef WEXITSTATUS
# ifdef __WIN__
# ifdef _WIN32
# define WEXITSTATUS(stat_val) (stat_val)
# else
# define WEXITSTATUS(stat_val) ((unsigned)(stat_val) >> 8)
@ -121,7 +121,7 @@ static struct my_option my_long_options[]=
"Password to use when connecting to server. If password is not given,"
" it's solicited on the tty.", &opt_password,&opt_password,
0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
#ifdef __WIN__
#ifdef _WIN32
{"pipe", 'W', "Use named pipes to connect to server.", 0, 0, 0,
GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
#endif
@ -451,7 +451,7 @@ static int run_tool(char *tool_path, DYNAMIC_STRING *ds_res, ...)
va_end(args);
#ifdef __WIN__
#ifdef _WIN32
dynstr_append(&ds_cmdline, "\"");
#endif
@ -1286,7 +1286,7 @@ int main(int argc, char **argv)
load_defaults_or_exit("my", load_default_groups, &argc, &argv);
defaults_argv= argv; /* Must be freed by 'free_defaults' */
#if defined(__WIN__)
#if defined(_WIN32)
if (GetModuleFileName(NULL, self_name, FN_REFLEN) == 0)
#endif
{

View file

@ -175,7 +175,7 @@ static struct my_option my_long_options[] =
{"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__
#ifdef _WIN32
{"pipe", 'W', "Use named pipes to connect to server.", 0, 0, 0, GET_NO_ARG,
NO_ARG, 0, 0, 0, 0, 0, 0},
#endif
@ -278,7 +278,7 @@ get_one_option(const struct my_option *opt, const char *argument, const char *fi
option_silent++;
break;
case 'W':
#ifdef __WIN__
#ifdef _WIN32
opt_protocol = MYSQL_PROTOCOL_PIPE;
/* Prioritize pipe if explicit via command line */
@ -1153,7 +1153,7 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv)
{
bool old= (find_type(argv[0], &command_typelib, FIND_TYPE_BASIC) ==
ADMIN_OLD_PASSWORD);
#ifdef __WIN__
#ifdef _WIN32
size_t pw_len= strlen(typed_password);
if (pw_len > 1 && typed_password[0] == '\'' &&
typed_password[pw_len-1] == '\'')

View file

@ -2918,7 +2918,7 @@ static Exit_status dump_local_log_entries(PRINT_EVENT_INFO *print_event_info,
stdin in binary mode. Errors on setting this mode result in
halting the function and printing an error message to stderr.
*/
#if defined (__WIN__) || defined(_WIN64)
#if defined (_WIN32)
if (_setmode(fileno(stdin), O_BINARY) == -1)
{
error("Could not set binary mode on stdin.");

View file

@ -165,7 +165,7 @@ static struct my_option my_long_options[] =
"When using ANALYZE TABLE use the PERSISTENT FOR ALL option.",
&opt_persistent_all, &opt_persistent_all, 0, GET_BOOL, NO_ARG,
0, 0, 0, 0, 0, 0},
#ifdef __WIN__
#ifdef _WIN32
{"pipe", 'W', "Use named pipes to connect to server.", 0, 0, 0, GET_NO_ARG,
NO_ARG, 0, 0, 0, 0, 0, 0},
#endif
@ -355,7 +355,7 @@ get_one_option(const struct my_option *opt,
opt_upgrade= 1;
break;
case 'W':
#ifdef __WIN__
#ifdef _WIN32
opt_protocol = MYSQL_PROTOCOL_PIPE;
/* Prioritize pipe if explicit via command line */

View file

@ -504,7 +504,7 @@ static struct my_option my_long_options[] =
{"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__
#ifdef _WIN32
{"pipe", 'W', "Use named pipes to connect to server.", 0, 0, 0, GET_NO_ARG,
NO_ARG, 0, 0, 0, 0, 0, 0},
#endif
@ -896,7 +896,7 @@ get_one_option(const struct my_option *opt,
exit(1);
break;
case 'W':
#ifdef __WIN__
#ifdef _WIN32
opt_protocol= MYSQL_PROTOCOL_PIPE;
/* Prioritize pipe if explicit via command line */

View file

@ -146,7 +146,7 @@ static struct my_option my_long_options[] =
{"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__
#ifdef _WIN32
{"pipe", 'W', "Use named pipes to connect to server.", 0, 0, 0, GET_NO_ARG,
NO_ARG, 0, 0, 0, 0, 0, 0},
#endif
@ -252,7 +252,7 @@ get_one_option(const struct my_option *opt, const char *argument,
else
tty_password= 1;
break;
#ifdef __WIN__
#ifdef _WIN32
case 'W':
opt_protocol = MYSQL_PROTOCOL_PIPE;
opt_local_file=1;

View file

@ -247,7 +247,7 @@ static struct my_option my_long_options[] =
&opt_mysql_port,
&opt_mysql_port, 0, GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0,
0},
#ifdef __WIN__
#ifdef _WIN32
{"pipe", 'W', "Use named pipes to connect to server.", 0, 0, 0, GET_NO_ARG,
NO_ARG, 0, 0, 0, 0, 0, 0},
#endif
@ -336,7 +336,7 @@ get_one_option(const struct my_option *opt, const char *argument,
tty_password=1;
break;
case 'W':
#ifdef __WIN__
#ifdef _WIN32
opt_protocol = MYSQL_PROTOCOL_PIPE;
/* Prioritize pipe if explicit via command line */

View file

@ -86,16 +86,15 @@ TODO:
#include <my_dir.h>
#include <signal.h>
#include <sslopt-vars.h>
#ifndef __WIN__
#ifndef _WIN32
#include <sys/wait.h>
#endif
#include <ctype.h>
#include <welcome_copyright_notice.h> /* ORACLE_WELCOME_COPYRIGHT_NOTICE */
#ifdef __WIN__
#ifdef _WIN32
#define srandom srand
#define random rand
#define snprintf _snprintf
#endif
@ -282,7 +281,7 @@ static long int timedif(struct timeval a, struct timeval b)
return s + us;
}
#ifdef __WIN__
#ifdef _WIN32
static int gettimeofday(struct timeval *tp, void *tzp)
{
unsigned int ticks;
@ -665,7 +664,7 @@ static struct my_option my_long_options[] =
{"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__
#ifdef _WIN32
{"pipe", 'W', "Use named pipes to connect to server.", 0, 0, 0, GET_NO_ARG,
NO_ARG, 0, 0, 0, 0, 0, 0},
#endif
@ -772,7 +771,7 @@ get_one_option(const struct my_option *opt, const char *argument,
tty_password= 1;
break;
case 'W':
#ifdef __WIN__
#ifdef _WIN32
opt_protocol= MYSQL_PROTOCOL_PIPE;
/* Prioritize pipe if explicit via command line */

View file

@ -34,7 +34,7 @@ LINE_BUFFER *batch_readline_init(ulong max_size,FILE *file)
{
LINE_BUFFER *line_buff;
#ifndef __WIN__
#ifndef _WIN32
MY_STAT input_file_stat;
if (my_fstat(fileno(file), &input_file_stat, MYF(MY_WME)) ||
MY_S_ISDIR(input_file_stat.st_mode) ||

View file

@ -50,7 +50,7 @@ IF(MSVC AND CMAKE_CXX_COMPILER_ID MATCHES Clang)
SET(CLANG_CL TRUE)
ENDIF()
ADD_DEFINITIONS(-D_WINDOWS -D__WIN__ -D_CRT_SECURE_NO_DEPRECATE)
ADD_DEFINITIONS(-D_CRT_SECURE_NO_DEPRECATE)
ADD_DEFINITIONS(-D_WIN32_WINNT=0x0A00)
# We do not want the windows.h macros min/max
ADD_DEFINITIONS(-DNOMINMAX)

View file

@ -429,7 +429,7 @@
#define PSAPI_VERSION 1 /* for GetProcessMemoryInfo() */
/* We don't want the min/max macros */
#ifdef __WIN__
#ifdef _WIN32
#define NOMINMAX 1
#endif

View file

@ -97,7 +97,7 @@ extern void __gcov_flush();
#define fnmatch(A,B,C) strcmp(A,B)
#endif
#if defined(__WIN__)
#if defined(_WIN32)
#include <process.h>
#endif
@ -1872,7 +1872,7 @@ static void DoPrefix(CODE_STATE *cs, uint _line_)
(void) fprintf(cs->stack->out_file->file, "%5d: ", cs->lineno);
if (cs->stack->flags & TIMESTAMP_ON)
{
#ifdef __WIN__
#ifdef _WIN32
/* FIXME This doesn't give microseconds as in Unix case, and the resolution is
in system ticks, 10 ms intervals. See my_getsystime.c for high res */
SYSTEMTIME loc_t;
@ -2203,7 +2203,7 @@ void _db_flush_()
}
#ifndef __WIN__
#ifndef _WIN32
void _db_suicide_()
{
int retval;
@ -2222,7 +2222,7 @@ void _db_suicide_()
fprintf(stderr, "sigsuspend returned %d errno %d \n", retval, errno);
assert(FALSE); /* With full signal mask, we should never return here. */
}
#endif /* ! __WIN__ */
#endif /* ! _WIN32 */
void _db_lock_file_()

View file

@ -32,7 +32,7 @@
#include <time.h>
#include <sys/types.h>
#include <sys/stat.h>
#ifndef __WIN__
#ifndef _WIN32
# include <unistd.h>
#endif
#include <my_getopt.h>

View file

@ -75,7 +75,7 @@ stdout_open(ds_ctxt_t *ctxt __attribute__((unused)),
stdout_file = (ds_stdout_file_t *) (file + 1);
#ifdef __WIN__
#ifdef _WIN32
setmode(fileno(stdout), _O_BINARY);
#endif

View file

@ -43,7 +43,7 @@ xb_stream_read_new(void)
stream = (xb_rstream_t *) my_malloc(PSI_NOT_INSTRUMENTED, sizeof(xb_rstream_t), MYF(MY_FAE));
#ifdef __WIN__
#ifdef _WIN32
setmode(fileno(stdin), _O_BINARY);
#endif

View file

@ -110,7 +110,7 @@ xb_stream_write_open(xb_wstream_t *stream, const char *path,
file->chunk_ptr = file->chunk;
file->chunk_free = XB_STREAM_MIN_CHUNK_SIZE;
if (onwrite) {
#ifdef __WIN__
#ifdef _WIN32
setmode(fileno(stdout), _O_BINARY);
#endif
file->userdata = userdata;

View file

@ -1398,7 +1398,7 @@ struct my_option xb_server_options[] =
(G_PTR*) &mysql_data_home, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"tmpdir", 't',
"Path for temporary files. Several paths may be specified, separated by a "
#if defined(__WIN__) || defined(OS2) || defined(__NETWARE__)
#if defined(_WIN32)
"semicolon (;)"
#else
"colon (:)"
@ -6690,7 +6690,7 @@ static int main_low(char** argv)
/* get default temporary directory */
if (!opt_mysql_tmpdir || !opt_mysql_tmpdir[0]) {
opt_mysql_tmpdir = getenv("TMPDIR");
#if defined(__WIN__)
#if defined(_WIN32)
if (!opt_mysql_tmpdir) {
opt_mysql_tmpdir = getenv("TEMP");
}

View file

@ -17,9 +17,9 @@
#ifndef _my_dbug_h
#define _my_dbug_h
#ifndef __WIN__
#ifndef _WIN32
#include <signal.h>
#endif /* not __WIN__ */
#endif
#ifdef __cplusplus
extern "C" {
@ -134,7 +134,7 @@ extern int (*dbug_sanity)(void);
#define DBUG_FREE_CODE_STATE(arg) dbug_free_code_state(arg)
#undef DBUG_ASSERT_AS_PRINTF
#ifndef __WIN__
#ifndef _WIN32
#define DBUG_ABORT() (_db_flush_(), abort())
#else
/*
@ -156,12 +156,12 @@ extern int (*dbug_sanity)(void);
An alternative would be to use _exit(EXIT_FAILURE),
but then valgrind would report lots of memory leaks.
*/
#ifdef __WIN__
#ifdef _WIN32
#define DBUG_SUICIDE() DBUG_ABORT()
#else
extern void _db_suicide_(void);
#define DBUG_SUICIDE() (_db_flush_(), _db_suicide_())
#endif /* __WIN__ */
#endif /* _WIN32 */
#else /* No debugger */

View file

@ -20,9 +20,17 @@
#ifndef MY_GLOBAL_INCLUDED
#define MY_GLOBAL_INCLUDED
/* Client library users on Windows need this macro defined here. */
#if !defined(__WIN__) && defined(_WIN32)
#define __WIN__
/*
MDEV-25602 Deprecate __WIN__ symbol.
Temporarily, allow inside connect engine,
until fixed in upstream.
*/
#ifndef connect_EXPORTS
#ifdef _MSC_VER
#pragma deprecated("__WIN__")
#elif defined (__GNUC__)
#pragma GCC poison __WIN__
#endif
#endif
/*
@ -43,7 +51,7 @@
#undef _WIN
#undef _WIN32
#undef _WIN64
#undef __WIN__
#undef _WIN32
#undef __WIN32__
#define HAVE_ERRNO_AS_DEFINE
#define _POSIX_MONOTONIC_CLOCK
@ -79,7 +87,7 @@
#endif /* WITH_PERFSCHEMA_STORAGE_ENGINE */
/* Make it easier to add conditional code in _expressions_ */
#ifdef __WIN__
#ifdef _WIN32
#define IF_WIN(A,B) A
#else
#define IF_WIN(A,B) B
@ -240,7 +248,7 @@
#endif
#if !defined(__WIN__)
#if !defined(_WIN32)
#ifndef _POSIX_PTHREAD_SEMANTICS
#define _POSIX_PTHREAD_SEMANTICS /* We want posix threads */
#endif
@ -261,7 +269,7 @@ C_MODE_END
#if !defined(SCO) && !defined(_REENTRANT)
#define _REENTRANT 1 /* Threads requires reentrant code */
#endif
#endif /* !defined(__WIN__) */
#endif /* !defined(_WIN32) */
/* gcc/egcs issues */
@ -588,12 +596,12 @@ typedef SOCKET_SIZE_TYPE size_socket;
#endif
/* additional file share flags for win32 */
#ifdef __WIN__
#ifdef _WIN32
#define _SH_DENYRWD 0x110 /* deny read/write mode & delete */
#define _SH_DENYWRD 0x120 /* deny write mode & delete */
#define _SH_DENYRDD 0x130 /* deny read mode & delete */
#define _SH_DENYDEL 0x140 /* deny delete only */
#endif /* __WIN__ */
#endif /* _WIN32 */
/* General constants */
@ -693,7 +701,7 @@ typedef SOCKET_SIZE_TYPE size_socket;
/* Some defines of functions for portability */
#undef remove /* Crashes MySQL on SCO 5.0.0 */
#ifndef __WIN__
#ifndef _WIN32
#define closesocket(A) close(A)
#endif
@ -915,7 +923,7 @@ typedef ulonglong uint64;
#if defined(NO_CLIENT_LONG_LONG)
typedef unsigned long my_ulonglong;
#elif defined (__WIN__)
#elif defined (_WIN32)
typedef unsigned __int64 my_ulonglong;
#else
typedef unsigned long long my_ulonglong;
@ -955,7 +963,7 @@ typedef ulonglong table_map; /* Used for table bits in join */
typedef const struct charset_info_st CHARSET_INFO;
typedef struct st_mysql_lex_string LEX_STRING;
#if defined(__WIN__)
#if defined(_WIN32)
#define socket_errno WSAGetLastError()
#define SOCKET_EINTR WSAEINTR
#define SOCKET_ETIMEDOUT WSAETIMEDOUT

View file

@ -43,7 +43,7 @@ C_MODE_START
#include <sys/ioctl.h>
#endif
#if !defined(__WIN__)
#if !defined(_WIN32)
#include <netinet/in_systm.h>
#include <netinet/in.h>
#include <netinet/ip.h>
@ -52,7 +52,7 @@ C_MODE_START
#endif
#endif
#if defined(__WIN__)
#if defined(_WIN32)
#define O_NONBLOCK 1 /* For emulation of fcntl() */
/*

View file

@ -30,7 +30,7 @@ extern "C" {
#define EXTERNC
#endif /* __cplusplus */
#if defined(__WIN__)
#if defined(_WIN32)
typedef CRITICAL_SECTION pthread_mutex_t;
typedef DWORD pthread_t;
typedef struct thread_attr {
@ -277,7 +277,7 @@ struct tm *gmtime_r(const time_t *clock, struct tm *res);
#define HAVE_PTHREAD_KILL 1
#endif
#endif /* defined(__WIN__) */
#endif /* defined(_WIN32) */
#if defined(HPUX10) && !defined(DONT_REMAP_PTHREAD_FUNCTIONS)
#undef pthread_cond_timedwait

View file

@ -23,7 +23,7 @@
(defined(__alpha__) && defined(__GNUC__))
#define HAVE_STACKTRACE 1
#endif
#elif defined(__WIN__) || defined(HAVE_PRINTSTACK)
#elif defined(_WIN32) || defined(HAVE_PRINTSTACK)
#define HAVE_STACKTRACE 1
#endif
@ -49,12 +49,12 @@ void my_write_core(int sig);
# if BACKTRACE_DEMANGLE
char *my_demangle(const char *mangled_name, int *status);
# endif /* BACKTRACE_DEMANGLE */
# ifdef __WIN__
# ifdef _WIN32
# define my_setup_stacktrace()
void my_set_exception_pointers(EXCEPTION_POINTERS *ep);
# else
void my_setup_stacktrace(void);
# endif /* __WIN__ */
# endif /* _WIN32 */
#else
# define my_setup_stacktrace()
#endif /* ! (defined(HAVE_STACKTRACE) || defined(HAVE_BACKTRACE)) */

View file

@ -32,13 +32,6 @@
#include <standards.h>
#endif
#ifdef __CYGWIN__ /* CYGWIN implements a UNIX API */
#undef WIN
#undef _WIN
#undef _WIN32
#undef _WIN64
#undef __WIN__
#endif
#ifdef __cplusplus
extern "C" {
@ -53,10 +46,7 @@ extern "C" {
typedef char my_bool;
#endif
#if (defined(_WIN32) || defined(_WIN64)) && !defined(__WIN__)
#define __WIN__
#endif
#if !defined(__WIN__)
#if !defined(_WIN32)
#define STDCALL
#else
#define STDCALL __stdcall
@ -130,7 +120,7 @@ typedef unsigned int MYSQL_FIELD_OFFSET; /* offset to current field */
#ifndef MY_GLOBAL_INCLUDED
#if defined(NO_CLIENT_LONG_LONG)
typedef unsigned long my_ulonglong;
#elif defined (__WIN__)
#elif defined (_WIN32)
typedef unsigned __int64 my_ulonglong;
#else
typedef unsigned long long my_ulonglong;

View file

@ -96,10 +96,10 @@
#define LOCAL_HOST_NAMEDPIPE "."
#if defined(__WIN__) && !defined( _CUSTOMCONFIG_)
#if defined(_WIN32) && !defined( _CUSTOMCONFIG_)
#define MYSQL_NAMEDPIPE "MySQL"
#define MYSQL_SERVICENAME "MySQL"
#endif /* __WIN__ */
#endif
/*
You should add new commands to the end of this list, otherwise old

View file

@ -65,7 +65,7 @@ typedef my_bool ALARM;
#define end_thr_alarm(A)
#else
#if defined(__WIN__)
#if defined(_WIN32)
typedef struct st_thr_alarm_entry
{
UINT_PTR crono;
@ -77,7 +77,7 @@ typedef int thr_alarm_entry;
#define thr_got_alarm(thr_alarm) (**(thr_alarm))
#endif /* __WIN__ */
#endif /* _WIN32 */
typedef thr_alarm_entry* thr_alarm_t;

View file

@ -74,11 +74,11 @@ struct vio_keepalive_opts
Vio* vio_new(my_socket sd, enum enum_vio_type type, uint flags);
Vio* mysql_socket_vio_new(MYSQL_SOCKET mysql_socket, enum enum_vio_type type, uint flags);
#ifdef __WIN__
#ifdef _WIN32
Vio* vio_new_win32pipe(HANDLE hPipe);
#else
#define HANDLE void *
#endif /* __WIN__ */
#endif /* _WIN32 */
void vio_delete(Vio* vio);
int vio_close(Vio* vio);

View file

@ -578,7 +578,7 @@ int init_embedded_server(int argc, char **argv, char **groups)
/* Get default temporary directory */
opt_mysql_tmpdir=getenv("TMPDIR"); /* Use this if possible */
#if defined(__WIN__)
#if defined(_WIN32)
if (!opt_mysql_tmpdir)
opt_mysql_tmpdir=getenv("TEMP");
if (!opt_mysql_tmpdir)

View file

@ -35,7 +35,7 @@
#ifdef HAVE_PWD_H
#include <pwd.h>
#endif
#if !defined(__WIN__)
#if !defined(_WIN32)
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
@ -46,7 +46,7 @@
#ifdef HAVE_SYS_SELECT_H
#include <sys/select.h>
#endif
#endif /* !defined(__WIN__) */
#endif /* !defined(_WIN32) */
#if defined(HAVE_POLL_H)
#include <poll.h>
#elif defined(HAVE_SYS_POLL_H)
@ -55,7 +55,7 @@
#ifdef HAVE_SYS_UN_H
#include <sys/un.h>
#endif
#if !defined(__WIN__)
#if !defined(_WIN32)
#include <my_pthread.h> /* because of signal() */
#endif
#ifndef INADDR_NONE
@ -78,13 +78,13 @@ ulong max_allowed_packet= 1024L*1024L*1024L;
my_bool net_flush(NET *net);
#endif
#if defined(__WIN__)
#if defined(_WIN32)
/* socket_errno is defined in my_global.h for all platforms */
#define perror(A)
#else
#include <errno.h>
#define SOCKET_ERROR -1
#endif /* __WIN__ */
#endif /* _WIN32 */
/*
If allowed through some configuration, then this needs to
@ -167,7 +167,7 @@ int STDCALL mysql_server_init(int argc __attribute__((unused)),
if (!mysql_unix_port)
{
char *env;
#ifdef __WIN__
#ifdef _WIN32
mysql_unix_port = (char*) MYSQL_NAMEDPIPE;
#else
mysql_unix_port = (char*) MYSQL_UNIX_ADDR;
@ -176,7 +176,7 @@ int STDCALL mysql_server_init(int argc __attribute__((unused)),
mysql_unix_port = env;
}
mysql_debug(NullS);
#if defined(SIGPIPE) && !defined(__WIN__)
#if defined(SIGPIPE) && !defined(_WIN32)
(void) signal(SIGPIPE, SIG_IGN);
#endif
#ifdef EMBEDDED_LIBRARY
@ -421,7 +421,7 @@ struct passwd *getpwuid(uid_t);
char* getlogin(void);
#endif
#if !defined(__WIN__)
#if !defined(_WIN32)
void read_user_name(char *name)
{

View file

@ -32,7 +32,7 @@
#ifdef HAVE_PWD_H
#include <pwd.h>
#endif
#if !defined(__WIN__)
#if !defined(_WIN32)
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
@ -54,7 +54,7 @@
extern ulong net_buffer_length;
extern ulong max_allowed_packet;
#if defined(__WIN__)
#if defined(_WIN32)
#define ERRNO WSAGetLastError()
#define perror(A)
#else
@ -69,13 +69,6 @@ struct passwd *getpwuid(uid_t);
char* getlogin(void);
#endif
#ifdef __WIN__
static my_bool is_NT(void)
{
char *os=getenv("OS");
return (os && !strcmp(os, "Windows_NT")) ? 1 : 0;
}
#endif
int mysql_init_character_set(MYSQL *mysql);

View file

@ -29,7 +29,7 @@
#include <pwd.h>
#endif /* HAVE_PWD_H */
#else /* ! HAVE_GETPASS */
#ifndef __WIN__
#ifndef _WIN32
#include <sys/ioctl.h>
#ifdef HAVE_TERMIOS_H /* For tty-password */
#include <termios.h>
@ -49,14 +49,14 @@
#endif
#else
#include <conio.h>
#endif /* __WIN__ */
#endif /* _WIN32 */
#endif /* HAVE_GETPASS */
#ifdef HAVE_GETPASSPHRASE /* For Solaris */
#define getpass(A) getpassphrase(A)
#endif
#ifdef __WIN__
#ifdef _WIN32
/* were just going to fake it here and get input from
the keyboard */
@ -204,4 +204,4 @@ char *get_tty_password(const char *opt_message)
DBUG_RETURN(my_strdup(PSI_INSTRUMENT_ME, buff, MYF(MY_FAE)));
}
#endif /*__WIN__*/
#endif /*_WIN32*/

View file

@ -400,7 +400,7 @@ static long keycache_thread_id;
#define HASH_LINK_NUMBER(h) \
((uint) (((char*)(h)-(char *) keycache->hash_link_root)/sizeof(HASH_LINK)))
#if (defined(KEYCACHE_TIMEOUT) && !defined(__WIN__)) || defined(KEYCACHE_DEBUG)
#if (defined(KEYCACHE_TIMEOUT) && !defined(_WIN32)) || defined(KEYCACHE_DEBUG)
static int keycache_pthread_cond_wait(mysql_cond_t *cond,
mysql_mutex_t *mutex);
#else
@ -4674,7 +4674,7 @@ static void keycache_dump(SIMPLE_KEY_CACHE_CB *keycache)
#endif /* defined(KEYCACHE_TIMEOUT) */
#if defined(KEYCACHE_TIMEOUT) && !defined(__WIN__)
#if defined(KEYCACHE_TIMEOUT) && !defined(_WIN32)
static int keycache_pthread_cond_wait(mysql_cond_t *cond,
@ -4736,7 +4736,7 @@ static int keycache_pthread_cond_wait(mysql_cond_t *cond,
return rc;
}
#endif
#endif /* defined(KEYCACHE_TIMEOUT) && !defined(__WIN__) */
#endif /* defined(KEYCACHE_TIMEOUT) && !defined(_WIN32) */
#if defined(KEYCACHE_DEBUG)

View file

@ -74,7 +74,7 @@ char * my_path(char * to, const char *progname,
/* test if file without filename is found in path */
/* Returns to if found and to has dirpart if found, else NullS */
#if defined(__WIN__)
#if defined(_WIN32)
#define F_OK 0
#define PATH_SEP ';'
#define PROGRAM_EXTENSION ".exe"
@ -107,7 +107,7 @@ static char *find_file_in_path(char *to, const char *name)
}
}
}
#ifdef __WIN__
#ifdef _WIN32
to[0]=FN_CURLIB;
strxmov(to+1,dir,name,ext,NullS);
if (!access(to,F_OK)) /* Test in current dir */

View file

@ -16,7 +16,7 @@
#include "mysys_priv.h"
#include <m_string.h>
#if defined(__WIN__)
#if defined(_WIN32)
#define DELIM ';'
#else
#define DELIM ':'
@ -37,7 +37,7 @@ my_bool init_tmpdir(MY_TMPDIR *tmpdir, const char *pathlist)
{
/* Get default temporary directory */
pathlist=getenv("TMPDIR"); /* Use this if possible */
#if defined(__WIN__)
#if defined(_WIN32)
if (!pathlist)
pathlist=getenv("TEMP");
if (!pathlist)

View file

@ -17,7 +17,7 @@
#include "mysys_priv.h"
#include <m_string.h>
#ifdef __WIN__
#ifdef _WIN32
/*
Check a file or path for accessability.
@ -46,7 +46,7 @@ int my_access(const char *path, int amode)
return 0;
}
#endif /* __WIN__ */
#endif /* _WIN32 */
/*
@ -150,7 +150,7 @@ int check_if_legal_tablename(const char *name)
}
#ifdef __WIN__
#ifdef _WIN32
/**
Checks if the drive letter supplied is valid or not. Valid drive
letters are A to Z, both lower case and upper case.
@ -217,10 +217,9 @@ my_bool is_filename_allowed(const char *name __attribute__((unused)),
}
return TRUE;
} /* is_filename_allowed */
#endif /* __WIN__ */
#if defined(__WIN__) || defined(__EMX__)
#endif /* _WIN32 */
#if defined(_WIN32)
/*
Check if a path will access a reserved file name that may cause problems
@ -265,4 +264,4 @@ int check_if_legal_filename(const char *path)
DBUG_RETURN(0);
}
#endif /* defined(__WIN__) || defined(__EMX__) */
#endif /* defined(_WIN32) */

View file

@ -17,7 +17,7 @@
#include "mysys_priv.h"
#ifdef __WIN__
#ifdef _WIN32
static HANDLE my_coninpfh= 0; /* console input */
@ -220,4 +220,4 @@ char* my_cgets(char *buffer, size_t clen, size_t* plen)
return result;
}
#endif /* __WIN__ */
#endif /* _WIN32 */

View file

@ -116,7 +116,7 @@ int my_copy(const char *from, const char *to, myf MyFlags)
if (MyFlags & MY_FAE)
goto err;
}
#if !defined(__WIN__)
#if !defined(_WIN32)
/* Copy ownership */
if (chown(to, stat_buff.st_uid, stat_buff.st_gid))
{

View file

@ -39,7 +39,7 @@
#include <m_string.h>
#include <m_ctype.h>
#include <my_dir.h>
#ifdef __WIN__
#ifdef _WIN32
#include <winbase.h>
#endif
@ -66,7 +66,7 @@ const char *my_defaults_extra_file=0;
#define DEFAULT_DIRS_SIZE (MAX_DEFAULT_DIRS + 1) /* Terminate with NULL */
static const char **default_directories = NULL;
#ifdef __WIN__
#ifdef _WIN32
static const char *f_extensions[]= { ".ini", ".cnf", 0 };
#define NEWLINE "\r\n"
#else
@ -620,7 +620,7 @@ static int search_default_file_with_ext(struct handle_option_ctx *ctx,
strmov(name,config_file);
}
fn_format(name,name,"","",4);
#if !defined(__WIN__)
#if !defined(_WIN32)
{
MY_STAT stat_info;
if (!my_stat(name,&stat_info,MYF(0)))
@ -973,7 +973,7 @@ static int add_directory(MEM_ROOT *alloc, const char *dir, const char **dirs)
return 0;
}
#ifdef __WIN__
#ifdef _WIN32
static const char *my_get_module_parent(char *buf, size_t size)
{
char *last= NULL;
@ -1003,7 +1003,7 @@ static const char *my_get_module_parent(char *buf, size_t size)
return buf;
}
#endif /* __WIN__ */
#endif /* _WIN32 */
static const char **init_default_directories(MEM_ROOT *alloc)
@ -1018,7 +1018,7 @@ static const char **init_default_directories(MEM_ROOT *alloc)
DBUG_RETURN(NULL);
bzero((char *) dirs, DEFAULT_DIRS_SIZE * sizeof(char *));
#ifdef __WIN__
#ifdef _WIN32
{
char fname_buffer[FN_REFLEN];
@ -1066,7 +1066,7 @@ static const char **init_default_directories(MEM_ROOT *alloc)
/* Placeholder for --defaults-extra-file=<path> */
errors += add_directory(alloc, "", dirs);
#if !defined(__WIN__)
#if !defined(_WIN32)
errors += add_directory(alloc, "~/", dirs);
#endif

View file

@ -63,7 +63,7 @@ int my_getncpus(void)
#ifdef _SC_NPROCESSORS_ONLN
ncpus= sysconf(_SC_NPROCESSORS_ONLN);
#elif defined(__WIN__)
#elif defined(_WIN32)
SYSTEM_INFO sysinfo;
/*

View file

@ -18,7 +18,7 @@
#ifndef HAVE_GETPAGESIZE
#if defined __WIN__
#if defined _WIN32
int my_getpagesize(void)
{

View file

@ -22,7 +22,7 @@
#ifdef HAVE_GETWD
#include <sys/param.h>
#endif
#if defined(__WIN__)
#if defined(_WIN32)
#include <m_ctype.h>
#include <dos.h>
#include <direct.h>

View file

@ -18,7 +18,7 @@
#include "mysys_err.h"
#include <sys/types.h>
#include <sys/stat.h>
#ifdef __WIN__
#ifdef _WIN32
#include <direct.h>
#endif

View file

@ -90,7 +90,7 @@ struct tm *gmtime_r(const time_t *clock, struct tm *res)
** Author: Gary Wisniewski <garyw@spidereye.com.au>, much modified by Monty
****************************************************************************/
#if !defined(HAVE_SIGWAIT) && !defined(sigwait) && !defined(__WIN__) && !defined(HAVE_rts_threads)
#if !defined(HAVE_SIGWAIT) && !defined(sigwait) && !defined(_WIN32) && !defined(HAVE_rts_threads)
#if !defined(DONT_USE_SIGSUSPEND)

View file

@ -106,7 +106,7 @@ int my_copystat(const char *from, const char *to, int MyFlags)
return -1;
}
#if !defined(__WIN__)
#if !defined(_WIN32)
if (statbuf.st_nlink > 1 && MyFlags & MY_LINK_WARNING)
{
if (MyFlags & MY_LINK_WARNING)
@ -121,7 +121,7 @@ int my_copystat(const char *from, const char *to, int MyFlags)
if (MyFlags & MY_FAE)
return -1;
}
#endif /* !__WIN__ */
#endif /* !_WIN32 */
if (MyFlags & MY_COPYTIME)
{

View file

@ -81,7 +81,7 @@ int my_rename(const char *from, const char *to, myf MyFlags)
DBUG_ENTER("my_rename");
DBUG_PRINT("my",("from %s to %s MyFlags %lu", from, to, MyFlags));
#if defined(__WIN__)
#if defined(_WIN32)
if (!win_rename_with_retries(from, to))
{
my_osmaperr(GetLastError());

View file

@ -20,7 +20,7 @@
void my_sleep(ulong m_seconds)
{
#if defined(__WIN__)
#if defined(_WIN32)
Sleep(m_seconds/1000+1); /* Sleep() has millisecond arg */
#elif defined(HAVE_SELECT)
struct timeval t;

View file

@ -111,4 +111,4 @@ int pthread_attr_destroy(pthread_attr_t *connect_att)
return 0;
}
#endif /* __WIN__ */
#endif /* _WIN32 */

View file

@ -18,7 +18,7 @@
#include "mysys_priv.h"
#include <my_stacktrace.h>
#ifndef __WIN__
#ifndef _WIN32
#include <signal.h>
#include <m_string.h>
#ifdef HAVE_STACKTRACE
@ -43,10 +43,10 @@ static sig_handler default_handle_fatal_signal(int sig)
my_safe_printf_stderr("%s: Got signal %d. Attempting backtrace\n",
my_progname_short, sig);
my_print_stacktrace(0,0,1);
#ifndef __WIN__
#ifndef _WIN32
signal(sig, SIG_DFL);
kill(getpid(), sig);
#endif /* __WIN__ */
#endif /* _WIN32 */
return;
}
@ -428,7 +428,7 @@ void my_write_core(int sig)
#endif
}
#else /* __WIN__*/
#else /* _WIN32*/
#ifdef _MSC_VER
/* Silence warning in OS header dbghelp.h */
@ -713,7 +713,7 @@ int my_safe_print_str(const char *val, size_t len)
}
return 0;
}
#endif /*__WIN__*/
#endif /*_WIN32*/
size_t my_write_stderr(const void *buf, size_t count)

View file

@ -145,13 +145,13 @@ my_bool dynstr_trunc(DYNAMIC_STRING *str, size_t n)
my_bool dynstr_append_os_quoted(DYNAMIC_STRING *str, const char *append, ...)
{
#ifdef __WIN__
#ifdef _WIN32
LEX_CSTRING quote= { C_STRING_WITH_LEN("\"") };
LEX_CSTRING replace= { C_STRING_WITH_LEN("\\\"") };
#else
LEX_CSTRING quote= { C_STRING_WITH_LEN("\'") };
LEX_CSTRING replace= { C_STRING_WITH_LEN("'\"'\"'") };
#endif /* __WIN__ */
#endif /* _WIN32 */
my_bool ret= TRUE;
va_list dirty_text;

View file

@ -50,7 +50,7 @@
my_bool thr_alarm_inited= 0, my_disable_thr_alarm= 0;
#if !defined(__WIN__)
#if !defined(_WIN32)
uint thr_client_alarm;
static int alarm_aborted=1; /* No alarm thread */

View file

@ -433,7 +433,7 @@ int safe_mutex_unlock(safe_mutex_t *mp,const char *file, uint line)
remove_from_active_list(mp);
#ifdef __WIN__
#ifdef _WIN32
pthread_mutex_unlock(&mp->mutex);
error=0;
#else
@ -446,7 +446,7 @@ int safe_mutex_unlock(safe_mutex_t *mp,const char *file, uint line)
fflush(stderr);
abort();
}
#endif /* __WIN__ */
#endif /* _WIN32 */
pthread_mutex_unlock(&mp->global);
return error;
}
@ -603,7 +603,7 @@ int safe_mutex_destroy(safe_mutex_t *mp, const char *file, uint line)
/* Free all entries that points to this one */
safe_mutex_free_deadlock_data(mp);
#ifdef __WIN__
#ifdef _WIN32
pthread_mutex_destroy(&mp->global);
pthread_mutex_destroy(&mp->mutex);
#else
@ -611,7 +611,7 @@ int safe_mutex_destroy(safe_mutex_t *mp, const char *file, uint line)
error=1;
if (pthread_mutex_destroy(&mp->mutex))
error=1;
#endif /* __WIN__ */
#endif /* _WIN32 */
mp->file= 0; /* Mark destroyed */
#ifdef SAFE_MUTEX_DETECT_DESTROY

View file

@ -246,7 +246,7 @@ int my_getncpus()
{
#ifdef _SC_NPROCESSORS_ONLN
return sysconf(_SC_NPROCESSORS_ONLN);
#elif defined(__WIN__)
#elif defined(_WIN32)
SYSTEM_INFO sysinfo;
GetSystemInfo(&sysinfo);
return sysinfo.dwNumberOfProcessors;

View file

@ -217,7 +217,7 @@ static int loc_rename(const char *from, const char *to)
{
int error = 0;
#if defined(__WIN__)
#if defined(_WIN32)
if (!MoveFileEx(from, to, MOVEFILE_COPY_ALLOWED |
MOVEFILE_REPLACE_EXISTING))
{
@ -1044,9 +1044,9 @@ static int get_user_host(const char *uh_line, unsigned int uh_len,
return 0;
}
#if defined(__WIN__) && !defined(S_ISDIR)
#if defined(_WIN32) && !defined(S_ISDIR)
#define S_ISDIR(x) ((x) & _S_IFDIR)
#endif /*__WIN__ && !S_ISDIR*/
#endif /*_WIN32 && !S_ISDIR*/
static int start_logging()
{

View file

@ -18,7 +18,7 @@
#define __MYSQL_CUSTOM_BUILD_CONFIG__
#define MYSQL_PORT 5002
#ifdef __WIN__
#ifdef _WIN32
#define MYSQL_NAMEDPIPE "SwSqlServer"
#define MYSQL_SERVICENAME "SwSqlServer"
#define KEY_SERVICE_PARAMETERS

View file

@ -27,7 +27,7 @@
#include "sql_priv.h"
#include "hash_filo.h"
#ifdef __WIN__
#ifdef _WIN32
// Remove linker warning 4221 about empty file
namespace { char dummy; };
#endif // __WIN__
#endif // _WIN32

View file

@ -28,7 +28,7 @@
#include "sql_priv.h"
#include "unireg.h" // SPECIAL_NO_HOST_CACHE
#include "hostname.h"
#ifndef __WIN__
#ifndef _WIN32
#include <netdb.h> // getservbyname, servent
#endif
#include "hash_filo.h"
@ -40,12 +40,12 @@
#ifdef __cplusplus
extern "C" { // Because of SCO 3.2V4.2
#endif
#if !defined( __WIN__)
#if !defined( _WIN32)
#ifdef HAVE_SYS_UN_H
#include <sys/un.h>
#endif
#include <sys/utsname.h>
#endif // __WIN__
#endif // _WIN32
#ifdef __cplusplus
}
#endif

View file

@ -87,7 +87,7 @@ int _my_b_net_read(IO_CACHE *info, uchar *Buffer, size_t)
} /* extern "C" */
#elif defined(__WIN__)
#elif defined(_WIN32)
// Remove linker warning 4221 about empty file
namespace { char dummy; };

View file

@ -18,7 +18,7 @@
#include "sql_priv.h"
#include "unireg.h"
#include <signal.h>
#ifndef __WIN__
#ifndef _WIN32
#include <netdb.h> // getservbyname, servent
#endif
#include "sql_parse.h" // path_starts_from_data_home_dir
@ -148,7 +148,7 @@ extern "C" { // Because of SCO 3.2V4.2
#endif
#include <my_net.h>
#if !defined(__WIN__)
#if !defined(_WIN32)
#include <sys/resource.h>
#ifdef HAVE_SYS_UN_H
#include <sys/un.h>
@ -160,11 +160,11 @@ extern "C" { // Because of SCO 3.2V4.2
#include <sys/select.h>
#endif
#include <sys/utsname.h>
#endif /* __WIN__ */
#endif /* _WIN32 */
#include <my_libwrap.h>
#ifdef __WIN__
#ifdef _WIN32
#include <crtdbg.h>
#endif
@ -1636,7 +1636,7 @@ static void break_connect_loop()
#endif
}
mysql_mutex_unlock(&LOCK_start_thread);
#endif /* __WIN__ */
#endif /* _WIN32 */
}
@ -1784,7 +1784,7 @@ extern "C" sig_handler print_signal_warning(int sig)
#ifdef SIGNAL_HANDLER_RESET_ON_DELIVERY
my_sigset(sig,print_signal_warning); /* int. thread system calls */
#endif
#if !defined(__WIN__)
#if !defined(_WIN32)
if (sig == SIGALRM)
alarm(2); /* reschedule alarm */
#endif
@ -2109,7 +2109,7 @@ static void set_ports()
}
if (!mysqld_unix_port)
{
#ifdef __WIN__
#ifdef _WIN32
mysqld_unix_port= (char*) MYSQL_NAMEDPIPE;
#else
mysqld_unix_port= (char*) MYSQL_UNIX_ADDR;
@ -2168,7 +2168,7 @@ static void set_user(const char *user, struct passwd *user_info_arg)
allow_coredumps();
}
#if !defined(__WIN__)
#if !defined(_WIN32)
static void set_effective_user(struct passwd *user_info_arg)
{
DBUG_ASSERT(user_info_arg != 0);
@ -2189,7 +2189,7 @@ static void set_effective_user(struct passwd *user_info_arg)
/** Change root user if started with @c --chroot . */
static void set_root(const char *path)
{
#if !defined(__WIN__)
#if !defined(_WIN32)
if (chroot(path) == -1)
{
sql_perror("chroot");
@ -2272,7 +2272,7 @@ static void activate_tcp_port(uint port,
mysql_socket_set_thread_owner(ip_sock);
#ifndef __WIN__
#ifndef _WIN32
/*
We should not use SO_REUSEADDR on windows as this would enable a
user to open two mysqld servers with the same TCP/IP port.
@ -2280,7 +2280,7 @@ static void activate_tcp_port(uint port,
arg= 1;
(void) mysql_socket_setsockopt(ip_sock, SOL_SOCKET, SO_REUSEADDR,
(char*)&arg, sizeof(arg));
#endif /* __WIN__ */
#endif /* _WIN32 */
#ifdef IPV6_V6ONLY
/*
@ -2898,7 +2898,7 @@ static void start_signal_handler(void)
static void check_data_home(const char *path)
{}
#endif /* __WIN__ */
#endif /* _WIN32 */
#if BACKTRACE_DEMANGLE
@ -2925,7 +2925,7 @@ mariadb_dbug_assert_failed(const char *assert_expr, const char *file,
}
#endif /* DBUG_ASSERT_AS_PRINT */
#if !defined(__WIN__)
#if !defined(_WIN32)
#ifndef SA_RESETHAND
#define SA_RESETHAND 0
#endif /* SA_RESETHAND */
@ -3191,7 +3191,7 @@ static void check_data_home(const char *path)
{}
#endif /*!EMBEDDED_LIBRARY*/
#endif /* __WIN__*/
#endif /* _WIN32*/
/**
@ -3995,7 +3995,7 @@ static int init_common_variables()
/* MyISAM requires two file handles per table. */
wanted_files= (extra_files + max_connections + extra_max_connections +
tc_size * 2 * tc_instances);
#if defined(HAVE_POOL_OF_THREADS) && !defined(__WIN__)
#if defined(HAVE_POOL_OF_THREADS) && !defined(_WIN32)
// add epoll or kevent fd for each threadpool group, in case pool of threads is used
wanted_files+= (thread_handling > SCHEDULER_NO_THREADS) ? 0 : threadpool_size;
#endif
@ -6615,7 +6615,7 @@ struct my_option my_long_options[]=
&opt_use_ssl, &opt_use_ssl, 0, GET_BOOL, OPT_ARG, 0, 0, 0,
0, 0, 0},
#endif
#ifdef __WIN__
#ifdef _WIN32
{"standalone", 0,
"Dummy option to start as a standalone program (NT).", 0, 0, 0, GET_NO_ARG,
NO_ARG, 0, 0, 0, 0, 0, 0},
@ -7541,7 +7541,7 @@ static void usage(void)
puts("\nFor more help options (several pages), use mysqld --verbose --help.");
else
{
#ifdef __WIN__
#ifdef _WIN32
puts("NT and Win32 specific options:\n"
" --install Install the default service (NT).\n"
" --install-manual Install the default service started manually (NT).\n"
@ -7759,7 +7759,7 @@ static int mysql_init_variables(void)
#endif /* ! EMBEDDED_LIBRARY */
#endif /* HAVE_OPENSSL */
#if defined(__WIN__)
#if defined(_WIN32)
/* Allow Win32 users to move MySQL anywhere */
{
char prg_dev[LIBLEN];

View file

@ -697,7 +697,7 @@ void init_sql_statement_info();
void init_com_statement_info();
#endif /* HAVE_PSI_STATEMENT_INTERFACE */
#ifndef __WIN__
#ifndef _WIN32
extern pthread_t signal_thread;
#endif

View file

@ -92,7 +92,7 @@ static void inline MYSQL_SERVER_my_error(...) {}
the client should have a bigger max_allowed_packet.
*/
#if defined(__WIN__) || !defined(MYSQL_SERVER)
#if defined(_WIN32) || !defined(MYSQL_SERVER)
/* The following is because alarms doesn't work on windows. */
#ifndef NO_ALARM
#define NO_ALARM
@ -167,7 +167,7 @@ my_bool my_net_init(NET *net, Vio *vio, void *thd, uint my_flags)
{
/* For perl DBI/DBD. */
net->fd= vio_fd(vio);
#if defined(MYSQL_SERVER) && !defined(__WIN__)
#if defined(MYSQL_SERVER) && !defined(_WIN32)
if (!(test_flags & TEST_BLOCKING))
{
my_bool old_mode;
@ -279,7 +279,7 @@ static int net_data_is_ready(my_socket sd)
struct timeval tv;
int res;
#ifndef __WIN__
#ifndef _WIN32
/* Windows uses an _array_ of 64 fd's as default, so it's safe */
if (sd >= FD_SETSIZE)
return -1;
@ -710,7 +710,7 @@ net_real_write(NET *net,const uchar *packet, size_t len)
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(_WIN32)
if ((interrupted || length == 0) && !thr_alarm_in_use(&alarmed))
{
if (!thr_alarm(&alarmed, net->write_timeout, &alarm_buff))
@ -733,7 +733,7 @@ net_real_write(NET *net,const uchar *packet, size_t len)
}
}
else
#endif /* !defined(__WIN__) */
#endif /* !defined(_WIN32) */
if (thr_alarm_in_use(&alarmed) && !thr_got_alarm(&alarmed) &&
interrupted)
{
@ -758,7 +758,7 @@ net_real_write(NET *net,const uchar *packet, size_t len)
pos+=length;
update_statistics(thd_increment_bytes_sent(net->thd, length));
}
#ifndef __WIN__
#ifndef _WIN32
end:
#endif
#ifdef HAVE_COMPRESS
@ -1005,7 +1005,7 @@ retry:
goto end;
}
#if !defined(__WIN__) && defined(MYSQL_SERVER)
#if !defined(_WIN32) && 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 the blocking
@ -1037,7 +1037,7 @@ retry:
continue;
}
}
#endif /* (!defined(__WIN__) && defined(MYSQL_SERVER) */
#endif /* (!defined(_WIN32) && defined(MYSQL_SERVER) */
if (thr_alarm_in_use(&alarmed) && !thr_got_alarm(&alarmed) &&
interrupted)
{ /* Probably in MIT threads */

View file

@ -24,7 +24,7 @@
#include "sql_class.h"
#include "my_stacktrace.h"
#ifdef __WIN__
#ifdef _WIN32
#include <crtdbg.h>
#define SIGNAL_FMT "exception 0x%x"
#else
@ -346,7 +346,7 @@ extern "C" sig_handler handle_fatal_signal(int sig)
#endif
end:
#ifndef __WIN__
#ifndef _WIN32
/*
Quit, without running destructors (etc.)
Use a signal, because the parent (systemd) can check that with WIFSIGNALED

View file

@ -54,7 +54,7 @@
#include "sql_table.h" // build_table_filename
#include "datadict.h" // dd_frm_is_view()
#include "rpl_rli.h" // rpl_group_info
#ifdef __WIN__
#ifdef _WIN32
#include <io.h>
#endif
#include "wsrep_mysqld.h"

View file

@ -1851,7 +1851,7 @@ void add_diff_to_status(STATUS_VAR *to_var, STATUS_VAR *from_var,
}
#define SECONDS_TO_WAIT_FOR_KILL 2
#if !defined(__WIN__) && defined(HAVE_SELECT)
#if !defined(_WIN32) && defined(HAVE_SELECT)
/* my_sleep() can wait for sub second times */
#define WAIT_FOR_KILL_TRY_TIMES 20
#else

View file

@ -3033,7 +3033,7 @@ public:
} default_transaction, *transaction;
Global_read_lock global_read_lock;
Field *dup_field;
#ifndef __WIN__
#ifndef _WIN32
sigset_t signals;
#endif
#ifdef SIGNAL_WITH_VIO_CLOSE

View file

@ -23,7 +23,7 @@
#include "mariadb.h"
#include "mysqld.h"
#include "sql_priv.h"
#ifndef __WIN__
#ifndef _WIN32
#include <netdb.h> // getservbyname, servent
#endif
#include "sql_audit.h"

View file

@ -297,19 +297,6 @@
*/
#define MAX_TIME_ZONE_NAME_LENGTH (NAME_LEN + 1)
#if defined(__WIN__)
#define INTERRUPT_PRIOR -2
#define CONNECT_PRIOR -1
#define WAIT_PRIOR 0
#define QUERY_PRIOR 2
#else
#define INTERRUPT_PRIOR 10
#define CONNECT_PRIOR 9
#define WAIT_PRIOR 8
#define QUERY_PRIOR 6
#endif /* __WIN92__ */
#define SP_PSI_STATEMENT_INFO_COUNT 19
#endif /* SQL_CONST_INCLUDED */

View file

@ -44,7 +44,7 @@
#include <my_dir.h>
#include <m_ctype.h>
#include "log.h"
#ifdef __WIN__
#ifdef _WIN32
#include <direct.h>
#endif
#include "debug.h" // debug_crash_here

View file

@ -567,7 +567,7 @@ int mysql_load(THD *thd, const sql_exchange *ex, TABLE_LIST *table_list,
DBUG_RETURN(TRUE);
}
#if !defined(__WIN__) && ! defined(__NETWARE__)
#if !defined(_WIN32)
MY_STAT stat_info;
if (!my_stat(name, &stat_info, MYF(MY_WME)))
DBUG_RETURN(TRUE);

View file

@ -2183,7 +2183,7 @@ static int add_keyword_path(String *str, const char *keyword,
{
char temp_path[FN_REFLEN];
strcpy(temp_path, path);
#ifdef __WIN__
#ifdef _WIN32
/* Convert \ to / to be able to create table on unix */
char *pos, *end;
size_t length= strlen(temp_path);

View file

@ -1959,7 +1959,7 @@ static bool plugin_load_list(MEM_ROOT *tmp_root, const char *list)
list= NULL; /* terminate the loop */
/* fall through */
case ';':
#ifndef __WIN__
#ifndef _WIN32
case ':': /* can't use this as delimiter as it may be drive letter */
#endif
p[-1]= 0;

View file

@ -610,7 +610,7 @@ int PROFILING::fill_statistics_info(THD *thd_arg, TABLE_LIST *tables, Item *cond
table->field[9]->store((uint32)(entry->rusage.ru_oublock -
previous->rusage.ru_oublock));
table->field[9]->set_notnull();
#elif defined(__WIN__)
#elif defined(_WIN32)
ULONGLONG reads_delta = entry->io_count.ReadOperationCount -
previous->io_count.ReadOperationCount;
ULONGLONG writes_delta = entry->io_count.WriteOperationCount -
@ -643,7 +643,7 @@ int PROFILING::fill_statistics_info(THD *thd_arg, TABLE_LIST *tables, Item *cond
table->field[13]->store((uint32)(entry->rusage.ru_minflt -
previous->rusage.ru_minflt), true);
table->field[13]->set_notnull();
#elif defined(__WIN__)
#elif defined(_WIN32)
/* Windows APIs don't easily distinguish between hard and soft page
faults, so we just fill the 'major' column and leave the second NULL.
*/

View file

@ -46,7 +46,7 @@ int make_profile_table_for_show(THD *thd, ST_SCHEMA_TABLE *schema_table);
#include "sql_priv.h"
#include "unireg.h"
#ifdef __WIN__
#ifdef _WIN32
#include <psapi.h>
#endif

View file

@ -1651,7 +1651,7 @@ static void append_directory(THD *thd, String *packet, LEX_CSTRING *dir_type,
packet->append(' ');
packet->append(dir_type);
packet->append(STRING_WITH_LEN(" DIRECTORY='"));
#ifdef __WIN__
#ifdef _WIN32
/* Convert \ to / to be able to create table on unix */
char *winfilename= (char*) thd->memdup(filename, length);
char *pos, *end;

View file

@ -59,7 +59,7 @@
#include "debug.h" // debug_crash_here()
#include <algorithm>
#ifdef __WIN__
#ifdef _WIN32
#include <io.h>
#endif

View file

@ -3031,7 +3031,7 @@ static Sys_var_ulonglong Sys_thread_stack(
static Sys_var_charptr_fscs Sys_tmpdir(
"tmpdir", "Path for temporary files. Several paths may "
"be specified, separated by a "
#if defined(__WIN__)
#if defined(_WIN32)
"semicolon (;)"
#else
"colon (:)"

View file

@ -122,13 +122,13 @@
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#ifdef __WIN__
#ifdef _WIN32
typedef unsigned __int64 ulonglong; /* Microsofts 64 bit types */
typedef __int64 longlong;
#else
typedef unsigned long long ulonglong;
typedef long long longlong;
#endif /*__WIN__*/
#endif /*_WIN32*/
#else
#include "mariadb.h"
#include <my_sys.h>
@ -700,7 +700,7 @@ longlong udf_sequence(UDF_INIT *initid __attribute__((unused)), UDF_ARGS *args,
**
****************************************************************************/
#ifdef __WIN__
#ifdef _WIN32
#include <winsock2.h>
#else
#include <sys/socket.h>

View file

@ -729,7 +729,7 @@ static int sst_append_env_var(wsp::env& env,
return -env.error();
}
#ifdef __WIN__
#ifdef _WIN32
/*
Space, single quote, ampersand, backquote, I/O redirection
characters, caret, all brackets, plus, exclamation and comma
@ -803,7 +803,7 @@ static size_t estimate_cmd_len (bool* extra_args)
else if (IS_REQ_ESCAPING(c))
{
cmd_len++;
#ifdef __WIN__
#ifdef _WIN32
quotation= true;
#endif
}
@ -832,7 +832,7 @@ static size_t estimate_cmd_len (bool* extra_args)
else if (IS_REQ_ESCAPING(c))
{
cmd_len++;
#ifdef __WIN__
#ifdef _WIN32
quotation= true;
#endif
}
@ -888,7 +888,7 @@ static void copy_orig_argv (char* cmd_str)
else if (IS_REQ_ESCAPING(c))
{
plain= false;
#ifdef __WIN__
#ifdef _WIN32
quotation= true;
#endif
}
@ -928,7 +928,7 @@ static void copy_orig_argv (char* cmd_str)
c = *arg++;
if (IS_REQ_ESCAPING(c))
{
#ifdef __WIN__
#ifdef _WIN32
*cmd_str++ = c;
#else
*cmd_str++ = '\\';
@ -968,7 +968,7 @@ static void copy_orig_argv (char* cmd_str)
else if (IS_REQ_ESCAPING(c))
{
plain= false;
#ifdef __WIN__
#ifdef _WIN32
quotation= true;
#endif
}
@ -999,7 +999,7 @@ static void copy_orig_argv (char* cmd_str)
{
if (IS_REQ_ESCAPING(c))
{
#ifdef __WIN__
#ifdef _WIN32
*cmd_str++ = c;
#else
*cmd_str++ = '\\';

View file

@ -82,6 +82,7 @@ ELSE(NOT UNIX)
# Connect does not work with clang-cl
RETURN()
ENDIF()
add_definitions(-D__WIN__)
ENDIF(UNIX)

View file

@ -1466,7 +1466,7 @@ static void fill_server(MEM_ROOT *mem_root, FEDERATEDX_SERVER *server,
database.length(my_casedn_str(system_charset_info, database.c_ptr_safe()));
}
#ifndef __WIN__
#ifndef _WIN32
/*
TODO: there is no unix sockets under windows so the engine should be
revised about using sockets in such environment.

View file

@ -17,7 +17,7 @@
/* Write a record to heap-databas */
#include "heapdef.h"
#ifdef __WIN__
#ifdef _WIN32
#include <fcntl.h>
#endif

View file

@ -256,7 +256,7 @@ buf_dump(
#ifdef _WIN32
/* use my_fopen() for correct permissions during bootstrap*/
f = my_fopen(tmp_filename, O_RDWR|O_TRUNC|O_CREAT, 0);
#elif defined(__GLIBC__) || defined(__WIN__) || O_CLOEXEC == 0
#elif defined(__GLIBC__) || O_CLOEXEC == 0
f = fopen(tmp_filename, "w" STR_O_CLOEXEC);
#else
{

View file

@ -13294,7 +13294,7 @@ inline int ha_innobase::delete_table(const char* name, enum_sql_command sqlcom)
if (is_part) {
char par_case_name[FN_REFLEN];
#ifndef __WIN__
#ifndef _WIN32
/* Check for the table using lower
case name, including the partition
separator "P" */

View file

@ -487,7 +487,7 @@ it is read or written. */
# define UNIV_PREFETCH_RW(addr) ((void) 0)
# endif /* COMPILER_HINTS */
# elif defined __WIN__ && defined COMPILER_HINTS
# elif defined _WIN32 && defined COMPILER_HINTS
# include <xmmintrin.h>
# define UNIV_EXPECT(expr,value) (expr)
# define UNIV_LIKELY_NULL(expr) (expr)

View file

@ -3749,11 +3749,11 @@ row_rename_table_for_mysql(
/* We look for pattern #P# to see if the table is partitioned
MySQL table. */
#ifdef __WIN__
#ifdef _WIN32
is_part = strstr((char *)old_name, (char *)"#p#");
#else
is_part = strstr((char *)old_name, (char *)"#P#");
#endif /* __WIN__ */
#endif /* _WIN32 */
/* MariaDB partition engine hard codes the file name
separator as "#P#" and "#SP#". The text case is fixed even if
@ -3773,7 +3773,7 @@ row_rename_table_for_mysql(
case them in the system table. */
if (!table && is_part && lower_case_table_names == 1) {
char par_case_name[MAX_FULL_NAME_LEN + 1];
#ifndef __WIN__
#ifndef _WIN32
/* Check for the table using lower
case name, including the partition
separator "P" */

View file

@ -505,7 +505,7 @@ static void usage(void)
maria_chk very silent.\n\
-t, --tmpdir=path Path for temporary files. Multiple paths can be\n\
specified, separated by ");
#if defined( __WIN__) || defined(__NETWARE__)
#if defined( _WIN32)
printf("semicolon (;)");
#else
printf("colon (:)");

View file

@ -19,7 +19,7 @@ extern void translog_example_table_init();
static const char *load_default_groups[]= { "aria_dump_log",0 };
static void get_options(int *argc,char * * *argv);
#ifndef DBUG_OFF
#if defined(__WIN__)
#if defined(_WIN32)
const char *default_dbug_option= "d:t:i:O,\\aria_dump_log.trace";
#else
const char *default_dbug_option= "d:t:i:o,/tmp/aria_dump_log.trace";

View file

@ -24,7 +24,7 @@
static const char *load_default_groups[]= { "aria_read_log",0 };
static void get_options(int *argc,char * * *argv);
#ifndef DBUG_OFF
#if defined(__WIN__)
#if defined(_WIN32)
const char *default_dbug_option= "d:t:O,\\aria_read_log.trace";
#else
const char *default_dbug_option= "d:t:o,/tmp/aria_read_log.trace";
@ -273,7 +273,7 @@ static struct my_option my_long_options[] =
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"tmpdir", 't', "Path for temporary files. Multiple paths can be specified, "
"separated by "
#if defined( __WIN__) || defined(__NETWARE__)
#if defined( _WIN32)
"semicolon (;)"
#else
"colon (:)"

View file

@ -226,7 +226,7 @@ static int lock_control_file(const char *name, my_bool do_retry)
@todo BUG We should explore my_sopen(_SH_DENYWRD) to open or create the
file under Windows.
*/
#ifndef __WIN__
#ifndef _WIN32
uint retry= 0;
uint retry_count= do_retry ? MARIA_MAX_CONTROL_FILE_LOCK_RETRY : 0;
@ -581,7 +581,7 @@ int ma_control_file_end(void)
if (control_file_fd < 0) /* already closed */
DBUG_RETURN(0);
#ifndef __WIN__
#ifndef _WIN32
(void) my_lock(control_file_fd, F_UNLCK, 0L, F_TO_EOF,
MYF(MY_SEEK_NOT_DONE | MY_FORCE_LOCK));
#endif

View file

@ -23,12 +23,8 @@
#include "trnman.h"
#include "ma_crypt.h"
#if defined(MSDOS) || defined(__WIN__)
#ifdef __WIN__
#ifdef _WIN32
#include <fcntl.h>
#else
#include <process.h> /* Prototype for getpid */
#endif
#endif
#include <m_ctype.h>

View file

@ -16,7 +16,7 @@
/* Return useful base information for an open table */
#include "maria_def.h"
#ifdef __WIN__
#ifdef _WIN32
#include <sys/stat.h>
#endif

View file

@ -220,7 +220,7 @@ int maria_lock_database(MARIA_HA *info, int lock_type)
break; /* Impossible */
}
}
#ifdef __WIN__
#ifdef _WIN32
else
{
/*
@ -320,7 +320,7 @@ int _ma_writeinfo(register MARIA_HA *info, uint operation)
&share->state,
MA_STATE_INFO_WRITE_DONT_MOVE_OFFSET)))
olderror=my_errno;
#ifdef __WIN__
#ifdef _WIN32
if (maria_flush)
{
_commit(share->kfile.file);

View file

@ -29,7 +29,7 @@
Also there is no need to flush filesystem changes ,i.e to sync()
directories.
*/
#ifdef __WIN__
#ifdef _WIN32
#define sync_dir(A,B) 0
#else
#define sync_dir(A,B) mysql_file_sync(A,B)
@ -3673,7 +3673,7 @@ my_bool translog_init_with_table(const char *directory,
/* Directory to store files */
unpack_dirname(log_descriptor.directory, directory);
#ifndef __WIN__
#ifndef _WIN32
if ((log_descriptor.directory_fd= my_open(log_descriptor.directory,
O_RDONLY, MYF(MY_WME))) < 0)
{

View file

@ -26,12 +26,8 @@
#include "ma_crypt.h"
#include "s3_func.h"
#if defined(MSDOS) || defined(__WIN__)
#ifdef __WIN__
#ifdef _WIN32
#include <fcntl.h>
#else
#include <process.h> /* Prototype for getpid */
#endif
#endif
static void setup_key_functions(MARIA_KEYDEF *keyinfo);

View file

@ -589,7 +589,7 @@ static my_thread_id pagecache_thread_id;
((uint) (((char*)(h)-(char *) p->hash_link_root)/ \
sizeof(PAGECACHE_HASH_LINK)))
#if (defined(PAGECACHE_TIMEOUT) && !defined(__WIN__)) || defined(PAGECACHE_DEBUG)
#if (defined(PAGECACHE_TIMEOUT) && !defined(_WIN32)) || defined(PAGECACHE_DEBUG)
static int pagecache_pthread_cond_wait(mysql_cond_t *cond,
mysql_mutex_t *mutex);
#else
@ -5561,7 +5561,7 @@ static void pagecache_dump(PAGECACHE *pagecache)
#endif /* defined(PAGECACHE_TIMEOUT) */
#if defined(PAGECACHE_TIMEOUT) && !defined(__WIN__)
#if defined(PAGECACHE_TIMEOUT) && !defined(_WIN32)
static int pagecache_pthread_cond_wait(mysql_cond_t *cond,
@ -5623,7 +5623,7 @@ static int pagecache_pthread_cond_wait(mysql_cond_t *cond,
return rc;
}
#endif
#endif /* defined(PAGECACHE_TIMEOUT) && !defined(__WIN__) */
#endif /* defined(PAGECACHE_TIMEOUT) && !defined(_WIN32) */
#if defined(PAGECACHE_DEBUG)

View file

@ -20,7 +20,7 @@
#include "ma_fulltext.h"
#include <my_check_opt.h>
#if defined(MSDOS) || defined(__WIN__)
#if defined(_WIN32)
#include <fcntl.h>
#else
#include <stddef.h>

View file

@ -339,7 +339,7 @@ int main(int argc __attribute__((unused)),
MY_INIT(argv[0]);
#ifndef DBUG_OFF
#if defined(__WIN__)
#if defined(_WIN32)
default_dbug_option= "d:t:i:O,\\test_pagecache_consist.trace";
#else
default_dbug_option= "d:t:i:o,/tmp/test_pagecache_consist.trace";

View file

@ -210,7 +210,7 @@ int main(int argc __attribute__((unused)),
MY_INIT(argv[0]);
#ifndef DBUG_OFF
#if defined(__WIN__)
#if defined(_WIN32)
default_dbug_option= "d:t:i:O,\\test_pagecache_consist.trace";
#else
default_dbug_option= "d:t:i:O,/tmp/test_pagecache_consist.trace";

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