summaryrefslogtreecommitdiffstats
path: root/libc-bottom-half
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 16:23:18 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 16:23:18 +0000
commit3ae7992ac2104314256d1b2b09c74ed49750c89f (patch)
tree2669fa8afc3f2c6a0187e76f298b76a5eaa6d96d /libc-bottom-half
parentReleasing progress-linux version 0.0~git20221206.8b7148f-1~progress7.99u1. (diff)
downloadwasi-libc-3ae7992ac2104314256d1b2b09c74ed49750c89f.tar.xz
wasi-libc-3ae7992ac2104314256d1b2b09c74ed49750c89f.zip
Merging upstream version 0.0~git20230113.4362b18.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'libc-bottom-half')
-rw-r--r--libc-bottom-half/headers/public/__struct_sockaddr.h3
-rw-r--r--libc-bottom-half/headers/public/__struct_sockaddr_in.h5
-rw-r--r--libc-bottom-half/headers/public/__struct_sockaddr_in6.h5
-rw-r--r--libc-bottom-half/headers/public/__struct_sockaddr_storage.h5
-rw-r--r--libc-bottom-half/headers/public/__struct_sockaddr_un.h5
-rw-r--r--libc-bottom-half/headers/public/wasi/api.h2
-rw-r--r--libc-bottom-half/sources/__wasilibc_real.c5
-rw-r--r--libc-bottom-half/sources/posix.c100
8 files changed, 57 insertions, 73 deletions
diff --git a/libc-bottom-half/headers/public/__struct_sockaddr.h b/libc-bottom-half/headers/public/__struct_sockaddr.h
index 9891b90..2e14d95 100644
--- a/libc-bottom-half/headers/public/__struct_sockaddr.h
+++ b/libc-bottom-half/headers/public/__struct_sockaddr.h
@@ -1,9 +1,6 @@
#ifndef __wasilibc___struct_sockaddr_h
#define __wasilibc___struct_sockaddr_h
-#define __need_STDDEF_H_misc
-#include <stddef.h>
-
#include <__typedef_sa_family_t.h>
struct sockaddr {
diff --git a/libc-bottom-half/headers/public/__struct_sockaddr_in.h b/libc-bottom-half/headers/public/__struct_sockaddr_in.h
index 73dc5c6..5d4ce51 100644
--- a/libc-bottom-half/headers/public/__struct_sockaddr_in.h
+++ b/libc-bottom-half/headers/public/__struct_sockaddr_in.h
@@ -1,15 +1,12 @@
#ifndef __wasilibc___struct_sockaddr_in_h
#define __wasilibc___struct_sockaddr_in_h
-#define __need_STDDEF_H_misc
-#include <stddef.h>
-
#include <__typedef_sa_family_t.h>
#include <__typedef_in_port_t.h>
#include <__struct_in_addr.h>
struct sockaddr_in {
- _Alignas(max_align_t) sa_family_t sin_family;
+ __attribute__((aligned(__BIGGEST_ALIGNMENT__))) sa_family_t sin_family;
in_port_t sin_port;
struct in_addr sin_addr;
};
diff --git a/libc-bottom-half/headers/public/__struct_sockaddr_in6.h b/libc-bottom-half/headers/public/__struct_sockaddr_in6.h
index a220f91..98703dc 100644
--- a/libc-bottom-half/headers/public/__struct_sockaddr_in6.h
+++ b/libc-bottom-half/headers/public/__struct_sockaddr_in6.h
@@ -1,15 +1,12 @@
#ifndef __wasilibc___struct_sockaddr_in6_h
#define __wasilibc___struct_sockaddr_in6_h
-#define __need_STDDEF_H_misc
-#include <stddef.h>
-
#include <__typedef_sa_family_t.h>
#include <__typedef_in_port_t.h>
#include <__struct_in6_addr.h>
struct sockaddr_in6 {
- _Alignas(max_align_t) sa_family_t sin6_family;
+ __attribute__((aligned(__BIGGEST_ALIGNMENT__))) sa_family_t sin6_family;
in_port_t sin6_port;
unsigned sin6_flowinfo;
struct in6_addr sin6_addr;
diff --git a/libc-bottom-half/headers/public/__struct_sockaddr_storage.h b/libc-bottom-half/headers/public/__struct_sockaddr_storage.h
index 1ae26a7..b4ebad2 100644
--- a/libc-bottom-half/headers/public/__struct_sockaddr_storage.h
+++ b/libc-bottom-half/headers/public/__struct_sockaddr_storage.h
@@ -1,13 +1,10 @@
#ifndef __wasilibc___struct_sockaddr_storage_h
#define __wasilibc___struct_sockaddr_storage_h
-#define __need_STDDEF_H_misc
-#include <stddef.h>
-
#include <__typedef_sa_family_t.h>
struct sockaddr_storage {
- _Alignas(max_align_t) sa_family_t ss_family;
+ __attribute__((aligned(__BIGGEST_ALIGNMENT__))) sa_family_t ss_family;
char __ss_data[32];
};
diff --git a/libc-bottom-half/headers/public/__struct_sockaddr_un.h b/libc-bottom-half/headers/public/__struct_sockaddr_un.h
index a5be6e5..6371194 100644
--- a/libc-bottom-half/headers/public/__struct_sockaddr_un.h
+++ b/libc-bottom-half/headers/public/__struct_sockaddr_un.h
@@ -1,13 +1,10 @@
#ifndef __wasilibc___struct_sockaddr_un_h
#define __wasilibc___struct_sockaddr_un_h
-#define __need_STDDEF_H_misc
-#include <stddef.h>
-
#include <__typedef_sa_family_t.h>
struct sockaddr_un {
- _Alignas(max_align_t) sa_family_t sun_family;
+ __attribute__((aligned(__BIGGEST_ALIGNMENT__))) sa_family_t sun_family;
};
#endif
diff --git a/libc-bottom-half/headers/public/wasi/api.h b/libc-bottom-half/headers/public/wasi/api.h
index 1ab7699..45a6506 100644
--- a/libc-bottom-half/headers/public/wasi/api.h
+++ b/libc-bottom-half/headers/public/wasi/api.h
@@ -2099,7 +2099,7 @@ __wasi_errno_t __wasi_sock_shutdown(
*
* @see https://github.com/WebAssembly/wasi-threads/#readme
*/
-__wasi_errno_t __wasi_thread_spawn(
+int32_t __wasi_thread_spawn(
/**
* A pointer to an opaque struct to be passed to the module's entry
* function.
diff --git a/libc-bottom-half/sources/__wasilibc_real.c b/libc-bottom-half/sources/__wasilibc_real.c
index 855a2c6..d2e6b71 100644
--- a/libc-bottom-half/sources/__wasilibc_real.c
+++ b/libc-bottom-half/sources/__wasilibc_real.c
@@ -665,8 +665,7 @@ int32_t __imported_wasi_thread_spawn(int32_t arg0) __attribute__((
__import_name__("thread_spawn")
));
-__wasi_errno_t __wasi_thread_spawn(void* start_arg) {
- int32_t ret = __imported_wasi_thread_spawn((int32_t) start_arg);
- return (uint16_t) ret;
+int32_t __wasi_thread_spawn(void* start_arg) {
+ return __imported_wasi_thread_spawn((int32_t) start_arg);
}
#endif
diff --git a/libc-bottom-half/sources/posix.c b/libc-bottom-half/sources/posix.c
index 35dd99b..b3e59ec 100644
--- a/libc-bottom-half/sources/posix.c
+++ b/libc-bottom-half/sources/posix.c
@@ -58,9 +58,9 @@ int __wasilibc_open_nomode(const char *path, int oflag) {
char *relative_path;
int dirfd = find_relpath(path, &relative_path);
- // If we can't find a preopen for it, indicate that we lack capabilities.
+ // If we can't find a preopen for it, fail as if we can't find the path.
if (dirfd == -1) {
- errno = ENOTCAPABLE;
+ errno = ENOENT;
return -1;
}
@@ -71,9 +71,9 @@ int access(const char *path, int amode) {
char *relative_path;
int dirfd = find_relpath(path, &relative_path);
- // If we can't find a preopen for it, indicate that we lack capabilities.
+ // If we can't find a preopen for it, fail as if we can't find the path.
if (dirfd == -1) {
- errno = ENOTCAPABLE;
+ errno = ENOENT;
return -1;
}
@@ -88,9 +88,9 @@ ssize_t readlink(
char *relative_path;
int dirfd = find_relpath(path, &relative_path);
- // If we can't find a preopen for it, indicate that we lack capabilities.
+ // If we can't find a preopen for it, fail as if we can't find the path.
if (dirfd == -1) {
- errno = ENOTCAPABLE;
+ errno = ENOENT;
return -1;
}
@@ -101,9 +101,9 @@ int stat(const char *restrict path, struct stat *restrict buf) {
char *relative_path;
int dirfd = find_relpath(path, &relative_path);
- // If we can't find a preopen for it, indicate that we lack capabilities.
+ // If we can't find a preopen for it, fail as if we can't find the path.
if (dirfd == -1) {
- errno = ENOTCAPABLE;
+ errno = ENOENT;
return -1;
}
@@ -114,9 +114,9 @@ int lstat(const char *restrict path, struct stat *restrict buf) {
char *relative_path;
int dirfd = find_relpath(path, &relative_path);
- // If we can't find a preopen for it, indicate that we lack capabilities.
+ // If we can't find a preopen for it, fail as if we can't find the path.
if (dirfd == -1) {
- errno = ENOTCAPABLE;
+ errno = ENOENT;
return -1;
}
@@ -127,9 +127,9 @@ int utime(const char *path, const struct utimbuf *times) {
char *relative_path;
int dirfd = find_relpath(path, &relative_path);
- // If we can't find a preopen for it, indicate that we lack capabilities.
+ // If we can't find a preopen for it, fail as if we can't find the path.
if (dirfd == -1) {
- errno = ENOTCAPABLE;
+ errno = ENOENT;
return -1;
}
@@ -147,9 +147,9 @@ int utimes(const char *path, const struct timeval times[2]) {
char *relative_path;
int dirfd = find_relpath(path, &relative_path);
- // If we can't find a preopen for it, indicate that we lack capabilities.
+ // If we can't find a preopen for it, fail as if we can't find the path.
if (dirfd == -1) {
- errno = ENOTCAPABLE;
+ errno = ENOENT;
return -1;
}
@@ -169,9 +169,9 @@ int unlink(const char *path) {
char *relative_path;
int dirfd = find_relpath(path, &relative_path);
- // If we can't find a preopen for it, indicate that we lack capabilities.
+ // If we can't find a preopen for it, fail as if we can't find the path.
if (dirfd == -1) {
- errno = ENOTCAPABLE;
+ errno = ENOENT;
return -1;
}
@@ -185,9 +185,9 @@ int rmdir(const char *path) {
char *relative_path;
int dirfd = find_relpath(path, &relative_path);
- // If we can't find a preopen for it, indicate that we lack capabilities.
+ // If we can't find a preopen for it, fail as if we can't find the path.
if (dirfd == -1) {
- errno = ENOTCAPABLE;
+ errno = ENOENT;
return -1;
}
@@ -198,21 +198,21 @@ int remove(const char *path) {
char *relative_path;
int dirfd = find_relpath(path, &relative_path);
- // If we can't find a preopen for it, indicate that we lack capabilities.
+ // If we can't find a preopen for it, fail as if we can't find the path.
if (dirfd == -1) {
- errno = ENOTCAPABLE;
+ errno = ENOENT;
return -1;
}
// First try to remove it as a file.
int r = __wasilibc_nocwd___wasilibc_unlinkat(dirfd, relative_path);
- if (r != 0 && (errno == EISDIR || errno == ENOTCAPABLE)) {
+ if (r != 0 && (errno == EISDIR || errno == ENOENT)) {
// That failed, but it might be a directory.
r = __wasilibc_nocwd___wasilibc_rmdirat(dirfd, relative_path);
// If it isn't a directory, we lack capabilities to remove it as a file.
if (errno == ENOTDIR)
- errno = ENOTCAPABLE;
+ errno = ENOENT;
}
return r;
}
@@ -221,9 +221,9 @@ int mkdir(const char *path, mode_t mode) {
char *relative_path;
int dirfd = find_relpath(path, &relative_path);
- // If we can't find a preopen for it, indicate that we lack capabilities.
+ // If we can't find a preopen for it, fail as if we can't find the path.
if (dirfd == -1) {
- errno = ENOTCAPABLE;
+ errno = ENOENT;
return -1;
}
@@ -234,9 +234,9 @@ DIR *opendir(const char *dirname) {
char *relative_path;
int dirfd = find_relpath(dirname, &relative_path);
- // If we can't find a preopen for it, indicate that we lack capabilities.
+ // If we can't find a preopen for it, fail as if we can't find the path.
if (dirfd == -1) {
- errno = ENOTCAPABLE;
+ errno = ENOENT;
return NULL;
}
@@ -252,9 +252,9 @@ int scandir(
char *relative_path;
int dirfd = find_relpath(dir, &relative_path);
- // If we can't find a preopen for it, indicate that we lack capabilities.
+ // If we can't find a preopen for it, fail as if we can't find the path.
if (dirfd == -1) {
- errno = ENOTCAPABLE;
+ errno = ENOENT;
return -1;
}
@@ -265,9 +265,9 @@ int symlink(const char *target, const char *linkpath) {
char *relative_path;
int dirfd = find_relpath(linkpath, &relative_path);
- // If we can't find a preopen for it, indicate that we lack capabilities.
+ // If we can't find a preopen for it, fail as if we can't find the path.
if (dirfd == -1) {
- errno = ENOTCAPABLE;
+ errno = ENOENT;
return -1;
}
@@ -287,8 +287,8 @@ int link(const char *old, const char *new) {
new_dirfd, new_relative_path, 0);
}
- // We couldn't find a preopen for it; indicate that we lack capabilities.
- errno = ENOTCAPABLE;
+ // We couldn't find a preopen for it; fail as if we can't find the path.
+ errno = ENOENT;
return -1;
}
@@ -305,8 +305,8 @@ int rename(const char *old, const char *new) {
new_dirfd, new_relative_path);
}
- // We couldn't find a preopen for it; indicate that we lack capabilities.
- errno = ENOTCAPABLE;
+ // We couldn't find a preopen for it; fail as if we can't find the path.
+ errno = ENOENT;
return -1;
}
@@ -317,9 +317,9 @@ __wasilibc_access(const char *path, int mode, int flags)
char *relative_path;
int dirfd = find_relpath(path, &relative_path);
- // If we can't find a preopen for it, indicate that we lack capabilities.
+ // If we can't find a preopen for it, fail as if we can't find the path.
if (dirfd == -1) {
- errno = ENOTCAPABLE;
+ errno = ENOENT;
return -1;
}
@@ -334,9 +334,9 @@ __wasilibc_utimens(const char *path, const struct timespec times[2], int flags)
char *relative_path;
int dirfd = find_relpath(path, &relative_path);
- // If we can't find a preopen for it, indicate that we lack capabilities.
+ // If we can't find a preopen for it, fail as if we can't find the path.
if (dirfd == -1) {
- errno = ENOTCAPABLE;
+ errno = ENOENT;
return -1;
}
@@ -351,9 +351,9 @@ __wasilibc_stat(const char *__restrict path, struct stat *__restrict st, int fla
char *relative_path;
int dirfd = find_relpath(path, &relative_path);
- // If we can't find a preopen for it, indicate that we lack capabilities.
+ // If we can't find a preopen for it, fail as if we can't find the path.
if (dirfd == -1) {
- errno = ENOTCAPABLE;
+ errno = ENOENT;
return -1;
}
@@ -369,9 +369,9 @@ __wasilibc_link(const char *oldpath, const char *newpath, int flags)
int old_dirfd = find_relpath(oldpath, &old_relative_path);
int new_dirfd = find_relpath(newpath, &new_relative_path);
- // If we can't find a preopen for it, indicate that we lack capabilities.
+ // If we can't find a preopen for it, fail as if we can't find the path.
if (old_dirfd == -1 || new_dirfd == -1) {
- errno = ENOTCAPABLE;
+ errno = ENOENT;
return -1;
}
@@ -387,9 +387,9 @@ __wasilibc_link_oldat(int olddirfd, const char *oldpath, const char *newpath, in
char *new_relative_path;
int new_dirfd = find_relpath(newpath, &new_relative_path);
- // If we can't find a preopen for it, indicate that we lack capabilities.
+ // If we can't find a preopen for it, fail as if we can't find the path.
if (new_dirfd == -1) {
- errno = ENOTCAPABLE;
+ errno = ENOENT;
return -1;
}
@@ -405,9 +405,9 @@ __wasilibc_link_newat(const char *oldpath, int newdirfd, const char *newpath, in
char *old_relative_path;
int old_dirfd = find_relpath(oldpath, &old_relative_path);
- // If we can't find a preopen for it, indicate that we lack capabilities.
+ // If we can't find a preopen for it, fail as if we can't find the path.
if (old_dirfd == -1) {
- errno = ENOTCAPABLE;
+ errno = ENOENT;
return -1;
}
@@ -423,9 +423,9 @@ __wasilibc_rename_oldat(int fromdirfd, const char *from, const char *to)
char *to_relative_path;
int to_dirfd = find_relpath(to, &to_relative_path);
- // If we can't find a preopen for it, indicate that we lack capabilities.
+ // If we can't find a preopen for it, fail as if we can't find the path.
if (to_dirfd == -1) {
- errno = ENOTCAPABLE;
+ errno = ENOENT;
return -1;
}
@@ -439,9 +439,9 @@ __wasilibc_rename_newat(const char *from, int todirfd, const char *to)
char *from_relative_path;
int from_dirfd = find_relpath(from, &from_relative_path);
- // If we can't find a preopen for it, indicate that we lack capabilities.
+ // If we can't find a preopen for it, fail as if we can't find the path.
if (from_dirfd == -1) {
- errno = ENOTCAPABLE;
+ errno = ENOENT;
return -1;
}