Browse Source
MDEV-28592 disks plugin - getmntinfo (BSD) & getmntent (AIX)
MDEV-28592 disks plugin - getmntinfo (BSD) & getmntent (AIX)
Thanks to references from Brad Smith, BSDs use getmntinfo as
a system call for mounted filesystems.
Most BSDs return statfs structures, (and we use OSX's statfs64),
but NetBSD uses a statvfs structure.
Simplify Linux getmntent_r to just use getmntent.
AIX uses getmntent.
An attempt at writing Solaris compatibility with
a small bit of HPUX compatibility was made based on man page
entries only. Fixes welcome.
statvfs structures now use f_bsize for consistency with statfs
Test case adjusted as PATH_MAX is OS defined (e.g. 1023 on AIX)
Fixes: 0ee5cf837e
also fixes:
MDEV-27818: Disk plugin does not show zpool mounted devices
This is because zpool mounted point don't begin with /.
Due to the proliferation of multiple filesystem types since this
was written, we restrict the entries listed in the disks plugin
to excude:
* read only mount points (no point monitoring, and
includes squash, snaps, sysfs, procfs, cgroups...)
* mount points that aren't directories (excludes /etc/hostname and
similar mounts in containers). (getmntent (Linux/AIX) only)
* exclude systems where there is no capacity listed (excludes various
virtual filesystem types).
Reviewer: Sergei Golubchik
bb-10.3-MDEV-29433-lock_delete_updated
6 changed files with 211 additions and 55 deletions
-
5cmake/os/WindowsCache.cmake
-
6config.h.cmake
-
21plugin/disks/CMakeLists.txt
-
229plugin/disks/information_schema_disks.cc
-
4plugin/disks/mysql-test/disks/disks.result
-
1plugin/disks/mysql-test/disks/disks.test
@ -1,7 +1,24 @@ |
|||
INCLUDE (CheckIncludeFiles) |
|||
CHECK_INCLUDE_FILES ("sys/statvfs.h;mntent.h" INFO_HEADERS LANGUAGE CXX) |
|||
|
|||
IF (INFO_HEADERS) |
|||
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) |
|||
|
|||
IF (HAVE_GETMNTINFO) |
|||
CHECK_CXX_SOURCE_COMPILES(" |
|||
#include <sys/types.h> |
|||
#include <sys/statvfs.h> |
|||
int main() |
|||
{ |
|||
struct statvfs *s; |
|||
return getmntinfo(&s, ST_WAIT); |
|||
} |
|||
" HAVE_GETMNTINFO_TAKES_statvfs) |
|||
ENDIF() |
|||
IF (HAVE_GETMNTENT OR HAVE_GETMNTENT_IN_SYS_MNTAB OR |
|||
HAVE_GETMNTINFO OR HAVE_GETMNTINFO64) |
|||
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/sql) |
|||
MYSQL_ADD_PLUGIN(DISKS information_schema_disks.cc MODULE_ONLY RECOMPILE_FOR_EMBEDDED) |
|||
ENDIF() |
@ -1,2 +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; |
Write
Preview
Loading…
Cancel
Save
Reference in new issue