[LTP] [PATCH v2 4/5] fanotify: Check FAN_REPORT_{FID, NAME} support
Petr Vorel
pvorel@suse.cz
Fri Nov 13 16:51:22 CET 2020
in safe_fanotify_init()
Suggested-by: Amir Goldstein <amir73il@gmail.com>
Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
New in v2.
testcases/kernel/syscalls/fanotify/fanotify.h | 21 +++++++++++++++----
1 file changed, 17 insertions(+), 4 deletions(-)
diff --git a/testcases/kernel/syscalls/fanotify/fanotify.h b/testcases/kernel/syscalls/fanotify/fanotify.h
index 8452f983a..277760c09 100644
--- a/testcases/kernel/syscalls/fanotify/fanotify.h
+++ b/testcases/kernel/syscalls/fanotify/fanotify.h
@@ -48,11 +48,24 @@ int safe_fanotify_init(const char *file, const int lineno,
if (rval == -1) {
if (errno == ENOSYS) {
- tst_brk(TCONF,
- "fanotify is not configured in this kernel.");
+ tst_brk(TCONF, "%s:%d: fanotify is not configured in this kernel",
+ file, lineno);
}
- tst_brk(TBROK | TERRNO,
- "%s:%d: fanotify_init() failed", file, lineno);
+
+ if (errno == EINVAL) {
+ if (flags & FAN_REPORT_FID) {
+ tst_brk(TCONF, "%s:%d: FAN_REPORT_FID not supported by kernel?",
+ file, lineno);
+ }
+
+ if (flags & FAN_REPORT_NAME) {
+ tst_brk(TCONF, "%s:%d: FAN_REPORT_NAME not supported by kernel?",
+ file, lineno);
+ }
+ }
+
+ tst_brk(TBROK | TERRNO, "%s:%d: fanotify_init() failed",
+ file, lineno);
}
#else
tst_brk(TCONF, "Header <sys/fanotify.h> is not present");
--
2.29.2
More information about the ltp
mailing list