@@ -270,6 +270,9 @@ typedef uint8_t __wasi_whence_t;
270270#define __WASI_WHENCE_END (UINT8_C(1))
271271#define __WASI_WHENCE_SET (UINT8_C(2))
272272
273+ typedef uint8_t __wasi_preopentype_t ;
274+ #define __WASI_PREOPENTYPE_DIR (UINT8_C(0))
275+
273276typedef struct __wasi_dirent_t {
274277 __wasi_dircookie_t d_next ;
275278 __wasi_inode_t d_ino ;
@@ -304,6 +307,28 @@ _Static_assert(
304307_Static_assert (sizeof (__wasi_event_t ) == 32 , "non-wasi data layout" );
305308_Static_assert (_Alignof(__wasi_event_t ) == 8 , "non-wasi data layout" );
306309
310+ typedef struct __wasi_prestat_t {
311+ __wasi_preopentype_t pr_type ;
312+ union __wasi_prestat_u {
313+ struct __wasi_prestat_u_dir_t {
314+ size_t pr_name_len ;
315+ } dir ;
316+ } u ;
317+ } __wasi_prestat_t ;
318+ _Static_assert (offsetof(__wasi_prestat_t , pr_type ) == 0 , "non-wasi data layout" );
319+ _Static_assert (sizeof (void * ) != 4 ||
320+ offsetof(__wasi_prestat_t , u .dir .pr_name_len ) == 4 , "non-wasi data layout" );
321+ _Static_assert (sizeof (void * ) != 8 ||
322+ offsetof(__wasi_prestat_t , u .dir .pr_name_len ) == 8 , "non-wasi data layout" );
323+ _Static_assert (sizeof (void * ) != 4 ||
324+ sizeof (__wasi_prestat_t ) == 8 , "non-wasi data layout" );
325+ _Static_assert (sizeof (void * ) != 8 ||
326+ sizeof (__wasi_prestat_t ) == 16 , "non-wasi data layout" );
327+ _Static_assert (sizeof (void * ) != 4 ||
328+ _Alignof(__wasi_prestat_t ) == 4 , "non-wasi data layout" );
329+ _Static_assert (sizeof (void * ) != 8 ||
330+ _Alignof(__wasi_prestat_t ) == 8 , "non-wasi data layout" );
331+
307332typedef struct __wasi_fdstat_t {
308333 __wasi_filetype_t fs_filetype ;
309334 __wasi_fdflags_t fs_flags ;
@@ -457,6 +482,17 @@ __wasi_errno_t __wasi_environ_sizes_get(
457482 size_t * environ_buf_size
458483) __WASI_SYSCALL_NAME (environ_sizes_get ) __attribute__((__warn_unused_result__ ));
459484
485+ __wasi_errno_t __wasi_fd_prestat_get (
486+ __wasi_fd_t fd ,
487+ __wasi_prestat_t * buf
488+ ) __WASI_SYSCALL_NAME (fd_prestat_get ) __attribute__((__warn_unused_result__ ));
489+
490+ __wasi_errno_t __wasi_fd_prestat_dir_name (
491+ __wasi_fd_t fd ,
492+ char * path ,
493+ size_t path_len
494+ ) __WASI_SYSCALL_NAME (fd_prestat_dir_name ) __attribute__((__warn_unused_result__ ));
495+
460496__wasi_errno_t __wasi_fd_close (
461497 __wasi_fd_t fd
462498) __WASI_SYSCALL_NAME (fd_close ) __attribute__((__warn_unused_result__ ));
0 commit comments