Commit c22dff21 authored by Marko Mäkelä's avatar Marko Mäkelä

InnoDB cleanup: Replace UNIV_LINUX, UNIV_SOLARIS, UNIV_AIX

Let us use the normal platform-specific preprocessor symbols
__linux__, __sun__, _AIX instead of some homebrew ones.

The preprocessor symbol UNIV_HPUX must have lost its meaning
by f6deb00a (note: the symbol
UNIV_HPUX10 is being checked for, but only UNIV_HPUX is defined).
parent bbf81b51
...@@ -459,7 +459,7 @@ log_online_open_bitmap_file_read_only( ...@@ -459,7 +459,7 @@ log_online_open_bitmap_file_read_only(
bitmap_file->size = os_file_get_size(bitmap_file->file); bitmap_file->size = os_file_get_size(bitmap_file->file);
bitmap_file->offset = 0; bitmap_file->offset = 0;
#ifdef UNIV_LINUX #ifdef __linux__
posix_fadvise(bitmap_file->file, 0, 0, POSIX_FADV_SEQUENTIAL); posix_fadvise(bitmap_file->file, 0, 0, POSIX_FADV_SEQUENTIAL);
posix_fadvise(bitmap_file->file, 0, 0, POSIX_FADV_NOREUSE); posix_fadvise(bitmap_file->file, 0, 0, POSIX_FADV_NOREUSE);
#endif #endif
......
...@@ -76,7 +76,7 @@ Created 11/5/1995 Heikki Tuuri ...@@ -76,7 +76,7 @@ Created 11/5/1995 Heikki Tuuri
#include "ut0byte.h" #include "ut0byte.h"
#include <new> #include <new>
#ifdef UNIV_LINUX #ifdef __linux__
#include <stdlib.h> #include <stdlib.h>
#endif #endif
......
...@@ -47,14 +47,14 @@ Created 11/11/1995 Heikki Tuuri ...@@ -47,14 +47,14 @@ Created 11/11/1995 Heikki Tuuri
#include "srv0mon.h" #include "srv0mon.h"
#include "ut0stage.h" #include "ut0stage.h"
#include "fil0pagecompress.h" #include "fil0pagecompress.h"
#ifdef UNIV_LINUX #ifdef __linux__
/* include defs for CPU time priority settings */ /* include defs for CPU time priority settings */
#include <unistd.h> #include <unistd.h>
#include <sys/syscall.h> #include <sys/syscall.h>
#include <sys/time.h> #include <sys/time.h>
#include <sys/resource.h> #include <sys/resource.h>
static const int buf_flush_page_cleaner_priority = -20; static const int buf_flush_page_cleaner_priority = -20;
#endif /* UNIV_LINUX */ #endif /* __linux__ */
/** Sleep time in microseconds for loop waiting for the oldest /** Sleep time in microseconds for loop waiting for the oldest
modification lsn */ modification lsn */
...@@ -2875,7 +2875,7 @@ pc_wait_finished( ...@@ -2875,7 +2875,7 @@ pc_wait_finished(
return(all_succeeded); return(all_succeeded);
} }
#ifdef UNIV_LINUX #ifdef __linux__
/** /**
Set priority for page_cleaner threads. Set priority for page_cleaner threads.
@param[in] priority priority intended to set @param[in] priority priority intended to set
...@@ -2890,7 +2890,7 @@ buf_flush_page_cleaner_set_priority( ...@@ -2890,7 +2890,7 @@ buf_flush_page_cleaner_set_priority(
return(getpriority(PRIO_PROCESS, (pid_t)syscall(SYS_gettid)) return(getpriority(PRIO_PROCESS, (pid_t)syscall(SYS_gettid))
== priority); == priority);
} }
#endif /* UNIV_LINUX */ #endif /* __linux__ */
#ifdef UNIV_DEBUG #ifdef UNIV_DEBUG
/** Loop used to disable page cleaner threads. */ /** Loop used to disable page cleaner threads. */
...@@ -3017,7 +3017,7 @@ DECLARE_THREAD(buf_flush_page_cleaner_coordinator)(void*) ...@@ -3017,7 +3017,7 @@ DECLARE_THREAD(buf_flush_page_cleaner_coordinator)(void*)
ib::info() << "page_cleaner thread running, id " ib::info() << "page_cleaner thread running, id "
<< os_thread_pf(os_thread_get_curr_id()); << os_thread_pf(os_thread_get_curr_id());
#endif /* UNIV_DEBUG_THREAD_CREATION */ #endif /* UNIV_DEBUG_THREAD_CREATION */
#ifdef UNIV_LINUX #ifdef __linux__
/* linux might be able to set different setting for each thread. /* linux might be able to set different setting for each thread.
worth to try to set high priority for page cleaner threads */ worth to try to set high priority for page cleaner threads */
if (buf_flush_page_cleaner_set_priority( if (buf_flush_page_cleaner_set_priority(
...@@ -3032,7 +3032,7 @@ DECLARE_THREAD(buf_flush_page_cleaner_coordinator)(void*) ...@@ -3032,7 +3032,7 @@ DECLARE_THREAD(buf_flush_page_cleaner_coordinator)(void*)
} }
/* Signal that setpriority() has been attempted. */ /* Signal that setpriority() has been attempted. */
os_event_set(recv_sys->flush_end); os_event_set(recv_sys->flush_end);
#endif /* UNIV_LINUX */ #endif /* __linux__ */
do { do {
/* treat flushing requests during recovery. */ /* treat flushing requests during recovery. */
...@@ -3433,7 +3433,7 @@ DECLARE_THREAD(buf_flush_page_cleaner_worker)( ...@@ -3433,7 +3433,7 @@ DECLARE_THREAD(buf_flush_page_cleaner_worker)(
os_event_set(page_cleaner.is_started); os_event_set(page_cleaner.is_started);
mutex_exit(&page_cleaner.mutex); mutex_exit(&page_cleaner.mutex);
#ifdef UNIV_LINUX #ifdef __linux__
/* linux might be able to set different setting for each thread /* linux might be able to set different setting for each thread
worth to try to set high priority for page cleaner threads */ worth to try to set high priority for page cleaner threads */
if (buf_flush_page_cleaner_set_priority( if (buf_flush_page_cleaner_set_priority(
...@@ -3442,7 +3442,7 @@ DECLARE_THREAD(buf_flush_page_cleaner_worker)( ...@@ -3442,7 +3442,7 @@ DECLARE_THREAD(buf_flush_page_cleaner_worker)(
ib::info() << "page_cleaner worker priority: " ib::info() << "page_cleaner worker priority: "
<< buf_flush_page_cleaner_priority; << buf_flush_page_cleaner_priority;
} }
#endif /* UNIV_LINUX */ #endif /* __linux__ */
while (true) { while (true) {
os_event_wait(page_cleaner.is_requested); os_event_wait(page_cleaner.is_requested);
......
/***************************************************************************** /*****************************************************************************
Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2017, 2019, MariaDB Corporation. Copyright (c) 2017, 2022, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software the terms of the GNU General Public License as published by the Free Software
...@@ -30,7 +30,7 @@ Created 9/30/1995 Heikki Tuuri ...@@ -30,7 +30,7 @@ Created 9/30/1995 Heikki Tuuri
#include "univ.i" #include "univ.i"
#ifdef UNIV_LINUX #ifdef __linux__
#include <sys/ipc.h> #include <sys/ipc.h>
#include <sys/shm.h> #include <sys/shm.h>
#endif #endif
......
...@@ -55,7 +55,7 @@ ENDIF() ...@@ -55,7 +55,7 @@ ENDIF()
IF(UNIX) IF(UNIX)
IF(CMAKE_SYSTEM_NAME STREQUAL "Linux") IF(CMAKE_SYSTEM_NAME STREQUAL "Linux")
ADD_DEFINITIONS("-DUNIV_LINUX -D_GNU_SOURCE=1") ADD_DEFINITIONS("-D_GNU_SOURCE=1")
CHECK_INCLUDE_FILES (libaio.h HAVE_LIBAIO_H) CHECK_INCLUDE_FILES (libaio.h HAVE_LIBAIO_H)
CHECK_LIBRARY_EXISTS(aio io_queue_init "" HAVE_LIBAIO) CHECK_LIBRARY_EXISTS(aio io_queue_init "" HAVE_LIBAIO)
...@@ -67,12 +67,6 @@ IF(UNIX) ...@@ -67,12 +67,6 @@ IF(UNIX)
IF(HAVE_LIBNUMA) IF(HAVE_LIBNUMA)
LINK_LIBRARIES(numa) LINK_LIBRARIES(numa)
ENDIF() ENDIF()
ELSEIF(CMAKE_SYSTEM_NAME MATCHES "HP*")
ADD_DEFINITIONS("-DUNIV_HPUX")
ELSEIF(CMAKE_SYSTEM_NAME STREQUAL "AIX")
ADD_DEFINITIONS("-DUNIV_AIX")
ELSEIF(CMAKE_SYSTEM_NAME STREQUAL "SunOS")
ADD_DEFINITIONS("-DUNIV_SOLARIS")
ENDIF() ENDIF()
ENDIF() ENDIF()
......
...@@ -37,7 +37,7 @@ Created 10/21/1995 Heikki Tuuri ...@@ -37,7 +37,7 @@ Created 10/21/1995 Heikki Tuuri
#include "os0file.h" #include "os0file.h"
#include "sql_const.h" #include "sql_const.h"
#ifdef UNIV_LINUX #ifdef __linux__
#include <sys/types.h> #include <sys/types.h>
#include <sys/stat.h> #include <sys/stat.h>
#endif #endif
...@@ -63,18 +63,18 @@ Created 10/21/1995 Heikki Tuuri ...@@ -63,18 +63,18 @@ Created 10/21/1995 Heikki Tuuri
# include <linux/falloc.h> # include <linux/falloc.h>
#endif /* HAVE_FALLOC_PUNCH_HOLE_AND_KEEP_SIZE */ #endif /* HAVE_FALLOC_PUNCH_HOLE_AND_KEEP_SIZE */
#if defined(UNIV_LINUX) && defined(HAVE_SYS_IOCTL_H) #if defined(__linux__) && defined(HAVE_SYS_IOCTL_H)
# include <sys/ioctl.h> # include <sys/ioctl.h>
# ifndef DFS_IOCTL_ATOMIC_WRITE_SET # ifndef DFS_IOCTL_ATOMIC_WRITE_SET
# define DFS_IOCTL_ATOMIC_WRITE_SET _IOW(0x95, 2, uint) # define DFS_IOCTL_ATOMIC_WRITE_SET _IOW(0x95, 2, uint)
# endif # endif
#endif #endif
#if defined(UNIV_LINUX) && defined(HAVE_SYS_STATVFS_H) #if defined(__linux__) && defined(HAVE_SYS_STATVFS_H)
#include <sys/statvfs.h> #include <sys/statvfs.h>
#endif #endif
#if defined(UNIV_LINUX) && defined(HAVE_LINUX_FALLOC_H) #if defined(__linux__) && defined(HAVE_LINUX_FALLOC_H)
#include <linux/falloc.h> #include <linux/falloc.h>
#endif #endif
...@@ -827,7 +827,7 @@ os_file_get_block_size( ...@@ -827,7 +827,7 @@ os_file_get_block_size(
{ {
ulint fblock_size = 512; ulint fblock_size = 512;
#if defined(UNIV_LINUX) #if defined(__linux__)
struct stat local_stat; struct stat local_stat;
int err; int err;
...@@ -838,7 +838,7 @@ os_file_get_block_size( ...@@ -838,7 +838,7 @@ os_file_get_block_size(
} else { } else {
fblock_size = local_stat.st_blksize; fblock_size = local_stat.st_blksize;
} }
#endif /* UNIV_LINUX */ #endif /* __linux__ */
#ifdef _WIN32 #ifdef _WIN32
fblock_size = 0; fblock_size = 0;
...@@ -1629,7 +1629,7 @@ os_file_punch_hole_posix( ...@@ -1629,7 +1629,7 @@ os_file_punch_hole_posix(
return(DB_IO_ERROR); return(DB_IO_ERROR);
#elif defined(UNIV_SOLARIS) #elif defined __sun__
// Use F_FREESP // Use F_FREESP
...@@ -5206,7 +5206,7 @@ os_file_set_nocache( ...@@ -5206,7 +5206,7 @@ os_file_set_nocache(
const char* operation_name MY_ATTRIBUTE((unused))) const char* operation_name MY_ATTRIBUTE((unused)))
{ {
/* some versions of Solaris may not have DIRECTIO_ON */ /* some versions of Solaris may not have DIRECTIO_ON */
#if defined(UNIV_SOLARIS) && defined(DIRECTIO_ON) #if defined(__sun__) && defined(DIRECTIO_ON)
if (directio(fd, DIRECTIO_ON) == -1) { if (directio(fd, DIRECTIO_ON) == -1) {
int errno_save = errno; int errno_save = errno;
...@@ -5223,7 +5223,7 @@ os_file_set_nocache( ...@@ -5223,7 +5223,7 @@ os_file_set_nocache(
if (errno_save == EINVAL) { if (errno_save == EINVAL) {
if (!warning_message_printed) { if (!warning_message_printed) {
warning_message_printed = true; warning_message_printed = true;
# ifdef UNIV_LINUX # ifdef __linux__
ib::warn() ib::warn()
<< "Failed to set O_DIRECT on file" << "Failed to set O_DIRECT on file"
<< file_name << "; " << operation_name << file_name << "; " << operation_name
...@@ -5232,12 +5232,12 @@ os_file_set_nocache( ...@@ -5232,12 +5232,12 @@ os_file_set_nocache(
"known to result in 'Invalid argument' " "known to result in 'Invalid argument' "
"on Linux on tmpfs, " "on Linux on tmpfs, "
"see MySQL Bug#26662."; "see MySQL Bug#26662.";
# else /* UNIV_LINUX */ # else /* __linux__ */
goto short_warning; goto short_warning;
# endif /* UNIV_LINUX */ # endif /* __linux__ */
} }
} else { } else {
# ifndef UNIV_LINUX # ifndef __linux__
short_warning: short_warning:
# endif # endif
ib::warn() ib::warn()
...@@ -5247,7 +5247,7 @@ os_file_set_nocache( ...@@ -5247,7 +5247,7 @@ os_file_set_nocache(
<< ", continuing anyway."; << ", continuing anyway.";
} }
} }
#endif /* defined(UNIV_SOLARIS) && defined(DIRECTIO_ON) */ #endif /* defined(__sun__) && defined(DIRECTIO_ON) */
} }
#endif /* _WIN32 */ #endif /* _WIN32 */
......
/***************************************************************************** /*****************************************************************************
Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2019, MariaDB Corporation. Copyright (c) 2019, 2022, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software the terms of the GNU General Public License as published by the Free Software
...@@ -186,11 +186,11 @@ os_mem_free_large( ...@@ -186,11 +186,11 @@ os_mem_free_large(
#elif !defined OS_MAP_ANON #elif !defined OS_MAP_ANON
ut_free(ptr); ut_free(ptr);
#else #else
# if defined(UNIV_SOLARIS) # if defined(__sun__)
if (munmap(static_cast<caddr_t>(ptr), size)) { if (munmap(static_cast<caddr_t>(ptr), size)) {
# else # else
if (munmap(ptr, size)) { if (munmap(ptr, size)) {
# endif /* UNIV_SOLARIS */ # endif /* __sun__ */
ib::error() << "munmap(" << ptr << ", " << size << ") failed;" ib::error() << "munmap(" << ptr << ", " << size << ") failed;"
" errno " << errno; " errno " << errno;
} else { } else {
......
...@@ -3364,12 +3364,12 @@ row_merge_sort( ...@@ -3364,12 +3364,12 @@ row_merge_sort(
is used. MDEV-9356: innodb.innodb_bug53290 fails (crashes) on is used. MDEV-9356: innodb.innodb_bug53290 fails (crashes) on
sol10-64 in buildbot. sol10-64 in buildbot.
*/ */
#ifndef UNIV_SOLARIS #ifndef __sun__
/* Progress report only for "normal" indexes. */ /* Progress report only for "normal" indexes. */
if (!(dup->index->type & DICT_FTS)) { if (!(dup->index->type & DICT_FTS)) {
thd_progress_init(trx->mysql_thd, 1); thd_progress_init(trx->mysql_thd, 1);
} }
#endif /* UNIV_SOLARIS */ #endif /* __sun__ */
if (global_system_variables.log_warnings > 2) { if (global_system_variables.log_warnings > 2) {
sql_print_information("InnoDB: Online DDL : merge-sorting" sql_print_information("InnoDB: Online DDL : merge-sorting"
...@@ -3382,11 +3382,11 @@ row_merge_sort( ...@@ -3382,11 +3382,11 @@ row_merge_sort(
/* Report progress of merge sort to MySQL for /* Report progress of merge sort to MySQL for
show processlist progress field */ show processlist progress field */
/* Progress report only for "normal" indexes. */ /* Progress report only for "normal" indexes. */
#ifndef UNIV_SOLARIS #ifndef __sun__
if (!(dup->index->type & DICT_FTS)) { if (!(dup->index->type & DICT_FTS)) {
thd_progress_report(trx->mysql_thd, file->offset - num_runs, file->offset); thd_progress_report(trx->mysql_thd, file->offset - num_runs, file->offset);
} }
#endif /* UNIV_SOLARIS */ #endif /* __sun__ */
error = row_merge(trx, dup, file, block, tmpfd, error = row_merge(trx, dup, file, block, tmpfd,
&num_runs, run_offset, stage, &num_runs, run_offset, stage,
...@@ -3411,11 +3411,11 @@ row_merge_sort( ...@@ -3411,11 +3411,11 @@ row_merge_sort(
ut_free(run_offset); ut_free(run_offset);
/* Progress report only for "normal" indexes. */ /* Progress report only for "normal" indexes. */
#ifndef UNIV_SOLARIS #ifndef __sun__
if (!(dup->index->type & DICT_FTS)) { if (!(dup->index->type & DICT_FTS)) {
thd_progress_end(trx->mysql_thd); thd_progress_end(trx->mysql_thd);
} }
#endif /* UNIV_SOLARIS */ #endif /* __sun__ */
DBUG_RETURN(error); DBUG_RETURN(error);
} }
......
...@@ -606,12 +606,12 @@ srv_undo_tablespace_create( ...@@ -606,12 +606,12 @@ srv_undo_tablespace_create(
} else if (ret == FALSE) { } else if (ret == FALSE) {
if (os_file_get_last_error(false) != OS_FILE_ALREADY_EXISTS if (os_file_get_last_error(false) != OS_FILE_ALREADY_EXISTS
#ifdef UNIV_AIX #ifdef _AIX
/* AIX 5.1 after security patch ML7 may have /* AIX 5.1 after security patch ML7 may have
errno set to 0 here, which causes our function errno set to 0 here, which causes our function
to return 100; work around that AIX problem */ to return 100; work around that AIX problem */
&& os_file_get_last_error(false) != 100 && os_file_get_last_error(false) != 100
#endif /* UNIV_AIX */ #endif
) { ) {
ib::error() << "Can't create UNDO tablespace " ib::error() << "Can't create UNDO tablespace "
<< name; << name;
...@@ -1666,10 +1666,10 @@ dberr_t srv_start(bool create_new_db) ...@@ -1666,10 +1666,10 @@ dberr_t srv_start(bool create_new_db)
buf_flush_set_page_cleaner_thread_cnt(srv_n_page_cleaners); buf_flush_set_page_cleaner_thread_cnt(srv_n_page_cleaners);
} }
#ifdef UNIV_LINUX #ifdef __linux__
/* Wait for the setpriority() call to finish. */ /* Wait for the setpriority() call to finish. */
os_event_wait(recv_sys->flush_end); os_event_wait(recv_sys->flush_end);
#endif /* UNIV_LINUX */ #endif /* __linux__ */
srv_start_state_set(SRV_START_STATE_IO); srv_start_state_set(SRV_START_STATE_IO);
} }
......
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