]> git.proxmox.com Git - wasi-libc.git/commitdiff
Move the mode_t macros into their own header.
authorDan Gohman <sunfish@mozilla.com>
Thu, 9 May 2019 17:31:09 +0000 (10:31 -0700)
committerDan Gohman <sunfish@mozilla.com>
Fri, 10 May 2019 19:37:49 +0000 (12:37 -0700)
This allows them to be defined by <fcntl.h> as well, as specified by
POSIX.

This fixes a part of 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_sys_stat.h
libc-bottom-half/headers/public/__mode_t.h [new file with mode: 0644]

index f372283818307a2d39609c493cd3c92bf563c7bd..4204a6d20a50e9908e66fb1373ad970b487841fe 100644 (file)
@@ -20,6 +20,7 @@
 #include <__header_unistd.h>
 #include <__macro_FD_SETSIZE.h>
 #include <__macro_PAGESIZE.h>
+#include <__mode_t.h>
 #include <__seek.h>
 #include <__struct_dirent.h>
 #include <__struct_in6_addr.h>
index efe41951288f0990508accdb8d648210dec59203..7ac2247c14f976714ecd2ab3fb5e3334c56a1f45 100644 (file)
 #define __wasilibc___headers_stdlib_h 
 #define __wasilibc___headers_string_h 
 #define __wasilibc___macro_FD_SETSIZE_h 
+#define __wasilibc___mode_t_h 
 #define __wasilibc___seek_h 
 #define __wasilibc___struct_dirent_h 
 #define __wasilibc___struct_in6_addr_h 
index c5d5a0cbde2c4e429a1a60497d4e16e274810d57..24f72eaf971959a15a94139f5c3934b1bb0a29ea 100644 (file)
@@ -3,6 +3,7 @@
 
 #include <wasi/core.h>
 #include <__seek.h>
+#include <__mode_t.h>
 
 #define O_APPEND __WASI_FDFLAG_APPEND
 #define O_DSYNC __WASI_FDFLAG_DSYNC
index 063b71227baa8269596c630de3feb0fd5af7aa1f..f965cf3d33a2ab09d96e186cc6279473035de7c3 100644 (file)
@@ -7,39 +7,7 @@
 #define st_mtime st_mtim.tv_sec
 #define st_ctime st_ctim.tv_sec
 
-#define S_IFMT \
-    (S_IFBLK | S_IFCHR | S_IFDIR | S_IFIFO | S_IFLNK | S_IFREG | S_IFSOCK)
-#define S_IFBLK (0x6000)
-#define S_IFCHR (0x2000)
-#define S_IFDIR (0x4000)
-#define S_IFLNK (0xa000)
-#define S_IFREG (0x8000)
-#define S_IFSOCK (0xc000)
-#define S_IFIFO (0xc000)
-
-#define S_ISBLK(m) (((m)&S_IFMT) == S_IFBLK)
-#define S_ISCHR(m) (((m)&S_IFMT) == S_IFCHR)
-#define S_ISDIR(m) (((m)&S_IFMT) == S_IFDIR)
-#define S_ISFIFO(m) (((m)&S_IFMT) == S_IFIFO)
-#define S_ISLNK(m) (((m)&S_IFMT) == S_IFLNK)
-#define S_ISREG(m) (((m)&S_IFMT) == S_IFREG)
-#define S_ISSOCK(m) (((m)&S_IFMT) == S_IFSOCK)
-
-#define S_IXOTH (0x1)
-#define S_IWOTH (0x2)
-#define S_IROTH (0x4)
-#define S_IRWXO (S_IXOTH | S_IWOTH | S_IROTH)
-#define S_IXGRP (0x8)
-#define S_IWGRP (0x10)
-#define S_IRGRP (0x20)
-#define S_IRWXG (S_IXGRP | S_IWGRP | S_IRGRP)
-#define S_IXUSR (0x40)
-#define S_IWUSR (0x80)
-#define S_IRUSR (0x100)
-#define S_IRWXU (S_IXUSR | S_IWUSR | S_IRUSR)
-#define S_ISVTX (0x200)
-#define S_ISGID (0x400)
-#define S_ISUID (0x800)
+#include <__mode_t.h>
 
 #define UTIME_NOW (-1)
 #define UTIME_OMIT (-2)
diff --git a/libc-bottom-half/headers/public/__mode_t.h b/libc-bottom-half/headers/public/__mode_t.h
new file mode 100644 (file)
index 0000000..c0beef5
--- /dev/null
@@ -0,0 +1,38 @@
+#ifndef __wasilibc___mode_t_h
+#define __wasilibc___mode_t_h
+
+#define S_IFMT \
+    (S_IFBLK | S_IFCHR | S_IFDIR | S_IFIFO | S_IFLNK | S_IFREG | S_IFSOCK)
+#define S_IFBLK (0x6000)
+#define S_IFCHR (0x2000)
+#define S_IFDIR (0x4000)
+#define S_IFLNK (0xa000)
+#define S_IFREG (0x8000)
+#define S_IFSOCK (0xc000)
+#define S_IFIFO (0xc000)
+
+#define S_ISBLK(m) (((m)&S_IFMT) == S_IFBLK)
+#define S_ISCHR(m) (((m)&S_IFMT) == S_IFCHR)
+#define S_ISDIR(m) (((m)&S_IFMT) == S_IFDIR)
+#define S_ISFIFO(m) (((m)&S_IFMT) == S_IFIFO)
+#define S_ISLNK(m) (((m)&S_IFMT) == S_IFLNK)
+#define S_ISREG(m) (((m)&S_IFMT) == S_IFREG)
+#define S_ISSOCK(m) (((m)&S_IFMT) == S_IFSOCK)
+
+#define S_IXOTH (0x1)
+#define S_IWOTH (0x2)
+#define S_IROTH (0x4)
+#define S_IRWXO (S_IXOTH | S_IWOTH | S_IROTH)
+#define S_IXGRP (0x8)
+#define S_IWGRP (0x10)
+#define S_IRGRP (0x20)
+#define S_IRWXG (S_IXGRP | S_IWGRP | S_IRGRP)
+#define S_IXUSR (0x40)
+#define S_IWUSR (0x80)
+#define S_IRUSR (0x100)
+#define S_IRWXU (S_IXUSR | S_IWUSR | S_IRUSR)
+#define S_ISVTX (0x200)
+#define S_ISGID (0x400)
+#define S_ISUID (0x800)
+
+#endif