xref: /third_party/node/deps/uvwasi/src/wasi_rights.h (revision 1cb0ef41)
11cb0ef41Sopenharmony_ci#ifndef __UVWASI_WASI_RIGHTS_H__
21cb0ef41Sopenharmony_ci#define __UVWASI_WASI_RIGHTS_H__
31cb0ef41Sopenharmony_ci
41cb0ef41Sopenharmony_ci#include "wasi_types.h"
51cb0ef41Sopenharmony_ci
61cb0ef41Sopenharmony_ci#define UVWASI__RIGHTS_ALL (UVWASI_RIGHT_FD_DATASYNC |                        \
71cb0ef41Sopenharmony_ci                            UVWASI_RIGHT_FD_READ |                            \
81cb0ef41Sopenharmony_ci                            UVWASI_RIGHT_FD_SEEK |                            \
91cb0ef41Sopenharmony_ci                            UVWASI_RIGHT_FD_FDSTAT_SET_FLAGS |                \
101cb0ef41Sopenharmony_ci                            UVWASI_RIGHT_FD_SYNC |                            \
111cb0ef41Sopenharmony_ci                            UVWASI_RIGHT_FD_TELL |                            \
121cb0ef41Sopenharmony_ci                            UVWASI_RIGHT_FD_WRITE |                           \
131cb0ef41Sopenharmony_ci                            UVWASI_RIGHT_FD_ADVISE |                          \
141cb0ef41Sopenharmony_ci                            UVWASI_RIGHT_FD_ALLOCATE |                        \
151cb0ef41Sopenharmony_ci                            UVWASI_RIGHT_PATH_CREATE_DIRECTORY |              \
161cb0ef41Sopenharmony_ci                            UVWASI_RIGHT_PATH_CREATE_FILE |                   \
171cb0ef41Sopenharmony_ci                            UVWASI_RIGHT_PATH_LINK_SOURCE |                   \
181cb0ef41Sopenharmony_ci                            UVWASI_RIGHT_PATH_LINK_TARGET |                   \
191cb0ef41Sopenharmony_ci                            UVWASI_RIGHT_PATH_OPEN |                          \
201cb0ef41Sopenharmony_ci                            UVWASI_RIGHT_FD_READDIR |                         \
211cb0ef41Sopenharmony_ci                            UVWASI_RIGHT_PATH_READLINK |                      \
221cb0ef41Sopenharmony_ci                            UVWASI_RIGHT_PATH_RENAME_SOURCE |                 \
231cb0ef41Sopenharmony_ci                            UVWASI_RIGHT_PATH_RENAME_TARGET |                 \
241cb0ef41Sopenharmony_ci                            UVWASI_RIGHT_PATH_FILESTAT_GET |                  \
251cb0ef41Sopenharmony_ci                            UVWASI_RIGHT_PATH_FILESTAT_SET_SIZE |             \
261cb0ef41Sopenharmony_ci                            UVWASI_RIGHT_PATH_FILESTAT_SET_TIMES |            \
271cb0ef41Sopenharmony_ci                            UVWASI_RIGHT_FD_FILESTAT_GET |                    \
281cb0ef41Sopenharmony_ci                            UVWASI_RIGHT_FD_FILESTAT_SET_TIMES |              \
291cb0ef41Sopenharmony_ci                            UVWASI_RIGHT_FD_FILESTAT_SET_SIZE |               \
301cb0ef41Sopenharmony_ci                            UVWASI_RIGHT_PATH_SYMLINK |                       \
311cb0ef41Sopenharmony_ci                            UVWASI_RIGHT_PATH_UNLINK_FILE |                   \
321cb0ef41Sopenharmony_ci                            UVWASI_RIGHT_PATH_REMOVE_DIRECTORY |              \
331cb0ef41Sopenharmony_ci                            UVWASI_RIGHT_POLL_FD_READWRITE |                  \
341cb0ef41Sopenharmony_ci                            UVWASI_RIGHT_SOCK_SHUTDOWN |                      \
351cb0ef41Sopenharmony_ci                            UVWASI_RIGHT_SOCK_ACCEPT)
361cb0ef41Sopenharmony_ci
371cb0ef41Sopenharmony_ci#define UVWASI__RIGHTS_BLOCK_DEVICE_BASE UVWASI__RIGHTS_ALL
381cb0ef41Sopenharmony_ci#define UVWASI__RIGHTS_BLOCK_DEVICE_INHERITING UVWASI__RIGHTS_ALL
391cb0ef41Sopenharmony_ci
401cb0ef41Sopenharmony_ci#define UVWASI__RIGHTS_CHARACTER_DEVICE_BASE UVWASI__RIGHTS_ALL
411cb0ef41Sopenharmony_ci#define UVWASI__RIGHTS_CHARACTER_DEVICE_INHERITING UVWASI__RIGHTS_ALL
421cb0ef41Sopenharmony_ci
431cb0ef41Sopenharmony_ci#define UVWASI__RIGHTS_REGULAR_FILE_BASE (UVWASI_RIGHT_FD_DATASYNC |          \
441cb0ef41Sopenharmony_ci                                          UVWASI_RIGHT_FD_READ |              \
451cb0ef41Sopenharmony_ci                                          UVWASI_RIGHT_FD_SEEK |              \
461cb0ef41Sopenharmony_ci                                          UVWASI_RIGHT_FD_FDSTAT_SET_FLAGS |  \
471cb0ef41Sopenharmony_ci                                          UVWASI_RIGHT_FD_SYNC |              \
481cb0ef41Sopenharmony_ci                                          UVWASI_RIGHT_FD_TELL |              \
491cb0ef41Sopenharmony_ci                                          UVWASI_RIGHT_FD_WRITE |             \
501cb0ef41Sopenharmony_ci                                          UVWASI_RIGHT_FD_ADVISE |            \
511cb0ef41Sopenharmony_ci                                          UVWASI_RIGHT_FD_ALLOCATE |          \
521cb0ef41Sopenharmony_ci                                          UVWASI_RIGHT_FD_FILESTAT_GET |      \
531cb0ef41Sopenharmony_ci                                          UVWASI_RIGHT_FD_FILESTAT_SET_SIZE | \
541cb0ef41Sopenharmony_ci                                          UVWASI_RIGHT_FD_FILESTAT_SET_TIMES |\
551cb0ef41Sopenharmony_ci                                          UVWASI_RIGHT_POLL_FD_READWRITE)
561cb0ef41Sopenharmony_ci#define UVWASI__RIGHTS_REGULAR_FILE_INHERITING 0
571cb0ef41Sopenharmony_ci
581cb0ef41Sopenharmony_ci#define UVWASI__RIGHTS_DIRECTORY_BASE (UVWASI_RIGHT_FD_FDSTAT_SET_FLAGS |     \
591cb0ef41Sopenharmony_ci                                       UVWASI_RIGHT_FD_SYNC |                 \
601cb0ef41Sopenharmony_ci                                       UVWASI_RIGHT_FD_ADVISE |               \
611cb0ef41Sopenharmony_ci                                       UVWASI_RIGHT_PATH_CREATE_DIRECTORY |   \
621cb0ef41Sopenharmony_ci                                       UVWASI_RIGHT_PATH_CREATE_FILE |        \
631cb0ef41Sopenharmony_ci                                       UVWASI_RIGHT_PATH_LINK_SOURCE |        \
641cb0ef41Sopenharmony_ci                                       UVWASI_RIGHT_PATH_LINK_TARGET |        \
651cb0ef41Sopenharmony_ci                                       UVWASI_RIGHT_PATH_OPEN |               \
661cb0ef41Sopenharmony_ci                                       UVWASI_RIGHT_FD_READDIR |              \
671cb0ef41Sopenharmony_ci                                       UVWASI_RIGHT_PATH_READLINK |           \
681cb0ef41Sopenharmony_ci                                       UVWASI_RIGHT_PATH_RENAME_SOURCE |      \
691cb0ef41Sopenharmony_ci                                       UVWASI_RIGHT_PATH_RENAME_TARGET |      \
701cb0ef41Sopenharmony_ci                                       UVWASI_RIGHT_PATH_FILESTAT_GET |       \
711cb0ef41Sopenharmony_ci                                       UVWASI_RIGHT_PATH_FILESTAT_SET_SIZE |  \
721cb0ef41Sopenharmony_ci                                       UVWASI_RIGHT_PATH_FILESTAT_SET_TIMES | \
731cb0ef41Sopenharmony_ci                                       UVWASI_RIGHT_FD_FILESTAT_GET |         \
741cb0ef41Sopenharmony_ci                                       UVWASI_RIGHT_FD_FILESTAT_SET_TIMES |   \
751cb0ef41Sopenharmony_ci                                       UVWASI_RIGHT_PATH_SYMLINK |            \
761cb0ef41Sopenharmony_ci                                       UVWASI_RIGHT_PATH_UNLINK_FILE |        \
771cb0ef41Sopenharmony_ci                                       UVWASI_RIGHT_PATH_REMOVE_DIRECTORY |   \
781cb0ef41Sopenharmony_ci                                       UVWASI_RIGHT_POLL_FD_READWRITE)
791cb0ef41Sopenharmony_ci#define UVWASI__RIGHTS_DIRECTORY_INHERITING (UVWASI__RIGHTS_DIRECTORY_BASE |  \
801cb0ef41Sopenharmony_ci                                             UVWASI__RIGHTS_REGULAR_FILE_BASE)
811cb0ef41Sopenharmony_ci
821cb0ef41Sopenharmony_ci#define UVWASI__RIGHTS_SOCKET_BASE (UVWASI_RIGHT_FD_READ |                    \
831cb0ef41Sopenharmony_ci                                    UVWASI_RIGHT_FD_FDSTAT_SET_FLAGS |        \
841cb0ef41Sopenharmony_ci                                    UVWASI_RIGHT_FD_WRITE |                   \
851cb0ef41Sopenharmony_ci                                    UVWASI_RIGHT_FD_FILESTAT_GET |            \
861cb0ef41Sopenharmony_ci                                    UVWASI_RIGHT_POLL_FD_READWRITE |          \
871cb0ef41Sopenharmony_ci                                    UVWASI_RIGHT_SOCK_SHUTDOWN |              \
881cb0ef41Sopenharmony_ci                                    UVWASI_RIGHT_SOCK_ACCEPT)
891cb0ef41Sopenharmony_ci#define UVWASI__RIGHTS_SOCKET_INHERITING UVWASI__RIGHTS_ALL
901cb0ef41Sopenharmony_ci
911cb0ef41Sopenharmony_ci#define UVWASI__RIGHTS_TTY_BASE (UVWASI_RIGHT_FD_READ |                       \
921cb0ef41Sopenharmony_ci                                 UVWASI_RIGHT_FD_FDSTAT_SET_FLAGS |           \
931cb0ef41Sopenharmony_ci                                 UVWASI_RIGHT_FD_WRITE |                      \
941cb0ef41Sopenharmony_ci                                 UVWASI_RIGHT_FD_FILESTAT_GET |               \
951cb0ef41Sopenharmony_ci                                 UVWASI_RIGHT_POLL_FD_READWRITE)
961cb0ef41Sopenharmony_ci#define UVWASI__RIGHTS_TTY_INHERITING 0
971cb0ef41Sopenharmony_ci
981cb0ef41Sopenharmony_ci
991cb0ef41Sopenharmony_ciuvwasi_errno_t uvwasi__get_rights(uv_file fd,
1001cb0ef41Sopenharmony_ci                                  int flags,
1011cb0ef41Sopenharmony_ci                                  uvwasi_filetype_t type,
1021cb0ef41Sopenharmony_ci                                  uvwasi_rights_t* rights_base,
1031cb0ef41Sopenharmony_ci                                  uvwasi_rights_t* rights_inheriting);
1041cb0ef41Sopenharmony_ci
1051cb0ef41Sopenharmony_ci
1061cb0ef41Sopenharmony_ci#endif /* __UVWASI_WASI_RIGHTS_H__ */
107