diff --git a/phases/ephemeral/witx/typenames.witx b/phases/ephemeral/witx/typenames.witx index a614d8528..00ae3d15e 100644 --- a/phases/ephemeral/witx/typenames.witx +++ b/phases/ephemeral/witx/typenames.witx @@ -5,29 +5,29 @@ ;; This is a `witx` file. See [here](https://github.com/WebAssembly/WASI/tree/master/docs/witx.md) ;; for an explanation of what that means. -(typename $size_t u32) +(typename $size u32) ;;; Non-negative file size or length of a region within a file. -(typename $filesize_t u64) +(typename $filesize u64) ;;; Timestamp in nanoseconds. -(typename $timestamp_t u64) +(typename $timestamp u64) ;;; Identifiers for clocks. -(typename $clockid_t +(typename $clockid (enum u32 ;;; The clock measuring real time. Time value zero corresponds with ;;; 1970-01-01T00:00:00Z. - $CLOCK_REALTIME + $realtime ;;; The store-wide monotonic clock, which is defined as a clock measuring ;;; real time, whose value cannot be adjusted and which cannot have negative ;;; clock jumps. The epoch of this clock is undefined. The absolute time ;;; value of this clock therefore has no meaning. - $CLOCK_MONOTONIC + $monotonic ;;; The CPU-time clock associated with the current process. - $CLOCK_PROCESS_CPUTIME_ID + $process_cputime_id ;;; The CPU-time clock associated with the current thread. - $CLOCK_THREAD_CPUTIME_ID + $thread_cputime_id ) ) @@ -35,732 +35,732 @@ ;;; Not all of these error codes are returned by the functions provided by this ;;; API; some are used in higher-level library layers, and others are provided ;;; merely for alignment with POSIX. -(typename $errno_t +(typename $errno (enum u16 ;;; No error occurred. System call completed successfully. - $ESUCCESS + $success ;;; Argument list too long. - $E2BIG + $2big ;;; Permission denied. - $EACCES + $acces ;;; Address in use. - $EADDRINUSE + $addrinuse ;;; Address not available. - $EADDRNOTAVAIL + $addrnotavail ;;; Address family not supported. - $EAFNOSUPPORT + $afnosupport ;;; Resource unavailable, or operation would block. - $EAGAIN + $again ;;; Connection already in progress. - $EALREADY + $already ;;; Bad file descriptor. - $EBADF + $badf ;;; Bad message. - $EBADMSG + $badmsg ;;; Device or resource busy. - $EBUSY + $busy ;;; Operation canceled. - $ECANCELED + $canceled ;;; No child processes. - $ECHILD + $child ;;; Connection aborted. - $ECONNABORTED + $connaborted ;;; Connection refused. - $ECONNREFUSED + $connrefused ;;; Connection reset. - $ECONNRESET + $connreset ;;; Resource deadlock would occur. - $EDEADLK + $deadlk ;;; Destination address required. - $EDESTADDRREQ + $destaddrreq ;;; Mathematics argument out of domain of function. - $EDOM + $dom ;;; Reserved. - $EDQUOT + $dquot ;;; File exists. - $EEXIST + $exist ;;; Bad address. - $EFAULT + $fault ;;; File too large. - $EFBIG + $fbig ;;; Host is unreachable. - $EHOSTUNREACH + $hostunreach ;;; Identifier removed. - $EIDRM + $idrm ;;; Illegal byte sequence. - $EILSEQ + $ilseq ;;; Operation in progress. - $EINPROGRESS + $inprogress ;;; Interrupted function. - $EINTR + $intr ;;; Invalid argument. - $EINVAL + $inval ;;; I/O error. - $EIO + $io ;;; Socket is connected. - $EISCONN + $isconn ;;; Is a directory. - $EISDIR + $isdir ;;; Too many levels of symbolic links. - $ELOOP + $loop ;;; File descriptor value too large. - $EMFILE + $mfile ;;; Too many links. - $EMLINK + $mlink ;;; Message too large. - $EMSGSIZE + $msgsize ;;; Reserved. - $EMULTIHOP + $multihop ;;; Filename too long. - $ENAMETOOLONG + $nametoolong ;;; Network is down. - $ENETDOWN + $netdown ;;; Connection aborted by network. - $ENETRESET + $netreset ;;; Network unreachable. - $ENETUNREACH + $netunreach ;;; Too many files open in system. - $ENFILE + $nfile ;;; No buffer space available. - $ENOBUFS + $nobufs ;;; No such device. - $ENODEV + $nodev ;;; No such file or directory. - $ENOENT + $noent ;;; Executable file format error. - $ENOEXEC + $noexec ;;; No locks available. - $ENOLCK + $nolck ;;; Reserved. - $ENOLINK + $nolink ;;; Not enough space. - $ENOMEM + $nomem ;;; No message of the desired type. - $ENOMSG + $nomsg ;;; Protocol not available. - $ENOPROTOOPT + $noprotoopt ;;; No space left on device. - $ENOSPC + $nospc ;;; Function not supported. - $ENOSYS + $nosys ;;; The socket is not connected. - $ENOTCONN + $notconn ;;; Not a directory or a symbolic link to a directory. - $ENOTDIR + $notdir ;;; Directory not empty. - $ENOTEMPTY + $notempty ;;; State not recoverable. - $ENOTRECOVERABLE + $notrecoverable ;;; Not a socket. - $ENOTSOCK + $notsock ;;; Not supported, or operation not supported on socket. - $ENOTSUP + $notsup ;;; Inappropriate I/O control operation. - $ENOTTY + $notty ;;; No such device or address. - $ENXIO + $nxio ;;; Value too large to be stored in data type. - $EOVERFLOW + $overflow ;;; Previous owner died. - $EOWNERDEAD + $ownerdead ;;; Operation not permitted. - $EPERM + $perm ;;; Broken pipe. - $EPIPE + $pipe ;;; Protocol error. - $EPROTO + $proto ;;; Protocol not supported. - $EPROTONOSUPPORT + $protonosupport ;;; Protocol wrong type for socket. - $EPROTOTYPE + $prototype ;;; Result too large. - $ERANGE + $range ;;; Read-only file system. - $EROFS + $rofs ;;; Invalid seek. - $ESPIPE + $spipe ;;; No such process. - $ESRCH + $srch ;;; Reserved. - $ESTALE + $stale ;;; Connection timed out. - $ETIMEDOUT + $timedout ;;; Text file busy. - $ETXTBSY + $txtbsy ;;; Cross-device link. - $EXDEV + $xdev ;;; Extension: Capabilities insufficient. - $ENOTCAPABLE + $notcapable ) ) ;;; File descriptor rights, determining which actions may be performed. -(typename $rights_t +(typename $rights (flags u64 ;;; The right to invoke `fd_datasync`. ;; - ;;; If `RIGHT_PATH_OPEN` is set, includes the right to invoke - ;;; `path_open` with `FDFLAG_DSYNC`. - $RIGHT_FD_DATASYNC + ;;; If `path_open` is set, includes the right to invoke + ;;; `path_open` with `fdflag::dsync`. + $fd_datasync ;;; The right to invoke `fd_read` and `sock_recv`. ;; - ;;; If `RIGHT_FD_SEEK` is set, includes the right to invoke `fd_pread`. - $RIGHT_FD_READ - ;;; The right to invoke `fd_seek`. This flag implies `RIGHT_FD_TELL`. - $RIGHT_FD_SEEK + ;;; If `rights::fd_seek` is set, includes the right to invoke `fd_pread`. + $fd_read + ;;; The right to invoke `fd_seek`. This flag implies `rights::fd_tell`. + $fd_seek ;;; The right to invoke `fd_fdstat_set_flags`. - $RIGHT_FD_FDSTAT_SET_FLAGS + $fd_fdstat_set_flags ;;; The right to invoke `fd_sync`. ;; - ;;; If `RIGHT_PATH_OPEN` is set, includes the right to invoke - ;;; `path_open` with `FDFLAG_RSYNC` and `FDFLAG_DSYNC`. - $RIGHT_FD_SYNC + ;;; If `path_open` is set, includes the right to invoke + ;;; `path_open` with `fdflag::rsync` and `fdflag::dsync`. + $fd_sync ;;; The right to invoke `fd_seek` in such a way that the file offset ;;; remains unaltered (i.e., `WHENCE_CUR` with offset zero), or to ;;; invoke `fd_tell`. - $RIGHT_FD_TELL + $fd_tell ;;; The right to invoke `fd_write` and `sock_send`. - ;;; If `RIGHT_FD_SEEK` is set, includes the right to invoke `fd_pwrite`. - $RIGHT_FD_WRITE + ;;; If `rights::fd_seek` is set, includes the right to invoke `fd_pwrite`. + $fd_write ;;; The right to invoke `fd_advise`. - $RIGHT_FD_ADVISE + $fd_advise ;;; The right to invoke `fd_allocate`. - $RIGHT_FD_ALLOCATE + $fd_allocate ;;; The right to invoke `path_create_directory`. - $RIGHT_PATH_CREATE_DIRECTORY - ;;; If `RIGHT_PATH_OPEN` is set, the right to invoke `path_open` with `O_CREAT`. - $RIGHT_PATH_CREATE_FILE + $path_create_directory + ;;; If `path_open` is set, the right to invoke `path_open` with `oflags::creat`. + $path_create_file ;;; The right to invoke `path_link` with the file descriptor as the ;;; source directory. - $RIGHT_PATH_LINK_SOURCE + $path_link_source ;;; The right to invoke `path_link` with the file descriptor as the ;;; target directory. - $RIGHT_PATH_LINK_TARGET + $path_link_target ;;; The right to invoke `path_open`. - $RIGHT_PATH_OPEN + $path_open ;;; The right to invoke `fd_readdir`. - $RIGHT_FD_READDIR + $fd_readdir ;;; The right to invoke `path_readlink`. - $RIGHT_PATH_READLINK + $path_readlink ;;; The right to invoke `path_rename` with the file descriptor as the source directory. - $RIGHT_PATH_RENAME_SOURCE + $path_rename_source ;;; The right to invoke `path_rename` with the file descriptor as the target directory. - $RIGHT_PATH_RENAME_TARGET + $path_rename_target ;;; The right to invoke `path_filestat_get`. - $RIGHT_PATH_FILESTAT_GET + $path_filestat_get ;;; The right to change a file's size (there is no `path_filestat_set_size`). - ;;; If `RIGHT_PATH_OPEN` is set, includes the right to invoke `path_open` with `O_TRUNC`. - $RIGHT_PATH_FILESTAT_SET_SIZE + ;;; If `path_open` is set, includes the right to invoke `path_open` with `oflags::trunc`. + $path_filestat_set_size ;;; The right to invoke `path_filestat_set_times`. - $RIGHT_PATH_FILESTAT_SET_TIMES + $path_filestat_set_times ;;; The right to invoke `fd_filestat_get`. - $RIGHT_FD_FILESTAT_GET + $fd_filestat_get ;;; The right to invoke `fd_filestat_set_size`. - $RIGHT_FD_FILESTAT_SET_SIZE + $fd_filestat_set_size ;;; The right to invoke `fd_filestat_set_times`. - $RIGHT_FD_FILESTAT_SET_TIMES + $fd_filestat_set_times ;;; The right to invoke `path_symlink`. - $RIGHT_PATH_SYMLINK + $path_symlink ;;; The right to invoke `path_remove_directory`. - $RIGHT_PATH_REMOVE_DIRECTORY + $path_remove_directory ;;; The right to invoke `path_unlink_file`. - $RIGHT_PATH_UNLINK_FILE - ;;; If `RIGHT_FD_READ` is set, includes the right to invoke `poll_oneoff` to subscribe to `EVENTTYPE_FD_READ`. - ;;; If `RIGHT_FD_WRITE` is set, includes the right to invoke `poll_oneoff` to subscribe to `EVENTTYPE_FD_WRITE`. - $RIGHT_POLL_FD_READWRITE + $path_unlink_file + ;;; If `rights::fd_read` is set, includes the right to invoke `poll_oneoff` to subscribe to `eventtype::fd_read`. + ;;; If `rights::fd_write` is set, includes the right to invoke `poll_oneoff` to subscribe to `eventtype::fd_write`. + $poll_fd_readwrite ;;; The right to invoke `sock_shutdown`. - $RIGHT_SOCK_SHUTDOWN + $sock_shutdown ) ) ;;; A file descriptor index. -(typename $fd_t u32) +(typename $fd u32) ;;; A region of memory for scatter/gather reads. -(typename $iovec_t +(typename $iovec (struct ;;; The address of the buffer to be filled. (field $buf (@witx pointer u8)) ;;; The length of the buffer to be filled. - (field $buf_len $size_t) + (field $buf_len $size) ) ) ;;; A region of memory for scatter/gather writes. -(typename $ciovec_t +(typename $ciovec (struct ;;; The address of the buffer to be written. (field $buf (@witx const_pointer u8)) ;;; The length of the buffer to be written. - (field $buf_len $size_t) + (field $buf_len $size) ) ) -(typename $iovec_t_array (array $iovec_t)) -(typename $ciovec_t_array (array $ciovec_t)) +(typename $iovec_array (array $iovec)) +(typename $ciovec_array (array $ciovec)) ;;; Relative offset within a file. -(typename $filedelta_t s64) +(typename $filedelta s64) ;;; The position relative to which to set the offset of the file descriptor. -(typename $whence_t +(typename $whence (enum u8 ;;; Seek relative to start-of-file. - $WHENCE_SET + $set ;;; Seek relative to current position. - $WHENCE_CUR + $cur ;;; Seek relative to end-of-file. - $WHENCE_END + $end ) ) ;;; A reference to the offset of a directory entry. ;; ;;; The value 0 signifies the start of the directory. -(typename $dircookie_t u64) +(typename $dircookie u64) -;;; The type for the $d_namlen field of $dirent_t. -(typename $dirnamlen_t u32) +;;; The type for the $d_namlen field of $dirent. +(typename $dirnamlen u32) ;;; File serial number that is unique within its file system. -(typename $inode_t u64) +(typename $inode u64) ;;; The type of a file descriptor or file. -(typename $filetype_t +(typename $filetype (enum u8 ;;; The type of the file descriptor or file is unknown or is different from any of the other types specified. - $FILETYPE_UNKNOWN + $unknown ;;; The file descriptor or file refers to a block device inode. - $FILETYPE_BLOCK_DEVICE + $block_device ;;; The file descriptor or file refers to a character device inode. - $FILETYPE_CHARACTER_DEVICE + $character_device ;;; The file descriptor or file refers to a directory inode. - $FILETYPE_DIRECTORY + $directory ;;; The file descriptor or file refers to a regular file inode. - $FILETYPE_REGULAR_FILE + $regular_file ;;; The file descriptor or file refers to a datagram socket. - $FILETYPE_SOCKET_DGRAM + $socket_dgram ;;; The file descriptor or file refers to a byte-stream socket. - $FILETYPE_SOCKET_STREAM + $socket_stream ;;; The file refers to a symbolic link inode. - $FILETYPE_SYMBOLIC_LINK + $symbolic_link ) ) ;;; A directory entry. -(typename $dirent_t +(typename $dirent (struct ;;; The offset of the next directory entry stored in this directory. - (field $d_next $dircookie_t) + (field $d_next $dircookie) ;;; The serial number of the file referred to by this directory entry. - (field $d_ino $inode_t) + (field $d_ino $inode) ;;; The length of the name of the directory entry. - (field $d_namlen $dirnamlen_t) + (field $d_namlen $dirnamlen) ;;; The type of the file referred to by this directory entry. - (field $d_type $filetype_t) + (field $d_type $filetype) ) ) ;;; File or memory access pattern advisory information. -(typename $advice_t +(typename $advice (enum u8 ;;; The application has no advice to give on its behavior with respect to the specified data. - $ADVICE_NORMAL + $normal ;;; The application expects to access the specified data sequentially from lower offsets to higher offsets. - $ADVICE_SEQUENTIAL + $sequential ;;; The application expects to access the specified data in a random order. - $ADVICE_RANDOM + $random ;;; The application expects to access the specified data in the near future. - $ADVICE_WILLNEED + $willneed ;;; The application expects that it will not access the specified data in the near future. - $ADVICE_DONTNEED + $dontneed ;;; The application expects to access the specified data once and then not reuse it thereafter. - $ADVICE_NOREUSE + $noreuse ) ) ;;; File descriptor flags. -(typename $fdflags_t +(typename $fdflags (flags u16 ;;; Append mode: Data written to the file is always appended to the file's end. - $FDFLAG_APPEND + $append ;;; Write according to synchronized I/O data integrity completion. Only the data stored in the file is synchronized. - $FDFLAG_DSYNC + $dsync ;;; Non-blocking mode. - $FDFLAG_NONBLOCK + $nonblock ;;; Synchronized read I/O operations. - $FDFLAG_RSYNC + $rsync ;;; Write according to synchronized I/O file integrity completion. In ;;; addition to synchronizing the data stored in the file, the implementation ;;; may also synchronously update the file's metadata. - $FDFLAG_SYNC + $sync ) ) ;;; File descriptor attributes. -(typename $fdstat_t +(typename $fdstat (struct ;;; File type. - (field $fs_filetype $filetype_t) + (field $fs_filetype $filetype) ;;; File descriptor flags. - (field $fs_flags $fdflags_t) + (field $fs_flags $fdflags) ;;; Rights that apply to this file descriptor. - (field $fs_rights_base $rights_t) + (field $fs_rights_base $rights) ;;; Maximum set of rights that may be installed on new file descriptors that ;;; are created through this file descriptor, e.g., through `path_open`. - (field $fs_rights_inheriting $rights_t) + (field $fs_rights_inheriting $rights) ) ) ;;; Identifier for a device containing a file system. Can be used in combination -;;; with `inode_t` to uniquely identify a file or directory in the filesystem. -(typename $device_t u64) +;;; with `inode` to uniquely identify a file or directory in the filesystem. +(typename $device u64) ;;; Which file time attributes to adjust. -(typename $fstflags_t +(typename $fstflags (flags u16 - ;;; Adjust the last data access timestamp to the value stored in `filestat_t::st_atim`. - $FILESTAT_SET_ATIM - ;;; Adjust the last data access timestamp to the time of clock `CLOCK_REALTIME`. - $FILESTAT_SET_ATIM_NOW - ;;; Adjust the last data modification timestamp to the value stored in `filestat_t::st_mtim`. - $FILESTAT_SET_MTIM - ;;; Adjust the last data modification timestamp to the time of clock `CLOCK_REALTIME`. - $FILESTAT_SET_MTIM_NOW + ;;; Adjust the last data access timestamp to the value stored in `filestat::st_atim`. + $atim + ;;; Adjust the last data access timestamp to the time of clock `clock::realtime`. + $atim_now + ;;; Adjust the last data modification timestamp to the value stored in `filestat::st_mtim`. + $mtim + ;;; Adjust the last data modification timestamp to the time of clock `clock::realtime`. + $mtim_now ) ) ;;; Flags determining the method of how paths are resolved. -(typename $lookupflags_t +(typename $lookupflags (flags u32 ;;; As long as the resolved path corresponds to a symbolic link, it is expanded. - $LOOKUP_SYMLINK_FOLLOW + $symlink_follow ) ) ;;; Open flags used by `path_open`. -(typename $oflags_t +(typename $oflags (flags u16 ;;; Create file if it does not exist. - $O_CREAT + $creat ;;; Fail if not a directory. - $O_DIRECTORY + $directory ;;; Fail if file already exists. - $O_EXCL + $excl ;;; Truncate file to size 0. - $O_TRUNC + $trunc ) ) ;;; Number of hard links to an inode. -(typename $linkcount_t u64) +(typename $linkcount u64) ;;; File attributes. -(typename $filestat_t +(typename $filestat (struct ;;; Device ID of device containing the file. - (field $st_dev $device_t) + (field $dev $device) ;;; File serial number. - (field $st_ino $inode_t) + (field $ino $inode) ;;; File type. - (field $st_filetype $filetype_t) + (field $filetype $filetype) ;;; Number of hard links to the file. - (field $st_nlink $linkcount_t) + (field $nlink $linkcount) ;;; For regular files, the file size in bytes. For symbolic links, the length in bytes of the pathname contained in the symbolic link. - (field $st_size $filesize_t) + (field $size $filesize) ;;; Last data access timestamp. - (field $st_atim $timestamp_t) + (field $atim $timestamp) ;;; Last data modification timestamp. - (field $st_mtim $timestamp_t) + (field $mtim $timestamp) ;;; Last file status change timestamp. - (field $st_ctim $timestamp_t) + (field $ctim $timestamp) ) ) ;;; User-provided value that may be attached to objects that is retained when ;;; extracted from the implementation. -(typename $userdata_t u64) +(typename $userdata u64) ;;; Type of a subscription to an event or its occurrence. -(typename $eventtype_t +(typename $eventtype (enum u8 - ;;; The time value of clock `subscription_t::u.clock.clock_id` has - ;;; reached timestamp `subscription_t::u.clock.timeout`. - $EVENTTYPE_CLOCK - ;;; File descriptor `subscription_t::u.fd_readwrite.fd` has data + ;;; The time value of clock `subscription::u.clock.clock_id` has + ;;; reached timestamp `subscription::u.clock.timeout`. + $clock + ;;; File descriptor `subscription::u.fd_readwrite.fd` has data ;;; available for reading. This event always triggers for regular files. - $EVENTTYPE_FD_READ - ;;; File descriptor `subscription_t::u.fd_readwrite.fd` has capacity + $fd_read + ;;; File descriptor `subscription::u.fd_readwrite.fd` has capacity ;;; available for writing. This event always triggers for regular files. - $EVENTTYPE_FD_WRITE + $fd_write ) ) ;;; The state of the file descriptor subscribed to with -;;; `EVENTTYPE_FD_READ` or `EVENTTYPE_FD_WRITE`. -(typename $eventrwflags_t +;;; `eventtype::fd_read` or `eventtype::fd_write`. +(typename $eventrwflags (flags u16 ;;; The peer of this socket has closed or disconnected. - $EVENT_FD_READWRITE_HANGUP + $fd_readwrite_hangup ) ) -;;; The contents of an $event_t when type is `EVENTTYPE_FD_READ` or -;;; `EVENTTYPE_FD_WRITE`. -(typename $event_fd_readwrite_t +;;; The contents of an $event when type is `eventtype::fd_read` or +;;; `eventtype::fd_write`. +(typename $event_fd_readwrite (struct ;;; The number of bytes available for reading or writing. - (field $nbytes $filesize_t) + (field $nbytes $filesize) ;;; The state of the file descriptor. - (field $flags $eventrwflags_t) + (field $flags $eventrwflags) ) ) -;;; The contents of an $event_t. +;;; The contents of an $event. (typename $event_u (union - ;;; When type is `EVENTTYPE_FD_READ` or `EVENTTYPE_FD_WRITE`: - (field $fd_readwrite $event_fd_readwrite_t) + ;;; When type is `eventtype::fd_read` or `eventtype::fd_write`: + (field $fd_readwrite $event_fd_readwrite) ) ) ;;; An event that occurred. -(typename $event_t +(typename $event (struct - ;;; User-provided value that got attached to `subscription_t::userdata`. - (field $userdata $userdata_t) + ;;; User-provided value that got attached to `subscription::userdata`. + (field $userdata $userdata) ;;; If non-zero, an error that occurred while processing the subscription request. - (field $error $errno_t) + (field $error $errno) ;;; The type of the event that occurred. - (field $type $eventtype_t) + (field $type $eventtype) ;;; The contents of the event. (field $u $event_u) ) ) ;;; Flags determining how to interpret the timestamp provided in -;;; `subscription_t::u.clock.timeout.` -(typename $subclockflags_t +;;; `subscription::u.clock.timeout.` +(typename $subclockflags (flags u16 ;;; If set, treat the timestamp provided in - ;;; `subscription_t::u.clock.timeout` as an absolute timestamp of clock - ;;; `subscription_t::u.clock.clock_id.` If clear, treat the timestamp - ;;; provided in `subscription_t::u.clock.timeout` relative to the - ;;; current time value of clock `subscription_t::u.clock.clock_id.` - $SUBSCRIPTION_CLOCK_ABSTIME + ;;; `subscription::u.clock.timeout` as an absolute timestamp of clock + ;;; `subscription::u.clock.clock_id.` If clear, treat the timestamp + ;;; provided in `subscription::u.clock.timeout` relative to the + ;;; current time value of clock `subscription::u.clock.clock_id.` + $subscription_clock_abstime ) ) -;;; The contents of a $subscription_t when type is `EVENTTYPE_CLOCK`. -(typename $subscription_clock_t +;;; The contents of a $subscription when type is `eventtype::clock`. +(typename $subscription_clock (struct ;;; The clock against which to compare the timestamp. - (field $clock_id $clockid_t) + (field $id $clockid) ;;; The absolute or relative timestamp. - (field $timeout $timestamp_t) + (field $timeout $timestamp) ;;; The amount of time that the implementation may wait additionally ;;; to coalesce with other events. - (field $precision $timestamp_t) + (field $precision $timestamp) ;;; Flags specifying whether the timeout is absolute or relative - (field $flags $subclockflags_t) + (field $flags $subclockflags) ) ) -;;; The contents of a $subscription_t when type is type is -;;; `EVENTTYPE_FD_READ` or `EVENTTYPE_FD_WRITE`. -(typename $subscription_fd_readwrite_t +;;; The contents of a $subscription when type is type is +;;; `eventtype::fd_read` or `eventtype::fd_write`. +(typename $subscription_fd_readwrite (struct ;;; The file descriptor on which to wait for it to become ready for reading or writing. - (field $file_descriptor $fd_t) + (field $file_descriptor $fd) ) ) -;;; The contents of a $subscription_t. +;;; The contents of a $subscription. (typename $subscription_u (union - ;;; When type is `EVENTTYPE_CLOCK`: - (field $clock $subscription_clock_t) - ;;; When type is `EVENTTYPE_FD_READ` or `EVENTTYPE_FD_WRITE`: - (field $fd_readwrite $subscription_fd_readwrite_t) + ;;; When type is `eventtype::clock`: + (field $clock $subscription_clock) + ;;; When type is `eventtype::fd_read` or `eventtype::fd_write`: + (field $fd_readwrite $subscription_fd_readwrite) ) ) ;;; Subscription to an event. -(typename $subscription_t +(typename $subscription (struct ;;; User-provided value that is attached to the subscription in the - ;;; implementation and returned through `event_t::userdata`. - (field $userdata $userdata_t) + ;;; implementation and returned through `event::userdata`. + (field $userdata $userdata) ;;; The type of the event to which to subscribe. - (field $type $eventtype_t) + (field $type $eventtype) ;;; The contents of the subscription. (field $u $subscription_u) ) ) ;;; Exit code generated by a process when exiting. -(typename $exitcode_t u32) +(typename $exitcode u32) ;;; Signal condition. -(typename $signal_t +(typename $signal (enum u8 ;;; No signal. Note that POSIX has special semantics for `kill(pid, 0)`, ;;; so this value is reserved. - $SIGNONE + $none ;;; Hangup. ;;; Action: Terminates the process. - $SIGHUP + $hup ;;; Terminate interrupt signal. ;;; Action: Terminates the process. - $SIGINT + $int ;;; Terminal quit signal. ;;; Action: Terminates the process. - $SIGQUIT + $quit ;;; Illegal instruction. ;;; Action: Terminates the process. - $SIGILL + $ill ;;; Trace/breakpoint trap. ;;; Action: Terminates the process. - $SIGTRAP + $trap ;;; Process abort signal. ;;; Action: Terminates the process. - $SIGABRT + $abrt ;;; Access to an undefined portion of a memory object. ;;; Action: Terminates the process. - $SIGBUS + $bus ;;; Erroneous arithmetic operation. ;;; Action: Terminates the process. - $SIGFPE + $fpe ;;; Kill. ;;; Action: Terminates the process. - $SIGKILL + $kill ;;; User-defined signal 1. ;;; Action: Terminates the process. - $SIGUSR1 + $usr1 ;;; Invalid memory reference. ;;; Action: Terminates the process. - $SIGSEGV + $segv ;;; User-defined signal 2. ;;; Action: Terminates the process. - $SIGUSR2 + $usr2 ;;; Write on a pipe with no one to read it. ;;; Action: Ignored. - $SIGPIPE + $pipe ;;; Alarm clock. ;;; Action: Terminates the process. - $SIGALRM + $alrm ;;; Termination signal. ;;; Action: Terminates the process. - $SIGTERM + $term ;;; Child process terminated, stopped, or continued. ;;; Action: Ignored. - $SIGCHLD + $chld ;;; Continue executing, if stopped. ;;; Action: Continues executing, if stopped. - $SIGCONT + $cont ;;; Stop executing. ;;; Action: Stops executing. - $SIGSTOP + $stop ;;; Terminal stop signal. ;;; Action: Stops executing. - $SIGTSTP + $tstp ;;; Background process attempting read. ;;; Action: Stops executing. - $SIGTTIN + $ttin ;;; Background process attempting write. ;;; Action: Stops executing. - $SIGTTOU + $ttou ;;; High bandwidth data is available at a socket. ;;; Action: Ignored. - $SIGURG + $urg ;;; CPU time limit exceeded. ;;; Action: Terminates the process. - $SIGXCPU + $xcpu ;;; File size limit exceeded. ;;; Action: Terminates the process. - $SIGXFSZ + $xfsz ;;; Virtual timer expired. ;;; Action: Terminates the process. - $SIGVTALRM + $vtalrm ;;; Profiling timer expired. ;;; Action: Terminates the process. - $SIGPROF + $prof ;;; Window changed. ;;; Action: Ignored. - $SIGWINCH + $winch ;;; I/O possible. ;;; Action: Terminates the process. - $SIGPOLL + $poll ;;; Power failure. ;;; Action: Terminates the process. - $SIGPWR + $pwr ;;; Bad system call. ;;; Action: Terminates the process. - $SIGSYS + $sys ) ) ;;; Flags provided to `sock_recv`. -(typename $riflags_t +(typename $riflags (flags u16 ;;; Returns the message without removing it from the socket's receive queue. - $SOCK_RECV_PEEK + $recv_peek ;;; On byte-stream sockets, block until the full amount of data can be returned. - $SOCK_RECV_WAITALL + $recv_waitall ) ) ;;; Flags returned by `sock_recv`. -(typename $roflags_t +(typename $roflags (flags u16 ;;; Returned by `sock_recv`: Message data has been truncated. - $SOCK_RECV_DATA_TRUNCATED + $recv_data_truncated ) ) ;;; Flags provided to `sock_send`. As there are currently no flags ;;; defined, it must be set to zero. -(typename $siflags_t u16) +(typename $siflags u16) ;;; Which channels on a socket to shut down. -(typename $sdflags_t +(typename $sdflags (flags u8 ;;; Disables further receive operations. - $SHUT_RD + $rd ;;; Disables further send operations. - $SHUT_WR + $wr ) ) ;;; Identifiers for preopened capabilities. -(typename $preopentype_t +(typename $preopentype (enum u8 ;;; A pre-opened directory. - $PREOPENTYPE_DIR + $dir ) ) -;;; The contents of a $prestat_t when type is `PREOPENTYPE_DIR`. +;;; The contents of a $prestat when type is `preopentype::dir`. (typename $prestat_dir (struct ;;; The length of the directory name for use with `fd_prestat_dir_name`. - (field $pr_name_len $size_t) + (field $pr_name_len $size) ) ) -;;; The contents of an $prestat_t. +;;; The contents of an $prestat. (typename $prestat_u (union - ;;; When type is `PREOPENTYPE_DIR`: + ;;; When type is `preopentype::dir`: (field $dir $prestat_dir) ) ) ;;; Information about a pre-opened capability. -(typename $prestat_t +(typename $prestat (struct ;;; The type of the pre-opened capability. - (field $pr_type $preopentype_t) + (field $pr_type $preopentype) ;;; The contents of the information. (field $u $prestat_u) ) diff --git a/phases/ephemeral/witx/wasi_ephemeral_preview.witx b/phases/ephemeral/witx/wasi_ephemeral_preview.witx index d15b8c514..43bd57e4b 100644 --- a/phases/ephemeral/witx/wasi_ephemeral_preview.witx +++ b/phases/ephemeral/witx/wasi_ephemeral_preview.witx @@ -17,15 +17,15 @@ (@interface func (export "args_get") (param $argv (@witx pointer (@witx pointer u8))) (param $argv_buf (@witx pointer u8)) - (result $error $errno_t) + (result $error $errno) ) ;;; Return command-line argument data sizes. (@interface func (export "args_sizes_get") - (result $error $errno_t) + (result $error $errno) ;;; The number of arguments. - (result $argc $size_t) + (result $argc $size) ;;; The size of the argument string data. - (result $argv_buf_size $size_t) + (result $argv_buf_size $size) ) ;;; Read environment variable data. @@ -33,187 +33,187 @@ (@interface func (export "environ_get") (param $environ (@witx pointer (@witx pointer u8))) (param $environ_buf (@witx pointer u8)) - (result $error $errno_t) + (result $error $errno) ) ;;; Return command-line argument data sizes. (@interface func (export "environ_sizes_get") - (result $error $errno_t) + (result $error $errno) ;;; The number of arguments. - (result $argc $size_t) + (result $argc $size) ;;; The size of the argument string data. - (result $argv_buf_size $size_t) + (result $argv_buf_size $size) ) ;;; Return the resolution of a clock. ;;; Implementations are required to provide a non-zero value for supported clocks. For unsupported clocks, return `WASI_EINVAL` ;;; Note: This is similar to `clock_getres` in POSIX. (@interface func (export "clock_res_get") - (result $error $errno_t) + (result $error $errno) ;;; The clock for which to return the resolution. - (param $clock_id $clockid_t) + (param $id $clockid) ;;; The resolution of the clock. - (result $resolution $timestamp_t) + (result $resolution $timestamp) ) ;;; Return the time value of a clock. ;;; Note: This is similar to `clock_gettime` in POSIX. (@interface func (export "clock_time_get") ;;; The clock for which to return the time. - (param $clock_id $clockid_t) + (param $id $clockid) ;;; The maximum lag (exclusive) that the returned time value may have, compared to its actual value. - (param $precision $timestamp_t) - (result $error $errno_t) + (param $precision $timestamp) + (result $error $errno) ;;; The time value of the clock. - (result $time $timestamp_t) + (result $time $timestamp) ) ;;; Provide file advisory information on a file descriptor. ;;; Note: This is similar to `posix_fadvise` in POSIX. (@interface func (export "fd_advise") - (param $fd $fd_t) + (param $fd $fd) ;;; The offset within the file to which the advisory applies. - (param $offset $filesize_t) + (param $offset $filesize) ;;; The length of the region to which the advisory applies. - (param $len $filesize_t) + (param $len $filesize) ;;; The advice. - (param $advice $advice_t) - (result $error $errno_t) + (param $advice $advice) + (result $error $errno) ) ;;; Force the allocation of space in a file. ;;; Note: This is similar to `posix_fallocate` in POSIX. (@interface func (export "fd_allocate") - (param $fd $fd_t) + (param $fd $fd) ;;; The offset at which to start the allocation. - (param $offset $filesize_t) + (param $offset $filesize) ;;; The length of the area that is allocated. - (param $len $filesize_t) - (result $error $errno_t) + (param $len $filesize) + (result $error $errno) ) ;;; Close a file descriptor. ;;; Note: This is similar to `close` in POSIX. (@interface func (export "fd_close") - (param $fd $fd_t) - (result $error $errno_t) + (param $fd $fd) + (result $error $errno) ) ;;; Synchronize the data of a file to disk. ;;; Note: This is similar to `fdatasync` in POSIX. (@interface func (export "fd_datasync") - (param $fd $fd_t) - (result $error $errno_t) + (param $fd $fd) + (result $error $errno) ) ;;; Get the attributes of a file descriptor. ;;; Note: This returns similar flags to `fsync(fd, F_GETFL)` in POSIX, as well as additional fields. (@interface func (export "fd_fdstat_get") - (param $fd $fd_t) - (result $error $errno_t) + (param $fd $fd) + (result $error $errno) ;;; The buffer where the file descriptor's attributes are stored. - (result $stat $fdstat_t) + (result $stat $fdstat) ) ;;; Adjust the flags associated with a file descriptor. ;;; Note: This is similar to `fcntl(fd, F_SETFL, flags)` in POSIX. (@interface func (export "fd_fdstat_set_flags") - (param $fd $fd_t) + (param $fd $fd) ;;; The desired values of the file descriptor flags. - (param $flags $fdflags_t) - (result $error $errno_t) + (param $flags $fdflags) + (result $error $errno) ) ;;; Adjust the rights associated with a file descriptor. ;;; This can only be used to remove rights, and returns `ENOTCAPABLE` if called in a way that would attempt to add rights (@interface func (export "fd_fdstat_set_rights") - (param $fd $fd_t) + (param $fd $fd) ;;; The desired rights of the file descriptor. - (param $fs_rights_base $rights_t) - (param $fs_rights_inheriting $rights_t) - (result $error $errno_t) + (param $fs_rights_base $rights) + (param $fs_rights_inheriting $rights) + (result $error $errno) ) ;;; Return the attributes of an open file. (@interface func (export "fd_filestat_get") - (param $fd $fd_t) - (result $error $errno_t) + (param $fd $fd) + (result $error $errno) ;;; The buffer where the file's attributes are stored. - (result $buf $filestat_t) + (result $buf $filestat) ) ;;; Adjust the size of an open file. If this increases the file's size, the extra bytes are filled with zeros. ;;; Note: This is similar to `ftruncate` in POSIX. (@interface func (export "fd_filestat_set_size") - (param $fd $fd_t) + (param $fd $fd) ;;; The desired file size. - (param $st_size $filesize_t) - (result $error $errno_t) + (param $size $filesize) + (result $error $errno) ) ;;; Adjust the timestamps of an open file or directory. ;;; Note: This is similar to `futimens` in POSIX. (@interface func (export "fd_filestat_set_times") - (param $fd $fd_t) + (param $fd $fd) ;;; The desired values of the data access timestamp. - (param $st_atim $timestamp_t) + (param $atim $timestamp) ;;; The desired values of the data modification timestamp. - (param $st_mtim $timestamp_t) + (param $mtim $timestamp) ;;; A bitmask indicating which timestamps to adjust. - (param $fst_flags $fstflags_t) - (result $error $errno_t) + (param $fst_flags $fstflags) + (result $error $errno) ) ;;; Read from a file descriptor, without using and updating the file descriptor's offset. ;;; Note: This is similar to `preadv` in POSIX. (@interface func (export "fd_pread") - (param $fd $fd_t) + (param $fd $fd) ;;; List of scatter/gather vectors in which to store data. - (param $iovs $iovec_t_array) + (param $iovs $iovec_array) ;;; The offset within the file at which to read. - (param $offset $filesize_t) - (result $error $errno_t) + (param $offset $filesize) + (result $error $errno) ;;; The number of bytes read. - (result $nread $size_t) + (result $nread $size) ) ;;; Return a description of the given preopened file descriptor. (@interface func (export "fd_prestat_get") - (param $fd $fd_t) - (result $error $errno_t) + (param $fd $fd) + (result $error $errno) ;;; The buffer where the description is stored. - (result $buf $prestat_t) + (result $buf $prestat) ) ;;; Return a description of the given preopened file descriptor. (@interface func (export "fd_prestat_dir_name") - (param $fd $fd_t) + (param $fd $fd) ;;; A buffer into which to write the preopened directory name. (param $path (@witx pointer u8)) - (param $path_len $size_t) - (result $error $errno_t) + (param $path_len $size) + (result $error $errno) ) ;;; Write to a file descriptor, without using and updating the file descriptor's offset. ;;; Note: This is similar to `pwritev` in POSIX. (@interface func (export "fd_pwrite") - (param $fd $fd_t) + (param $fd $fd) ;;; List of scatter/gather vectors from which to retrieve data. - (param $iovs $ciovec_t_array) + (param $iovs $ciovec_array) ;;; The offset within the file at which to write. - (param $offset $filesize_t) - (result $error $errno_t) + (param $offset $filesize) + (result $error $errno) ;;; The number of bytes written. - (result $nwritten $size_t) + (result $nwritten $size) ) ;;; Read from a file descriptor. ;;; Note: This is similar to `readv` in POSIX. (@interface func (export "fd_read") - (param $fd $fd_t) + (param $fd $fd) ;;; List of scatter/gather vectors to which to store data. - (param $iovs $iovec_t_array) - (result $error $errno_t) + (param $iovs $iovec_array) + (result $error $errno) ;;; The number of bytes read. - (result $nread $size_t) + (result $nread $size) ) ;;; Read directory entries from a directory. @@ -227,15 +227,15 @@ ;;; read buffer size in case it's too small to fit a single large directory ;;; entry, or skip the oversized directory entry. (@interface func (export "fd_readdir") - (param $fd $fd_t) + (param $fd $fd) ;;; The buffer where directory entries are stored (param $buf (@witx pointer u8)) - (param $buf_len $size_t) + (param $buf_len $size) ;;; The location within the directory to start reading - (param $cookie $dircookie_t) - (result $error $errno_t) + (param $cookie $dircookie) + (result $error $errno) ;;; The number of bytes stored in the read buffer. If less than the size of the read buffer, the end of the directory has been reached. - (result $bufused $size_t) + (result $bufused $size) ) ;;; Atomically replace a file descriptor by renumbering another file descriptor. @@ -249,104 +249,104 @@ ;;; This function provides a way to atomically renumber file descriptors, which ;;; would disappear if `dup2()` were to be removed entirely. (@interface func (export "fd_renumber") - (param $fd $fd_t) + (param $fd $fd) ;;; The file descriptor to overwrite. - (param $to $fd_t) - (result $error $errno_t) + (param $to $fd) + (result $error $errno) ) ;;; Move the offset of a file descriptor. ;;; Note: This is similar to `lseek` in POSIX. (@interface func (export "fd_seek") - (param $fd $fd_t) + (param $fd $fd) ;;; The number of bytes to move. - (param $offset $filedelta_t) + (param $offset $filedelta) ;;; The base from which the offset is relative. - (param $whence $whence_t) - (result $error $errno_t) + (param $whence $whence) + (result $error $errno) ;;; The new offset of the file descriptor, relative to the start of the file. - (result $newoffset $filesize_t) + (result $newoffset $filesize) ) ;;; Synchronize the data and metadata of a file to disk. ;;; Note: This is similar to `fsync` in POSIX. (@interface func (export "fd_sync") - (param $fd $fd_t) - (result $error $errno_t) + (param $fd $fd) + (result $error $errno) ) ;;; Return the current offset of a file descriptor. ;;; Note: This is similar to `lseek(fd, 0, SEEK_CUR)` in POSIX. (@interface func (export "fd_tell") - (param $fd $fd_t) - (result $error $errno_t) + (param $fd $fd) + (result $error $errno) ;;; The current offset of the file descriptor, relative to the start of the file. - (result $offset $filesize_t) + (result $offset $filesize) ) ;;; Write to a file descriptor. ;;; Note: This is similar to `writev` in POSIX. (@interface func (export "fd_write") - (param $fd $fd_t) + (param $fd $fd) ;;; List of scatter/gather vectors from which to retrieve data. - (param $iovs $ciovec_t_array) - (result $error $errno_t) + (param $iovs $ciovec_array) + (result $error $errno) ;;; The number of bytes written. - (result $nwritten $size_t) + (result $nwritten $size) ) ;;; Create a directory. ;;; Note: This is similar to `mkdirat` in POSIX. (@interface func (export "path_create_directory") - (param $fd $fd_t) + (param $fd $fd) ;;; The path at which to create the directory. (param $path string) - (result $error $errno_t) + (result $error $errno) ) ;;; Return the attributes of a file or directory. ;;; Note: This is similar to `stat` in POSIX. (@interface func (export "path_filestat_get") - (param $fd $fd_t) + (param $fd $fd) ;;; Flags determining the method of how the path is resolved. - (param $flags $lookupflags_t) + (param $flags $lookupflags) ;;; The path of the file or directory to inspect. (param $path string) - (result $error $errno_t) + (result $error $errno) ;;; The buffer where the file's attributes are stored. - (result $buf $filestat_t) + (result $buf $filestat) ) ;;; Adjust the timestamps of a file or directory. ;;; Note: This is similar to `utimensat` in POSIX. (@interface func (export "path_filestat_set_times") - (param $fd $fd_t) + (param $fd $fd) ;;; Flags determining the method of how the path is resolved. - (param $flags $lookupflags_t) + (param $flags $lookupflags) ;;; The path of the file or directory to operate on. (param $path string) ;;; The desired values of the data access timestamp. - (param $st_atim $timestamp_t) + (param $atim $timestamp) ;;; The desired values of the data modification timestamp. - (param $st_mtim $timestamp_t) + (param $mtim $timestamp) ;;; A bitmask indicating which timestamps to adjust. - (param $fst_flags $fstflags_t) - (result $error $errno_t) + (param $fst_flags $fstflags) + (result $error $errno) ) ;;; Create a hard link. ;;; Note: This is similar to `linkat` in POSIX. (@interface func (export "path_link") - (param $old_fd $fd_t) + (param $old_fd $fd) ;;; Flags determining the method of how the path is resolved. - (param $old_flags $lookupflags_t) + (param $old_flags $lookupflags) ;;; The source path from which to link. (param $old_path string) ;;; The working directory at which the resolution of the new path starts. - (param $new_fd $fd_t) + (param $new_fd $fd) ;;; The destination path at which to create the hard link. (param $new_path string) - (result $error $errno_t) + (result $error $errno) ) ;;; Open a file or directory. @@ -359,14 +359,14 @@ ;; ;;; Note: This is similar to `openat` in POSIX. (@interface func (export "path_open") - (param $fd $fd_t) + (param $fd $fd) ;;; Flags determining the method of how the path is resolved. - (param $dirflags $lookupflags_t) + (param $dirflags $lookupflags) ;;; The relative path of the file or directory to open, relative to the ;;; `dirfd` directory. (param $path string) ;;; The method by which to open the file. - (param $o_flags $oflags_t) + (param $oflags $oflags) ;;; The initial rights of the newly created file descriptor. The ;;; implementation is allowed to return a file descriptor with fewer rights ;;; than specified, if and only if those rights do not apply to the type of @@ -375,49 +375,49 @@ ;;; The *base* rights are rights that will apply to operations using the file ;;; descriptor itself, while the *inheriting* rights are rights that apply to ;;; file descriptors derived from it. - (param $fs_rights_base $rights_t) - (param $fs_rights_inherting $rights_t) - (param $flags $fdflags_t) - (result $error $errno_t) + (param $fs_rights_base $rights) + (param $fs_rights_inherting $rights) + (param $fdflags $fdflags) + (result $error $errno) ;;; The file descriptor of the file that has been opened. - (result $opened_fd $fd_t) + (result $opened_fd $fd) ) ;;; Read the contents of a symbolic link. ;;; Note: This is similar to `readlinkat` in POSIX. (@interface func (export "path_readlink") - (param $fd $fd_t) + (param $fd $fd) ;;; The path of the symbolic link from which to read. (param $path string) ;;; The buffer to which to write the contents of the symbolic link. (param $buf (@witx pointer u8)) - (param $buf_len $size_t) - (result $error $errno_t) + (param $buf_len $size) + (result $error $errno) ;;; The number of bytes placed in the buffer. - (result $bufused $size_t) + (result $bufused $size) ) ;;; Remove a directory. ;;; Return `ENOTEMPTY` if the directory is not empty. ;;; Note: This is similar to `unlinkat(fd, path, AT_REMOVEDIR)` in POSIX. (@interface func (export "path_remove_directory") - (param $fd $fd_t) + (param $fd $fd) ;;; The path to a directory to remove. (param $path string) - (result $error $errno_t) + (result $error $errno) ) ;;; Rename a file or directory. ;;; Note: This is similar to `renameat` in POSIX. (@interface func (export "path_rename") - (param $fd $fd_t) + (param $fd $fd) ;;; The source path of the file or directory to rename. (param $old_path string) ;;; The working directory at which the resolution of the new path starts. - (param $new_fd $fd_t) + (param $new_fd $fd) ;;; The destination path to which to rename the file or directory. (param $new_path string) - (result $error $errno_t) + (result $error $errno) ) ;;; Create a symbolic link. @@ -425,10 +425,10 @@ (@interface func (export "path_symlink") ;;; The contents of the symbolic link. (param $old_path string) - (param $fd $fd_t) + (param $fd $fd) ;;; The destination path at which to create the symbolic link. (param $new_path string) - (result $error $errno_t) + (result $error $errno) ) @@ -436,23 +436,23 @@ ;;; Return `EISDIR` if the path refers to a directory. ;;; Note: This is similar to `unlinkat(fd, path, 0)` in POSIX. (@interface func (export "path_unlink_file") - (param $fd $fd_t) + (param $fd $fd) ;;; The path to a file to unlink. (param $path string) - (result $error $errno_t) + (result $error $errno) ) ;;; Concurrently poll for the occurrence of a set of events. (@interface func (export "poll_oneoff") ;;; The events to which to subscribe. - (param $in (@witx const_pointer $subscription_t)) + (param $in (@witx const_pointer $subscription)) ;;; The events that have occurred. - (param $out (@witx pointer $event_t)) + (param $out (@witx pointer $event)) ;;; Both the number of subscriptions and events. - (param $nsubscriptions $size_t) - (result $error $errno_t) + (param $nsubscriptions $size) + (result $error $errno) ;;; The number of events stored. - (result $nevents $size_t) + (result $nevents $size) ) ;;; Terminate the process normally. An exit code of 0 indicates successful @@ -460,21 +460,21 @@ ;;; the environment. (@interface func (export "proc_exit") ;;; The exit code returned by the process. - (param $rval $exitcode_t) + (param $rval $exitcode) ) ;;; Send a signal to the process of the calling thread. ;;; Note: This is similar to `raise` in POSIX. (@interface func (export "proc_raise") ;;; The signal condition to trigger. - (param $sig $signal_t) - (result $error $errno_t) + (param $sig $signal) + (result $error $errno) ) ;;; Temporarily yield execution of the calling thread. ;;; Note: This is similar to `sched_yield` in POSIX. (@interface func (export "sched_yield") - (result $error $errno_t) + (result $error $errno) ) ;;; Write high-quality random data into a buffer. @@ -486,46 +486,46 @@ (@interface func (export "random_get") ;;; The buffer to fill with random data. (param $buf (@witx pointer u8)) - (param $buf_len $size_t) - (result $error $errno_t) + (param $buf_len $size) + (result $error $errno) ) ;;; Receive a message from a socket. ;;; Note: This is similar to `recv` in POSIX, though it also supports reading ;;; the data into multiple buffers in the manner of `readv`. (@interface func (export "sock_recv") - (param $fd $fd_t) + (param $fd $fd) ;;; List of scatter/gather vectors to which to store data. - (param $ri_data $iovec_t_array) + (param $ri_data $iovec_array) ;;; Message flags. - (param $ri_flags $riflags_t) - (result $error $errno_t) + (param $ri_flags $riflags) + (result $error $errno) ;;; Number of bytes stored in ri_data. - (result $ro_datalen $size_t) + (result $ro_datalen $size) ;;; Message flags. - (result $ro_flags $roflags_t) + (result $ro_flags $roflags) ) ;;; Send a message on a socket. ;;; Note: This is similar to `send` in POSIX, though it also supports writing ;;; the data from multiple buffers in the manner of `writev`. (@interface func (export "sock_send") - (param $fd $fd_t) + (param $fd $fd) ;;; List of scatter/gather vectors to which to retrieve data - (param $si_data $ciovec_t_array) + (param $si_data $ciovec_array) ;;; Message flags. - (param $si_flags $siflags_t) - (result $error $errno_t) + (param $si_flags $siflags) + (result $error $errno) ;;; Number of bytes transmitted. - (result $so_datalen $size_t) + (result $so_datalen $size) ) ;;; Shut down socket send and receive channels. ;;; Note: This is similar to `shutdown` in POSIX. (@interface func (export "sock_shutdown") - (param $fd $fd_t) + (param $fd $fd) ;;; Which channels on the socket to shut down. - (param $how $sdflags_t) - (result $error $errno_t) + (param $how $sdflags) + (result $error $errno) ) ) diff --git a/phases/old/snapshot_0/witx/typenames.witx b/phases/old/snapshot_0/witx/typenames.witx index cf39a2deb..9a7fc0bb2 100644 --- a/phases/old/snapshot_0/witx/typenames.witx +++ b/phases/old/snapshot_0/witx/typenames.witx @@ -5,29 +5,29 @@ ;; This is a `witx` file. See [here](https://github.com/WebAssembly/WASI/tree/master/docs/witx.md) ;; for an explanation of what that means. -(typename $size_t u32) +(typename $size u32) ;;; Non-negative file size or length of a region within a file. -(typename $filesize_t u64) +(typename $filesize u64) ;;; Timestamp in nanoseconds. -(typename $timestamp_t u64) +(typename $timestamp u64) ;;; Identifiers for clocks. -(typename $clockid_t +(typename $clockid (enum u32 ;;; The clock measuring real time. Time value zero corresponds with ;;; 1970-01-01T00:00:00Z. - $CLOCK_REALTIME + $realtime ;;; The store-wide monotonic clock, which is defined as a clock measuring ;;; real time, whose value cannot be adjusted and which cannot have negative ;;; clock jumps. The epoch of this clock is undefined. The absolute time ;;; value of this clock therefore has no meaning. - $CLOCK_MONOTONIC + $monotonic ;;; The CPU-time clock associated with the current process. - $CLOCK_PROCESS_CPUTIME_ID + $process_cputime_id ;;; The CPU-time clock associated with the current thread. - $CLOCK_THREAD_CPUTIME_ID + $thread_cputime_id ) ) @@ -35,720 +35,720 @@ ;;; Not all of these error codes are returned by the functions provided by this ;;; API; some are used in higher-level library layers, and others are provided ;;; merely for alignment with POSIX. -(typename $errno_t +(typename $errno (enum u16 ;;; No error occurred. System call completed successfully. - $ESUCCESS + $success ;;; Argument list too long. - $E2BIG + $2big ;;; Permission denied. - $EACCES + $acces ;;; Address in use. - $EADDRINUSE + $addrinuse ;;; Address not available. - $EADDRNOTAVAIL + $addrnotavail ;;; Address family not supported. - $EAFNOSUPPORT + $afnosupport ;;; Resource unavailable, or operation would block. - $EAGAIN + $again ;;; Connection already in progress. - $EALREADY + $already ;;; Bad file descriptor. - $EBADF + $badf ;;; Bad message. - $EBADMSG + $badmsg ;;; Device or resource busy. - $EBUSY + $busy ;;; Operation canceled. - $ECANCELED + $canceled ;;; No child processes. - $ECHILD + $child ;;; Connection aborted. - $ECONNABORTED + $connaborted ;;; Connection refused. - $ECONNREFUSED + $connrefused ;;; Connection reset. - $ECONNRESET + $connreset ;;; Resource deadlock would occur. - $EDEADLK + $deadlk ;;; Destination address required. - $EDESTADDRREQ + $destaddrreq ;;; Mathematics argument out of domain of function. - $EDOM + $dom ;;; Reserved. - $EDQUOT + $dquot ;;; File exists. - $EEXIST + $exist ;;; Bad address. - $EFAULT + $fault ;;; File too large. - $EFBIG + $fbig ;;; Host is unreachable. - $EHOSTUNREACH + $hostunreach ;;; Identifier removed. - $EIDRM + $idrm ;;; Illegal byte sequence. - $EILSEQ + $ilseq ;;; Operation in progress. - $EINPROGRESS + $inprogress ;;; Interrupted function. - $EINTR + $intr ;;; Invalid argument. - $EINVAL + $inval ;;; I/O error. - $EIO + $io ;;; Socket is connected. - $EISCONN + $isconn ;;; Is a directory. - $EISDIR + $isdir ;;; Too many levels of symbolic links. - $ELOOP + $loop ;;; File descriptor value too large. - $EMFILE + $mfile ;;; Too many links. - $EMLINK + $mlink ;;; Message too large. - $EMSGSIZE + $msgsize ;;; Reserved. - $EMULTIHOP + $multihop ;;; Filename too long. - $ENAMETOOLONG + $nametoolong ;;; Network is down. - $ENETDOWN + $netdown ;;; Connection aborted by network. - $ENETRESET + $netreset ;;; Network unreachable. - $ENETUNREACH + $netunreach ;;; Too many files open in system. - $ENFILE + $nfile ;;; No buffer space available. - $ENOBUFS + $nobufs ;;; No such device. - $ENODEV + $nodev ;;; No such file or directory. - $ENOENT + $noent ;;; Executable file format error. - $ENOEXEC + $noexec ;;; No locks available. - $ENOLCK + $nolck ;;; Reserved. - $ENOLINK + $nolink ;;; Not enough space. - $ENOMEM + $nomem ;;; No message of the desired type. - $ENOMSG + $nomsg ;;; Protocol not available. - $ENOPROTOOPT + $noprotoopt ;;; No space left on device. - $ENOSPC + $nospc ;;; Function not supported. - $ENOSYS + $nosys ;;; The socket is not connected. - $ENOTCONN + $notconn ;;; Not a directory or a symbolic link to a directory. - $ENOTDIR + $notdir ;;; Directory not empty. - $ENOTEMPTY + $notempty ;;; State not recoverable. - $ENOTRECOVERABLE + $notrecoverable ;;; Not a socket. - $ENOTSOCK + $notsock ;;; Not supported, or operation not supported on socket. - $ENOTSUP + $notsup ;;; Inappropriate I/O control operation. - $ENOTTY + $notty ;;; No such device or address. - $ENXIO + $nxio ;;; Value too large to be stored in data type. - $EOVERFLOW + $overflow ;;; Previous owner died. - $EOWNERDEAD + $ownerdead ;;; Operation not permitted. - $EPERM + $perm ;;; Broken pipe. - $EPIPE + $pipe ;;; Protocol error. - $EPROTO + $proto ;;; Protocol not supported. - $EPROTONOSUPPORT + $protonosupport ;;; Protocol wrong type for socket. - $EPROTOTYPE + $prototype ;;; Result too large. - $ERANGE + $range ;;; Read-only file system. - $EROFS + $rofs ;;; Invalid seek. - $ESPIPE + $spipe ;;; No such process. - $ESRCH + $srch ;;; Reserved. - $ESTALE + $stale ;;; Connection timed out. - $ETIMEDOUT + $timedout ;;; Text file busy. - $ETXTBSY + $txtbsy ;;; Cross-device link. - $EXDEV + $xdev ;;; Extension: Capabilities insufficient. - $ENOTCAPABLE + $notcapable ) ) ;;; File descriptor rights, determining which actions may be performed. -(typename $rights_t +(typename $rights (flags u64 ;;; The right to invoke `fd_datasync`. ;; - ;;; If `RIGHT_PATH_OPEN` is set, includes the right to invoke + ;;; If `rights::path_open` is set, includes the right to invoke ;;; `path_open` with `FDFLAG_DSYNC`. - $RIGHT_FD_DATASYNC + $fd_datasync ;;; The right to invoke `fd_read` and `sock_recv`. ;; - ;;; If `RIGHT_FD_SEEK` is set, includes the right to invoke `fd_pread`. - $RIGHT_FD_READ - ;;; The right to invoke `fd_seek`. This flag implies `RIGHT_FD_TELL`. - $RIGHT_FD_SEEK + ;;; If `rights::fd_seek` is set, includes the right to invoke `fd_pread`. + $fd_read + ;;; The right to invoke `fd_seek`. This flag implies `rights::fd_tell`. + $fd_seek ;;; The right to invoke `fd_fdstat_set_flags`. - $RIGHT_FD_FDSTAT_SET_FLAGS + $fd_fdstat_set_flags ;;; The right to invoke `fd_sync`. ;; - ;;; If `RIGHT_PATH_OPEN` is set, includes the right to invoke + ;;; If `rights::path_open` is set, includes the right to invoke ;;; `path_open` with `FDFLAG_RSYNC` and `FDFLAG_DSYNC`. - $RIGHT_FD_SYNC + $fd_sync ;;; The right to invoke `fd_seek` in such a way that the file offset ;;; remains unaltered (i.e., `WHENCE_CUR` with offset zero), or to ;;; invoke `fd_tell`. - $RIGHT_FD_TELL + $fd_tell ;;; The right to invoke `fd_write` and `sock_send`. - ;;; If `RIGHT_FD_SEEK` is set, includes the right to invoke `fd_pwrite`. - $RIGHT_FD_WRITE + ;;; If `rights::fd_seek` is set, includes the right to invoke `fd_pwrite`. + $fd_write ;;; The right to invoke `fd_advise`. - $RIGHT_FD_ADVISE + $fd_advise ;;; The right to invoke `fd_allocate`. - $RIGHT_FD_ALLOCATE + $fd_allocate ;;; The right to invoke `path_create_directory`. - $RIGHT_PATH_CREATE_DIRECTORY - ;;; If `RIGHT_PATH_OPEN` is set, the right to invoke `path_open` with `O_CREAT`. - $RIGHT_PATH_CREATE_FILE + $path_create_directory + ;;; If `rights::path_open` is set, the right to invoke `path_open` with `O_CREAT`. + $path_create_file ;;; The right to invoke `path_link` with the file descriptor as the ;;; source directory. - $RIGHT_PATH_LINK_SOURCE + $path_link_source ;;; The right to invoke `path_link` with the file descriptor as the ;;; target directory. - $RIGHT_PATH_LINK_TARGET + $path_link_target ;;; The right to invoke `path_open`. - $RIGHT_PATH_OPEN + $path_open ;;; The right to invoke `fd_readdir`. - $RIGHT_FD_READDIR + $fd_readdir ;;; The right to invoke `path_readlink`. - $RIGHT_PATH_READLINK + $path_readlink ;;; The right to invoke `path_rename` with the file descriptor as the source directory. - $RIGHT_PATH_RENAME_SOURCE + $path_rename_source ;;; The right to invoke `path_rename` with the file descriptor as the target directory. - $RIGHT_PATH_RENAME_TARGET + $path_rename_target ;;; The right to invoke `path_filestat_get`. - $RIGHT_PATH_FILESTAT_GET + $path_filestat_get ;;; The right to change a file's size (there is no `path_filestat_set_size`). - ;;; If `RIGHT_PATH_OPEN` is set, includes the right to invoke `path_open` with `O_TRUNC`. - $RIGHT_PATH_FILESTAT_SET_SIZE + ;;; If `rights::path_open` is set, includes the right to invoke `path_open` with `O_TRUNC`. + $path_filestat_set_size ;;; The right to invoke `path_filestat_set_times`. - $RIGHT_PATH_FILESTAT_SET_TIMES + $path_filestat_set_times ;;; The right to invoke `fd_filestat_get`. - $RIGHT_FD_FILESTAT_GET + $fd_filestat_get ;;; The right to invoke `fd_filestat_set_size`. - $RIGHT_FD_FILESTAT_SET_SIZE + $fd_filestat_set_size ;;; The right to invoke `fd_filestat_set_times`. - $RIGHT_FD_FILESTAT_SET_TIMES + $fd_filestat_set_times ;;; The right to invoke `path_symlink`. - $RIGHT_PATH_SYMLINK + $path_symlink ;;; The right to invoke `path_remove_directory`. - $RIGHT_PATH_REMOVE_DIRECTORY + $path_remove_directory ;;; The right to invoke `path_unlink_file`. - $RIGHT_PATH_UNLINK_FILE - ;;; If `RIGHT_FD_READ` is set, includes the right to invoke `poll_oneoff` to subscribe to `EVENTTYPE_FD_READ`. - ;;; If `RIGHT_FD_WRITE` is set, includes the right to invoke `poll_oneoff` to subscribe to `EVENTTYPE_FD_WRITE`. - $RIGHT_POLL_FD_READWRITE + $path_unlink_file + ;;; If `rights::fd_read` is set, includes the right to invoke `poll_oneoff` to subscribe to `eventtype::fd_read`. + ;;; If `rights::fd_write` is set, includes the right to invoke `poll_oneoff` to subscribe to `eventtype::fd_write`. + $poll_fd_readwrite ;;; The right to invoke `sock_shutdown`. - $RIGHT_SOCK_SHUTDOWN + $sock_shutdown ) ) ;;; A file descriptor index. -(typename $fd_t u32) +(typename $fd u32) ;;; A region of memory for scatter/gather reads. -(typename $iovec_t +(typename $iovec (struct ;;; The address of the buffer to be filled. (field $buf (@witx pointer u8)) ;;; The length of the buffer to be filled. - (field $buf_len $size_t) + (field $buf_len $size) ) ) ;;; A region of memory for scatter/gather writes. -(typename $ciovec_t +(typename $ciovec (struct ;;; The address of the buffer to be written. (field $buf (@witx const_pointer u8)) ;;; The length of the buffer to be written. - (field $buf_len $size_t) + (field $buf_len $size) ) ) -(typename $iovec_t_array (array $iovec_t)) -(typename $ciovec_t_array (array $ciovec_t)) +(typename $iovec_array (array $iovec)) +(typename $ciovec_array (array $ciovec)) ;;; Relative offset within a file. -(typename $filedelta_t s64) +(typename $filedelta s64) ;;; The position relative to which to set the offset of the file descriptor. -(typename $whence_t +(typename $whence (enum u8 ;;; Seek relative to current position. - $WHENCE_CUR + $cur ;;; Seek relative to end-of-file. - $WHENCE_END + $end ;;; Seek relative to start-of-file. - $WHENCE_SET + $set ) ) ;;; A reference to the offset of a directory entry. -(typename $dircookie_t u64) +(typename $dircookie u64) -;;; The type for the $d_namlen field of $dirent_t. -(typename $dirnamlen_t u32) +;;; The type for the $d_namlen field of $dirent. +(typename $dirnamlen u32) ;;; File serial number that is unique within its file system. -(typename $inode_t u64) +(typename $inode u64) ;;; The type of a file descriptor or file. -(typename $filetype_t +(typename $filetype (enum u8 ;;; The type of the file descriptor or file is unknown or is different from any of the other types specified. - $FILETYPE_UNKNOWN + $unknown ;;; The file descriptor or file refers to a block device inode. - $FILETYPE_BLOCK_DEVICE + $block_device ;;; The file descriptor or file refers to a character device inode. - $FILETYPE_CHARACTER_DEVICE + $character_device ;;; The file descriptor or file refers to a directory inode. - $FILETYPE_DIRECTORY + $directory ;;; The file descriptor or file refers to a regular file inode. - $FILETYPE_REGULAR_FILE + $regular_file ;;; The file descriptor or file refers to a datagram socket. - $FILETYPE_SOCKET_DGRAM + $socket_dgram ;;; The file descriptor or file refers to a byte-stream socket. - $FILETYPE_SOCKET_STREAM + $socket_stream ;;; The file refers to a symbolic link inode. - $FILETYPE_SYMBOLIC_LINK + $symbolic_link ) ) ;;; A directory entry. -(typename $dirent_t +(typename $dirent (struct ;;; The offset of the next directory entry stored in this directory. - (field $d_next $dircookie_t) + (field $d_next $dircookie) ;;; The serial number of the file referred to by this directory entry. - (field $d_ino $inode_t) + (field $d_ino $inode) ;;; The length of the name of the directory entry. - (field $d_namlen $dirnamlen_t) + (field $d_namlen $dirnamlen) ;;; The type of the file referred to by this directory entry. - (field $d_type $filetype_t) + (field $d_type $filetype) ) ) ;;; File or memory access pattern advisory information. -(typename $advice_t +(typename $advice (enum u8 ;;; The application has no advice to give on its behavior with respect to the specified data. - $ADVICE_NORMAL + $normal ;;; The application expects to access the specified data sequentially from lower offsets to higher offsets. - $ADVICE_SEQUENTIAL + $sequential ;;; The application expects to access the specified data in a random order. - $ADVICE_RANDOM + $random ;;; The application expects to access the specified data in the near future. - $ADVICE_WILLNEED + $willneed ;;; The application expects that it will not access the specified data in the near future. - $ADVICE_DONTNEED + $dontneed ;;; The application expects to access the specified data once and then not reuse it thereafter. - $ADVICE_NOREUSE + $noreuse ) ) ;;; File descriptor flags. -(typename $fdflags_t +(typename $fdflags (flags u16 ;;; Append mode: Data written to the file is always appended to the file's end. - $FDFLAG_APPEND + $append ;;; Write according to synchronized I/O data integrity completion. Only the data stored in the file is synchronized. - $FDFLAG_DSYNC + $dsync ;;; Non-blocking mode. - $FDFLAG_NONBLOCK + $nonblock ;;; Synchronized read I/O operations. - $FDFLAG_RSYNC + $rsync ;;; Write according to synchronized I/O file integrity completion. In ;;; addition to synchronizing the data stored in the file, the implementation ;;; may also synchronously update the file's metadata. - $FDFLAG_SYNC + $sync ) ) ;;; File descriptor attributes. -(typename $fdstat_t +(typename $fdstat (struct ;;; File type. - (field $fs_filetype $filetype_t) + (field $fs_filetype $filetype) ;;; File descriptor flags. - (field $fs_flags $fdflags_t) + (field $fs_flags $fdflags) ;;; Rights that apply to this file descriptor. - (field $fs_rights_base $rights_t) + (field $fs_rights_base $rights) ;;; Maximum set of rights that may be installed on new file descriptors that ;;; are created through this file descriptor, e.g., through `path_open`. - (field $fs_rights_inheriting $rights_t) + (field $fs_rights_inheriting $rights) ) ) ;;; Identifier for a device containing a file system. Can be used in combination -;;; with `inode_t` to uniquely identify a file or directory in the filesystem. -(typename $device_t u64) +;;; with `inode` to uniquely identify a file or directory in the filesystem. +(typename $device u64) ;;; Which file time attributes to adjust. -(typename $fstflags_t +(typename $fstflags (flags u16 - ;;; Adjust the last data access timestamp to the value stored in `filestat_t::st_atim`. - $FILESTAT_SET_ATIM - ;;; Adjust the last data access timestamp to the time of clock `CLOCK_REALTIME`. - $FILESTAT_SET_ATIM_NOW - ;;; Adjust the last data modification timestamp to the value stored in `filestat_t::st_mtim`. - $FILESTAT_SET_MTIM - ;;; Adjust the last data modification timestamp to the time of clock `CLOCK_REALTIME`. - $FILESTAT_SET_MTIM_NOW + ;;; Adjust the last data access timestamp to the value stored in `filestat::st_atim`. + $atim + ;;; Adjust the last data access timestamp to the time of clock `clock::realtime`. + $atim_now + ;;; Adjust the last data modification timestamp to the value stored in `filestat::st_mtim`. + $mtim + ;;; Adjust the last data modification timestamp to the time of clock `clock::realtime`. + $mtim_now ) ) ;;; Flags determining the method of how paths are resolved. -(typename $lookupflags_t +(typename $lookupflags (flags u32 ;;; As long as the resolved path corresponds to a symbolic link, it is expanded. - $LOOKUP_SYMLINK_FOLLOW + $symlink_follow ) ) ;;; Open flags used by `path_open`. -(typename $oflags_t +(typename $oflags (flags u16 ;;; Create file if it does not exist. - $O_CREAT + $creat ;;; Fail if not a directory. - $O_DIRECTORY + $directory ;;; Fail if file already exists. - $O_EXCL + $excl ;;; Truncate file to size 0. - $O_TRUNC + $trunc ) ) ;;; Number of hard links to an inode. -(typename $linkcount_t u32) +(typename $linkcount u32) ;;; File attributes. -(typename $filestat_t +(typename $filestat (struct ;;; Device ID of device containing the file. - (field $st_dev $device_t) + (field $dev $device) ;;; File serial number. - (field $st_ino $inode_t) + (field $ino $inode) ;;; File type. - (field $st_filetype $filetype_t) + (field $filetype $filetype) ;;; Number of hard links to the file. - (field $st_nlink $linkcount_t) + (field $nlink $linkcount) ;;; For regular files, the file size in bytes. For symbolic links, the length in bytes of the pathname contained in the symbolic link. - (field $st_size $filesize_t) + (field $size $filesize) ;;; Last data access timestamp. - (field $st_atim $timestamp_t) + (field $atim $timestamp) ;;; Last data modification timestamp. - (field $st_mtim $timestamp_t) + (field $mtim $timestamp) ;;; Last file status change timestamp. - (field $st_ctim $timestamp_t) + (field $ctim $timestamp) ) ) ;;; User-provided value that may be attached to objects that is retained when ;;; extracted from the implementation. -(typename $userdata_t u64) +(typename $userdata u64) ;;; Type of a subscription to an event or its occurrence. -(typename $eventtype_t +(typename $eventtype (enum u8 - ;;; The time value of clock `subscription_t::u.clock.clock_id` has - ;;; reached timestamp `subscription_t::u.clock.timeout`. - $EVENTTYPE_CLOCK - ;;; File descriptor `subscription_t::u.fd_readwrite.fd` has data + ;;; The time value of clock `subscription::u.clock.clock_id` has + ;;; reached timestamp `subscription::u.clock.timeout`. + $clock + ;;; File descriptor `subscription::u.fd_readwrite.fd` has data ;;; available for reading. This event always triggers for regular files. - $EVENTTYPE_FD_READ - ;;; File descriptor `subscription_t::u.fd_readwrite.fd` has capacity + $fd_read + ;;; File descriptor `subscription::u.fd_readwrite.fd` has capacity ;;; available for writing. This event always triggers for regular files. - $EVENTTYPE_FD_WRITE + $fd_write ) ) ;;; The state of the file descriptor subscribed to with -;;; `EVENTTYPE_FD_READ` or `EVENTTYPE_FD_WRITE`. -(typename $eventrwflags_t +;;; `eventtype::fd_read` or `eventtype::fd_write`. +(typename $eventrwflags (flags u16 ;;; The peer of this socket has closed or disconnected. - $EVENT_FD_READWRITE_HANGUP + $fd_readwrite_hangup ) ) -;;; The contents of an $event_t when type is `EVENTTYPE_FD_READ` or -;;; `EVENTTYPE_FD_WRITE`. -(typename $event_fd_readwrite_t +;;; The contents of an $event when type is `eventtype::fd_read` or +;;; `eventtype::fd_write`. +(typename $event_fd_readwrite (struct ;;; The number of bytes available for reading or writing. - (field $nbytes $filesize_t) + (field $nbytes $filesize) ;;; The state of the file descriptor. - (field $flags $eventrwflags_t) + (field $flags $eventrwflags) ) ) -;;; The contents of an $event_t. +;;; The contents of an $event. (typename $event_u (union - ;;; When type is `EVENTTYPE_FD_READ` or `EVENTTYPE_FD_WRITE`: - (field $fd_readwrite $event_fd_readwrite_t) + ;;; When type is `eventtype::fd_read` or `eventtype::fd_write`: + (field $fd_readwrite $event_fd_readwrite) ) ) ;;; An event that occurred. -(typename $event_t +(typename $event (struct - ;;; User-provided value that got attached to `subscription_t::userdata`. - (field $userdata $userdata_t) + ;;; User-provided value that got attached to `subscription::userdata`. + (field $userdata $userdata) ;;; If non-zero, an error that occurred while processing the subscription request. - (field $error $errno_t) + (field $error $errno) ;;; The type of the event that occurred. - (field $type $eventtype_t) + (field $type $eventtype) ;;; The contents of the event. (field $u $event_u) ) ) ;;; Flags determining how to interpret the timestamp provided in -;;; `subscription_t::u.clock.timeout.` -(typename $subclockflags_t +;;; `subscription::u.clock.timeout.` +(typename $subclockflags (flags u16 ;;; If set, treat the timestamp provided in - ;;; `subscription_t::u.clock.timeout` as an absolute timestamp of clock - ;;; `subscription_t::u.clock.clock_id.` If clear, treat the timestamp - ;;; provided in `subscription_t::u.clock.timeout` relative to the - ;;; current time value of clock `subscription_t::u.clock.clock_id.` - $SUBSCRIPTION_CLOCK_ABSTIME + ;;; `subscription::u.clock.timeout` as an absolute timestamp of clock + ;;; `subscription::u.clock.clock_id.` If clear, treat the timestamp + ;;; provided in `subscription::u.clock.timeout` relative to the + ;;; current time value of clock `subscription::u.clock.clock_id.` + $subscription_clock_abstime ) ) -;;; The contents of a $subscription_t when type is `EVENTTYPE_CLOCK`. -(typename $subscription_clock_t +;;; The contents of a $subscription when type is `eventtype::clock`. +(typename $subscription_clock (struct ;;; The user-defined unique identifier of the clock. - (field $identifier $userdata_t) + (field $identifier $userdata) ;;; The clock against which to compare the timestamp. - (field $clock_id $clockid_t) + (field $id $clockid) ;;; The absolute or relative timestamp. - (field $timeout $timestamp_t) + (field $timeout $timestamp) ;;; The amount of time that the implementation may wait additionally ;;; to coalesce with other events. - (field $precision $timestamp_t) + (field $precision $timestamp) ;;; Flags specifying whether the timeout is absolute or relative - (field $flags $subclockflags_t) + (field $flags $subclockflags) ) ) -;;; The contents of a $subscription_t when type is type is -;;; `EVENTTYPE_FD_READ` or `EVENTTYPE_FD_WRITE`. -(typename $subscription_fd_readwrite_t +;;; The contents of a $subscription when type is type is +;;; `eventtype::fd_read` or `eventtype::fd_write`. +(typename $subscription_fd_readwrite (struct ;;; The file descriptor on which to wait for it to become ready for reading or writing. - (field $file_descriptor $fd_t) + (field $file_descriptor $fd) ) ) -;;; The contents of a $subscription_t. +;;; The contents of a $subscription. (typename $subscription_u (union - ;;; When type is `EVENTTYPE_CLOCK`: - (field $clock $subscription_clock_t) - ;;; When type is `EVENTTYPE_FD_READ` or `EVENTTYPE_FD_WRITE`: - (field $fd_readwrite $subscription_fd_readwrite_t) + ;;; When type is `eventtype::clock`: + (field $clock $subscription_clock) + ;;; When type is `eventtype::fd_read` or `eventtype::fd_write`: + (field $fd_readwrite $subscription_fd_readwrite) ) ) ;;; Subscription to an event. -(typename $subscription_t +(typename $subscription (struct ;;; User-provided value that is attached to the subscription in the - ;;; implementation and returned through `event_t::userdata`. - (field $userdata $userdata_t) + ;;; implementation and returned through `event::userdata`. + (field $userdata $userdata) ;;; The type of the event to which to subscribe. - (field $type $eventtype_t) + (field $type $eventtype) ;;; The contents of the subscription. (field $u $subscription_u) ) ) ;;; Exit code generated by a process when exiting. -(typename $exitcode_t u32) +(typename $exitcode u32) ;;; Signal condition. -(typename $signal_t +(typename $signal (enum u8 ;;; No signal. Note that POSIX has special semantics for `kill(pid, 0)`, ;;; so this value is reserved. - $SIGNONE + $none ;;; Hangup. ;;; Action: Terminates the process. - $SIGHUP + $hup ;;; Terminate interrupt signal. ;;; Action: Terminates the process. - $SIGINT + $int ;;; Terminal quit signal. ;;; Action: Terminates the process. - $SIGQUIT + $quit ;;; Illegal instruction. ;;; Action: Terminates the process. - $SIGILL + $ill ;;; Trace/breakpoint trap. ;;; Action: Terminates the process. - $SIGTRAP + $trap ;;; Process abort signal. ;;; Action: Terminates the process. - $SIGABRT + $abrt ;;; Access to an undefined portion of a memory object. ;;; Action: Terminates the process. - $SIGBUS + $bus ;;; Erroneous arithmetic operation. ;;; Action: Terminates the process. - $SIGFPE + $fpe ;;; Kill. ;;; Action: Terminates the process. - $SIGKILL + $kill ;;; User-defined signal 1. ;;; Action: Terminates the process. - $SIGUSR1 + $usr1 ;;; Invalid memory reference. ;;; Action: Terminates the process. - $SIGSEGV + $segv ;;; User-defined signal 2. ;;; Action: Terminates the process. - $SIGUSR2 + $usr2 ;;; Write on a pipe with no one to read it. ;;; Action: Ignored. - $SIGPIPE + $pipe ;;; Alarm clock. ;;; Action: Terminates the process. - $SIGALRM + $alrm ;;; Termination signal. ;;; Action: Terminates the process. - $SIGTERM + $term ;;; Child process terminated, stopped, or continued. ;;; Action: Ignored. - $SIGCHLD + $chld ;;; Continue executing, if stopped. ;;; Action: Continues executing, if stopped. - $SIGCONT + $cont ;;; Stop executing. ;;; Action: Stops executing. - $SIGSTOP + $stop ;;; Terminal stop signal. ;;; Action: Stops executing. - $SIGTSTP + $tstp ;;; Background process attempting read. ;;; Action: Stops executing. - $SIGTTIN + $ttin ;;; Background process attempting write. ;;; Action: Stops executing. - $SIGTTOU + $ttou ;;; High bandwidth data is available at a socket. ;;; Action: Ignored. - $SIGURG + $urg ;;; CPU time limit exceeded. ;;; Action: Terminates the process. - $SIGXCPU + $xcpu ;;; File size limit exceeded. ;;; Action: Terminates the process. - $SIGXFSZ + $xfsz ;;; Virtual timer expired. ;;; Action: Terminates the process. - $SIGVTALRM + $vtalrm ;;; Profiling timer expired. ;;; Action: Terminates the process. - $SIGPROF + $prof ;;; Window changed. ;;; Action: Ignored. - $SIGWINCH + $winch ;;; I/O possible. ;;; Action: Terminates the process. - $SIGPOLL + $poll ;;; Power failure. ;;; Action: Terminates the process. - $SIGPWR + $pwr ;;; Bad system call. ;;; Action: Terminates the process. - $SIGSYS + $sys ) ) ;;; Flags provided to `sock_recv`. -(typename $riflags_t +(typename $riflags (flags u16 ;;; Returns the message without removing it from the socket's receive queue. - $SOCK_RECV_PEEK + $recv_peek ;;; On byte-stream sockets, block until the full amount of data can be returned. - $SOCK_RECV_WAITALL + $recv_waitall ) ) ;;; Flags returned by `sock_recv`. -(typename $roflags_t +(typename $roflags (flags u16 ;;; Returned by `sock_recv`: Message data has been truncated. - $SOCK_RECV_DATA_TRUNCATED + $recv_data_truncated ) ) ;;; Flags provided to `sock_send`. As there are currently no flags ;;; defined, it must be set to zero. -(typename $siflags_t u16) +(typename $siflags u16) ;;; Which channels on a socket to shut down. -(typename $sdflags_t +(typename $sdflags (flags u8 ;;; Disables further receive operations. - $SHUT_RD + $rd ;;; Disables further send operations. - $SHUT_WR + $wr ) ) ;;; Identifiers for preopened capabilities. -(typename $preopentype_t +(typename $preopentype (enum u8 ;;; A pre-opened directory. - $PREOPENTYPE_DIR + $dir ) ) -;;; The contents of a $prestat_t when type is `PREOPENTYPE_DIR`. +;;; The contents of a $prestat when type is `PREOPENTYPE_DIR`. (typename $prestat_dir (struct ;;; The length of the directory name for use with `fd_prestat_dir_name`. - (field $pr_name_len $size_t) + (field $pr_name_len $size) ) ) -;;; The contents of an $prestat_t. +;;; The contents of an $prestat. (typename $prestat_u (union ;;; When type is `PREOPENTYPE_DIR`: @@ -757,10 +757,10 @@ ) ;;; Information about a pre-opened capability. -(typename $prestat_t +(typename $prestat (struct ;;; The type of the pre-opened capability. - (field $pr_type $preopentype_t) + (field $pr_type $preopentype) ;;; The contents of the information. (field $u $prestat_u) ) diff --git a/phases/old/snapshot_0/witx/wasi_unstable.witx b/phases/old/snapshot_0/witx/wasi_unstable.witx index 4cf5f4ffa..5e125caf2 100644 --- a/phases/old/snapshot_0/witx/wasi_unstable.witx +++ b/phases/old/snapshot_0/witx/wasi_unstable.witx @@ -20,15 +20,15 @@ (@interface func (export "args_get") (param $argv (@witx pointer (@witx pointer u8))) (param $argv_buf (@witx pointer u8)) - (result $error $errno_t) + (result $error $errno) ) ;;; Return command-line argument data sizes. (@interface func (export "args_sizes_get") - (result $error $errno_t) + (result $error $errno) ;;; The number of arguments. - (result $argc $size_t) + (result $argc $size) ;;; The size of the argument string data. - (result $argv_buf_size $size_t) + (result $argv_buf_size $size) ) ;;; Read environment variable data. @@ -36,187 +36,187 @@ (@interface func (export "environ_get") (param $environ (@witx pointer (@witx pointer u8))) (param $environ_buf (@witx pointer u8)) - (result $error $errno_t) + (result $error $errno) ) ;;; Return command-line argument data sizes. (@interface func (export "environ_sizes_get") - (result $error $errno_t) + (result $error $errno) ;;; The number of arguments. - (result $argc $size_t) + (result $argc $size) ;;; The size of the argument string data. - (result $argv_buf_size $size_t) + (result $argv_buf_size $size) ) ;;; Return the resolution of a clock. ;;; Implementations are required to provide a non-zero value for supported clocks. For unsupported clocks, return `WASI_EINVAL` ;;; Note: This is similar to `clock_getres` in POSIX. (@interface func (export "clock_res_get") - (result $error $errno_t) + (result $error $errno) ;;; The clock for which to return the resolution. - (param $clock_id $clockid_t) + (param $id $clockid) ;;; The resolution of the clock. - (result $resolution $timestamp_t) + (result $resolution $timestamp) ) ;;; Return the time value of a clock. ;;; Note: This is similar to `clock_gettime` in POSIX. (@interface func (export "clock_time_get") ;;; The clock for which to return the time. - (param $clock_id $clockid_t) + (param $id $clockid) ;;; The maximum lag (exclusive) that the returned time value may have, compared to its actual value. - (param $precision $timestamp_t) - (result $error $errno_t) + (param $precision $timestamp) + (result $error $errno) ;;; The time value of the clock. - (result $time $timestamp_t) + (result $time $timestamp) ) ;;; Provide file advisory information on a file descriptor. ;;; Note: This is similar to `posix_fadvise` in POSIX. (@interface func (export "fd_advise") - (param $fd $fd_t) + (param $fd $fd) ;;; The offset within the file to which the advisory applies. - (param $offset $filesize_t) + (param $offset $filesize) ;;; The length of the region to which the advisory applies. - (param $len $filesize_t) + (param $len $filesize) ;;; The advice. - (param $advice $advice_t) - (result $error $errno_t) + (param $advice $advice) + (result $error $errno) ) ;;; Force the allocation of space in a file. ;;; Note: This is similar to `posix_fallocate` in POSIX. (@interface func (export "fd_allocate") - (param $fd $fd_t) + (param $fd $fd) ;;; The offset at which to start the allocation. - (param $offset $filesize_t) + (param $offset $filesize) ;;; The length of the area that is allocated. - (param $len $filesize_t) - (result $error $errno_t) + (param $len $filesize) + (result $error $errno) ) ;;; Close a file descriptor. ;;; Note: This is similar to `close` in POSIX. (@interface func (export "fd_close") - (param $fd $fd_t) - (result $error $errno_t) + (param $fd $fd) + (result $error $errno) ) ;;; Synchronize the data of a file to disk. ;;; Note: This is similar to `fdatasync` in POSIX. (@interface func (export "fd_datasync") - (param $fd $fd_t) - (result $error $errno_t) + (param $fd $fd) + (result $error $errno) ) ;;; Get the attributes of a file descriptor. ;;; Note: This returns similar flags to `fsync(fd, F_GETFL)` in POSIX, as well as additional fields. (@interface func (export "fd_fdstat_get") - (param $fd $fd_t) - (result $error $errno_t) + (param $fd $fd) + (result $error $errno) ;;; The buffer where the file descriptor's attributes are stored. - (result $stat $fdstat_t) + (result $stat $fdstat) ) ;;; Adjust the flags associated with a file descriptor. ;;; Note: This is similar to `fcntl(fd, F_SETFL, flags)` in POSIX. (@interface func (export "fd_fdstat_set_flags") - (param $fd $fd_t) + (param $fd $fd) ;;; The desired values of the file descriptor flags. - (param $flags $fdflags_t) - (result $error $errno_t) + (param $flags $fdflags) + (result $error $errno) ) ;;; Adjust the rights associated with a file descriptor. ;;; This can only be used to remove rights, and returns `ENOTCAPABLE` if called in a way that would attempt to add rights (@interface func (export "fd_fdstat_set_rights") - (param $fd $fd_t) + (param $fd $fd) ;;; The desired rights of the file descriptor. - (param $fs_rights_base $rights_t) - (param $fs_rights_inheriting $rights_t) - (result $error $errno_t) + (param $fs_rights_base $rights) + (param $fs_rights_inheriting $rights) + (result $error $errno) ) ;;; Return the attributes of an open file. (@interface func (export "fd_filestat_get") - (param $fd $fd_t) - (result $error $errno_t) + (param $fd $fd) + (result $error $errno) ;;; The buffer where the file's attributes are stored. - (result $buf $filestat_t) + (result $buf $filestat) ) ;;; Adjust the size of an open file. If this increases the file's size, the extra bytes are filled with zeros. ;;; Note: This is similar to `ftruncate` in POSIX. (@interface func (export "fd_filestat_set_size") - (param $fd $fd_t) + (param $fd $fd) ;;; The desired file size. - (param $st_size $filesize_t) - (result $error $errno_t) + (param $size $filesize) + (result $error $errno) ) ;;; Adjust the timestamps of an open file or directory. ;;; Note: This is similar to `futimens` in POSIX. (@interface func (export "fd_filestat_set_times") - (param $fd $fd_t) + (param $fd $fd) ;;; The desired values of the data access timestamp. - (param $st_atim $timestamp_t) + (param $atim $timestamp) ;;; The desired values of the data modification timestamp. - (param $st_mtim $timestamp_t) + (param $mtim $timestamp) ;;; A bitmask indicating which timestamps to adjust. - (param $fst_flags $fstflags_t) - (result $error $errno_t) + (param $fst_flags $fstflags) + (result $error $errno) ) ;;; Read from a file descriptor, without using and updating the file descriptor's offset. ;;; Note: This is similar to `preadv` in POSIX. (@interface func (export "fd_pread") - (param $fd $fd_t) + (param $fd $fd) ;;; List of scatter/gather vectors in which to store data. - (param $iovs $iovec_t_array) + (param $iovs $iovec_array) ;;; The offset within the file at which to read. - (param $offset $filesize_t) - (result $error $errno_t) + (param $offset $filesize) + (result $error $errno) ;;; The number of bytes read. - (result $nread $size_t) + (result $nread $size) ) ;;; Return a description of the given preopened file descriptor. (@interface func (export "fd_prestat_get") - (param $fd $fd_t) - (result $error $errno_t) + (param $fd $fd) + (result $error $errno) ;;; The buffer where the description is stored. - (result $buf $prestat_t) + (result $buf $prestat) ) ;;; Return a description of the given preopened file descriptor. (@interface func (export "fd_prestat_dir_name") - (param $fd $fd_t) + (param $fd $fd) ;;; A buffer into which to write the preopened directory name. (param $path (@witx pointer u8)) - (param $path_len $size_t) - (result $error $errno_t) + (param $path_len $size) + (result $error $errno) ) ;;; Write to a file descriptor, without using and updating the file descriptor's offset. ;;; Note: This is similar to `pwritev` in POSIX. (@interface func (export "fd_pwrite") - (param $fd $fd_t) + (param $fd $fd) ;;; List of scatter/gather vectors from which to retrieve data. - (param $iovs $ciovec_t_array) + (param $iovs $ciovec_array) ;;; The offset within the file at which to write. - (param $offset $filesize_t) - (result $error $errno_t) + (param $offset $filesize) + (result $error $errno) ;;; The number of bytes written. - (result $nwritten $size_t) + (result $nwritten $size) ) ;;; Read from a file descriptor. ;;; Note: This is similar to `readv` in POSIX. (@interface func (export "fd_read") - (param $fd $fd_t) + (param $fd $fd) ;;; List of scatter/gather vectors to which to store data. - (param $iovs $iovec_t_array) - (result $error $errno_t) + (param $iovs $iovec_array) + (result $error $errno) ;;; The number of bytes read. - (result $nread $size_t) + (result $nread $size) ) ;;; Read directory entries from a directory. @@ -230,15 +230,15 @@ ;;; read buffer size in case it's too small to fit a single large directory ;;; entry, or skip the oversized directory entry. (@interface func (export "fd_readdir") - (param $fd $fd_t) + (param $fd $fd) ;;; The buffer where directory entries are stored (param $buf (@witx pointer u8)) - (param $buf_len $size_t) + (param $buf_len $size) ;;; The location within the directory to start reading - (param $cookie $dircookie_t) - (result $error $errno_t) + (param $cookie $dircookie) + (result $error $errno) ;;; The number of bytes stored in the read buffer. If less than the size of the read buffer, the end of the directory has been reached. - (result $bufused $size_t) + (result $bufused $size) ) ;;; Atomically replace a file descriptor by renumbering another file descriptor. @@ -252,104 +252,104 @@ ;;; This function provides a way to atomically renumber file descriptors, which ;;; would disappear if `dup2()` were to be removed entirely. (@interface func (export "fd_renumber") - (param $fd $fd_t) + (param $fd $fd) ;;; The file descriptor to overwrite. - (param $to $fd_t) - (result $error $errno_t) + (param $to $fd) + (result $error $errno) ) ;;; Move the offset of a file descriptor. ;;; Note: This is similar to `lseek` in POSIX. (@interface func (export "fd_seek") - (param $fd $fd_t) + (param $fd $fd) ;;; The number of bytes to move. - (param $offset $filedelta_t) + (param $offset $filedelta) ;;; The base from which the offset is relative. - (param $whence $whence_t) - (result $error $errno_t) + (param $whence $whence) + (result $error $errno) ;;; The new offset of the file descriptor, relative to the start of the file. - (result $newoffset $filesize_t) + (result $newoffset $filesize) ) ;;; Synchronize the data and metadata of a file to disk. ;;; Note: This is similar to `fsync` in POSIX. (@interface func (export "fd_sync") - (param $fd $fd_t) - (result $error $errno_t) + (param $fd $fd) + (result $error $errno) ) ;;; Return the current offset of a file descriptor. ;;; Note: This is similar to `lseek(fd, 0, SEEK_CUR)` in POSIX. (@interface func (export "fd_tell") - (param $fd $fd_t) - (result $error $errno_t) + (param $fd $fd) + (result $error $errno) ;;; The current offset of the file descriptor, relative to the start of the file. - (result $offset $filesize_t) + (result $offset $filesize) ) ;;; Write to a file descriptor. ;;; Note: This is similar to `writev` in POSIX. (@interface func (export "fd_write") - (param $fd $fd_t) + (param $fd $fd) ;;; List of scatter/gather vectors from which to retrieve data. - (param $iovs $ciovec_t_array) - (result $error $errno_t) + (param $iovs $ciovec_array) + (result $error $errno) ;;; The number of bytes written. - (result $nwritten $size_t) + (result $nwritten $size) ) ;;; Create a directory. ;;; Note: This is similar to `mkdirat` in POSIX. (@interface func (export "path_create_directory") - (param $fd $fd_t) + (param $fd $fd) ;;; The path at which to create the directory. (param $path string) - (result $error $errno_t) + (result $error $errno) ) ;;; Return the attributes of a file or directory. ;;; Note: This is similar to `stat` in POSIX. (@interface func (export "path_filestat_get") - (param $fd $fd_t) + (param $fd $fd) ;;; Flags determining the method of how the path is resolved. - (param $flags $lookupflags_t) + (param $flags $lookupflags) ;;; The path of the file or directory to inspect. (param $path string) - (result $error $errno_t) + (result $error $errno) ;;; The buffer where the file's attributes are stored. - (result $buf $filestat_t) + (result $buf $filestat) ) ;;; Adjust the timestamps of a file or directory. ;;; Note: This is similar to `utimensat` in POSIX. (@interface func (export "path_filestat_set_times") - (param $fd $fd_t) + (param $fd $fd) ;;; Flags determining the method of how the path is resolved. - (param $flags $lookupflags_t) + (param $flags $lookupflags) ;;; The path of the file or directory to operate on. (param $path string) ;;; The desired values of the data access timestamp. - (param $st_atim $timestamp_t) + (param $atim $timestamp) ;;; The desired values of the data modification timestamp. - (param $st_mtim $timestamp_t) + (param $mtim $timestamp) ;;; A bitmask indicating which timestamps to adjust. - (param $fst_flags $fstflags_t) - (result $error $errno_t) + (param $fst_flags $fstflags) + (result $error $errno) ) ;;; Create a hard link. ;;; Note: This is similar to `linkat` in POSIX. (@interface func (export "path_link") - (param $old_fd $fd_t) + (param $old_fd $fd) ;;; Flags determining the method of how the path is resolved. - (param $old_flags $lookupflags_t) + (param $old_flags $lookupflags) ;;; The source path from which to link. (param $old_path string) ;;; The working directory at which the resolution of the new path starts. - (param $new_fd $fd_t) + (param $new_fd $fd) ;;; The destination path at which to create the hard link. (param $new_path string) - (result $error $errno_t) + (result $error $errno) ) ;;; Open a file or directory. @@ -362,14 +362,14 @@ ;; ;;; Note: This is similar to `openat` in POSIX. (@interface func (export "path_open") - (param $fd $fd_t) + (param $fd $fd) ;;; Flags determining the method of how the path is resolved. - (param $dirflags $lookupflags_t) + (param $dirflags $lookupflags) ;;; The relative path of the file or directory to open, relative to the ;;; `dirfd` directory. (param $path string) ;;; The method by which to open the file. - (param $o_flags $oflags_t) + (param $oflags $oflags) ;;; The initial rights of the newly created file descriptor. The ;;; implementation is allowed to return a file descriptor with fewer rights ;;; than specified, if and only if those rights do not apply to the type of @@ -378,49 +378,49 @@ ;;; The *base* rights are rights that will apply to operations using the file ;;; descriptor itself, while the *inheriting* rights are rights that apply to ;;; file descriptors derived from it. - (param $fs_rights_base $rights_t) - (param $fs_rights_inherting $rights_t) - (param $flags $fdflags_t) - (result $error $errno_t) + (param $fs_rights_base $rights) + (param $fs_rights_inherting $rights) + (param $fdflags $fdflags) + (result $error $errno) ;;; The file descriptor of the file that has been opened. - (result $opened_fd $fd_t) + (result $opened_fd $fd) ) ;;; Read the contents of a symbolic link. ;;; Note: This is similar to `readlinkat` in POSIX. (@interface func (export "path_readlink") - (param $fd $fd_t) + (param $fd $fd) ;;; The path of the symbolic link from which to read. (param $path string) ;;; The buffer to which to write the contents of the symbolic link. (param $buf (@witx pointer u8)) - (param $buf_len $size_t) - (result $error $errno_t) + (param $buf_len $size) + (result $error $errno) ;;; The number of bytes placed in the buffer. - (result $bufused $size_t) + (result $bufused $size) ) ;;; Remove a directory. ;;; Return `ENOTEMPTY` if the directory is not empty. ;;; Note: This is similar to `unlinkat(fd, path, AT_REMOVEDIR)` in POSIX. (@interface func (export "path_remove_directory") - (param $fd $fd_t) + (param $fd $fd) ;;; The path to a directory to remove. (param $path string) - (result $error $errno_t) + (result $error $errno) ) ;;; Rename a file or directory. ;;; Note: This is similar to `renameat` in POSIX. (@interface func (export "path_rename") - (param $fd $fd_t) + (param $fd $fd) ;;; The source path of the file or directory to rename. (param $old_path string) ;;; The working directory at which the resolution of the new path starts. - (param $new_fd $fd_t) + (param $new_fd $fd) ;;; The destination path to which to rename the file or directory. (param $new_path string) - (result $error $errno_t) + (result $error $errno) ) ;;; Create a symbolic link. @@ -428,10 +428,10 @@ (@interface func (export "path_symlink") ;;; The contents of the symbolic link. (param $old_path string) - (param $fd $fd_t) + (param $fd $fd) ;;; The destination path at which to create the symbolic link. (param $new_path string) - (result $error $errno_t) + (result $error $errno) ) @@ -439,23 +439,23 @@ ;;; Return `EISDIR` if the path refers to a directory. ;;; Note: This is similar to `unlinkat(fd, path, 0)` in POSIX. (@interface func (export "path_unlink_file") - (param $fd $fd_t) + (param $fd $fd) ;;; The path to a file to unlink. (param $path string) - (result $error $errno_t) + (result $error $errno) ) ;;; Concurrently poll for the occurrence of a set of events. (@interface func (export "poll_oneoff") ;;; The events to which to subscribe. - (param $in (@witx const_pointer $subscription_t)) + (param $in (@witx const_pointer $subscription)) ;;; The events that have occurred. - (param $out (@witx pointer $event_t)) + (param $out (@witx pointer $event)) ;;; Both the number of subscriptions and events. - (param $nsubscriptions $size_t) - (result $error $errno_t) + (param $nsubscriptions $size) + (result $error $errno) ;;; The number of events stored. - (result $nevents $size_t) + (result $nevents $size) ) ;;; Terminate the process normally. An exit code of 0 indicates successful @@ -463,21 +463,21 @@ ;;; the environment. (@interface func (export "proc_exit") ;;; The exit code returned by the process. - (param $rval $exitcode_t) + (param $rval $exitcode) ) ;;; Send a signal to the process of the calling thread. ;;; Note: This is similar to `raise` in POSIX. (@interface func (export "proc_raise") ;;; The signal condition to trigger. - (param $sig $signal_t) - (result $error $errno_t) + (param $sig $signal) + (result $error $errno) ) ;;; Temporarily yield execution of the calling thread. ;;; Note: This is similar to `sched_yield` in POSIX. (@interface func (export "sched_yield") - (result $error $errno_t) + (result $error $errno) ) ;;; Write high-quality random data into a buffer. @@ -489,46 +489,46 @@ (@interface func (export "random_get") ;;; The buffer to fill with random data. (param $buf (@witx pointer u8)) - (param $buf_len $size_t) - (result $error $errno_t) + (param $buf_len $size) + (result $error $errno) ) ;;; Receive a message from a socket. ;;; Note: This is similar to `recv` in POSIX, though it also supports reading ;;; the data into multiple buffers in the manner of `readv`. (@interface func (export "sock_recv") - (param $fd $fd_t) + (param $fd $fd) ;;; List of scatter/gather vectors to which to store data. - (param $ri_data $iovec_t_array) + (param $ri_data $iovec_array) ;;; Message flags. - (param $ri_flags $riflags_t) - (result $error $errno_t) + (param $ri_flags $riflags) + (result $error $errno) ;;; Number of bytes stored in ri_data. - (result $ro_datalen $size_t) + (result $ro_datalen $size) ;;; Message flags. - (result $ro_flags $roflags_t) + (result $ro_flags $roflags) ) ;;; Send a message on a socket. ;;; Note: This is similar to `send` in POSIX, though it also supports writing ;;; the data from multiple buffers in the manner of `writev`. (@interface func (export "sock_send") - (param $fd $fd_t) + (param $fd $fd) ;;; List of scatter/gather vectors to which to retrieve data - (param $si_data $ciovec_t_array) + (param $si_data $ciovec_array) ;;; Message flags. - (param $si_flags $siflags_t) - (result $error $errno_t) + (param $si_flags $siflags) + (result $error $errno) ;;; Number of bytes transmitted. - (result $so_datalen $size_t) + (result $so_datalen $size) ) ;;; Shut down socket send and receive channels. ;;; Note: This is similar to `shutdown` in POSIX. (@interface func (export "sock_shutdown") - (param $fd $fd_t) + (param $fd $fd) ;;; Which channels on the socket to shut down. - (param $how $sdflags_t) - (result $error $errno_t) + (param $how $sdflags) + (result $error $errno) ) ) diff --git a/phases/snapshot/witx/typenames.witx b/phases/snapshot/witx/typenames.witx index 68f6fac4a..d8ce215d7 100644 --- a/phases/snapshot/witx/typenames.witx +++ b/phases/snapshot/witx/typenames.witx @@ -5,29 +5,29 @@ ;; This is a `witx` file. See [here](https://github.com/WebAssembly/WASI/tree/master/docs/witx.md) ;; for an explanation of what that means. -(typename $size_t u32) +(typename $size u32) ;;; Non-negative file size or length of a region within a file. -(typename $filesize_t u64) +(typename $filesize u64) ;;; Timestamp in nanoseconds. -(typename $timestamp_t u64) +(typename $timestamp u64) ;;; Identifiers for clocks. -(typename $clockid_t +(typename $clockid (enum u32 ;;; The clock measuring real time. Time value zero corresponds with ;;; 1970-01-01T00:00:00Z. - $CLOCK_REALTIME + $realtime ;;; The store-wide monotonic clock, which is defined as a clock measuring ;;; real time, whose value cannot be adjusted and which cannot have negative ;;; clock jumps. The epoch of this clock is undefined. The absolute time ;;; value of this clock therefore has no meaning. - $CLOCK_MONOTONIC + $monotonic ;;; The CPU-time clock associated with the current process. - $CLOCK_PROCESS_CPUTIME_ID + $process_cputime_id ;;; The CPU-time clock associated with the current thread. - $CLOCK_THREAD_CPUTIME_ID + $thread_cputime_id ) ) @@ -35,732 +35,732 @@ ;;; Not all of these error codes are returned by the functions provided by this ;;; API; some are used in higher-level library layers, and others are provided ;;; merely for alignment with POSIX. -(typename $errno_t +(typename $errno (enum u16 ;;; No error occurred. System call completed successfully. - $ESUCCESS + $success ;;; Argument list too long. - $E2BIG + $2big ;;; Permission denied. - $EACCES + $acces ;;; Address in use. - $EADDRINUSE + $addrinuse ;;; Address not available. - $EADDRNOTAVAIL + $addrnotavail ;;; Address family not supported. - $EAFNOSUPPORT + $afnosupport ;;; Resource unavailable, or operation would block. - $EAGAIN + $again ;;; Connection already in progress. - $EALREADY + $already ;;; Bad file descriptor. - $EBADF + $badf ;;; Bad message. - $EBADMSG + $badmsg ;;; Device or resource busy. - $EBUSY + $busy ;;; Operation canceled. - $ECANCELED + $canceled ;;; No child processes. - $ECHILD + $child ;;; Connection aborted. - $ECONNABORTED + $connaborted ;;; Connection refused. - $ECONNREFUSED + $connrefused ;;; Connection reset. - $ECONNRESET + $connreset ;;; Resource deadlock would occur. - $EDEADLK + $deadlk ;;; Destination address required. - $EDESTADDRREQ + $destaddrreq ;;; Mathematics argument out of domain of function. - $EDOM + $dom ;;; Reserved. - $EDQUOT + $dquot ;;; File exists. - $EEXIST + $exist ;;; Bad address. - $EFAULT + $fault ;;; File too large. - $EFBIG + $fbig ;;; Host is unreachable. - $EHOSTUNREACH + $hostunreach ;;; Identifier removed. - $EIDRM + $idrm ;;; Illegal byte sequence. - $EILSEQ + $ilseq ;;; Operation in progress. - $EINPROGRESS + $inprogress ;;; Interrupted function. - $EINTR + $intr ;;; Invalid argument. - $EINVAL + $inval ;;; I/O error. - $EIO + $io ;;; Socket is connected. - $EISCONN + $isconn ;;; Is a directory. - $EISDIR + $isdir ;;; Too many levels of symbolic links. - $ELOOP + $loop ;;; File descriptor value too large. - $EMFILE + $mfile ;;; Too many links. - $EMLINK + $mlink ;;; Message too large. - $EMSGSIZE + $msgsize ;;; Reserved. - $EMULTIHOP + $multihop ;;; Filename too long. - $ENAMETOOLONG + $nametoolong ;;; Network is down. - $ENETDOWN + $netdown ;;; Connection aborted by network. - $ENETRESET + $netreset ;;; Network unreachable. - $ENETUNREACH + $netunreach ;;; Too many files open in system. - $ENFILE + $nfile ;;; No buffer space available. - $ENOBUFS + $nobufs ;;; No such device. - $ENODEV + $nodev ;;; No such file or directory. - $ENOENT + $noent ;;; Executable file format error. - $ENOEXEC + $noexec ;;; No locks available. - $ENOLCK + $nolck ;;; Reserved. - $ENOLINK + $nolink ;;; Not enough space. - $ENOMEM + $nomem ;;; No message of the desired type. - $ENOMSG + $nomsg ;;; Protocol not available. - $ENOPROTOOPT + $noprotoopt ;;; No space left on device. - $ENOSPC + $nospc ;;; Function not supported. - $ENOSYS + $nosys ;;; The socket is not connected. - $ENOTCONN + $notconn ;;; Not a directory or a symbolic link to a directory. - $ENOTDIR + $notdir ;;; Directory not empty. - $ENOTEMPTY + $notempty ;;; State not recoverable. - $ENOTRECOVERABLE + $notrecoverable ;;; Not a socket. - $ENOTSOCK + $notsock ;;; Not supported, or operation not supported on socket. - $ENOTSUP + $notsup ;;; Inappropriate I/O control operation. - $ENOTTY + $notty ;;; No such device or address. - $ENXIO + $nxio ;;; Value too large to be stored in data type. - $EOVERFLOW + $overflow ;;; Previous owner died. - $EOWNERDEAD + $ownerdead ;;; Operation not permitted. - $EPERM + $perm ;;; Broken pipe. - $EPIPE + $pipe ;;; Protocol error. - $EPROTO + $proto ;;; Protocol not supported. - $EPROTONOSUPPORT + $protonosupport ;;; Protocol wrong type for socket. - $EPROTOTYPE + $prototype ;;; Result too large. - $ERANGE + $range ;;; Read-only file system. - $EROFS + $rofs ;;; Invalid seek. - $ESPIPE + $spipe ;;; No such process. - $ESRCH + $srch ;;; Reserved. - $ESTALE + $stale ;;; Connection timed out. - $ETIMEDOUT + $timedout ;;; Text file busy. - $ETXTBSY + $txtbsy ;;; Cross-device link. - $EXDEV + $xdev ;;; Extension: Capabilities insufficient. - $ENOTCAPABLE + $notcapable ) ) ;;; File descriptor rights, determining which actions may be performed. -(typename $rights_t +(typename $rights (flags u64 ;;; The right to invoke `fd_datasync`. ;; - ;;; If `RIGHT_PATH_OPEN` is set, includes the right to invoke - ;;; `path_open` with `FDFLAG_DSYNC`. - $RIGHT_FD_DATASYNC + ;;; If `path_open` is set, includes the right to invoke + ;;; `path_open` with `fdflag::dsync`. + $fd_datasync ;;; The right to invoke `fd_read` and `sock_recv`. ;; - ;;; If `RIGHT_FD_SEEK` is set, includes the right to invoke `fd_pread`. - $RIGHT_FD_READ - ;;; The right to invoke `fd_seek`. This flag implies `RIGHT_FD_TELL`. - $RIGHT_FD_SEEK + ;;; If `rights::fd_seek` is set, includes the right to invoke `fd_pread`. + $fd_read + ;;; The right to invoke `fd_seek`. This flag implies `rights::fd_tell`. + $fd_seek ;;; The right to invoke `fd_fdstat_set_flags`. - $RIGHT_FD_FDSTAT_SET_FLAGS + $fd_fdstat_set_flags ;;; The right to invoke `fd_sync`. ;; - ;;; If `RIGHT_PATH_OPEN` is set, includes the right to invoke - ;;; `path_open` with `FDFLAG_RSYNC` and `FDFLAG_DSYNC`. - $RIGHT_FD_SYNC + ;;; If `path_open` is set, includes the right to invoke + ;;; `path_open` with `fdflag::rsync` and `fdflag::dsync`. + $fd_sync ;;; The right to invoke `fd_seek` in such a way that the file offset ;;; remains unaltered (i.e., `WHENCE_CUR` with offset zero), or to ;;; invoke `fd_tell`. - $RIGHT_FD_TELL + $fd_tell ;;; The right to invoke `fd_write` and `sock_send`. - ;;; If `RIGHT_FD_SEEK` is set, includes the right to invoke `fd_pwrite`. - $RIGHT_FD_WRITE + ;;; If `rights::fd_seek` is set, includes the right to invoke `fd_pwrite`. + $fd_write ;;; The right to invoke `fd_advise`. - $RIGHT_FD_ADVISE + $fd_advise ;;; The right to invoke `fd_allocate`. - $RIGHT_FD_ALLOCATE + $fd_allocate ;;; The right to invoke `path_create_directory`. - $RIGHT_PATH_CREATE_DIRECTORY - ;;; If `RIGHT_PATH_OPEN` is set, the right to invoke `path_open` with `O_CREAT`. - $RIGHT_PATH_CREATE_FILE + $path_create_directory + ;;; If `path_open` is set, the right to invoke `path_open` with `oflags::creat`. + $path_create_file ;;; The right to invoke `path_link` with the file descriptor as the ;;; source directory. - $RIGHT_PATH_LINK_SOURCE + $path_link_source ;;; The right to invoke `path_link` with the file descriptor as the ;;; target directory. - $RIGHT_PATH_LINK_TARGET + $path_link_target ;;; The right to invoke `path_open`. - $RIGHT_PATH_OPEN + $path_open ;;; The right to invoke `fd_readdir`. - $RIGHT_FD_READDIR + $fd_readdir ;;; The right to invoke `path_readlink`. - $RIGHT_PATH_READLINK + $path_readlink ;;; The right to invoke `path_rename` with the file descriptor as the source directory. - $RIGHT_PATH_RENAME_SOURCE + $path_rename_source ;;; The right to invoke `path_rename` with the file descriptor as the target directory. - $RIGHT_PATH_RENAME_TARGET + $path_rename_target ;;; The right to invoke `path_filestat_get`. - $RIGHT_PATH_FILESTAT_GET + $path_filestat_get ;;; The right to change a file's size (there is no `path_filestat_set_size`). - ;;; If `RIGHT_PATH_OPEN` is set, includes the right to invoke `path_open` with `O_TRUNC`. - $RIGHT_PATH_FILESTAT_SET_SIZE + ;;; If `path_open` is set, includes the right to invoke `path_open` with `oflags::trunc`. + $path_filestat_set_size ;;; The right to invoke `path_filestat_set_times`. - $RIGHT_PATH_FILESTAT_SET_TIMES + $path_filestat_set_times ;;; The right to invoke `fd_filestat_get`. - $RIGHT_FD_FILESTAT_GET + $fd_filestat_get ;;; The right to invoke `fd_filestat_set_size`. - $RIGHT_FD_FILESTAT_SET_SIZE + $fd_filestat_set_size ;;; The right to invoke `fd_filestat_set_times`. - $RIGHT_FD_FILESTAT_SET_TIMES + $fd_filestat_set_times ;;; The right to invoke `path_symlink`. - $RIGHT_PATH_SYMLINK + $path_symlink ;;; The right to invoke `path_remove_directory`. - $RIGHT_PATH_REMOVE_DIRECTORY + $path_remove_directory ;;; The right to invoke `path_unlink_file`. - $RIGHT_PATH_UNLINK_FILE - ;;; If `RIGHT_FD_READ` is set, includes the right to invoke `poll_oneoff` to subscribe to `EVENTTYPE_FD_READ`. - ;;; If `RIGHT_FD_WRITE` is set, includes the right to invoke `poll_oneoff` to subscribe to `EVENTTYPE_FD_WRITE`. - $RIGHT_POLL_FD_READWRITE + $path_unlink_file + ;;; If `rights::fd_read` is set, includes the right to invoke `poll_oneoff` to subscribe to `eventtype::fd_read`. + ;;; If `rights::fd_write` is set, includes the right to invoke `poll_oneoff` to subscribe to `eventtype::fd_write`. + $poll_fd_readwrite ;;; The right to invoke `sock_shutdown`. - $RIGHT_SOCK_SHUTDOWN + $sock_shutdown ) ) ;;; A file descriptor index. -(typename $fd_t u32) +(typename $fd u32) ;;; A region of memory for scatter/gather reads. -(typename $iovec_t +(typename $iovec (struct ;;; The address of the buffer to be filled. (field $buf (@witx pointer u8)) ;;; The length of the buffer to be filled. - (field $buf_len $size_t) + (field $buf_len $size) ) ) ;;; A region of memory for scatter/gather writes. -(typename $ciovec_t +(typename $ciovec (struct ;;; The address of the buffer to be written. (field $buf (@witx const_pointer u8)) ;;; The length of the buffer to be written. - (field $buf_len $size_t) + (field $buf_len $size) ) ) -(typename $iovec_t_array (array $iovec_t)) -(typename $ciovec_t_array (array $ciovec_t)) +(typename $iovec_array (array $iovec)) +(typename $ciovec_array (array $ciovec)) ;;; Relative offset within a file. -(typename $filedelta_t s64) +(typename $filedelta s64) ;;; The position relative to which to set the offset of the file descriptor. -(typename $whence_t +(typename $whence (enum u8 ;;; Seek relative to start-of-file. - $WHENCE_SET + $set ;;; Seek relative to current position. - $WHENCE_CUR + $cur ;;; Seek relative to end-of-file. - $WHENCE_END + $end ) ) ;;; A reference to the offset of a directory entry. ;;; ;;; The value 0 signifies the start of the directory. -(typename $dircookie_t u64) +(typename $dircookie u64) -;;; The type for the $d_namlen field of $dirent_t. -(typename $dirnamlen_t u32) +;;; The type for the $d_namlen field of $dirent. +(typename $dirnamlen u32) ;;; File serial number that is unique within its file system. -(typename $inode_t u64) +(typename $inode u64) ;;; The type of a file descriptor or file. -(typename $filetype_t +(typename $filetype (enum u8 ;;; The type of the file descriptor or file is unknown or is different from any of the other types specified. - $FILETYPE_UNKNOWN + $unknown ;;; The file descriptor or file refers to a block device inode. - $FILETYPE_BLOCK_DEVICE + $block_device ;;; The file descriptor or file refers to a character device inode. - $FILETYPE_CHARACTER_DEVICE + $character_device ;;; The file descriptor or file refers to a directory inode. - $FILETYPE_DIRECTORY + $directory ;;; The file descriptor or file refers to a regular file inode. - $FILETYPE_REGULAR_FILE + $regular_file ;;; The file descriptor or file refers to a datagram socket. - $FILETYPE_SOCKET_DGRAM + $socket_dgram ;;; The file descriptor or file refers to a byte-stream socket. - $FILETYPE_SOCKET_STREAM + $socket_stream ;;; The file refers to a symbolic link inode. - $FILETYPE_SYMBOLIC_LINK + $symbolic_link ) ) ;;; A directory entry. -(typename $dirent_t +(typename $dirent (struct ;;; The offset of the next directory entry stored in this directory. - (field $d_next $dircookie_t) + (field $d_next $dircookie) ;;; The serial number of the file referred to by this directory entry. - (field $d_ino $inode_t) + (field $d_ino $inode) ;;; The length of the name of the directory entry. - (field $d_namlen $dirnamlen_t) + (field $d_namlen $dirnamlen) ;;; The type of the file referred to by this directory entry. - (field $d_type $filetype_t) + (field $d_type $filetype) ) ) ;;; File or memory access pattern advisory information. -(typename $advice_t +(typename $advice (enum u8 ;;; The application has no advice to give on its behavior with respect to the specified data. - $ADVICE_NORMAL + $normal ;;; The application expects to access the specified data sequentially from lower offsets to higher offsets. - $ADVICE_SEQUENTIAL + $sequential ;;; The application expects to access the specified data in a random order. - $ADVICE_RANDOM + $random ;;; The application expects to access the specified data in the near future. - $ADVICE_WILLNEED + $willneed ;;; The application expects that it will not access the specified data in the near future. - $ADVICE_DONTNEED + $dontneed ;;; The application expects to access the specified data once and then not reuse it thereafter. - $ADVICE_NOREUSE + $noreuse ) ) ;;; File descriptor flags. -(typename $fdflags_t +(typename $fdflags (flags u16 ;;; Append mode: Data written to the file is always appended to the file's end. - $FDFLAG_APPEND + $append ;;; Write according to synchronized I/O data integrity completion. Only the data stored in the file is synchronized. - $FDFLAG_DSYNC + $dsync ;;; Non-blocking mode. - $FDFLAG_NONBLOCK + $nonblock ;;; Synchronized read I/O operations. - $FDFLAG_RSYNC + $rsync ;;; Write according to synchronized I/O file integrity completion. In ;;; addition to synchronizing the data stored in the file, the implementation ;;; may also synchronously update the file's metadata. - $FDFLAG_SYNC + $sync ) ) ;;; File descriptor attributes. -(typename $fdstat_t +(typename $fdstat (struct ;;; File type. - (field $fs_filetype $filetype_t) + (field $fs_filetype $filetype) ;;; File descriptor flags. - (field $fs_flags $fdflags_t) + (field $fs_flags $fdflags) ;;; Rights that apply to this file descriptor. - (field $fs_rights_base $rights_t) + (field $fs_rights_base $rights) ;;; Maximum set of rights that may be installed on new file descriptors that ;;; are created through this file descriptor, e.g., through `path_open`. - (field $fs_rights_inheriting $rights_t) + (field $fs_rights_inheriting $rights) ) ) ;;; Identifier for a device containing a file system. Can be used in combination -;;; with `inode_t` to uniquely identify a file or directory in the filesystem. -(typename $device_t u64) +;;; with `inode` to uniquely identify a file or directory in the filesystem. +(typename $device u64) ;;; Which file time attributes to adjust. -(typename $fstflags_t +(typename $fstflags (flags u16 - ;;; Adjust the last data access timestamp to the value stored in `filestat_t::st_atim`. - $FILESTAT_SET_ATIM - ;;; Adjust the last data access timestamp to the time of clock `CLOCK_REALTIME`. - $FILESTAT_SET_ATIM_NOW - ;;; Adjust the last data modification timestamp to the value stored in `filestat_t::st_mtim`. - $FILESTAT_SET_MTIM - ;;; Adjust the last data modification timestamp to the time of clock `CLOCK_REALTIME`. - $FILESTAT_SET_MTIM_NOW + ;;; Adjust the last data access timestamp to the value stored in `filestat::st_atim`. + $atim + ;;; Adjust the last data access timestamp to the time of clock `clock::realtime`. + $atim_now + ;;; Adjust the last data modification timestamp to the value stored in `filestat::st_mtim`. + $mtim + ;;; Adjust the last data modification timestamp to the time of clock `clock::realtime`. + $mtim_now ) ) ;;; Flags determining the method of how paths are resolved. -(typename $lookupflags_t +(typename $lookupflags (flags u32 ;;; As long as the resolved path corresponds to a symbolic link, it is expanded. - $LOOKUP_SYMLINK_FOLLOW + $symlink_follow ) ) ;;; Open flags used by `path_open`. -(typename $oflags_t +(typename $oflags (flags u16 ;;; Create file if it does not exist. - $O_CREAT + $creat ;;; Fail if not a directory. - $O_DIRECTORY + $directory ;;; Fail if file already exists. - $O_EXCL + $excl ;;; Truncate file to size 0. - $O_TRUNC + $trunc ) ) ;;; Number of hard links to an inode. -(typename $linkcount_t u64) +(typename $linkcount u64) ;;; File attributes. -(typename $filestat_t +(typename $filestat (struct ;;; Device ID of device containing the file. - (field $st_dev $device_t) + (field $dev $device) ;;; File serial number. - (field $st_ino $inode_t) + (field $ino $inode) ;;; File type. - (field $st_filetype $filetype_t) + (field $filetype $filetype) ;;; Number of hard links to the file. - (field $st_nlink $linkcount_t) + (field $nlink $linkcount) ;;; For regular files, the file size in bytes. For symbolic links, the length in bytes of the pathname contained in the symbolic link. - (field $st_size $filesize_t) + (field $size $filesize) ;;; Last data access timestamp. - (field $st_atim $timestamp_t) + (field $atim $timestamp) ;;; Last data modification timestamp. - (field $st_mtim $timestamp_t) + (field $mtim $timestamp) ;;; Last file status change timestamp. - (field $st_ctim $timestamp_t) + (field $ctim $timestamp) ) ) ;;; User-provided value that may be attached to objects that is retained when ;;; extracted from the implementation. -(typename $userdata_t u64) +(typename $userdata u64) ;;; Type of a subscription to an event or its occurrence. -(typename $eventtype_t +(typename $eventtype (enum u8 - ;;; The time value of clock `subscription_t::u.clock.clock_id` has - ;;; reached timestamp `subscription_t::u.clock.timeout`. - $EVENTTYPE_CLOCK - ;;; File descriptor `subscription_t::u.fd_readwrite.fd` has data + ;;; The time value of clock `subscription::u.clock.clock_id` has + ;;; reached timestamp `subscription::u.clock.timeout`. + $clock + ;;; File descriptor `subscription::u.fd_readwrite.fd` has data ;;; available for reading. This event always triggers for regular files. - $EVENTTYPE_FD_READ - ;;; File descriptor `subscription_t::u.fd_readwrite.fd` has capacity + $fd_read + ;;; File descriptor `subscription::u.fd_readwrite.fd` has capacity ;;; available for writing. This event always triggers for regular files. - $EVENTTYPE_FD_WRITE + $fd_write ) ) ;;; The state of the file descriptor subscribed to with -;;; `EVENTTYPE_FD_READ` or `EVENTTYPE_FD_WRITE`. -(typename $eventrwflags_t +;;; `eventtype::fd_read` or `eventtype::fd_write`. +(typename $eventrwflags (flags u16 ;;; The peer of this socket has closed or disconnected. - $EVENT_FD_READWRITE_HANGUP + $fd_readwrite_hangup ) ) -;;; The contents of an $event_t when type is `EVENTTYPE_FD_READ` or -;;; `EVENTTYPE_FD_WRITE`. -(typename $event_fd_readwrite_t +;;; The contents of an $event when type is `eventtype::fd_read` or +;;; `eventtype::fd_write`. +(typename $event_fd_readwrite (struct ;;; The number of bytes available for reading or writing. - (field $nbytes $filesize_t) + (field $nbytes $filesize) ;;; The state of the file descriptor. - (field $flags $eventrwflags_t) + (field $flags $eventrwflags) ) ) -;;; The contents of an $event_t. +;;; The contents of an $event. (typename $event_u (union - ;;; When type is `EVENTTYPE_FD_READ` or `EVENTTYPE_FD_WRITE`: - (field $fd_readwrite $event_fd_readwrite_t) + ;;; When type is `eventtype::fd_read` or `eventtype::fd_write`: + (field $fd_readwrite $event_fd_readwrite) ) ) ;;; An event that occurred. -(typename $event_t +(typename $event (struct - ;;; User-provided value that got attached to `subscription_t::userdata`. - (field $userdata $userdata_t) + ;;; User-provided value that got attached to `subscription::userdata`. + (field $userdata $userdata) ;;; If non-zero, an error that occurred while processing the subscription request. - (field $error $errno_t) + (field $error $errno) ;;; The type of the event that occurred. - (field $type $eventtype_t) + (field $type $eventtype) ;;; The contents of the event. (field $u $event_u) ) ) ;;; Flags determining how to interpret the timestamp provided in -;;; `subscription_t::u.clock.timeout.` -(typename $subclockflags_t +;;; `subscription::u.clock.timeout.` +(typename $subclockflags (flags u16 ;;; If set, treat the timestamp provided in - ;;; `subscription_t::u.clock.timeout` as an absolute timestamp of clock - ;;; `subscription_t::u.clock.clock_id.` If clear, treat the timestamp - ;;; provided in `subscription_t::u.clock.timeout` relative to the - ;;; current time value of clock `subscription_t::u.clock.clock_id.` - $SUBSCRIPTION_CLOCK_ABSTIME + ;;; `subscription::u.clock.timeout` as an absolute timestamp of clock + ;;; `subscription::u.clock.clock_id.` If clear, treat the timestamp + ;;; provided in `subscription::u.clock.timeout` relative to the + ;;; current time value of clock `subscription::u.clock.clock_id.` + $subscription_clock_abstime ) ) -;;; The contents of a $subscription_t when type is `EVENTTYPE_CLOCK`. -(typename $subscription_clock_t +;;; The contents of a $subscription when type is `eventtype::clock`. +(typename $subscription_clock (struct ;;; The clock against which to compare the timestamp. - (field $clock_id $clockid_t) + (field $id $clockid) ;;; The absolute or relative timestamp. - (field $timeout $timestamp_t) + (field $timeout $timestamp) ;;; The amount of time that the implementation may wait additionally ;;; to coalesce with other events. - (field $precision $timestamp_t) + (field $precision $timestamp) ;;; Flags specifying whether the timeout is absolute or relative - (field $flags $subclockflags_t) + (field $flags $subclockflags) ) ) -;;; The contents of a $subscription_t when type is type is -;;; `EVENTTYPE_FD_READ` or `EVENTTYPE_FD_WRITE`. -(typename $subscription_fd_readwrite_t +;;; The contents of a $subscription when type is type is +;;; `eventtype::fd_read` or `eventtype::fd_write`. +(typename $subscription_fd_readwrite (struct ;;; The file descriptor on which to wait for it to become ready for reading or writing. - (field $file_descriptor $fd_t) + (field $file_descriptor $fd) ) ) -;;; The contents of a $subscription_t. +;;; The contents of a $subscription. (typename $subscription_u (union - ;;; When type is `EVENTTYPE_CLOCK`: - (field $clock $subscription_clock_t) - ;;; When type is `EVENTTYPE_FD_READ` or `EVENTTYPE_FD_WRITE`: - (field $fd_readwrite $subscription_fd_readwrite_t) + ;;; When type is `eventtype::clock`: + (field $clock $subscription_clock) + ;;; When type is `eventtype::fd_read` or `eventtype::fd_write`: + (field $fd_readwrite $subscription_fd_readwrite) ) ) ;;; Subscription to an event. -(typename $subscription_t +(typename $subscription (struct ;;; User-provided value that is attached to the subscription in the - ;;; implementation and returned through `event_t::userdata`. - (field $userdata $userdata_t) + ;;; implementation and returned through `event::userdata`. + (field $userdata $userdata) ;;; The type of the event to which to subscribe. - (field $type $eventtype_t) + (field $type $eventtype) ;;; The contents of the subscription. (field $u $subscription_u) ) ) ;;; Exit code generated by a process when exiting. -(typename $exitcode_t u32) +(typename $exitcode u32) ;;; Signal condition. -(typename $signal_t +(typename $signal (enum u8 ;;; No signal. Note that POSIX has special semantics for `kill(pid, 0)`, ;;; so this value is reserved. - $SIGNONE + $none ;;; Hangup. ;;; Action: Terminates the process. - $SIGHUP + $hup ;;; Terminate interrupt signal. ;;; Action: Terminates the process. - $SIGINT + $int ;;; Terminal quit signal. ;;; Action: Terminates the process. - $SIGQUIT + $quit ;;; Illegal instruction. ;;; Action: Terminates the process. - $SIGILL + $ill ;;; Trace/breakpoint trap. ;;; Action: Terminates the process. - $SIGTRAP + $trap ;;; Process abort signal. ;;; Action: Terminates the process. - $SIGABRT + $abrt ;;; Access to an undefined portion of a memory object. ;;; Action: Terminates the process. - $SIGBUS + $bus ;;; Erroneous arithmetic operation. ;;; Action: Terminates the process. - $SIGFPE + $fpe ;;; Kill. ;;; Action: Terminates the process. - $SIGKILL + $kill ;;; User-defined signal 1. ;;; Action: Terminates the process. - $SIGUSR1 + $usr1 ;;; Invalid memory reference. ;;; Action: Terminates the process. - $SIGSEGV + $segv ;;; User-defined signal 2. ;;; Action: Terminates the process. - $SIGUSR2 + $usr2 ;;; Write on a pipe with no one to read it. ;;; Action: Ignored. - $SIGPIPE + $pipe ;;; Alarm clock. ;;; Action: Terminates the process. - $SIGALRM + $alrm ;;; Termination signal. ;;; Action: Terminates the process. - $SIGTERM + $term ;;; Child process terminated, stopped, or continued. ;;; Action: Ignored. - $SIGCHLD + $chld ;;; Continue executing, if stopped. ;;; Action: Continues executing, if stopped. - $SIGCONT + $cont ;;; Stop executing. ;;; Action: Stops executing. - $SIGSTOP + $stop ;;; Terminal stop signal. ;;; Action: Stops executing. - $SIGTSTP + $tstp ;;; Background process attempting read. ;;; Action: Stops executing. - $SIGTTIN + $ttin ;;; Background process attempting write. ;;; Action: Stops executing. - $SIGTTOU + $ttou ;;; High bandwidth data is available at a socket. ;;; Action: Ignored. - $SIGURG + $urg ;;; CPU time limit exceeded. ;;; Action: Terminates the process. - $SIGXCPU + $xcpu ;;; File size limit exceeded. ;;; Action: Terminates the process. - $SIGXFSZ + $xfsz ;;; Virtual timer expired. ;;; Action: Terminates the process. - $SIGVTALRM + $vtalrm ;;; Profiling timer expired. ;;; Action: Terminates the process. - $SIGPROF + $prof ;;; Window changed. ;;; Action: Ignored. - $SIGWINCH + $winch ;;; I/O possible. ;;; Action: Terminates the process. - $SIGPOLL + $poll ;;; Power failure. ;;; Action: Terminates the process. - $SIGPWR + $pwr ;;; Bad system call. ;;; Action: Terminates the process. - $SIGSYS + $sys ) ) ;;; Flags provided to `sock_recv`. -(typename $riflags_t +(typename $riflags (flags u16 ;;; Returns the message without removing it from the socket's receive queue. - $SOCK_RECV_PEEK + $recv_peek ;;; On byte-stream sockets, block until the full amount of data can be returned. - $SOCK_RECV_WAITALL + $recv_waitall ) ) ;;; Flags returned by `sock_recv`. -(typename $roflags_t +(typename $roflags (flags u16 ;;; Returned by `sock_recv`: Message data has been truncated. - $SOCK_RECV_DATA_TRUNCATED + $recv_data_truncated ) ) ;;; Flags provided to `sock_send`. As there are currently no flags ;;; defined, it must be set to zero. -(typename $siflags_t u16) +(typename $siflags u16) ;;; Which channels on a socket to shut down. -(typename $sdflags_t +(typename $sdflags (flags u8 ;;; Disables further receive operations. - $SHUT_RD + $rd ;;; Disables further send operations. - $SHUT_WR + $wr ) ) ;;; Identifiers for preopened capabilities. -(typename $preopentype_t +(typename $preopentype (enum u8 ;;; A pre-opened directory. - $PREOPENTYPE_DIR + $dir ) ) -;;; The contents of a $prestat_t when type is `PREOPENTYPE_DIR`. +;;; The contents of a $prestat when type is `preopentype::dir`. (typename $prestat_dir (struct ;;; The length of the directory name for use with `fd_prestat_dir_name`. - (field $pr_name_len $size_t) + (field $pr_name_len $size) ) ) -;;; The contents of an $prestat_t. +;;; The contents of an $prestat. (typename $prestat_u (union - ;;; When type is `PREOPENTYPE_DIR`: + ;;; When type is `preopentype::dir`: (field $dir $prestat_dir) ) ) ;;; Information about a pre-opened capability. -(typename $prestat_t +(typename $prestat (struct ;;; The type of the pre-opened capability. - (field $pr_type $preopentype_t) + (field $pr_type $preopentype) ;;; The contents of the information. (field $u $prestat_u) ) diff --git a/phases/snapshot/witx/wasi_snapshot_preview1.witx b/phases/snapshot/witx/wasi_snapshot_preview1.witx index e69b788dc..44a297b8c 100644 --- a/phases/snapshot/witx/wasi_snapshot_preview1.witx +++ b/phases/snapshot/witx/wasi_snapshot_preview1.witx @@ -17,15 +17,15 @@ (@interface func (export "args_get") (param $argv (@witx pointer (@witx pointer u8))) (param $argv_buf (@witx pointer u8)) - (result $error $errno_t) + (result $error $errno) ) ;;; Return command-line argument data sizes. (@interface func (export "args_sizes_get") - (result $error $errno_t) + (result $error $errno) ;;; The number of arguments. - (result $argc $size_t) + (result $argc $size) ;;; The size of the argument string data. - (result $argv_buf_size $size_t) + (result $argv_buf_size $size) ) ;;; Read environment variable data. @@ -33,187 +33,187 @@ (@interface func (export "environ_get") (param $environ (@witx pointer (@witx pointer u8))) (param $environ_buf (@witx pointer u8)) - (result $error $errno_t) + (result $error $errno) ) ;;; Return command-line argument data sizes. (@interface func (export "environ_sizes_get") - (result $error $errno_t) + (result $error $errno) ;;; The number of arguments. - (result $argc $size_t) + (result $argc $size) ;;; The size of the argument string data. - (result $argv_buf_size $size_t) + (result $argv_buf_size $size) ) ;;; Return the resolution of a clock. ;;; Implementations are required to provide a non-zero value for supported clocks. For unsupported clocks, return `WASI_EINVAL` ;;; Note: This is similar to `clock_getres` in POSIX. (@interface func (export "clock_res_get") - (result $error $errno_t) + (result $error $errno) ;;; The clock for which to return the resolution. - (param $clock_id $clockid_t) + (param $id $clockid) ;;; The resolution of the clock. - (result $resolution $timestamp_t) + (result $resolution $timestamp) ) ;;; Return the time value of a clock. ;;; Note: This is similar to `clock_gettime` in POSIX. (@interface func (export "clock_time_get") ;;; The clock for which to return the time. - (param $clock_id $clockid_t) + (param $id $clockid) ;;; The maximum lag (exclusive) that the returned time value may have, compared to its actual value. - (param $precision $timestamp_t) - (result $error $errno_t) + (param $precision $timestamp) + (result $error $errno) ;;; The time value of the clock. - (result $time $timestamp_t) + (result $time $timestamp) ) ;;; Provide file advisory information on a file descriptor. ;;; Note: This is similar to `posix_fadvise` in POSIX. (@interface func (export "fd_advise") - (param $fd $fd_t) + (param $fd $fd) ;;; The offset within the file to which the advisory applies. - (param $offset $filesize_t) + (param $offset $filesize) ;;; The length of the region to which the advisory applies. - (param $len $filesize_t) + (param $len $filesize) ;;; The advice. - (param $advice $advice_t) - (result $error $errno_t) + (param $advice $advice) + (result $error $errno) ) ;;; Force the allocation of space in a file. ;;; Note: This is similar to `posix_fallocate` in POSIX. (@interface func (export "fd_allocate") - (param $fd $fd_t) + (param $fd $fd) ;;; The offset at which to start the allocation. - (param $offset $filesize_t) + (param $offset $filesize) ;;; The length of the area that is allocated. - (param $len $filesize_t) - (result $error $errno_t) + (param $len $filesize) + (result $error $errno) ) ;;; Close a file descriptor. ;;; Note: This is similar to `close` in POSIX. (@interface func (export "fd_close") - (param $fd $fd_t) - (result $error $errno_t) + (param $fd $fd) + (result $error $errno) ) ;;; Synchronize the data of a file to disk. ;;; Note: This is similar to `fdatasync` in POSIX. (@interface func (export "fd_datasync") - (param $fd $fd_t) - (result $error $errno_t) + (param $fd $fd) + (result $error $errno) ) ;;; Get the attributes of a file descriptor. ;;; Note: This returns similar flags to `fsync(fd, F_GETFL)` in POSIX, as well as additional fields. (@interface func (export "fd_fdstat_get") - (param $fd $fd_t) - (result $error $errno_t) + (param $fd $fd) + (result $error $errno) ;;; The buffer where the file descriptor's attributes are stored. - (result $stat $fdstat_t) + (result $stat $fdstat) ) ;;; Adjust the flags associated with a file descriptor. ;;; Note: This is similar to `fcntl(fd, F_SETFL, flags)` in POSIX. (@interface func (export "fd_fdstat_set_flags") - (param $fd $fd_t) + (param $fd $fd) ;;; The desired values of the file descriptor flags. - (param $flags $fdflags_t) - (result $error $errno_t) + (param $flags $fdflags) + (result $error $errno) ) ;;; Adjust the rights associated with a file descriptor. ;;; This can only be used to remove rights, and returns `ENOTCAPABLE` if called in a way that would attempt to add rights (@interface func (export "fd_fdstat_set_rights") - (param $fd $fd_t) + (param $fd $fd) ;;; The desired rights of the file descriptor. - (param $fs_rights_base $rights_t) - (param $fs_rights_inheriting $rights_t) - (result $error $errno_t) + (param $fs_rights_base $rights) + (param $fs_rights_inheriting $rights) + (result $error $errno) ) ;;; Return the attributes of an open file. (@interface func (export "fd_filestat_get") - (param $fd $fd_t) - (result $error $errno_t) + (param $fd $fd) + (result $error $errno) ;;; The buffer where the file's attributes are stored. - (result $buf $filestat_t) + (result $buf $filestat) ) ;;; Adjust the size of an open file. If this increases the file's size, the extra bytes are filled with zeros. ;;; Note: This is similar to `ftruncate` in POSIX. (@interface func (export "fd_filestat_set_size") - (param $fd $fd_t) + (param $fd $fd) ;;; The desired file size. - (param $st_size $filesize_t) - (result $error $errno_t) + (param $size $filesize) + (result $error $errno) ) ;;; Adjust the timestamps of an open file or directory. ;;; Note: This is similar to `futimens` in POSIX. (@interface func (export "fd_filestat_set_times") - (param $fd $fd_t) + (param $fd $fd) ;;; The desired values of the data access timestamp. - (param $st_atim $timestamp_t) + (param $atim $timestamp) ;;; The desired values of the data modification timestamp. - (param $st_mtim $timestamp_t) + (param $mtim $timestamp) ;;; A bitmask indicating which timestamps to adjust. - (param $fst_flags $fstflags_t) - (result $error $errno_t) + (param $fst_flags $fstflags) + (result $error $errno) ) ;;; Read from a file descriptor, without using and updating the file descriptor's offset. ;;; Note: This is similar to `preadv` in POSIX. (@interface func (export "fd_pread") - (param $fd $fd_t) + (param $fd $fd) ;;; List of scatter/gather vectors in which to store data. - (param $iovs $iovec_t_array) + (param $iovs $iovec_array) ;;; The offset within the file at which to read. - (param $offset $filesize_t) - (result $error $errno_t) + (param $offset $filesize) + (result $error $errno) ;;; The number of bytes read. - (result $nread $size_t) + (result $nread $size) ) ;;; Return a description of the given preopened file descriptor. (@interface func (export "fd_prestat_get") - (param $fd $fd_t) - (result $error $errno_t) + (param $fd $fd) + (result $error $errno) ;;; The buffer where the description is stored. - (result $buf $prestat_t) + (result $buf $prestat) ) ;;; Return a description of the given preopened file descriptor. (@interface func (export "fd_prestat_dir_name") - (param $fd $fd_t) + (param $fd $fd) ;;; A buffer into which to write the preopened directory name. (param $path (@witx pointer u8)) - (param $path_len $size_t) - (result $error $errno_t) + (param $path_len $size) + (result $error $errno) ) ;;; Write to a file descriptor, without using and updating the file descriptor's offset. ;;; Note: This is similar to `pwritev` in POSIX. (@interface func (export "fd_pwrite") - (param $fd $fd_t) + (param $fd $fd) ;;; List of scatter/gather vectors from which to retrieve data. - (param $iovs $ciovec_t_array) + (param $iovs $ciovec_array) ;;; The offset within the file at which to write. - (param $offset $filesize_t) - (result $error $errno_t) + (param $offset $filesize) + (result $error $errno) ;;; The number of bytes written. - (result $nwritten $size_t) + (result $nwritten $size) ) ;;; Read from a file descriptor. ;;; Note: This is similar to `readv` in POSIX. (@interface func (export "fd_read") - (param $fd $fd_t) + (param $fd $fd) ;;; List of scatter/gather vectors to which to store data. - (param $iovs $iovec_t_array) - (result $error $errno_t) + (param $iovs $iovec_array) + (result $error $errno) ;;; The number of bytes read. - (result $nread $size_t) + (result $nread $size) ) ;;; Read directory entries from a directory. @@ -227,15 +227,15 @@ ;;; read buffer size in case it's too small to fit a single large directory ;;; entry, or skip the oversized directory entry. (@interface func (export "fd_readdir") - (param $fd $fd_t) + (param $fd $fd) ;;; The buffer where directory entries are stored (param $buf (@witx pointer u8)) - (param $buf_len $size_t) + (param $buf_len $size) ;;; The location within the directory to start reading - (param $cookie $dircookie_t) - (result $error $errno_t) + (param $cookie $dircookie) + (result $error $errno) ;;; The number of bytes stored in the read buffer. If less than the size of the read buffer, the end of the directory has been reached. - (result $bufused $size_t) + (result $bufused $size) ) ;;; Atomically replace a file descriptor by renumbering another file descriptor. @@ -249,104 +249,104 @@ ;;; This function provides a way to atomically renumber file descriptors, which ;;; would disappear if `dup2()` were to be removed entirely. (@interface func (export "fd_renumber") - (param $fd $fd_t) + (param $fd $fd) ;;; The file descriptor to overwrite. - (param $to $fd_t) - (result $error $errno_t) + (param $to $fd) + (result $error $errno) ) ;;; Move the offset of a file descriptor. ;;; Note: This is similar to `lseek` in POSIX. (@interface func (export "fd_seek") - (param $fd $fd_t) + (param $fd $fd) ;;; The number of bytes to move. - (param $offset $filedelta_t) + (param $offset $filedelta) ;;; The base from which the offset is relative. - (param $whence $whence_t) - (result $error $errno_t) + (param $whence $whence) + (result $error $errno) ;;; The new offset of the file descriptor, relative to the start of the file. - (result $newoffset $filesize_t) + (result $newoffset $filesize) ) ;;; Synchronize the data and metadata of a file to disk. ;;; Note: This is similar to `fsync` in POSIX. (@interface func (export "fd_sync") - (param $fd $fd_t) - (result $error $errno_t) + (param $fd $fd) + (result $error $errno) ) ;;; Return the current offset of a file descriptor. ;;; Note: This is similar to `lseek(fd, 0, SEEK_CUR)` in POSIX. (@interface func (export "fd_tell") - (param $fd $fd_t) - (result $error $errno_t) + (param $fd $fd) + (result $error $errno) ;;; The current offset of the file descriptor, relative to the start of the file. - (result $offset $filesize_t) + (result $offset $filesize) ) ;;; Write to a file descriptor. ;;; Note: This is similar to `writev` in POSIX. (@interface func (export "fd_write") - (param $fd $fd_t) + (param $fd $fd) ;;; List of scatter/gather vectors from which to retrieve data. - (param $iovs $ciovec_t_array) - (result $error $errno_t) + (param $iovs $ciovec_array) + (result $error $errno) ;;; The number of bytes written. - (result $nwritten $size_t) + (result $nwritten $size) ) ;;; Create a directory. ;;; Note: This is similar to `mkdirat` in POSIX. (@interface func (export "path_create_directory") - (param $fd $fd_t) + (param $fd $fd) ;;; The path at which to create the directory. (param $path string) - (result $error $errno_t) + (result $error $errno) ) ;;; Return the attributes of a file or directory. ;;; Note: This is similar to `stat` in POSIX. (@interface func (export "path_filestat_get") - (param $fd $fd_t) + (param $fd $fd) ;;; Flags determining the method of how the path is resolved. - (param $flags $lookupflags_t) + (param $flags $lookupflags) ;;; The path of the file or directory to inspect. (param $path string) - (result $error $errno_t) + (result $error $errno) ;;; The buffer where the file's attributes are stored. - (result $buf $filestat_t) + (result $buf $filestat) ) ;;; Adjust the timestamps of a file or directory. ;;; Note: This is similar to `utimensat` in POSIX. (@interface func (export "path_filestat_set_times") - (param $fd $fd_t) + (param $fd $fd) ;;; Flags determining the method of how the path is resolved. - (param $flags $lookupflags_t) + (param $flags $lookupflags) ;;; The path of the file or directory to operate on. (param $path string) ;;; The desired values of the data access timestamp. - (param $st_atim $timestamp_t) + (param $atim $timestamp) ;;; The desired values of the data modification timestamp. - (param $st_mtim $timestamp_t) + (param $mtim $timestamp) ;;; A bitmask indicating which timestamps to adjust. - (param $fst_flags $fstflags_t) - (result $error $errno_t) + (param $fst_flags $fstflags) + (result $error $errno) ) ;;; Create a hard link. ;;; Note: This is similar to `linkat` in POSIX. (@interface func (export "path_link") - (param $old_fd $fd_t) + (param $old_fd $fd) ;;; Flags determining the method of how the path is resolved. - (param $old_flags $lookupflags_t) + (param $old_flags $lookupflags) ;;; The source path from which to link. (param $old_path string) ;;; The working directory at which the resolution of the new path starts. - (param $new_fd $fd_t) + (param $new_fd $fd) ;;; The destination path at which to create the hard link. (param $new_path string) - (result $error $errno_t) + (result $error $errno) ) ;;; Open a file or directory. @@ -359,14 +359,14 @@ ;; ;;; Note: This is similar to `openat` in POSIX. (@interface func (export "path_open") - (param $fd $fd_t) + (param $fd $fd) ;;; Flags determining the method of how the path is resolved. - (param $dirflags $lookupflags_t) + (param $dirflags $lookupflags) ;;; The relative path of the file or directory to open, relative to the ;;; `dirfd` directory. (param $path string) ;;; The method by which to open the file. - (param $o_flags $oflags_t) + (param $oflags $oflags) ;;; The initial rights of the newly created file descriptor. The ;;; implementation is allowed to return a file descriptor with fewer rights ;;; than specified, if and only if those rights do not apply to the type of @@ -375,49 +375,49 @@ ;;; The *base* rights are rights that will apply to operations using the file ;;; descriptor itself, while the *inheriting* rights are rights that apply to ;;; file descriptors derived from it. - (param $fs_rights_base $rights_t) - (param $fs_rights_inherting $rights_t) - (param $flags $fdflags_t) - (result $error $errno_t) + (param $fs_rights_base $rights) + (param $fs_rights_inherting $rights) + (param $fdflags $fdflags) + (result $error $errno) ;;; The file descriptor of the file that has been opened. - (result $opened_fd $fd_t) + (result $opened_fd $fd) ) ;;; Read the contents of a symbolic link. ;;; Note: This is similar to `readlinkat` in POSIX. (@interface func (export "path_readlink") - (param $fd $fd_t) + (param $fd $fd) ;;; The path of the symbolic link from which to read. (param $path string) ;;; The buffer to which to write the contents of the symbolic link. (param $buf (@witx pointer u8)) - (param $buf_len $size_t) - (result $error $errno_t) + (param $buf_len $size) + (result $error $errno) ;;; The number of bytes placed in the buffer. - (result $bufused $size_t) + (result $bufused $size) ) ;;; Remove a directory. ;;; Return `ENOTEMPTY` if the directory is not empty. ;;; Note: This is similar to `unlinkat(fd, path, AT_REMOVEDIR)` in POSIX. (@interface func (export "path_remove_directory") - (param $fd $fd_t) + (param $fd $fd) ;;; The path to a directory to remove. (param $path string) - (result $error $errno_t) + (result $error $errno) ) ;;; Rename a file or directory. ;;; Note: This is similar to `renameat` in POSIX. (@interface func (export "path_rename") - (param $fd $fd_t) + (param $fd $fd) ;;; The source path of the file or directory to rename. (param $old_path string) ;;; The working directory at which the resolution of the new path starts. - (param $new_fd $fd_t) + (param $new_fd $fd) ;;; The destination path to which to rename the file or directory. (param $new_path string) - (result $error $errno_t) + (result $error $errno) ) ;;; Create a symbolic link. @@ -425,10 +425,10 @@ (@interface func (export "path_symlink") ;;; The contents of the symbolic link. (param $old_path string) - (param $fd $fd_t) + (param $fd $fd) ;;; The destination path at which to create the symbolic link. (param $new_path string) - (result $error $errno_t) + (result $error $errno) ) @@ -436,23 +436,23 @@ ;;; Return `EISDIR` if the path refers to a directory. ;;; Note: This is similar to `unlinkat(fd, path, 0)` in POSIX. (@interface func (export "path_unlink_file") - (param $fd $fd_t) + (param $fd $fd) ;;; The path to a file to unlink. (param $path string) - (result $error $errno_t) + (result $error $errno) ) ;;; Concurrently poll for the occurrence of a set of events. (@interface func (export "poll_oneoff") ;;; The events to which to subscribe. - (param $in (@witx const_pointer $subscription_t)) + (param $in (@witx const_pointer $subscription)) ;;; The events that have occurred. - (param $out (@witx pointer $event_t)) + (param $out (@witx pointer $event)) ;;; Both the number of subscriptions and events. - (param $nsubscriptions $size_t) - (result $error $errno_t) + (param $nsubscriptions $size) + (result $error $errno) ;;; The number of events stored. - (result $nevents $size_t) + (result $nevents $size) ) ;;; Terminate the process normally. An exit code of 0 indicates successful @@ -460,21 +460,21 @@ ;;; the environment. (@interface func (export "proc_exit") ;;; The exit code returned by the process. - (param $rval $exitcode_t) + (param $rval $exitcode) ) ;;; Send a signal to the process of the calling thread. ;;; Note: This is similar to `raise` in POSIX. (@interface func (export "proc_raise") ;;; The signal condition to trigger. - (param $sig $signal_t) - (result $error $errno_t) + (param $sig $signal) + (result $error $errno) ) ;;; Temporarily yield execution of the calling thread. ;;; Note: This is similar to `sched_yield` in POSIX. (@interface func (export "sched_yield") - (result $error $errno_t) + (result $error $errno) ) ;;; Write high-quality random data into a buffer. @@ -486,46 +486,46 @@ (@interface func (export "random_get") ;;; The buffer to fill with random data. (param $buf (@witx pointer u8)) - (param $buf_len $size_t) - (result $error $errno_t) + (param $buf_len $size) + (result $error $errno) ) ;;; Receive a message from a socket. ;;; Note: This is similar to `recv` in POSIX, though it also supports reading ;;; the data into multiple buffers in the manner of `readv`. (@interface func (export "sock_recv") - (param $fd $fd_t) + (param $fd $fd) ;;; List of scatter/gather vectors to which to store data. - (param $ri_data $iovec_t_array) + (param $ri_data $iovec_array) ;;; Message flags. - (param $ri_flags $riflags_t) - (result $error $errno_t) + (param $ri_flags $riflags) + (result $error $errno) ;;; Number of bytes stored in ri_data. - (result $ro_datalen $size_t) + (result $ro_datalen $size) ;;; Message flags. - (result $ro_flags $roflags_t) + (result $ro_flags $roflags) ) ;;; Send a message on a socket. ;;; Note: This is similar to `send` in POSIX, though it also supports writing ;;; the data from multiple buffers in the manner of `writev`. (@interface func (export "sock_send") - (param $fd $fd_t) + (param $fd $fd) ;;; List of scatter/gather vectors to which to retrieve data - (param $si_data $ciovec_t_array) + (param $si_data $ciovec_array) ;;; Message flags. - (param $si_flags $siflags_t) - (result $error $errno_t) + (param $si_flags $siflags) + (result $error $errno) ;;; Number of bytes transmitted. - (result $so_datalen $size_t) + (result $so_datalen $size) ) ;;; Shut down socket send and receive channels. ;;; Note: This is similar to `shutdown` in POSIX. (@interface func (export "sock_shutdown") - (param $fd $fd_t) + (param $fd $fd) ;;; Which channels on the socket to shut down. - (param $how $sdflags_t) - (result $error $errno_t) + (param $how $sdflags) + (result $error $errno) ) ) diff --git a/tools/witx/tests/wasi.rs b/tools/witx/tests/wasi.rs index aef954236..938c78067 100644 --- a/tools/witx/tests/wasi.rs +++ b/tools/witx/tests/wasi.rs @@ -25,11 +25,6 @@ fn render_roundtrip() { let back_to_sexprs = format!("{}", doc); println!("{}", back_to_sexprs); - let doc2 = witx::parse(&back_to_sexprs) - .map_err(|e| e.report_with(&witx::MockFs::new(&[("-", &back_to_sexprs)]))) - .unwrap(); - - let back_to_sexprs = format!("{}", doc); let doc2 = witx::parse(&back_to_sexprs) .map_err(|e| e.report_with(&witx::MockFs::new(&[("-", &back_to_sexprs)])))