]> xenbits.xensource.com Git - unikraft/libs/newlib.git/commitdiff
include/fcntl.h: Replace O_NONBLOCK with new one on arm
authorJia He <justin.he@arm.com>
Wed, 20 May 2020 09:56:03 +0000 (17:56 +0800)
committerSimon Kuenzer <simon.kuenzer@neclab.eu>
Fri, 7 Aug 2020 17:38:39 +0000 (19:38 +0200)
in newlib _default_fcntl.h, it defines O_NONBLOCK as follows:
\#define _FNONBLOCK      0x4000  /* non blocking I/O (POSIX style) */
But it is different from linux definition(04000=0x800):
\#define O_NONBLOCK 00004000

This difference confused virtio-9p open() syscall. If you open a
file with O_NONBLOCK(is 0x4000 in newlib) and sys_open will regard
it as O_DIRECTORY. At last it returns a ENOTDIR error.

Signed-off-by: Jia He <justin.he@arm.com>
Reviewed-by: Razvan Deaconescu <razvan.deaconescu@cs.pub.ro>
include/fcntl.h

index feb4f7c2fc792600121aeabb1911516db6248441..367c1e60fd97494c4908bf16c30f00873e58739e 100644 (file)
@@ -15,6 +15,8 @@
 #define O_DIRECT     040000
 #define O_NOATIME  01000000
 #elif ((defined CONFIG_ARCH_ARM_64) || (defined CONFIG_ARCH_ARM_32))
+#undef O_NONBLOCK
+#define O_NONBLOCK    04000
 #define O_NOFOLLOW  0100000
 #define O_DIRECTORY  040000
 #define O_CLOEXEC  02000000