diff options
-rw-r--r-- | cmake/install_layout.cmake | 10 | ||||
-rwxr-xr-x | debian/rules | 3 | ||||
-rw-r--r-- | mysys/my_getncpus.c | 44 |
3 files changed, 26 insertions, 31 deletions
diff --git a/cmake/install_layout.cmake b/cmake/install_layout.cmake index 49dceccb9d2..2779e07e9dd 100644 --- a/cmake/install_layout.cmake +++ b/cmake/install_layout.cmake @@ -174,7 +174,7 @@ SET(INSTALL_SCRIPTDIR_DEB "bin") SET(INSTALL_SYSCONFDIR_DEB "/etc") SET(INSTALL_SYSCONF2DIR_DEB "/etc/mysql/conf.d") # -SET(INSTALL_LIBDIR_DEB "lib") +SET(INSTALL_LIBDIR_DEB "lib/${CMAKE_CXX_LIBRARY_ARCHITECTURE}") SET(INSTALL_PLUGINDIR_DEB "lib/mysql/plugin") # SET(INSTALL_INCLUDEDIR_DEB "include/mariadb") @@ -186,7 +186,7 @@ SET(INSTALL_INFODIR_DEB "share/info") # SET(INSTALL_SHAREDIR_DEB "share") SET(INSTALL_MYSQLSHAREDIR_DEB "share/mysql") -SET(INSTALL_MYSQLTESTDIR_DEB "mysql-test") +SET(INSTALL_MYSQLTESTDIR_DEB "share/mysql/mysql-test") SET(INSTALL_SQLBENCHDIR_DEB ".") SET(INSTALL_SUPPORTFILESDIR_DEB "share/mysql") # @@ -196,11 +196,7 @@ SET(INSTALL_UNIX_ADDRDIR_DEB "/var/run/mysqld/mysqld.sock") SET(INSTALL_SYSTEMD_UNITDIR_DEB "/lib/systemd/system") SET(INSTALL_SYSTEMD_SYSUSERSDIR_DEB "/usr/lib/sysusers.d") SET(INSTALL_SYSTEMD_TMPFILESDIR_DEB "/usr/lib/tmpfiles.d") -IF(CMAKE_SIZEOF_VOID_P EQUAL 8) - SET(INSTALL_PAMDIR_DEB "/lib/x86_64-linux-gnu/security") -ELSE() - SET(INSTALL_PAMDIR_DEB "/lib/i386-linux-gnu/security") -ENDIF() +SET(INSTALL_PAMDIR_DEB "/lib/${CMAKE_CXX_LIBRARY_ARCHITECTURE}/security") # # SVR4 layout diff --git a/debian/rules b/debian/rules index 93bfe01e55e..e8ca0d92527 100755 --- a/debian/rules +++ b/debian/rules @@ -86,9 +86,6 @@ endif -DSYSTEM_TYPE="debian-$(DEB_HOST_GNU_SYSTEM)" \ -DCMAKE_SYSTEM_PROCESSOR=$(DEB_HOST_ARCH) \ -DBUILD_CONFIG=mysql_release \ - -DINSTALL_LIBDIR=lib/$(DEB_HOST_MULTIARCH) \ - -DINSTALL_PLUGINDIR=lib/mysql/plugin \ - -DINSTALL_MYSQLTESTDIR=share/mysql/mysql-test \ -DPLUGIN_AWS_KEY_MANAGEMENT=NO \ -DDEB=$(DEB_VENDOR) ..' diff --git a/mysys/my_getncpus.c b/mysys/my_getncpus.c index 0ee03631da8..6890de4f827 100644 --- a/mysys/my_getncpus.c +++ b/mysys/my_getncpus.c @@ -30,50 +30,52 @@ static int ncpus=0; int my_getncpus(void) { -#if (defined(__linux__) || defined(__FreeBSD__)) && defined(HAVE_PTHREAD_GETAFFINITY_NP) - cpu_set_t set; - if (!ncpus) { + /* + First attempt to get the total number of available cores. sysconf is + the fallback, but it can return a larger number. It will return the + total number of cores, not the ones available to the process - as + configured via core affinity. + */ +#if (defined(__linux__) || defined(__FreeBSD__)) && defined(HAVE_PTHREAD_GETAFFINITY_NP) + cpu_set_t set; if (pthread_getaffinity_np(pthread_self(), sizeof(set), &set) == 0) { +#ifdef CPU_COUNT + /* CPU_COUNT was introduced with glibc 2.6. */ ncpus= CPU_COUNT(&set); - } - else - { -#ifdef _SC_NPROCESSORS_ONLN - ncpus= sysconf(_SC_NPROCESSORS_ONLN); #else - ncpus= 2; + /* Implementation for platforms with glibc < 2.6 */ + size_t i; + + for (i= 0; i < CPU_SETSIZE; i++) + if (CPU_ISSET(i, &set)) + ncpus++; #endif + return ncpus; } - } - -#else /* __linux__ || FreeBSD && HAVE_PTHREAD_GETAFFINITY_NP */ +#endif /* (__linux__ || __FreeBSD__) && HAVE_PTHREAD_GETAFFINITY_NP */ - if (!ncpus) - { #ifdef _SC_NPROCESSORS_ONLN ncpus= sysconf(_SC_NPROCESSORS_ONLN); #elif defined(__WIN__) SYSTEM_INFO sysinfo; /* - * We are not calling GetNativeSystemInfo here because (1) we - * don't believe that they return different values for number - * of processors and (2) if WOW64 limits processors for Win32 - * then we don't want to try to override that. + We are not calling GetNativeSystemInfo here because (1) we + don't believe that they return different values for number + of processors and (2) if WOW64 limits processors for Win32 + then we don't want to try to override that. */ GetSystemInfo(&sysinfo); ncpus= sysinfo.dwNumberOfProcessors; #else - /* unknown so play safe: assume SMP and forbid uniprocessor build */ + /* Unknown so play safe: assume SMP and forbid uniprocessor build */ ncpus= 2; #endif } -#endif /* __linux__ || FreeBSD && HAVE_PTHREAD_GETAFFINITY_NP */ - return ncpus; } |