linux-user: fix O_TMPFILE handling
authorRiku Voipio <riku.voipio@linaro.org>
Tue, 8 Aug 2017 13:01:19 +0000 (16:01 +0300)
committerRiku Voipio <riku.voipio@linaro.org>
Mon, 16 Oct 2017 13:00:56 +0000 (16:00 +0300)
Since O_TMPFILE might differ between guest and host,
add it to the bitmask_transtbl. While at it, fix the definitions
of O_DIRECTORY etc which should arm32 according to kernel sources.

This fixes open14 and openat03 ltp testcases. Fixes:

https://bugs.launchpad.net/qemu/+bug/1709170

linux-user/strace.c
linux-user/syscall.c
linux-user/syscall_defs.h

index d821d165ff97a41a3125f8154839fcba808ba198..bd897a3f20a999dde8ae32f44e5c9941f01e370e 100644 (file)
@@ -837,6 +837,10 @@ UNUSED static struct flags open_flags[] = {
 #endif
 #ifdef O_PATH
     FLAG_TARGET(O_PATH),
+#endif
+#ifdef O_TMPFILE
+    FLAG_TARGET(O_TMPFILE),
+    FLAG_TARGET(__O_TMPFILE),
 #endif
     FLAG_END,
 };
index 9b6364a266dc18a1020db25a0620336634a73309..08fbc4d5f79e3675e8cab1f03946b1e874b2d66e 100644 (file)
@@ -341,6 +341,9 @@ static bitmask_transtbl fcntl_flags_tbl[] = {
 #endif
 #if defined(O_PATH)
   { TARGET_O_PATH,      TARGET_O_PATH,      O_PATH,      O_PATH       },
+#endif
+#if defined(O_TMPFILE)
+  { TARGET_O_TMPFILE,   TARGET_O_TMPFILE,   O_TMPFILE,   O_TMPFILE    },
 #endif
   /* Don't terminate the list prematurely on 64-bit host+guest.  */
 #if TARGET_O_LARGEFILE != 0 || O_LARGEFILE != 0
index 40c5027e93011167439f0de61d39ee0359291734..6e2287e918cb5d38ad90cea78449ef4c0ebc5fc5 100644 (file)
@@ -2416,7 +2416,7 @@ struct target_statfs64 {
 #define TARGET_O_CLOEXEC     010000000
 #define TARGET___O_SYNC      000100000
 #define TARGET_O_PATH        020000000
-#elif defined(TARGET_ARM) || defined(TARGET_M68K)
+#elif defined(TARGET_ARM) || defined(TARGET_M68K) || defined(TARGET_AARCH64)
 #define TARGET_O_DIRECTORY      040000 /* must be a directory */
 #define TARGET_O_NOFOLLOW      0100000 /* don't follow links */
 #define TARGET_O_DIRECT        0200000 /* direct disk access hint */
@@ -2513,6 +2513,12 @@ struct target_statfs64 {
 #ifndef TARGET_O_PATH
 #define TARGET_O_PATH        010000000
 #endif
+#ifndef TARGET___O_TMPFILE
+#define TARGET___O_TMPFILE   020000000
+#endif
+#ifndef TARGET_O_TMPFILE
+#define TARGET_O_TMPFILE     (TARGET___O_TMPFILE | TARGET_O_DIRECTORY)
+#endif
 #ifndef TARGET_O_NDELAY
 #define TARGET_O_NDELAY  TARGET_O_NONBLOCK
 #endif