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
14 changes: 3 additions & 11 deletions libc-bottom-half/cloudlibc/src/libc/fcntl/fcntl.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#endif

int fcntl(int fildes, int cmd, ...) {
#ifdef __wasip2__
#if defined(__wasip2__) || defined(__wasip3__)
descriptor_table_entry_t *entry = descriptor_table_get_ref(fildes);
if (entry == NULL)
return -1;
Expand Down Expand Up @@ -51,16 +51,12 @@ int fcntl(int fildes, int cmd, ...) {
oflags |= O_SEARCH;
}
return oflags;
#elif defined(__wasip2__)
#elif defined(__wasip2__) || defined(__wasip3__)
if (!entry->vtable->fcntl_getfl) {
errno = EINVAL;
return -1;
}
return entry->vtable->fcntl_getfl(entry->data);
#elif defined(__wasip3__)
// TODO(wasip3)
errno = ENOTSUP;
return -1;
#else
# error "Unknown WASI version"
#endif
Expand All @@ -80,16 +76,12 @@ int fcntl(int fildes, int cmd, ...) {
errno = error;
return -1;
}
#elif defined(__wasip2__)
#elif defined(__wasip2__) || defined(__wasip3__)
if (!entry->vtable->fcntl_setfl) {
errno = EINVAL;
return -1;
}
return entry->vtable->fcntl_setfl(entry->data, flags);
#elif defined(__wasip3__)
// TODO(wasip3)
errno = ENOTSUP;
return -1;
#else
# error "Unknown WASI version"
#endif
Expand Down
1 change: 0 additions & 1 deletion libc-bottom-half/cloudlibc/src/libc/poll/poll.c
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,6 @@ static int poll_impl(struct pollfd *fds, size_t nfds, int timeout) {
#elif defined(__wasip3__)

static int poll_impl(struct pollfd *fds, size_t nfds, int timeout) {
// TODO(wasip3)
errno = ENOTSUP;
return -1;
}
Expand Down
6 changes: 1 addition & 5 deletions libc-bottom-half/cloudlibc/src/libc/sys/ioctl/ioctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ int ioctl(int fildes, int request, ...) {
return -1;
}
return 0;
#elif defined(__wasip2__)
#elif defined(__wasip2__) || defined(__wasip3__)
descriptor_table_entry_t *entry = descriptor_table_get_ref(fildes);
va_list ap;
va_start(ap, request);
Expand All @@ -101,10 +101,6 @@ int ioctl(int fildes, int request, ...) {
return -1;
}
return entry->vtable->set_blocking(entry->data, blocking);
#elif defined(__wasip3__)
// TODO(wasip3)
errno = ENOTSUP;
return -1;
#else
# error "Unknown WASI version"
#endif
Expand Down
4 changes: 2 additions & 2 deletions libc-bottom-half/sources/udp.c
Original file line number Diff line number Diff line change
Expand Up @@ -836,6 +836,7 @@ static int udp_poll_register(void *data, poll_state_t *state, short events) {
}
return 0;
}
#endif

static int udp_fcntl_getfl(void *data) {
udp_socket_t *socket = (udp_socket_t *)data;
Expand All @@ -855,7 +856,6 @@ static int udp_fcntl_setfl(void *data, int flags) {
}
return 0;
}
#endif

static descriptor_vtable_t udp_vtable = {
.free = udp_free,
Expand All @@ -874,8 +874,8 @@ static descriptor_vtable_t udp_vtable = {
.setsockopt = udp_setsockopt,

.poll_register = udp_poll_register,
#endif

.fcntl_getfl = udp_fcntl_getfl,
.fcntl_setfl = udp_fcntl_setfl,
#endif
};
2 changes: 1 addition & 1 deletion test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ if (NOT (WASI STREQUAL "p1"))
add_wasilibc_test(sockets-nonblocking-udp.c NETWORK FAILP3)
add_wasilibc_test(sockets-nonblocking-multiple.c NETWORK FAILP3)
add_wasilibc_test(sockets-nonblocking-udp-multiple.c NETWORK FAILP3)
add_wasilibc_test(sockets-fcntl.c NETWORK FAILP3)
add_wasilibc_test(sockets-fcntl.c NETWORK)

# TODO: flaky tests
# add_wasilibc_test(sockets-nonblocking.c NETWORK)
Expand Down