Skip to content

Update to the next version of the witx crate #234

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Feb 23, 2021
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 Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,7 @@ finish: startup_files libc
|grep ' U ' |sed 's/.* U //' |LC_ALL=C sort |uniq); do \
grep -q '\<'$$undef_sym'\>' "$(SYSROOT_SHARE)/defined-symbols.txt" || echo $$undef_sym; \
done | grep -v "^__mul" > "$(SYSROOT_SHARE)/undefined-symbols.txt"
grep '^_*wasi_' "$(SYSROOT_SHARE)/undefined-symbols.txt" \
grep '^_*imported_wasi_' "$(SYSROOT_SHARE)/undefined-symbols.txt" \
> "$(SYSROOT_LIB)/libc.imports"

#
Expand Down
45 changes: 45 additions & 0 deletions expected/wasm32-wasi/defined-symbols.txt
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,51 @@ __uflow
__unlist_locked_file
__uselocale
__utc
__wasi_args_get
__wasi_args_sizes_get
__wasi_clock_res_get
__wasi_clock_time_get
__wasi_environ_get
__wasi_environ_sizes_get
__wasi_fd_advise
__wasi_fd_allocate
__wasi_fd_close
__wasi_fd_datasync
__wasi_fd_fdstat_get
__wasi_fd_fdstat_set_flags
__wasi_fd_fdstat_set_rights
__wasi_fd_filestat_get
__wasi_fd_filestat_set_size
__wasi_fd_filestat_set_times
__wasi_fd_pread
__wasi_fd_prestat_dir_name
__wasi_fd_prestat_get
__wasi_fd_pwrite
__wasi_fd_read
__wasi_fd_readdir
__wasi_fd_renumber
__wasi_fd_seek
__wasi_fd_sync
__wasi_fd_tell
__wasi_fd_write
__wasi_path_create_directory
__wasi_path_filestat_get
__wasi_path_filestat_set_times
__wasi_path_link
__wasi_path_open
__wasi_path_readlink
__wasi_path_remove_directory
__wasi_path_rename
__wasi_path_symlink
__wasi_path_unlink_file
__wasi_poll_oneoff
__wasi_proc_exit
__wasi_proc_raise
__wasi_random_get
__wasi_sched_yield
__wasi_sock_recv
__wasi_sock_send
__wasi_sock_shutdown
__wasilibc_access
__wasilibc_cwd
__wasilibc_ensure_environ
Expand Down
100 changes: 50 additions & 50 deletions expected/wasm32-wasi/predefined-macros.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2894,15 +2894,15 @@
#define __WASI_ERRNO_TIMEDOUT (UINT16_C(73))
#define __WASI_ERRNO_TXTBSY (UINT16_C(74))
#define __WASI_ERRNO_XDEV (UINT16_C(75))
#define __WASI_EVENTRWFLAGS_FD_READWRITE_HANGUP (UINT16_C(1))
#define __WASI_EVENTRWFLAGS_FD_READWRITE_HANGUP ((__wasi_eventrwflags_t)(1 << 0))
#define __WASI_EVENTTYPE_CLOCK (UINT8_C(0))
#define __WASI_EVENTTYPE_FD_READ (UINT8_C(1))
#define __WASI_EVENTTYPE_FD_WRITE (UINT8_C(2))
#define __WASI_FDFLAGS_APPEND (UINT16_C(1))
#define __WASI_FDFLAGS_DSYNC (UINT16_C(2))
#define __WASI_FDFLAGS_NONBLOCK (UINT16_C(4))
#define __WASI_FDFLAGS_RSYNC (UINT16_C(8))
#define __WASI_FDFLAGS_SYNC (UINT16_C(16))
#define __WASI_FDFLAGS_APPEND ((__wasi_fdflags_t)(1 << 0))
#define __WASI_FDFLAGS_DSYNC ((__wasi_fdflags_t)(1 << 1))
#define __WASI_FDFLAGS_NONBLOCK ((__wasi_fdflags_t)(1 << 2))
#define __WASI_FDFLAGS_RSYNC ((__wasi_fdflags_t)(1 << 3))
#define __WASI_FDFLAGS_SYNC ((__wasi_fdflags_t)(1 << 4))
#define __WASI_FILETYPE_BLOCK_DEVICE (UINT8_C(1))
#define __WASI_FILETYPE_CHARACTER_DEVICE (UINT8_C(2))
#define __WASI_FILETYPE_DIRECTORY (UINT8_C(3))
Expand All @@ -2911,50 +2911,50 @@
#define __WASI_FILETYPE_SOCKET_STREAM (UINT8_C(6))
#define __WASI_FILETYPE_SYMBOLIC_LINK (UINT8_C(7))
#define __WASI_FILETYPE_UNKNOWN (UINT8_C(0))
#define __WASI_FSTFLAGS_ATIM (UINT16_C(1))
#define __WASI_FSTFLAGS_ATIM_NOW (UINT16_C(2))
#define __WASI_FSTFLAGS_MTIM (UINT16_C(4))
#define __WASI_FSTFLAGS_MTIM_NOW (UINT16_C(8))
#define __WASI_LOOKUPFLAGS_SYMLINK_FOLLOW (UINT32_C(1))
#define __WASI_OFLAGS_CREAT (UINT16_C(1))
#define __WASI_OFLAGS_DIRECTORY (UINT16_C(2))
#define __WASI_OFLAGS_EXCL (UINT16_C(4))
#define __WASI_OFLAGS_TRUNC (UINT16_C(8))
#define __WASI_FSTFLAGS_ATIM ((__wasi_fstflags_t)(1 << 0))
#define __WASI_FSTFLAGS_ATIM_NOW ((__wasi_fstflags_t)(1 << 1))
#define __WASI_FSTFLAGS_MTIM ((__wasi_fstflags_t)(1 << 2))
#define __WASI_FSTFLAGS_MTIM_NOW ((__wasi_fstflags_t)(1 << 3))
#define __WASI_LOOKUPFLAGS_SYMLINK_FOLLOW ((__wasi_lookupflags_t)(1 << 0))
#define __WASI_OFLAGS_CREAT ((__wasi_oflags_t)(1 << 0))
#define __WASI_OFLAGS_DIRECTORY ((__wasi_oflags_t)(1 << 1))
#define __WASI_OFLAGS_EXCL ((__wasi_oflags_t)(1 << 2))
#define __WASI_OFLAGS_TRUNC ((__wasi_oflags_t)(1 << 3))
#define __WASI_PREOPENTYPE_DIR (UINT8_C(0))
#define __WASI_RIFLAGS_RECV_PEEK (UINT16_C(1))
#define __WASI_RIFLAGS_RECV_WAITALL (UINT16_C(2))
#define __WASI_RIGHTS_FD_ADVISE (UINT64_C(128))
#define __WASI_RIGHTS_FD_ALLOCATE (UINT64_C(256))
#define __WASI_RIGHTS_FD_DATASYNC (UINT64_C(1))
#define __WASI_RIGHTS_FD_FDSTAT_SET_FLAGS (UINT64_C(8))
#define __WASI_RIGHTS_FD_FILESTAT_GET (UINT64_C(2097152))
#define __WASI_RIGHTS_FD_FILESTAT_SET_SIZE (UINT64_C(4194304))
#define __WASI_RIGHTS_FD_FILESTAT_SET_TIMES (UINT64_C(8388608))
#define __WASI_RIGHTS_FD_READ (UINT64_C(2))
#define __WASI_RIGHTS_FD_READDIR (UINT64_C(16384))
#define __WASI_RIGHTS_FD_SEEK (UINT64_C(4))
#define __WASI_RIGHTS_FD_SYNC (UINT64_C(16))
#define __WASI_RIGHTS_FD_TELL (UINT64_C(32))
#define __WASI_RIGHTS_FD_WRITE (UINT64_C(64))
#define __WASI_RIGHTS_PATH_CREATE_DIRECTORY (UINT64_C(512))
#define __WASI_RIGHTS_PATH_CREATE_FILE (UINT64_C(1024))
#define __WASI_RIGHTS_PATH_FILESTAT_GET (UINT64_C(262144))
#define __WASI_RIGHTS_PATH_FILESTAT_SET_SIZE (UINT64_C(524288))
#define __WASI_RIGHTS_PATH_FILESTAT_SET_TIMES (UINT64_C(1048576))
#define __WASI_RIGHTS_PATH_LINK_SOURCE (UINT64_C(2048))
#define __WASI_RIGHTS_PATH_LINK_TARGET (UINT64_C(4096))
#define __WASI_RIGHTS_PATH_OPEN (UINT64_C(8192))
#define __WASI_RIGHTS_PATH_READLINK (UINT64_C(32768))
#define __WASI_RIGHTS_PATH_REMOVE_DIRECTORY (UINT64_C(33554432))
#define __WASI_RIGHTS_PATH_RENAME_SOURCE (UINT64_C(65536))
#define __WASI_RIGHTS_PATH_RENAME_TARGET (UINT64_C(131072))
#define __WASI_RIGHTS_PATH_SYMLINK (UINT64_C(16777216))
#define __WASI_RIGHTS_PATH_UNLINK_FILE (UINT64_C(67108864))
#define __WASI_RIGHTS_POLL_FD_READWRITE (UINT64_C(134217728))
#define __WASI_RIGHTS_SOCK_SHUTDOWN (UINT64_C(268435456))
#define __WASI_ROFLAGS_RECV_DATA_TRUNCATED (UINT16_C(1))
#define __WASI_SDFLAGS_RD (UINT8_C(1))
#define __WASI_SDFLAGS_WR (UINT8_C(2))
#define __WASI_RIFLAGS_RECV_PEEK ((__wasi_riflags_t)(1 << 0))
#define __WASI_RIFLAGS_RECV_WAITALL ((__wasi_riflags_t)(1 << 1))
#define __WASI_RIGHTS_FD_ADVISE ((__wasi_rights_t)(1 << 7))
#define __WASI_RIGHTS_FD_ALLOCATE ((__wasi_rights_t)(1 << 8))
#define __WASI_RIGHTS_FD_DATASYNC ((__wasi_rights_t)(1 << 0))
#define __WASI_RIGHTS_FD_FDSTAT_SET_FLAGS ((__wasi_rights_t)(1 << 3))
#define __WASI_RIGHTS_FD_FILESTAT_GET ((__wasi_rights_t)(1 << 21))
#define __WASI_RIGHTS_FD_FILESTAT_SET_SIZE ((__wasi_rights_t)(1 << 22))
#define __WASI_RIGHTS_FD_FILESTAT_SET_TIMES ((__wasi_rights_t)(1 << 23))
#define __WASI_RIGHTS_FD_READ ((__wasi_rights_t)(1 << 1))
#define __WASI_RIGHTS_FD_READDIR ((__wasi_rights_t)(1 << 14))
#define __WASI_RIGHTS_FD_SEEK ((__wasi_rights_t)(1 << 2))
#define __WASI_RIGHTS_FD_SYNC ((__wasi_rights_t)(1 << 4))
#define __WASI_RIGHTS_FD_TELL ((__wasi_rights_t)(1 << 5))
#define __WASI_RIGHTS_FD_WRITE ((__wasi_rights_t)(1 << 6))
#define __WASI_RIGHTS_PATH_CREATE_DIRECTORY ((__wasi_rights_t)(1 << 9))
#define __WASI_RIGHTS_PATH_CREATE_FILE ((__wasi_rights_t)(1 << 10))
#define __WASI_RIGHTS_PATH_FILESTAT_GET ((__wasi_rights_t)(1 << 18))
#define __WASI_RIGHTS_PATH_FILESTAT_SET_SIZE ((__wasi_rights_t)(1 << 19))
#define __WASI_RIGHTS_PATH_FILESTAT_SET_TIMES ((__wasi_rights_t)(1 << 20))
#define __WASI_RIGHTS_PATH_LINK_SOURCE ((__wasi_rights_t)(1 << 11))
#define __WASI_RIGHTS_PATH_LINK_TARGET ((__wasi_rights_t)(1 << 12))
#define __WASI_RIGHTS_PATH_OPEN ((__wasi_rights_t)(1 << 13))
#define __WASI_RIGHTS_PATH_READLINK ((__wasi_rights_t)(1 << 15))
#define __WASI_RIGHTS_PATH_REMOVE_DIRECTORY ((__wasi_rights_t)(1 << 25))
#define __WASI_RIGHTS_PATH_RENAME_SOURCE ((__wasi_rights_t)(1 << 16))
#define __WASI_RIGHTS_PATH_RENAME_TARGET ((__wasi_rights_t)(1 << 17))
#define __WASI_RIGHTS_PATH_SYMLINK ((__wasi_rights_t)(1 << 24))
#define __WASI_RIGHTS_PATH_UNLINK_FILE ((__wasi_rights_t)(1 << 26))
#define __WASI_RIGHTS_POLL_FD_READWRITE ((__wasi_rights_t)(1 << 27))
#define __WASI_RIGHTS_SOCK_SHUTDOWN ((__wasi_rights_t)(1 << 28))
#define __WASI_ROFLAGS_RECV_DATA_TRUNCATED ((__wasi_roflags_t)(1 << 0))
#define __WASI_SDFLAGS_RD ((__wasi_sdflags_t)(1 << 0))
#define __WASI_SDFLAGS_WR ((__wasi_sdflags_t)(1 << 1))
#define __WASI_SIGNAL_ABRT (UINT8_C(6))
#define __WASI_SIGNAL_ALRM (UINT8_C(14))
#define __WASI_SIGNAL_BUS (UINT8_C(7))
Expand Down Expand Up @@ -2986,7 +2986,7 @@
#define __WASI_SIGNAL_WINCH (UINT8_C(27))
#define __WASI_SIGNAL_XCPU (UINT8_C(23))
#define __WASI_SIGNAL_XFSZ (UINT8_C(24))
#define __WASI_SUBCLOCKFLAGS_SUBSCRIPTION_CLOCK_ABSTIME (UINT16_C(1))
#define __WASI_SUBCLOCKFLAGS_SUBSCRIPTION_CLOCK_ABSTIME ((__wasi_subclockflags_t)(1 << 0))
#define __WASI_WHENCE_CUR (UINT8_C(1))
#define __WASI_WHENCE_END (UINT8_C(2))
#define __WASI_WHENCE_SET (UINT8_C(0))
Expand Down
88 changes: 45 additions & 43 deletions expected/wasm32-wasi/undefined-symbols.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,51 @@ __floatunsitf
__getf2
__gttf2
__heap_base
__imported_wasi_snapshot_preview1_args_get
__imported_wasi_snapshot_preview1_args_sizes_get
__imported_wasi_snapshot_preview1_clock_res_get
__imported_wasi_snapshot_preview1_clock_time_get
__imported_wasi_snapshot_preview1_environ_get
__imported_wasi_snapshot_preview1_environ_sizes_get
__imported_wasi_snapshot_preview1_fd_advise
__imported_wasi_snapshot_preview1_fd_allocate
__imported_wasi_snapshot_preview1_fd_close
__imported_wasi_snapshot_preview1_fd_datasync
__imported_wasi_snapshot_preview1_fd_fdstat_get
__imported_wasi_snapshot_preview1_fd_fdstat_set_flags
__imported_wasi_snapshot_preview1_fd_fdstat_set_rights
__imported_wasi_snapshot_preview1_fd_filestat_get
__imported_wasi_snapshot_preview1_fd_filestat_set_size
__imported_wasi_snapshot_preview1_fd_filestat_set_times
__imported_wasi_snapshot_preview1_fd_pread
__imported_wasi_snapshot_preview1_fd_prestat_dir_name
__imported_wasi_snapshot_preview1_fd_prestat_get
__imported_wasi_snapshot_preview1_fd_pwrite
__imported_wasi_snapshot_preview1_fd_read
__imported_wasi_snapshot_preview1_fd_readdir
__imported_wasi_snapshot_preview1_fd_renumber
__imported_wasi_snapshot_preview1_fd_seek
__imported_wasi_snapshot_preview1_fd_sync
__imported_wasi_snapshot_preview1_fd_tell
__imported_wasi_snapshot_preview1_fd_write
__imported_wasi_snapshot_preview1_path_create_directory
__imported_wasi_snapshot_preview1_path_filestat_get
__imported_wasi_snapshot_preview1_path_filestat_set_times
__imported_wasi_snapshot_preview1_path_link
__imported_wasi_snapshot_preview1_path_open
__imported_wasi_snapshot_preview1_path_readlink
__imported_wasi_snapshot_preview1_path_remove_directory
__imported_wasi_snapshot_preview1_path_rename
__imported_wasi_snapshot_preview1_path_symlink
__imported_wasi_snapshot_preview1_path_unlink_file
__imported_wasi_snapshot_preview1_poll_oneoff
__imported_wasi_snapshot_preview1_proc_exit
__imported_wasi_snapshot_preview1_proc_raise
__imported_wasi_snapshot_preview1_random_get
__imported_wasi_snapshot_preview1_sched_yield
__imported_wasi_snapshot_preview1_sock_recv
__imported_wasi_snapshot_preview1_sock_send
__imported_wasi_snapshot_preview1_sock_shutdown
__letf2
__lttf2
__netf2
Expand All @@ -19,48 +64,5 @@ __subtf3
__trunctfdf2
__trunctfsf2
__unordtf2
__wasi_args_get
__wasi_args_sizes_get
__wasi_clock_res_get
__wasi_clock_time_get
__wasi_environ_get
__wasi_environ_sizes_get
__wasi_fd_advise
__wasi_fd_allocate
__wasi_fd_close
__wasi_fd_datasync
__wasi_fd_fdstat_get
__wasi_fd_fdstat_set_flags
__wasi_fd_filestat_get
__wasi_fd_filestat_set_size
__wasi_fd_filestat_set_times
__wasi_fd_pread
__wasi_fd_prestat_dir_name
__wasi_fd_prestat_get
__wasi_fd_pwrite
__wasi_fd_read
__wasi_fd_readdir
__wasi_fd_renumber
__wasi_fd_seek
__wasi_fd_sync
__wasi_fd_tell
__wasi_fd_write
__wasi_path_create_directory
__wasi_path_filestat_get
__wasi_path_filestat_set_times
__wasi_path_link
__wasi_path_open
__wasi_path_readlink
__wasi_path_remove_directory
__wasi_path_rename
__wasi_path_symlink
__wasi_path_unlink_file
__wasi_poll_oneoff
__wasi_proc_exit
__wasi_random_get
__wasi_sched_yield
__wasi_sock_recv
__wasi_sock_send
__wasi_sock_shutdown
__wasm_call_ctors
main
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 @@ -70,7 +70,7 @@ int __wasilibc_nocwd_openat_nomode(int fd, const char *path, int oflag) {
__wasi_rights_t fs_rights_base = max & fsb_cur.fs_rights_inheriting;
__wasi_rights_t fs_rights_inheriting = fsb_cur.fs_rights_inheriting;
__wasi_fd_t newfd;
error = __wasi_path_open(fd, lookup_flags, path, strlen(path),
error = __wasi_path_open(fd, lookup_flags, path,
(oflag >> 12) & 0xfff,
fs_rights_base, fs_rights_inheriting, fs_flags,
&newfd);
Expand Down
3 changes: 1 addition & 2 deletions libc-bottom-half/cloudlibc/src/libc/stdio/renameat.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@
#include <string.h>

int __wasilibc_nocwd_renameat(int oldfd, const char *old, int newfd, const char *new) {
__wasi_errno_t error = __wasi_path_rename(oldfd, old, strlen(old),
newfd, new, strlen(new));
__wasi_errno_t error = __wasi_path_rename(oldfd, old, newfd, new);
if (error != 0) {
errno = errno_fixup_directory(oldfd, errno_fixup_directory(newfd, error));
return -1;
Expand Down
2 changes: 1 addition & 1 deletion libc-bottom-half/cloudlibc/src/libc/sys/stat/fstatat.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ int __wasilibc_nocwd_fstatat(int fd, const char *restrict path, struct stat *res
// Perform system call.
__wasi_filestat_t internal_stat;
__wasi_errno_t error =
__wasi_path_filestat_get(fd, lookup_flags, path, strlen(path), &internal_stat);
__wasi_path_filestat_get(fd, lookup_flags, path, &internal_stat);
if (error != 0) {
errno = errno_fixup_directory(fd, error);
return -1;
Expand Down
3 changes: 1 addition & 2 deletions libc-bottom-half/cloudlibc/src/libc/sys/stat/mkdirat.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@
#include <string.h>

int __wasilibc_nocwd_mkdirat_nomode(int fd, const char *path) {
__wasi_errno_t error = __wasi_path_create_directory(
fd, path, strlen(path));
__wasi_errno_t error = __wasi_path_create_directory(fd, path);
if (error != 0) {
errno = errno_fixup_directory(fd, error);
return -1;
Expand Down
2 changes: 1 addition & 1 deletion libc-bottom-half/cloudlibc/src/libc/sys/stat/utimensat.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ int __wasilibc_nocwd_utimensat(int fd, const char *path, const struct timespec t

// Perform system call.
__wasi_errno_t error =
__wasi_path_filestat_set_times(fd, lookup_flags, path, strlen(path), st_atim, st_mtim, flags);
__wasi_path_filestat_set_times(fd, lookup_flags, path, st_atim, st_mtim, flags);
if (error != 0) {
errno = errno_fixup_directory(fd, error);
return -1;
Expand Down
2 changes: 1 addition & 1 deletion libc-bottom-half/cloudlibc/src/libc/unistd/faccessat.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ int __wasilibc_nocwd_faccessat(int fd, const char *path, int amode, int flag) {
__wasi_lookupflags_t lookup_flags = __WASI_LOOKUPFLAGS_SYMLINK_FOLLOW;
__wasi_filestat_t file;
__wasi_errno_t error =
__wasi_path_filestat_get(fd, lookup_flags, path, strlen(path), &file);
__wasi_path_filestat_get(fd, lookup_flags, path, &file);
if (error != 0) {
errno = errno_fixup_directory(fd, error);
return -1;
Expand Down
3 changes: 1 addition & 2 deletions libc-bottom-half/cloudlibc/src/libc/unistd/linkat.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ int __wasilibc_nocwd_linkat(int fd1, const char *path1, int fd2, const char *pat
lookup1_flags |= __WASI_LOOKUPFLAGS_SYMLINK_FOLLOW;

// Perform system call.
__wasi_errno_t error = __wasi_path_link(fd1, lookup1_flags, path1, strlen(path1),
fd2, path2, strlen(path2));
__wasi_errno_t error = __wasi_path_link(fd1, lookup1_flags, path1, fd2, path2);
if (error != 0) {
errno = errno_fixup_directory(fd1, errno_fixup_directory(fd2, error));
return -1;
Expand Down
2 changes: 1 addition & 1 deletion libc-bottom-half/cloudlibc/src/libc/unistd/readlinkat.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ ssize_t __wasilibc_nocwd_readlinkat(int fd, const char *restrict path, char *res
size_t bufsize) {
size_t bufused;
// TODO: Remove the cast on `buf` once the witx is updated with char8 support.
__wasi_errno_t error = __wasi_path_readlink(fd, path, strlen(path),
__wasi_errno_t error = __wasi_path_readlink(fd, path,
(uint8_t*)buf, bufsize, &bufused);
if (error != 0) {
errno = errno_fixup_directory(fd, error);
Expand Down
3 changes: 1 addition & 2 deletions libc-bottom-half/cloudlibc/src/libc/unistd/symlinkat.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@
#include <unistd.h>

int __wasilibc_nocwd_symlinkat(const char *path1, int fd, const char *path2) {
__wasi_errno_t error =
__wasi_path_symlink(path1, strlen(path1), fd, path2, strlen(path2));
__wasi_errno_t error = __wasi_path_symlink(path1, fd, path2);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given that these are now library calls its makes me wonder if we should continue to use the __ prefix. Perhaps these should be just wasi_path_symlink and then the real imports could be __wasi_path_symlink? Would most likely mean changing all the types too.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm happy to implement either way, but @sunfishcode would probably be best to answer the question (I'm not familiar enough with C idioms to know what best to do here).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The __ prefix continues to make sense :-). For example, users can call WASI APIs directly, and may have their own wasi_* wrappers around things, so the __ prefix here ensures that even if they do that, they can also link in libc at the same time.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That said, if we wanted to make it easier for people to write code that calls directly into WASI, one thing we could do would be to provide weak aliases named wasi_* that point to the __wasi_ symbols.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just think maybe the __ prefix is not the right way to carve of our own namespace. Of course this is unrelated to this PR, but I think __ is normally reserved for toolchain internal stuff isn't it?

Again, unrelated to this PR.

Copy link
Member

@sunfishcode sunfishcode Feb 17, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The C standard just says "reserved for any use". In practice, musl, glibc, and other libc impls commonly use __ for their own purposes.

if (error != 0) {
errno = errno_fixup_directory(fd, error);
return -1;
Expand Down
Loading