Skip to content

Commit 2f4296d

Browse files
alviroiskandaraxboe
authored andcommitted
test/fsnotify: Skip fsnotify test if sys/fanotify.h not available
Fix build on Termux (Android). Most android devices don't have <sys/fanotify.h> on Termux. Skip the test if it's not available. Reported-by: Dwiky Rizky Ananditya <[email protected]> Tested-by: Dwiky Rizky Ananditya <[email protected]> Signed-off-by: Alviro Iskandar Setiawan <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jens Axboe <[email protected]>
1 parent b9231b5 commit 2f4296d

File tree

2 files changed

+31
-1
lines changed

2 files changed

+31
-1
lines changed

configure

+19
Original file line numberDiff line numberDiff line change
@@ -419,6 +419,22 @@ fi
419419
print_config "nolibc support" "$liburing_nolibc";
420420
#############################################################################
421421

422+
####################################################
423+
# Most Android devices don't have sys/fanotify.h
424+
has_fanotify="no"
425+
cat > $TMPC << EOF
426+
#include <sys/fanotify.h>
427+
int main(void)
428+
{
429+
return 0;
430+
}
431+
EOF
432+
if compile_prog "" "" "fanotify"; then
433+
has_fanotify="yes"
434+
fi
435+
print_config "has_fanotify" "$has_fanotify"
436+
####################################################
437+
422438
if test "$liburing_nolibc" = "yes"; then
423439
output_sym "CONFIG_NOLIBC"
424440
fi
@@ -452,6 +468,9 @@ fi
452468
if test "$nvme_uring_cmd" = "yes"; then
453469
output_sym "CONFIG_HAVE_NVME_URING"
454470
fi
471+
if test "$has_fanotify" = "yes"; then
472+
output_sym "CONFIG_HAVE_FANOTIFY"
473+
fi
455474

456475
echo "CC=$cc" >> $config_host_mak
457476
print_config "CC" "$cc"

test/fsnotify.c

+12-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22
/*
33
* Description: test fsnotify access off O_DIRECT read
44
*/
5+
6+
#include "helpers.h"
7+
8+
#ifdef CONFIG_HAVE_FANOTIFY
59
#include <stdio.h>
610
#include <stdlib.h>
711
#include <unistd.h>
@@ -11,7 +15,6 @@
1115
#include <sys/wait.h>
1216

1317
#include "liburing.h"
14-
#include "helpers.h"
1518

1619
int main(int argc, char *argv[])
1720
{
@@ -99,3 +102,11 @@ int main(int argc, char *argv[])
99102
unlink(fname);
100103
return err;
101104
}
105+
106+
#else /* #ifdef CONFIG_HAVE_FANOTIFY */
107+
108+
int main(void)
109+
{
110+
return T_EXIT_SKIP;
111+
}
112+
#endif /* #ifdef CONFIG_HAVE_FANOTIFY */

0 commit comments

Comments
 (0)