Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ else()
endif()

set(wasip2-version 0.2.0)
set(wasip3-version 0.3.0-rc-2026-01-06)
set(wasip3-version 0.3.0-rc-2026-03-15)

include(bindings)
include(builtins)
Expand Down
6 changes: 3 additions & 3 deletions cmake/wasi-wits.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ if(WKG_EXECUTABLE)
OUTPUT_VARIABLE WKG_VERSION
OUTPUT_STRIP_TRAILING_WHITESPACE)

if (NOT (WKG_VERSION MATCHES "0\\.13\\.0"))
message(WARNING "wkg version 0.13.0 is required, found: ${WKG_VERSION}")
if (NOT (WKG_VERSION MATCHES "0\\.15\\.0"))
message(WARNING "wkg version 0.15.0 is required, found: ${WKG_VERSION}")
set(WKG_EXECUTABLE "")
endif()
endif()
Expand All @@ -23,7 +23,7 @@ if (NOT WKG_EXECUTABLE)
ba_download(
wkg
"https://github.com/bytecodealliance/wasm-pkg-tools"
"0.13.0"
"0.15.0"
)
ExternalProject_Get_Property(wkg DOWNLOADED_FILE)
set(wkg_bin ${DOWNLOADED_FILE})
Expand Down
18 changes: 18 additions & 0 deletions expected/wasm32-wasip3/defined-symbols.txt
Original file line number Diff line number Diff line change
Expand Up @@ -618,7 +618,9 @@ fileno_unlocked
filesystem_borrow_descriptor
filesystem_descriptor_drop_own
filesystem_descriptor_stat_free
filesystem_descriptor_type_free
filesystem_directory_entry_free
filesystem_error_code_free
filesystem_future_result_void_error_code_cancel_read
filesystem_future_result_void_error_code_cancel_write
filesystem_future_result_void_error_code_drop_readable
Expand Down Expand Up @@ -833,6 +835,7 @@ inet_pton
initstate
insque
ioctl
ip_name_lookup_error_code_free
ip_name_lookup_ip_address_free
ip_name_lookup_list_ip_address_free
ip_name_lookup_resolve_addresses
Expand Down Expand Up @@ -1226,6 +1229,7 @@ snprintf
socket
sockets_borrow_tcp_socket
sockets_borrow_udp_socket
sockets_error_code_free
sockets_future_result_void_error_code_cancel_read
sockets_future_result_void_error_code_cancel_write
sockets_future_result_void_error_code_drop_readable
Expand Down Expand Up @@ -1315,6 +1319,13 @@ sscanf
stat
statvfs
stderr
stderr_future_result_void_error_code_cancel_read
stderr_future_result_void_error_code_cancel_write
stderr_future_result_void_error_code_drop_readable
stderr_future_result_void_error_code_drop_writable
stderr_future_result_void_error_code_new
stderr_future_result_void_error_code_read
stderr_future_result_void_error_code_write
stderr_result_void_error_code_free
stderr_write_via_stream
stdin
Expand All @@ -1335,6 +1346,13 @@ stdin_stream_u8_new
stdin_stream_u8_read
stdin_stream_u8_write
stdout
stdout_future_result_void_error_code_cancel_read
stdout_future_result_void_error_code_cancel_write
stdout_future_result_void_error_code_drop_readable
stdout_future_result_void_error_code_drop_writable
stdout_future_result_void_error_code_new
stdout_future_result_void_error_code_read
stdout_future_result_void_error_code_write
stdout_result_void_error_code_free
stdout_write_via_stream
stpcpy
Expand Down
52 changes: 27 additions & 25 deletions expected/wasm32-wasip3/predefined-macros.txt
Original file line number Diff line number Diff line change
Expand Up @@ -373,14 +373,14 @@
#define FILESYSTEM_DESCRIPTOR_FLAGS_READ (1 << 0)
#define FILESYSTEM_DESCRIPTOR_FLAGS_REQUESTED_WRITE_SYNC (1 << 4)
#define FILESYSTEM_DESCRIPTOR_FLAGS_WRITE (1 << 1)
#define FILESYSTEM_DESCRIPTOR_TYPE_BLOCK_DEVICE 1
#define FILESYSTEM_DESCRIPTOR_TYPE_CHARACTER_DEVICE 2
#define FILESYSTEM_DESCRIPTOR_TYPE_DIRECTORY 3
#define FILESYSTEM_DESCRIPTOR_TYPE_FIFO 4
#define FILESYSTEM_DESCRIPTOR_TYPE_REGULAR_FILE 6
#define FILESYSTEM_DESCRIPTOR_TYPE_SOCKET 7
#define FILESYSTEM_DESCRIPTOR_TYPE_SYMBOLIC_LINK 5
#define FILESYSTEM_DESCRIPTOR_TYPE_UNKNOWN 0
#define FILESYSTEM_DESCRIPTOR_TYPE_BLOCK_DEVICE 0
#define FILESYSTEM_DESCRIPTOR_TYPE_CHARACTER_DEVICE 1
#define FILESYSTEM_DESCRIPTOR_TYPE_DIRECTORY 2
#define FILESYSTEM_DESCRIPTOR_TYPE_FIFO 3
#define FILESYSTEM_DESCRIPTOR_TYPE_OTHER 7
#define FILESYSTEM_DESCRIPTOR_TYPE_REGULAR_FILE 5
#define FILESYSTEM_DESCRIPTOR_TYPE_SOCKET 6
#define FILESYSTEM_DESCRIPTOR_TYPE_SYMBOLIC_LINK 4
#define FILESYSTEM_ERROR_CODE_ACCESS 0
#define FILESYSTEM_ERROR_CODE_ALREADY 1
#define FILESYSTEM_ERROR_CODE_BAD_DESCRIPTOR 2
Expand Down Expand Up @@ -410,6 +410,7 @@
#define FILESYSTEM_ERROR_CODE_NO_LOCK 20
#define FILESYSTEM_ERROR_CODE_NO_SUCH_DEVICE 28
#define FILESYSTEM_ERROR_CODE_NO_TTY 27
#define FILESYSTEM_ERROR_CODE_OTHER 36
#define FILESYSTEM_ERROR_CODE_OVERFLOW 29
#define FILESYSTEM_ERROR_CODE_PIPE 31
#define FILESYSTEM_ERROR_CODE_QUOTA 5
Expand Down Expand Up @@ -1003,12 +1004,12 @@
#define IP_MULTICAST_IF 32
#define IP_MULTICAST_LOOP 34
#define IP_MULTICAST_TTL 33
#define IP_NAME_LOOKUP_ERROR_CODE_ACCESS_DENIED 1
#define IP_NAME_LOOKUP_ERROR_CODE_INVALID_ARGUMENT 2
#define IP_NAME_LOOKUP_ERROR_CODE_NAME_UNRESOLVABLE 3
#define IP_NAME_LOOKUP_ERROR_CODE_PERMANENT_RESOLVER_FAILURE 5
#define IP_NAME_LOOKUP_ERROR_CODE_TEMPORARY_RESOLVER_FAILURE 4
#define IP_NAME_LOOKUP_ERROR_CODE_UNKNOWN 0
#define IP_NAME_LOOKUP_ERROR_CODE_ACCESS_DENIED 0
#define IP_NAME_LOOKUP_ERROR_CODE_INVALID_ARGUMENT 1
#define IP_NAME_LOOKUP_ERROR_CODE_NAME_UNRESOLVABLE 2
#define IP_NAME_LOOKUP_ERROR_CODE_OTHER 5
#define IP_NAME_LOOKUP_ERROR_CODE_PERMANENT_RESOLVER_FAILURE 4
#define IP_NAME_LOOKUP_ERROR_CODE_TEMPORARY_RESOLVER_FAILURE 3
#define IP_NODEFRAG 22
#define IP_OFFMASK 0x1fff
#define IP_OPTIONS 4
Expand Down Expand Up @@ -1781,20 +1782,21 @@
#define SLC_XON 15
#define SNDPIPE 0x002
#define SNDZERO 0x001
#define SOCKETS_ERROR_CODE_ACCESS_DENIED 1
#define SOCKETS_ERROR_CODE_ADDRESS_IN_USE 8
#define SOCKETS_ERROR_CODE_ADDRESS_NOT_BINDABLE 7
#define SOCKETS_ERROR_CODE_ACCESS_DENIED 0
#define SOCKETS_ERROR_CODE_ADDRESS_IN_USE 7
#define SOCKETS_ERROR_CODE_ADDRESS_NOT_BINDABLE 6
#define SOCKETS_ERROR_CODE_CONNECTION_ABORTED 12
#define SOCKETS_ERROR_CODE_CONNECTION_REFUSED 10
#define SOCKETS_ERROR_CODE_CONNECTION_BROKEN 10
#define SOCKETS_ERROR_CODE_CONNECTION_REFUSED 9
#define SOCKETS_ERROR_CODE_CONNECTION_RESET 11
#define SOCKETS_ERROR_CODE_DATAGRAM_TOO_LARGE 13
#define SOCKETS_ERROR_CODE_INVALID_ARGUMENT 3
#define SOCKETS_ERROR_CODE_INVALID_STATE 6
#define SOCKETS_ERROR_CODE_NOT_SUPPORTED 2
#define SOCKETS_ERROR_CODE_OUT_OF_MEMORY 4
#define SOCKETS_ERROR_CODE_REMOTE_UNREACHABLE 9
#define SOCKETS_ERROR_CODE_TIMEOUT 5
#define SOCKETS_ERROR_CODE_UNKNOWN 0
#define SOCKETS_ERROR_CODE_INVALID_ARGUMENT 2
#define SOCKETS_ERROR_CODE_INVALID_STATE 5
#define SOCKETS_ERROR_CODE_NOT_SUPPORTED 1
#define SOCKETS_ERROR_CODE_OTHER 14
#define SOCKETS_ERROR_CODE_OUT_OF_MEMORY 3
#define SOCKETS_ERROR_CODE_REMOTE_UNREACHABLE 8
#define SOCKETS_ERROR_CODE_TIMEOUT 4
#define SOCKETS_IP_ADDRESS_FAMILY_IPV4 0
#define SOCKETS_IP_ADDRESS_FAMILY_IPV6 1
#define SOCKETS_IP_ADDRESS_IPV4 0
Expand Down
14 changes: 14 additions & 0 deletions expected/wasm32-wasip3/undefined-symbols.txt
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,13 @@ sockets_stream_u8__drop_writable
sockets_stream_u8__new
sockets_stream_u8__read
sockets_stream_u8__write
stderr_future_result_void_error_code__cancel_read
stderr_future_result_void_error_code__cancel_write
stderr_future_result_void_error_code__drop_readable
stderr_future_result_void_error_code__drop_writable
stderr_future_result_void_error_code__new
stderr_future_result_void_error_code__read
stderr_future_result_void_error_code__write
stdin_future_result_void_error_code__cancel_read
stdin_future_result_void_error_code__cancel_write
stdin_future_result_void_error_code__drop_readable
Expand All @@ -199,3 +206,10 @@ stdin_stream_u8__drop_writable
stdin_stream_u8__new
stdin_stream_u8__read
stdin_stream_u8__write
stdout_future_result_void_error_code__cancel_read
stdout_future_result_void_error_code__cancel_write
stdout_future_result_void_error_code__drop_readable
stdout_future_result_void_error_code__drop_writable
stdout_future_result_void_error_code__new
stdout_future_result_void_error_code__read
stdout_future_result_void_error_code__write
19 changes: 17 additions & 2 deletions libc-bottom-half/cloudlibc/src/common/errors.h
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
#include <wasi/api.h>

