Commit d6f18fa4 authored by Dmitry Safonov's avatar Dmitry Safonov Committed by Pavel Emelyanov

zdtm/fanotify00: fix fanotify_{init, mark} calls

O_* flags should be in event_f_flags parameter, according to
fanotify_init(2).
On x86_32 fanotify_mark() has second mask argument (as mask is 64-bit,
the higher parts of mask shouldn't be used):
> COMPAT_SYSCALL_DEFINE6(fanotify_mark,
> 				int, fanotify_fd, unsigned int, flags,
> 				__u32, mask0, __u32, mask1, int, dfd,
> 				const char  __user *, pathname)
> {
> 	return sys_fanotify_mark(fanotify_fd, flags,
> #ifdef __BIG_ENDIAN
> 				((__u64)mask0 << 32) | mask1,
> #else
> 				((__u64)mask1 << 32) | mask0,
> #endif
> 				 dfd, pathname);

travis-ci: success for 32-bit tests fixes
Signed-off-by: 's avatarDmitry Safonov <dsafonov@virtuozzo.com>
Signed-off-by: 's avatarPavel Emelyanov <xemul@virtuozzo.com>
parent 10e38c63
...@@ -75,7 +75,11 @@ static int fanotify_init(unsigned int flags, unsigned int event_f_flags) ...@@ -75,7 +75,11 @@ static int fanotify_init(unsigned int flags, unsigned int event_f_flags)
static int fanotify_mark(int fanotify_fd, unsigned int flags, unsigned long mask, static int fanotify_mark(int fanotify_fd, unsigned int flags, unsigned long mask,
int dfd, const char *pathname) int dfd, const char *pathname)
{ {
#ifdef __i386__
return syscall(__NR_fanotify_mark, fanotify_fd, flags, mask, 0, dfd, pathname);
#else
return syscall(__NR_fanotify_mark, fanotify_fd, flags, mask, dfd, pathname); return syscall(__NR_fanotify_mark, fanotify_fd, flags, mask, dfd, pathname);
#endif
} }
#define fdinfo_field(str, field) !strncmp(str, field":", sizeof(field)) #define fdinfo_field(str, field) !strncmp(str, field":", sizeof(field))
...@@ -226,9 +230,8 @@ int main (int argc, char *argv[]) ...@@ -226,9 +230,8 @@ int main (int argc, char *argv[])
} }
} }
fa_fd = fanotify_init(FAN_NONBLOCK | O_RDONLY | O_LARGEFILE | fa_fd = fanotify_init(FAN_NONBLOCK | FAN_CLASS_NOTIF | FAN_UNLIMITED_QUEUE,
FAN_CLASS_NOTIF | FAN_UNLIMITED_QUEUE, O_RDONLY | O_LARGEFILE);
0);
if (fa_fd < 0) { if (fa_fd < 0) {
pr_perror("fanotify_init failed"); pr_perror("fanotify_init failed");
exit(1); exit(1);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment