Skip to contentSkip to conversation

tst_device.h: Use <sys/syscall.h> and fallback to sync()

PATCH New Petr Vorel 2 participants 2 messages Jan 20, 2020

lore
Share & tools
lore

Petr Vorel

author
#0 lore raw

PATCH 1/1 tst_device.h: Use <sys/syscall.h> and fallback to sync()

This partly reverts commit 9e83513eb, which unconditionally included lapi/syscalls.h. Put back <sys/syscall.h> and fallback to sync() for these rare cases where __NR_syncfs.

Hope this is final fix for syncfs() issues.

Fixes 9e83513eb "tst_device.h: Use lapi/syscalls.h instead of <sys/syscall.h>"
---
 include/tst_device.h | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
include/tst_device.h +6 -1
index 13d92ee54..1456cb2ff 100644
@@ -19,7 +19,7 @@
 #define TST_DEVICE_H__
 
 #include <unistd.h>
-#include "lapi/syscalls.h"
+#include <sys/syscall.h>
 
 struct tst_device {
 	const char *dev;
@@ -78,7 +78,12 @@ int tst_detach_device(const char *dev_path);
  */
 static inline int tst_dev_sync(int fd)
 {
+#ifdef __NR_syncfs
 	return syscall(__NR_syncfs, fd);
+#else
+	sync();
+	return 0;
+#endif
 }
 
 /*
Signature · 1 line
2.24.1
#1 lore raw

PATCH 1/1 tst_device.h: Use <sys/syscall.h> and fallback to sync()

Hi!
I would rather fix the socketcall tests, I do not thing that anything else would break.

Signature · 2 lines
Cyril Hrubis
[email protected]