#if defined(__wasip2__) || defined(__wasip3__)
#include <assert.h>
#include <errno.h>
#include <stdlib.h>

static inline void translate_error(filesystem_error_code_t error) {
switch (error) {
static inline void translate_error(filesystem_error_code_t *error) {
#ifdef __wasip2__
switch (*error) {
#else
switch (error->tag) {
#endif
case FILESYSTEM_ERROR_CODE_ACCESS:
errno = EACCES;
break;
Expand Down Expand Up @@ -119,6 +124,16 @@ static inline void translate_error(filesystem_error_code_t error) {
case FILESYSTEM_ERROR_CODE_CROSS_DEVICE:
errno = EXDEV;
break;
#ifdef __wasip3__
case FILESYSTEM_ERROR_CODE_OTHER:
errno = EIO;
if (error->val.other.is_some) {
assert(error->val.other.val.ptr);
free(error->val.other.val.ptr);
error->val.other.is_some = false;
}
break;
#endif
default:
abort(); // Unreachable
}
Expand Down
2 changes: 1 addition & 1 deletion libc-bottom-half/cloudlibc/src/libc/dirent/fdopendir.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ DIR *fdopendir(int fd) {
&error_code);
if (!ok) {
free(dirp);
translate_error(error_code);
translate_error(&error_code);
return NULL;
}

Expand Down
24 changes: 8 additions & 16 deletions libc-bottom-half/cloudlibc/src/libc/dirent/readdir.c
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ static int ensure_has_directory_stream(DIR *dirp, filesystem_borrow_descriptor_t
&dirp->stream,
&error_code);
if (!ok) {
translate_error(error_code);
translate_error(&error_code);
return -1;
}
#elif defined(__wasip3__)
Expand Down Expand Up @@ -190,7 +190,7 @@ static struct dirent *readdir_next(DIR *dirp) {
&metadata,
&error_code);
if (!ok) {
translate_error(error_code);
translate_error(&error_code);
return NULL;
}
dirp->dirent->d_ino = metadata.lower;
Expand Down Expand Up @@ -221,7 +221,7 @@ static struct dirent *readdir_next(DIR *dirp) {
&dir_entry_optional,
&error_code);
if (!ok) {
translate_error(error_code);
translate_error(&error_code);
return NULL;
}

Expand Down Expand Up @@ -263,7 +263,7 @@ static struct dirent *readdir_next(DIR *dirp) {
filesystem_future_result_void_error_code_drop_readable(dirp->stream.f1);
dirp->stream.f1 = 0;
if (result.is_err)
translate_error(result.val.err);
translate_error(&result.val.err);
}

// The stream is closed, so return NULL. If `errno` needs to be set it'll
Expand All @@ -277,16 +277,12 @@ static struct dirent *readdir_next(DIR *dirp) {
// Ensure that the dirent is large enough to fit the filename
size_t the_size = offsetof(struct dirent, d_name);
if (grow(&dirp->dirent, &dirp->dirent_size, the_size + dir_entry.name.len + 1) == NULL) {
#ifdef __wasip2__
wasip2_string_free(&dir_entry.name);
#else
wasip3_string_free(&dir_entry.name);
#endif
filesystem_directory_entry_free(&dir_entry);
return NULL;
}

// Fill out `d_type` and `d_name`
dirp->dirent->d_type = dir_entry_type_to_d_type(dir_entry.type);
dirp->dirent->d_type = dir_entry_type_to_d_type(&dir_entry.type);
memcpy(dirp->dirent->d_name, dir_entry.name.ptr, dir_entry.name.len);
dirp->dirent->d_name[dir_entry.name.len] = '\0';

Expand All @@ -297,13 +293,9 @@ static struct dirent *readdir_next(DIR *dirp) {
&dir_entry.name,
&metadata,
&error_code);
#ifdef __wasip2__
wasip2_string_free(&dir_entry.name);
#else
wasip3_string_free(&dir_entry.name);
#endif
filesystem_directory_entry_free(&dir_entry);
if (!ok) {
translate_error(error_code);
translate_error(&error_code);
return NULL;
}
dirp->dirent->d_ino = metadata.lower;
Expand Down
2 changes: 1 addition & 1 deletion libc-bottom-half/cloudlibc/src/libc/fcntl/openat.c
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ int __wasilibc_nocwd_openat_nomode(int fd, const char *path, int oflag) {
&new_handle,
&error_code);
if (!ok) {
translate_error(error_code);
translate_error(&error_code);
return -1;
}

Expand Down
2 changes: 1 addition & 1 deletion libc-bottom-half/cloudlibc/src/libc/fcntl/posix_fadvise.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ int posix_fadvise(int fd, off_t offset, off_t len, int advice) {
}
bool ok = filesystem_method_descriptor_advise(file_handle, offset, len, fs_advice, &error_code);
if (!ok) {
translate_error(error_code);
translate_error(&error_code);
return errno;
}
return 0;
Expand Down
2 changes: 1 addition & 1 deletion libc-bottom-half/cloudlibc/src/libc/stdio/renameat.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ int __wasilibc_nocwd_renameat(int oldfd, const char *old, int newfd, const char
&new_path,
&error_code);
if (!ok) {
translate_error(error_code);
translate_error(&error_code);
return -1;
}
#else
Expand Down
4 changes: 2 additions & 2 deletions libc-bottom-half/cloudlibc/src/libc/sys/stat/fstatat.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ int __wasilibc_nocwd_fstatat(int fd, const char *restrict path, struct stat *res
&path_wasm_string,
&metadata,
&error)) {
translate_error(error);
translate_error(&error);
return -1;
}

Expand All @@ -73,7 +73,7 @@ int __wasilibc_nocwd_fstatat(int fd, const char *restrict path, struct stat *res
&internal_stat,
&error);
if (!stat_result) {
translate_error(error);
translate_error(&error);
return -1;
}

Expand Down
2 changes: 1 addition & 1 deletion libc-bottom-half/cloudlibc/src/libc/sys/stat/futimens.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ int futimens(int fd, const struct timespec *times) {
&new_timestamp_atim,
&new_timestamp_mtim,
&error)) {
translate_error(error);
translate_error(&error);
return -1;
}
#else
Expand Down
2 changes: 1 addition & 1 deletion libc-bottom-half/cloudlibc/src/libc/sys/stat/mkdirat.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ int __wasilibc_nocwd_mkdirat_nomode(int fd, const char *path) {
&path2,
&error);
if (!ok) {
translate_error(error);
translate_error(&error);
return -1;
}
return 0;
Expand Down
Loading
Loading