• 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 
36 #define UVWASI__RIGHTS_BLOCK_DEVICE_BASE UVWASI__RIGHTS_ALL
37 #define UVWASI__RIGHTS_BLOCK_DEVICE_INHERITING UVWASI__RIGHTS_ALL
38 
39 #define UVWASI__RIGHTS_CHARACTER_DEVICE_BASE UVWASI__RIGHTS_ALL
40 #define UVWASI__RIGHTS_CHARACTER_DEVICE_INHERITING UVWASI__RIGHTS_ALL
41 
42 #define UVWASI__RIGHTS_REGULAR_FILE_BASE (UVWASI_RIGHT_FD_DATASYNC |          \
43                                           UVWASI_RIGHT_FD_READ |              \
44                                           UVWASI_RIGHT_FD_SEEK |              \
45                                           UVWASI_RIGHT_FD_FDSTAT_SET_FLAGS |  \
46                                           UVWASI_RIGHT_FD_SYNC |              \
47                                           UVWASI_RIGHT_FD_TELL |              \
48                                           UVWASI_RIGHT_FD_WRITE |             \
49                                           UVWASI_RIGHT_FD_ADVISE |            \
50                                           UVWASI_RIGHT_FD_ALLOCATE |          \
51                                           UVWASI_RIGHT_FD_FILESTAT_GET |      \
52                                           UVWASI_RIGHT_FD_FILESTAT_SET_SIZE | \
53                                           UVWASI_RIGHT_FD_FILESTAT_SET_TIMES |\
54                                           UVWASI_RIGHT_POLL_FD_READWRITE)
55 #define UVWASI__RIGHTS_REGULAR_FILE_INHERITING 0
56 
57 #define UVWASI__RIGHTS_DIRECTORY_BASE (UVWASI_RIGHT_FD_FDSTAT_SET_FLAGS |     \
58                                        UVWASI_RIGHT_FD_SYNC |                 \
59                                        UVWASI_RIGHT_FD_ADVISE |               \
60                                        UVWASI_RIGHT_PATH_CREATE_DIRECTORY |   \
61                                        UVWASI_RIGHT_PATH_CREATE_FILE |        \
62                                        UVWASI_RIGHT_PATH_LINK_SOURCE |        \
63                                        UVWASI_RIGHT_PATH_LINK_TARGET |        \
64                                        UVWASI_RIGHT_PATH_OPEN |               \
65                                        UVWASI_RIGHT_FD_READDIR |              \
66                                        UVWASI_RIGHT_PATH_READLINK |           \
67                                        UVWASI_RIGHT_PATH_RENAME_SOURCE |      \
68                                        UVWASI_RIGHT_PATH_RENAME_TARGET |      \
69                                        UVWASI_RIGHT_PATH_FILESTAT_GET |       \
70                                        UVWASI_RIGHT_PATH_FILESTAT_SET_SIZE |  \
71                                        UVWASI_RIGHT_PATH_FILESTAT_SET_TIMES | \
72                                        UVWASI_RIGHT_FD_FILESTAT_GET |         \
73                                        UVWASI_RIGHT_FD_FILESTAT_SET_TIMES |   \
74                                        UVWASI_RIGHT_PATH_SYMLINK |            \
75                                        UVWASI_RIGHT_PATH_UNLINK_FILE |        \
76                                        UVWASI_RIGHT_PATH_REMOVE_DIRECTORY |   \
77                                        UVWASI_RIGHT_POLL_FD_READWRITE)
78 #define UVWASI__RIGHTS_DIRECTORY_INHERITING (UVWASI__RIGHTS_DIRECTORY_BASE |  \
79                                              UVWASI__RIGHTS_REGULAR_FILE_BASE)
80 
81 #define UVWASI__RIGHTS_SOCKET_BASE (UVWASI_RIGHT_FD_READ |                    \
82                                     UVWASI_RIGHT_FD_FDSTAT_SET_FLAGS |        \
83                                     UVWASI_RIGHT_FD_WRITE |                   \
84                                     UVWASI_RIGHT_FD_FILESTAT_GET |            \
85                                     UVWASI_RIGHT_POLL_FD_READWRITE |          \
86                                     UVWASI_RIGHT_SOCK_SHUTDOWN)
87 #define UVWASI__RIGHTS_SOCKET_INHERITING UVWASI__RIGHTS_ALL;
88 
89 #define UVWASI__RIGHTS_TTY_BASE (UVWASI_RIGHT_FD_READ |                       \
90                                  UVWASI_RIGHT_FD_FDSTAT_SET_FLAGS |           \
91                                  UVWASI_RIGHT_FD_WRITE |                      \
92                                  UVWASI_RIGHT_FD_FILESTAT_GET |               \
93                                  UVWASI_RIGHT_POLL_FD_READWRITE)
94 #define UVWASI__RIGHTS_TTY_INHERITING 0
95 
96 
97 uvwasi_errno_t uvwasi__get_rights(uv_file fd,
98                                   int flags,
99                                   uvwasi_filetype_t type,
100                                   uvwasi_rights_t* rights_base,
101                                   uvwasi_rights_t* rights_inheriting);
102 
103 
104 #endif /* __UVWASI_WASI_RIGHTS_H__ */
105