summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJens Axboe <axboe@kernel.dk>2021-11-12 11:26:54 -0700
committerJens Axboe <axboe@kernel.dk>2021-11-12 11:26:54 -0700
commit28e631994a6770072b833e27ec0f2f75b29de305 (patch)
tree76e3f181bfb2f718f2bc510caf2c996c4bf7c5e1
parent890179d06befbed024e3027d91ebe63a1018cfa0 (diff)
parent44b12f54191574462df337f0b2a2bcad147fd80b (diff)
downloadliburing-28e631994a6770072b833e27ec0f2f75b29de305.tar.gz
liburing-28e631994a6770072b833e27ec0f2f75b29de305.tar.bz2
Merge branch 'glibc-statx' of https://github.com/bikallem/liburing
* 'glibc-statx' of https://github.com/bikallem/liburing: fix 'make' when using glibc >= 2.28
-rwxr-xr-xconfigure31
-rw-r--r--src/include/liburing.h1
-rw-r--r--test/Makefile4
-rw-r--r--test/file-verify.c1
-rw-r--r--test/rename.c1
-rw-r--r--test/unlink.c1
6 files changed, 37 insertions, 2 deletions
diff --git a/configure b/configure
index d2866b3..2061148 100755
--- a/configure
+++ b/configure
@@ -268,7 +268,6 @@ print_config "__kernel_timespec" "$__kernel_timespec"
open_how="no"
cat > $TMPC << EOF
#include <sys/types.h>
-#include <sys/stat.h>
#include <fcntl.h>
#include <string.h>
#include <linux/openat2.h>
@@ -309,6 +308,27 @@ fi
print_config "statx" "$statx"
##########################################
+# check for glibc statx
+glibc_statx="no"
+cat > $TMPC << EOF
+#include <sys/types.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <string.h>
+#include <linux/stat.h>
+int main(int argc, char **argv)
+{
+ struct statx x;
+
+ return memset(&x, 0, sizeof(x)) != NULL;
+}
+EOF
+if compile_prog "" "" "glibc_statx"; then
+ glibc_statx="yes"
+fi
+print_config "glibc_statx" "$glibc_statx"
+
+##########################################
# check for C++
has_cxx="no"
cat > $TMPC << EOF
@@ -380,6 +400,9 @@ fi
if test "$statx" = "yes"; then
output_sym "CONFIG_HAVE_STATX"
fi
+if test "$glibc_statx" = "yes"; then
+ output_sym "CONFIG_HAVE_GLIBC_STATX"
+fi
if test "$has_cxx" = "yes"; then
output_sym "CONFIG_HAVE_CXX"
fi
@@ -448,6 +471,12 @@ else cat >> $compat_h << EOF
EOF
fi
+if test "$glibc_statx" = "no" && "$statx" = "yes"; then
+cat >> $compat_h << EOF
+#include <sys/stat.h>
+
+EOF
+fi
cat >> $compat_h << EOF
#endif
diff --git a/src/include/liburing.h b/src/include/liburing.h
index fc81542..169e098 100644
--- a/src/include/liburing.h
+++ b/src/include/liburing.h
@@ -8,7 +8,6 @@
#include <sys/socket.h>
#include <sys/uio.h>
-#include <sys/stat.h>
#include <errno.h>
#include <signal.h>
#include <stdbool.h>
diff --git a/test/Makefile b/test/Makefile
index f7eafad..d6e7227 100644
--- a/test/Makefile
+++ b/test/Makefile
@@ -157,6 +157,10 @@ include ../Makefile.quiet
ifdef CONFIG_HAVE_STATX
test_srcs += statx.c
endif
+
+ifdef CONFIG_HAVE_GLIBC_STATX
+ test_srcs += statx.c
+endif
all_targets += statx
diff --git a/test/file-verify.c b/test/file-verify.c
index 50cad45..327cb1d 100644
--- a/test/file-verify.c
+++ b/test/file-verify.c
@@ -12,6 +12,7 @@
#include <assert.h>
#include <string.h>
#include <sys/ioctl.h>
+#include <sys/stat.h>
#include <linux/fs.h>
#include "helpers.h"
diff --git a/test/rename.c b/test/rename.c
index af09d65..7798d43 100644
--- a/test/rename.c
+++ b/test/rename.c
@@ -9,6 +9,7 @@
#include <stdlib.h>
#include <string.h>
#include <fcntl.h>
+#include <sys/stat.h>
#include "liburing.h"
diff --git a/test/unlink.c b/test/unlink.c
index f8c7639..e4c210b 100644
--- a/test/unlink.c
+++ b/test/unlink.c
@@ -9,6 +9,7 @@
#include <stdlib.h>
#include <string.h>
#include <fcntl.h>
+#include <sys/stat.h>
#include "liburing.h"