From c7320b94af8db53b0a4b0a96e37d6e81a0d4a68c Mon Sep 17 00:00:00 2001 From: Tavian Barnes Date: Tue, 7 May 2024 13:24:06 -0400 Subject: build: Add a check for getmntinfo() --- build/has/getmntinfo.c | 10 ++++++++++ build/header.mk | 1 + src/mtab.c | 3 +-- 3 files changed, 12 insertions(+), 2 deletions(-) create mode 100644 build/has/getmntinfo.c diff --git a/build/has/getmntinfo.c b/build/has/getmntinfo.c new file mode 100644 index 0000000..90ef5fb --- /dev/null +++ b/build/has/getmntinfo.c @@ -0,0 +1,10 @@ +// Copyright © Tavian Barnes +// SPDX-License-Identifier: 0BSD + +#include +#include +#include + +int main(void) { + return getmntinfo(NULL, MNT_WAIT); +} diff --git a/build/header.mk b/build/header.mk index 2cd13fa..52dcb6a 100644 --- a/build/header.mk +++ b/build/header.mk @@ -24,6 +24,7 @@ HEADERS := \ gen/has/getdents.h \ gen/has/getdents64.h \ gen/has/getdents64-syscall.h \ + gen/has/getmntinfo.h \ gen/has/getprogname.h \ gen/has/getprogname-gnu.h \ gen/has/max-align-t.h \ diff --git a/src/mtab.c b/src/mtab.c index 9ea8d4a..9befde3 100644 --- a/src/mtab.c +++ b/src/mtab.c @@ -15,7 +15,7 @@ #if !defined(BFS_USE_MNTENT) && BFS_USE_MNTENT_H # define BFS_USE_MNTENT true -#elif !defined(BFS_USE_MNTINFO) && BSD +#elif !defined(BFS_USE_MNTINFO) && BFS_HAS_GETMNTINFO # define BFS_USE_MNTINFO true #elif !defined(BFS_USE_MNTTAB) && __SVR4 # define BFS_USE_MNTTAB true @@ -27,7 +27,6 @@ # include #elif BFS_USE_MNTINFO # include -# include #elif BFS_USE_MNTTAB # include # include -- cgit v1.2.3