summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Barkov <bar@mnogosearch.org>2014-02-27 19:44:00 +0400
committerAlexander Barkov <bar@mnogosearch.org>2014-02-27 19:44:00 +0400
commit57cdc561fc2b97c3d1d2b318fc0fa2410568c3d6 (patch)
tree8d61425ec6fed1b66faa46c1ad7ac1bc080df71e
parent11826b1bcfc2280e36a72c1516443c9b400edec2 (diff)
downloadmariadb-git-57cdc561fc2b97c3d1d2b318fc0fa2410568c3d6.tar.gz
Fixing AIX compilation failires
-rw-r--r--include/my_global.h33
-rw-r--r--plugin/handler_socket/libhsclient/auto_file.hpp5
-rw-r--r--sql-common/mysql_async.c6
-rw-r--r--sql/mysqld.cc2
-rw-r--r--sql/scheduler.h3
-rw-r--r--sql/threadpool_unix.cc5
-rw-r--r--storage/connect/os.h6
-rw-r--r--storage/perfschema/table_events_waits.cc14
-rw-r--r--storage/xtradb/include/sync0sync.h16
-rw-r--r--storage/xtradb/include/sync0sync.ic8
-rw-r--r--storage/xtradb/include/sync0types.h6
11 files changed, 82 insertions, 22 deletions
diff --git a/include/my_global.h b/include/my_global.h
index 55abb407872..9f47e5dcc63 100644
--- a/include/my_global.h
+++ b/include/my_global.h
@@ -144,6 +144,7 @@
/* Workaround for _LARGE_FILES and _LARGE_FILE_API incompatibility on AIX */
#if defined(_AIX) && defined(_LARGE_FILE_API)
#undef _LARGE_FILE_API
+#undef __GNUG__
#endif
/*
@@ -264,6 +265,16 @@
#endif
#endif
+
+#ifdef _AIX
+/*
+ AIX includes inttypes.h from sys/types.h
+ Explicitly request format macros before the first inclusion of inttypes.h
+*/
+#define __STDC_FORMAT_MACROS
+#endif
+
+
#if !defined(__WIN__)
#ifndef _POSIX_PTHREAD_SEMANTICS
#define _POSIX_PTHREAD_SEMANTICS /* We want posix threads */
@@ -316,6 +327,13 @@ C_MODE_END
#define _LONG_LONG 1 /* For AIX string library */
#endif
+/* Workaround for _LARGE_FILES and _LARGE_FILE_API incompatibility on AIX */
+#if defined(_AIX) && defined(_LARGE_FILE_API)
+#undef _LARGE_FILE_API
+#undef __GNUG__
+#endif
+
+
#ifndef stdin
#include <stdio.h>
#endif
@@ -341,6 +359,14 @@ C_MODE_END
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
+
+/* Workaround for _LARGE_FILES and _LARGE_FILE_API incompatibility on AIX */
+#if defined(_AIX) && defined(_LARGE_FILE_API)
+#undef _LARGE_FILE_API
+#undef __GNUG__
+#endif
+
+
#ifdef HAVE_FCNTL_H
#include <fcntl.h>
#endif
@@ -1221,4 +1247,11 @@ static inline double rint(double x)
#define DEFAULT_TMPDIR P_tmpdir
#endif
+/* Workaround for _LARGE_FILES and _LARGE_FILE_API incompatibility on AIX */
+#if defined(_AIX) && defined(_LARGE_FILE_API)
+#undef _LARGE_FILE_API
+#undef __GNUG__
+#endif
+
+
#endif /* my_global_h */
diff --git a/plugin/handler_socket/libhsclient/auto_file.hpp b/plugin/handler_socket/libhsclient/auto_file.hpp
index 841351e54cd..03c357f4d4e 100644
--- a/plugin/handler_socket/libhsclient/auto_file.hpp
+++ b/plugin/handler_socket/libhsclient/auto_file.hpp
@@ -9,6 +9,11 @@
#ifndef DENA_AUTO_FILE_HPP
#define DENA_AUTO_FILE_HPP
+/* Workaround for _LARGE_FILES and _LARGE_FILE_API incompatibility on AIX */
+#if defined(_AIX) && defined(_LARGE_FILE_API)
+#undef _LARGE_FILE_API
+#endif
+
#include <unistd.h>
#include <sys/types.h>
#include <dirent.h>
diff --git a/sql-common/mysql_async.c b/sql-common/mysql_async.c
index 8f3a91e26fa..ef01f292180 100644
--- a/sql-common/mysql_async.c
+++ b/sql-common/mysql_async.c
@@ -121,6 +121,12 @@ my_connect_async(struct mysql_async_context *b, my_socket fd,
IF_WIN(WSAGetLastError() != WSAEWOULDBLOCK, \
(errno != EAGAIN && errno != EINTR))
+#ifdef _AIX
+#ifndef MSG_DONTWAIT
+#define MSG_DONTWAIT 0
+#endif
+#endif
+
ssize_t
my_recv_async(struct mysql_async_context *b, int fd,
unsigned char *buf, size_t size, int timeout)
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index 6a7f58abb12..f40564955b4 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -8144,7 +8144,7 @@ static int mysql_init_variables(void)
my_atomic_rwlock_init(&thread_running_lock);
my_atomic_rwlock_init(&thread_count_lock);
my_atomic_rwlock_init(&statistics_lock);
- my_atomic_rwlock_init(slave_executed_entries_lock);
+ my_atomic_rwlock_init(&slave_executed_entries_lock);
strmov(server_version, MYSQL_SERVER_VERSION);
threads.empty();
thread_cache.empty();
diff --git a/sql/scheduler.h b/sql/scheduler.h
index 4e200e86d74..06c17c7b114 100644
--- a/sql/scheduler.h
+++ b/sql/scheduler.h
@@ -99,7 +99,8 @@ public:
void *data; /* scheduler-specific data structure */
};
-#if !defined(EMBEDDED_LIBRARY)
+#undef HAVE_POOL_OF_THREADS
+#if !defined(EMBEDDED_LIBRARY) && !defined(_AIX)
#define HAVE_POOL_OF_THREADS 1
void pool_of_threads_scheduler(scheduler_functions* func,
ulong *arg_max_connections,
diff --git a/sql/threadpool_unix.cc b/sql/threadpool_unix.cc
index f0454cfedb0..68c032fb67b 100644
--- a/sql/threadpool_unix.cc
+++ b/sql/threadpool_unix.cc
@@ -19,6 +19,9 @@
#include <sql_class.h>
#include <my_pthread.h>
#include <scheduler.h>
+
+#ifdef HAVE_POOL_OF_THREADS
+
#include <sql_connect.h>
#include <mysqld.h>
#include <debug_sync.h>
@@ -1678,3 +1681,5 @@ static void print_pool_blocked_message(bool max_threads_reached)
msg_written= true;
}
}
+
+#endif /* HAVE_POOL_OF_THREADS */
diff --git a/storage/connect/os.h b/storage/connect/os.h
index e3d452bf7b8..8e94f4241bb 100644
--- a/storage/connect/os.h
+++ b/storage/connect/os.h
@@ -9,6 +9,12 @@ typedef off_t off64_t;
#define O_LARGEFILE 0
#endif
+#ifdef _AIX
+#ifndef O_LARGEFILE
+#define O_LARGEFILE 0
+#endif
+#endif
+
#if defined(WIN32)
typedef __int64 BIGINT;
#else // !WIN32
diff --git a/storage/perfschema/table_events_waits.cc b/storage/perfschema/table_events_waits.cc
index 8fb7ca91c44..35b90816713 100644
--- a/storage/perfschema/table_events_waits.cc
+++ b/storage/perfschema/table_events_waits.cc
@@ -315,11 +315,15 @@ int table_events_waits_common::make_socket_object_columns(volatile PFS_events_wa
uint port;
char port_str[128];
char ip_str[INET6_ADDRSTRLEN+1];
- uint ip_len= 0;
+ /*
+ "ip_length" was "ip_len" originally.
+ but it conflicted with some macro on AIX. Renamed.
+ */
+ uint ip_length= 0;
port_str[0]= ':';
/* Get the IP address and port number */
- ip_len= pfs_get_socket_address(ip_str, sizeof(ip_str), &port,
+ ip_length= pfs_get_socket_address(ip_str, sizeof(ip_str), &port,
&safe_socket->m_sock_addr,
safe_socket->m_addr_len);
@@ -327,15 +331,15 @@ int table_events_waits_common::make_socket_object_columns(volatile PFS_events_wa
int port_len= int10_to_str(port, (port_str+1), 10) - port_str + 1;
/* OBJECT NAME */
- m_row.m_object_name_length= ip_len + port_len;
+ m_row.m_object_name_length= ip_length + port_len;
if (unlikely((m_row.m_object_name_length == 0) ||
(m_row.m_object_name_length > sizeof(m_row.m_object_name))))
return 1;
char *name= m_row.m_object_name;
- memcpy(name, ip_str, ip_len);
- memcpy(name + ip_len, port_str, port_len);
+ memcpy(name, ip_str, ip_length);
+ memcpy(name + ip_length, port_str, port_len);
}
else
{
diff --git a/storage/xtradb/include/sync0sync.h b/storage/xtradb/include/sync0sync.h
index f54c6d59af9..3d472183e59 100644
--- a/storage/xtradb/include/sync0sync.h
+++ b/storage/xtradb/include/sync0sync.h
@@ -198,10 +198,10 @@ necessary only if the memory block containing it is freed. */
pfs_mutex_enter_nowait_func((M), __FILE__, __LINE__)
# define mutex_enter_first(M) \
- pfs_mutex_enter_func((M), __FILE__, __LINE__, HIGH_PRIO)
+ pfs_mutex_enter_func((M), __FILE__, __LINE__, IB_HIGH_PRIO)
# define mutex_enter_last(M) \
- pfs_mutex_enter_func((M), __FILE__, __LINE__, LOW_PRIO)
+ pfs_mutex_enter_func((M), __FILE__, __LINE__, IB_LOW_PRIO)
# define mutex_exit(M) pfs_mutex_exit_func(M)
@@ -230,10 +230,10 @@ original non-instrumented functions */
mutex_enter_nowait_func((M), __FILE__, __LINE__)
# define mutex_enter_first(M) \
- mutex_enter_func((M), __FILE__, __LINE__, HIGH_PRIO)
+ mutex_enter_func((M), __FILE__, __LINE__, IB_HIGH_PRIO)
# define mutex_enter_last(M) \
- mutex_enter_func((M), __FILE__, __LINE__, LOW_PRIO)
+ mutex_enter_func((M), __FILE__, __LINE__, IB_LOW_PRIO)
# define mutex_exit(M) mutex_exit_func(M)
@@ -325,8 +325,8 @@ directly. Locks a priority mutex for the current thread. If the mutex is
reserved the function spins a preset time (controlled by SYNC_SPIN_ROUNDS)
waiting for the mutex before suspending the thread. If the thread is suspended,
the priority argument value determines the relative order for its wake up. Any
-HIGH_PRIO waiters will be woken up before any LOW_PRIO waiters. In case of
-DEFAULT_PRIO, the relative priority will be set according to
+IB_HIGH_PRIO waiters will be woken up before any IB_LOW_PRIO waiters. In case of
+IB_DEFAULT_PRIO, the relative priority will be set according to
srv_current_thread_priority. */
UNIV_INLINE
void
@@ -336,7 +336,7 @@ mutex_enter_func(
const char* file_name, /*!< in: file name where
locked */
ulint line, /*!< in: line where locked */
- enum ib_sync_priority priority = DEFAULT_PRIO);
+ enum ib_sync_priority priority = IB_DEFAULT_PRIO);
/*!<in: mutex acquisition
priority */
/********************************************************************//**
@@ -453,7 +453,7 @@ pfs_mutex_enter_func(
const char* file_name, /*!< in: file name where
locked */
ulint line, /*!< in: line where locked */
- enum ib_sync_priority priority = DEFAULT_PRIO);
+ enum ib_sync_priority priority = IB_DEFAULT_PRIO);
/*!<in: mutex acquisition
priority */
/********************************************************************//**
diff --git a/storage/xtradb/include/sync0sync.ic b/storage/xtradb/include/sync0sync.ic
index 396005ec83a..d403f2d95ba 100644
--- a/storage/xtradb/include/sync0sync.ic
+++ b/storage/xtradb/include/sync0sync.ic
@@ -278,8 +278,8 @@ directly. Locks a priority mutex for the current thread. If the mutex is
reserved the function spins a preset time (controlled by SYNC_SPIN_ROUNDS)
waiting for the mutex before suspending the thread. If the thread is suspended,
the priority argument value determines the relative order for its wake up. Any
-HIGH_PRIO waiters will be woken up before any LOW_PRIO waiters. In case of
-DEFAULT_PRIO, the relative priority will be set according to
+IB_HIGH_PRIO waiters will be woken up before any IB_LOW_PRIO waiters. In case
+of IB_DEFAULT_PRIO, the relative priority will be set according to
srv_current_thread_priority. */
UNIV_INLINE
void
@@ -309,10 +309,10 @@ mutex_enter_func(
return; /* Succeeded! */
}
- if (UNIV_LIKELY(priority == DEFAULT_PRIO)) {
+ if (UNIV_LIKELY(priority == IB_DEFAULT_PRIO)) {
high_priority = srv_current_thread_priority;
} else {
- high_priority = (priority == HIGH_PRIO);
+ high_priority = (priority == IB_HIGH_PRIO);
}
mutex_spin_wait(mutex, high_priority, file_name, line);
}
diff --git a/storage/xtradb/include/sync0types.h b/storage/xtradb/include/sync0types.h
index 67f613ab8ae..04baaa0339d 100644
--- a/storage/xtradb/include/sync0types.h
+++ b/storage/xtradb/include/sync0types.h
@@ -36,9 +36,9 @@ struct ib_prio_mutex_t;
/** Priority mutex and rwlatch acquisition priorities */
enum ib_sync_priority {
- DEFAULT_PRIO,
- LOW_PRIO,
- HIGH_PRIO
+ IB_DEFAULT_PRIO,
+ IB_LOW_PRIO,
+ IB_HIGH_PRIO
};
#endif