aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEdward Liaw <edliaw@google.com>2024-02-23 00:05:43 +0000
committerEdward Liaw <edliaw@google.com>2024-02-29 00:22:36 +0000
commit90164cf586a337bcb89a75f9dd92b9803e278dc1 (patch)
treebed7e68b13373f89a7ffd8feb37b0cc557e9da5b
parent54cba336036ccf76b10ec42f9ba6d9868166392e (diff)
downloadltp-90164cf586a337bcb89a75f9dd92b9803e278dc1.tar.gz
tst_fd: Use raw syscall for fanotify_init()
Some systems do not provide sys/fanotify.h, such as Android. We can use the raw syscall for open_fanotify to avoid importing the header file. Bug: 327505050 Test: mma Link: https://lore.kernel.org/ltp/20240223000543.1135129-1-edliaw@google.com/ Fixes: https://github.com/linux-test-project/ltp/issues/1134 Suggested-by: Cyril Hrubis <chrubis@suse.cz> Reviewed-by: Li Wang <liwang@redhat.com> Reviewed-by: Petr Vorel <pvorel@suse.cz> Change-Id: I47aaaa4846a360be62059d140dbda00964966a4d Signed-off-by: Edward Liaw <edliaw@google.com> (cherry picked from commit 7b1c5e0a239e1204ea444315e0b9c256ddbfd380)
-rw-r--r--lib/tst_fd.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/tst_fd.c b/lib/tst_fd.c
index b3d43a7c3..6538a098c 100644
--- a/lib/tst_fd.c
+++ b/lib/tst_fd.c
@@ -10,9 +10,9 @@
#include <sys/eventfd.h>
#include <sys/signalfd.h>
#include <sys/timerfd.h>
-#include <sys/fanotify.h>
#include <sys/inotify.h>
#include <linux/perf_event.h>
+#include <linux/fanotify.h>
#include "tst_test.h"
#include "tst_safe_macros.h"
@@ -146,7 +146,7 @@ static void open_pidfd(struct tst_fd *fd)
static void open_fanotify(struct tst_fd *fd)
{
- fd->fd = fanotify_init(FAN_CLASS_NOTIF, O_RDONLY);
+ fd->fd = syscall(__NR_fanotify_init, FAN_CLASS_NOTIF, O_RDONLY);
if (fd->fd < 0) {
tst_res(TCONF | TERRNO,
"Skipping %s", tst_fd_desc(fd));