]> git.proxmox.com Git - wasi-libc.git/commitdiff
Move the SEEK_* macros into their own header and use it from fcntl.h.
authorDan Gohman <sunfish@mozilla.com>
Wed, 8 May 2019 16:13:47 +0000 (09:13 -0700)
committerDan Gohman <sunfish@mozilla.com>
Thu, 9 May 2019 16:11:43 +0000 (09:11 -0700)
POSIX requires fcntl.h to define the SEEK_* macros, so this satisfies
that requirement. Also, this allows <stdio.h> to avoid including as much
unnecessary content.

This fixes one issue with src/api/fcntl.c.

expected/wasm32-wasi/include-all.c
expected/wasm32-wasi/predefined-macros.txt
libc-bottom-half/headers/public/__header_fcntl.h
libc-bottom-half/headers/public/__header_unistd.h
libc-bottom-half/headers/public/__seek.h [new file with mode: 0644]
libc-top-half/musl/include/stdio.h

index 714d03d7ac79c8d042c368f3e849f8c0b888962a..f372283818307a2d39609c493cd3c92bf563c7bd 100644 (file)
@@ -20,6 +20,7 @@
 #include <__header_unistd.h>
 #include <__macro_FD_SETSIZE.h>
 #include <__macro_PAGESIZE.h>
+#include <__seek.h>
 #include <__struct_dirent.h>
 #include <__struct_in6_addr.h>
 #include <__struct_in_addr.h>
index 91c911bf6da5f34f7547cc862d9d821afd44ed4f..740ed9c1f2d5aee5fe8bd8d61c64401a1d3fb851 100644 (file)
 #define __wasilibc___headers_stdlib_h 
 #define __wasilibc___headers_string_h 
 #define __wasilibc___macro_FD_SETSIZE_h 
+#define __wasilibc___seek_h 
 #define __wasilibc___struct_dirent_h 
 #define __wasilibc___struct_in6_addr_h 
 #define __wasilibc___struct_in_addr_h 
index afc5a8dd51cda58089c9ac38c0501bc36400b01c..af720ea3a87570481affb65dc2009f33b3ff979a 100644 (file)
@@ -2,6 +2,7 @@
 #define __wasilibc___header_fcntl_h
 
 #include <wasi/core.h>
+#include <__seek.h>
 
 #define O_APPEND __WASI_FDFLAG_APPEND
 #define O_DSYNC __WASI_FDFLAG_DSYNC
index 1b41628bce451bf5515d424bda45090bc96f9444..e9eae2b6404e5968c8772f1e7283b3dca21b8346 100644 (file)
@@ -3,11 +3,7 @@
 
 struct stat;
 
-#include <wasi/core.h>
-
-#define SEEK_CUR __WASI_WHENCE_CUR
-#define SEEK_END __WASI_WHENCE_END
-#define SEEK_SET __WASI_WHENCE_SET
+#include <__seek.h>
 
 #define F_OK 0
 #define R_OK 1
diff --git a/libc-bottom-half/headers/public/__seek.h b/libc-bottom-half/headers/public/__seek.h
new file mode 100644 (file)
index 0000000..868d040
--- /dev/null
@@ -0,0 +1,10 @@
+#ifndef __wasilibc___seek_h
+#define __wasilibc___seek_h
+
+#include <wasi/core.h>
+
+#define SEEK_CUR __WASI_WHENCE_CUR
+#define SEEK_END __WASI_WHENCE_END
+#define SEEK_SET __WASI_WHENCE_SET
+
+#endif
index b20147479d4af7a446d66435a56e0e1007e5f7a3..8d040b4cde4acd4c2828f231e3dac5a1b5db8993 100644 (file)
@@ -49,7 +49,7 @@ extern "C" {
 #define SEEK_CUR 1
 #define SEEK_END 2
 #else
-#include <__header_unistd.h>
+#include <__seek.h>
 #endif
 
 #define _IOFBF 0