diff options
Diffstat (limited to 'plugin/disks')
-rw-r--r-- | plugin/disks/CMakeLists.txt | 5 | ||||
-rw-r--r-- | plugin/disks/information_schema_disks.cc | 12 | ||||
-rw-r--r-- | plugin/disks/mysql-test/disks/disks.result | 4 | ||||
-rw-r--r-- | plugin/disks/mysql-test/disks/disks.test | 2 | ||||
-rw-r--r-- | plugin/disks/mysql-test/disks/disks_notembedded.result | 8 | ||||
-rw-r--r-- | plugin/disks/mysql-test/disks/disks_notembedded.test | 4 |
6 files changed, 17 insertions, 18 deletions
diff --git a/plugin/disks/CMakeLists.txt b/plugin/disks/CMakeLists.txt index 4e40842c..408a4324 100644 --- a/plugin/disks/CMakeLists.txt +++ b/plugin/disks/CMakeLists.txt @@ -4,7 +4,8 @@ CHECK_SYMBOL_EXISTS (getmntent "mntent.h" HAVE_GETMNTENT) CHECK_SYMBOL_EXISTS (getmntent "sys/mnttab.h" HAVE_GETMNTENT_IN_SYS_MNTAB) CHECK_SYMBOL_EXISTS (setmntent "mntent.h" HAVE_SETMNTENT) CHECK_SYMBOL_EXISTS (getmntinfo "sys/types.h;sys/mount.h" HAVE_GETMNTINFO) -CHECK_SYMBOL_EXISTS (getmntinfo64 "sys/types.h;sys/mount.h" HAVE_GETMNTINFO64) + +CHECK_INCLUDE_FILES (sys/mntent.h HAVE_SYS_MNTENT_H) IF (HAVE_GETMNTINFO) CHECK_CXX_SOURCE_COMPILES(" @@ -18,7 +19,7 @@ int main() " HAVE_GETMNTINFO_TAKES_statvfs) ENDIF() IF (HAVE_GETMNTENT OR HAVE_GETMNTENT_IN_SYS_MNTAB OR - HAVE_GETMNTINFO OR HAVE_GETMNTINFO64) + HAVE_GETMNTINFO) INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/sql) MYSQL_ADD_PLUGIN(DISKS information_schema_disks.cc MODULE_ONLY RECOMPILE_FOR_EMBEDDED) ENDIF() diff --git a/plugin/disks/information_schema_disks.cc b/plugin/disks/information_schema_disks.cc index 15e26dad..01df3259 100644 --- a/plugin/disks/information_schema_disks.cc +++ b/plugin/disks/information_schema_disks.cc @@ -19,7 +19,7 @@ #include <sys/types.h> #if defined(HAVE_GETMNTENT) #include <mntent.h> -#elif !defined(HAVE_GETMNTINFO_TAKES_statvfs) +#elif defined(HAVE_GETMNTINFO) && !defined(HAVE_GETMNTINFO_TAKES_statvfs) /* getmntinfo (the not NetBSD variants) */ #include <sys/param.h> #include <sys/ucred.h> @@ -28,6 +28,9 @@ #if defined(HAVE_GETMNTENT_IN_SYS_MNTAB) #include <sys/mnttab.h> #define HAVE_GETMNTENT +#if defined(HAVE_SYS_MNTENT_H) +#include <sys/mntent.h> +#endif #endif #include <sql_class.h> #include <sql_i_s.h> @@ -37,8 +40,7 @@ This intends to support *BSD's, macOS, Solaris, AIX, HP-UX, and Linux. specificly: - FreeBSD/OpenBSD/DragonFly (statfs) NetBSD (statvfs) uses getmntinfo(). - macOS uses getmntinfo64(). + FreeBSD/OpenBSD/DragonFly/macOS (statfs) NetBSD (statvfs) uses getmntinfo(). Linux can use getmntent_r(), but we've just used getmntent for simplification. Linux/Solaris/AIX/HP-UX uses setmntent()/getmntent(). Solaris uses getmntent() with a diffent prototype, return structure, and @@ -46,8 +48,6 @@ */ #if defined(HAVE_GETMNTINFO_TAKES_statvfs) || defined(HAVE_GETMNTENT) typedef struct statvfs st_info; -#elif defined(HAVE_GETMNTINFO64) -typedef struct statfs64 st_info; #else // GETMNTINFO typedef struct statfs st_info; #endif @@ -150,8 +150,6 @@ static int disks_fill_table(THD* pThd, TABLE_LIST* pTables, Item* pCond) #if defined(HAVE_GETMNTINFO_TAKES_statvfs) count= getmntinfo(&s, ST_WAIT); -#elif defined(HAVE_GETMNTINFO64) - count= getmntinfo64(&s, MNT_WAIT); #else count= getmntinfo(&s, MNT_WAIT); #endif diff --git a/plugin/disks/mysql-test/disks/disks.result b/plugin/disks/mysql-test/disks/disks.result index 888f2df6..e46390c7 100644 --- a/plugin/disks/mysql-test/disks/disks.result +++ b/plugin/disks/mysql-test/disks/disks.result @@ -7,6 +7,6 @@ DISKS CREATE TEMPORARY TABLE `DISKS` ( `Used` bigint(32) NOT NULL, `Available` bigint(32) NOT NULL ) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci -select sum(Total) > sum(Available), sum(Total)>sum(Used) from information_schema.disks; -sum(Total) > sum(Available) sum(Total)>sum(Used) +select sum(Total) >= sum(Available), sum(Total)>=sum(Used) from information_schema.disks; +sum(Total) >= sum(Available) sum(Total)>=sum(Used) 1 1 diff --git a/plugin/disks/mysql-test/disks/disks.test b/plugin/disks/mysql-test/disks/disks.test index 7189c548..9adc3f01 100644 --- a/plugin/disks/mysql-test/disks/disks.test +++ b/plugin/disks/mysql-test/disks/disks.test @@ -1,3 +1,3 @@ --replace_regex /varchar\([0-9]+\)/varchar(pathlen)/ show create table information_schema.disks; -select sum(Total) > sum(Available), sum(Total)>sum(Used) from information_schema.disks; +select sum(Total) >= sum(Available), sum(Total)>=sum(Used) from information_schema.disks; diff --git a/plugin/disks/mysql-test/disks/disks_notembedded.result b/plugin/disks/mysql-test/disks/disks_notembedded.result index 97429474..ea2ccc85 100644 --- a/plugin/disks/mysql-test/disks/disks_notembedded.result +++ b/plugin/disks/mysql-test/disks/disks_notembedded.result @@ -6,16 +6,16 @@ CREATE USER user1@localhost; GRANT SELECT ON *.* TO user1@localhost; connect con1,localhost,user1,,; connection con1; -select sum(Total) > sum(Available), sum(Total)>sum(Used) from information_schema.disks; -sum(Total) > sum(Available) sum(Total)>sum(Used) +select sum(Total) >= sum(Available), sum(Total) >= sum(Used) from information_schema.disks; +sum(Total) >= sum(Available) sum(Total) >= sum(Used) NULL NULL disconnect con1; connection default; GRANT FILE ON *.* TO user1@localhost; connect con1,localhost,user1,,; connection con1; -select sum(Total) > sum(Available), sum(Total)>sum(Used) from information_schema.disks; -sum(Total) > sum(Available) sum(Total)>sum(Used) +select sum(Total) >= sum(Available), sum(Total) >= sum(Used) from information_schema.disks; +sum(Total) >= sum(Available) sum(Total) >= sum(Used) 1 1 connection default; DROP USER user1@localhost; diff --git a/plugin/disks/mysql-test/disks/disks_notembedded.test b/plugin/disks/mysql-test/disks/disks_notembedded.test index a0f6c2e5..4481da9f 100644 --- a/plugin/disks/mysql-test/disks/disks_notembedded.test +++ b/plugin/disks/mysql-test/disks/disks_notembedded.test @@ -10,7 +10,7 @@ GRANT SELECT ON *.* TO user1@localhost; connect (con1,localhost,user1,,); connection con1; -select sum(Total) > sum(Available), sum(Total)>sum(Used) from information_schema.disks; +select sum(Total) >= sum(Available), sum(Total) >= sum(Used) from information_schema.disks; disconnect con1; connection default; @@ -18,7 +18,7 @@ GRANT FILE ON *.* TO user1@localhost; connect (con1,localhost,user1,,); connection con1; -select sum(Total) > sum(Available), sum(Total)>sum(Used) from information_schema.disks; +select sum(Total) >= sum(Available), sum(Total) >= sum(Used) from information_schema.disks; connection default; DROP USER user1@localhost; |