Commit 57cdc561 authored by Alexander Barkov's avatar Alexander Barkov

Fixing AIX compilation failires

parent 11826b1b
......@@ -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 */
......@@ -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>
......
......@@ -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)
......
......@@ -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();
......
......@@ -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,
......
......@@ -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 */
......@@ -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
......
......@@ -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
{
......
......@@ -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 */
/********************************************************************//**
......
......@@ -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);
}
......
......@@ -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
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