• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #ifndef __UVWASI_WASI_RIGHTS_H__
2 #define __UVWASI_WASI_RIGHTS_H__
3 
4 #include "wasi_types.h"
5 
6 #define UVWASI__RIGHTS_ALL (UVWASI_RIGHT_FD_DATASYNC |                        \
7                             UVWASI_RIGHT_FD_READ |                            \
8                             UVWASI_RIGHT_FD_SEEK |                            \
9                             UVWASI_RIGHT_FD_FDSTAT_SET_FLAGS |                \
10                             UVWASI_RIGHT_FD_SYNC |                            \
11                             UVWASI_RIGHT_FD_TELL |                            \
12                             UVWASI_RIGHT_FD_WRITE |                           \
13                             UVWASI_RIGHT_FD_ADVISE |                          \
14                             UVWASI_RIGHT_FD_ALLOCATE |                        \
15                             UVWASI_RIGHT_PATH_CREATE_DIRECTORY |              \
16                             UVWASI_RIGHT_PATH_CREATE_FILE |                   \
17                             UVWASI_RIGHT_PATH_LINK_SOURCE |                   \
18                             UVWASI_RIGHT_PATH_LINK_TARGET |                   \
19                             UVWASI_RIGHT_PATH_OPEN |                          \
20                             UVWASI_RIGHT_FD_READDIR |                         \
21                             UVWASI_RIGHT_PATH_READLINK |                      \
22                             UVWASI_RIGHT_PATH_RENAME_SOURCE |                 \
23                             UVWASI_RIGHT_PATH_RENAME_TARGET |                 \
24                             UVWASI_RIGHT_PATH_FILESTAT_GET |                  \
25                             UVWASI_RIGHT_PATH_FILESTAT_SET_SIZE |             \
26                             UVWASI_RIGHT_PATH_FILESTAT_SET_TIMES |            \
27                             UVWASI_RIGHT_FD_FILESTAT_GET |                    \
28                             UVWASI_RIGHT_FD_FILESTAT_SET_TIMES |              \
29                             UVWASI_RIGHT_FD_FILESTAT_SET_SIZE |               \
30                             UVWASI_RIGHT_PATH_SYMLINK |                       \
31                             UVWASI_RIGHT_PATH_UNLINK_FILE |                   \
32                             UVWASI_RIGHT_PATH_REMOVE_DIRECTORY |              \
33                             UVWASI_RIGHT_POLL_FD_READWRITE |                  \
34                             UVWASI_RIGHT_SOCK_SHUTDOWN |                      \
35                             UVWASI_RIGHT_SOCK_ACCEPT)
36 
37 #define UVWASI__RIGHTS_BLOCK_DEVICE_BASE UVWASI__RIGHTS_ALL
38 #define UVWASI__RIGHTS_BLOCK_DEVICE_INHERITING UVWASI__RIGHTS_ALL
39 
40 #define UVWASI__RIGHTS_CHARACTER_DEVICE_BASE UVWASI__RIGHTS_ALL
41 #define UVWASI__RIGHTS_CHARACTER_DEVICE_INHERITING UVWASI__RIGHTS_ALL
42 
43 #define UVWASI__RIGHTS_REGULAR_FILE_BASE (UVWASI_RIGHT_FD_DATASYNC |          \
44                                           UVWASI_RIGHT_FD_READ |              \
45                                           UVWASI_RIGHT_FD_SEEK |              \
46                                           UVWASI_RIGHT_FD_FDSTAT_SET_FLAGS |  \
47                                           UVWASI_RIGHT_FD_SYNC |              \
48                                           UVWASI_RIGHT_FD_TELL |              \
49                                           UVWASI_RIGHT_FD_WRITE |             \
50                                           UVWASI_RIGHT_FD_ADVISE |            \
51                                           UVWASI_RIGHT_FD_ALLOCATE |          \
52                                           UVWASI_RIGHT_FD_FILESTAT_GET |      \
53                                           UVWASI_RIGHT_FD_FILESTAT_SET_SIZE | \
54                                           UVWASI_RIGHT_FD_FILESTAT_SET_TIMES |\
55                                           UVWASI_RIGHT_POLL_FD_READWRITE)
56 #define UVWASI__RIGHTS_REGULAR_FILE_INHERITING 0
57 
58 #define UVWASI__RIGHTS_DIRECTORY_BASE (UVWASI_RIGHT_FD_FDSTAT_SET_FLAGS |     \
59                                        UVWASI_RIGHT_FD_SYNC |                 \
60                                        UVWASI_RIGHT_FD_ADVISE |               \
61                                        UVWASI_RIGHT_PATH_CREATE_DIRECTORY |   \
62                                        UVWASI_RIGHT_PATH_CREATE_FILE |        \
63                                        UVWASI_RIGHT_PATH_LINK_SOURCE |        \
64                                        UVWASI_RIGHT_PATH_LINK_TARGET |        \
65                                        UVWASI_RIGHT_PATH_OPEN |               \
66                                        UVWASI_RIGHT_FD_READDIR |              \
67                                        UVWASI_RIGHT_PATH_READLINK |           \
68                                        UVWASI_RIGHT_PATH_RENAME_SOURCE |      \
69                                        UVWASI_RIGHT_PATH_RENAME_TARGET |      \
70                                        UVWASI_RIGHT_PATH_FILESTAT_GET |       \
71                                        UVWASI_RIGHT_PATH_FILESTAT_SET_SIZE |  \
72                                        UVWASI_RIGHT_PATH_FILESTAT_SET_TIMES | \
73                                        UVWASI_RIGHT_FD_FILESTAT_GET |         \
74                                        UVWASI_RIGHT_FD_FILESTAT_SET_TIMES |   \
75                                        UVWASI_RIGHT_PATH_SYMLINK |            \
76                                        UVWASI_RIGHT_PATH_UNLINK_FILE |        \
77                                        UVWASI_RIGHT_PATH_REMOVE_DIRECTORY |   \
78                                        UVWASI_RIGHT_POLL_FD_READWRITE)
79 #define UVWASI__RIGHTS_DIRECTORY_INHERITING (UVWASI__RIGHTS_DIRECTORY_BASE |  \
80                                              UVWASI__RIGHTS_REGULAR_FILE_BASE)
81 
82 #define UVWASI__RIGHTS_SOCKET_BASE (UVWASI_RIGHT_FD_READ |                    \
83                                     UVWASI_RIGHT_FD_FDSTAT_SET_FLAGS |        \
84                                     UVWASI_RIGHT_FD_WRITE |                   \
85                                     UVWASI_RIGHT_FD_FILESTAT_GET |            \
86                                     UVWASI_RIGHT_POLL_FD_READWRITE |          \
87                                     UVWASI_RIGHT_SOCK_SHUTDOWN |              \
88                                     UVWASI_RIGHT_SOCK_ACCEPT)
89 #define UVWASI__RIGHTS_SOCKET_INHERITING UVWASI__RIGHTS_ALL
90 
91 #define UVWASI__RIGHTS_TTY_BASE (UVWASI_RIGHT_FD_READ |                       \
92                                  UVWASI_RIGHT_FD_FDSTAT_SET_FLAGS |           \
93                                  UVWASI_RIGHT_FD_WRITE |                      \
94                                  UVWASI_RIGHT_FD_FILESTAT_GET |               \
95                                  UVWASI_RIGHT_POLL_FD_READWRITE)
96 #define UVWASI__RIGHTS_TTY_INHERITING 0
97 
98 
99 uvwasi_errno_t uvwasi__get_rights(uv_file fd,
100                                   int flags,
101                                   uvwasi_filetype_t type,
102                                   uvwasi_rights_t* rights_base,
103                                   uvwasi_rights_t* rights_inheriting);
104 
105 
106 #endif /* __UVWASI_WASI_RIGHTS_H__ */
107