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
15 changes: 14 additions & 1 deletion system/lib/libc/musl/src/errno/__strerror.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,12 @@
* This file is included multiple times to declare and define a structure
* with these messages, and then to define a lookup table translating
* error codes to offsets of corresponding fields in the structure. */

#if defined(__EMSCRIPTEN__)
// This is intended to match the errno in llvm-libc.
E(0, "Success")
#else
E(0, "No error information")
#endif

E(EILSEQ, "Illegal byte sequence")
E(EDOM, "Domain error")
Expand All @@ -16,7 +20,12 @@ E(ENOENT, "No such file or directory")
E(ESRCH, "No such process")
E(EEXIST, "File exists")

#if defined(__EMSCRIPTEN__)
// This is intended to match the errno in llvm-libc.
E(EOVERFLOW, "Value too large for defined data type")
#else
E(EOVERFLOW, "Value too large for data type")
#endif
E(ENOSPC, "No space left on device")
E(ENOMEM, "Out of memory")

Expand Down Expand Up @@ -62,7 +71,11 @@ E(ENOLCK, "No locks available")

E(EDEADLK, "Resource deadlock would occur")
E(ENOTRECOVERABLE, "State not recoverable")
#if defined(__EMSCRIPTEN__)
E(EOWNERDEAD, "Owner died")
#else
E(EOWNERDEAD, "Previous owner died")
#endif
E(ECANCELED, "Operation canceled")
E(ENOSYS, "Function not implemented")
E(ENOMSG, "No message of desired type")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,7 @@ LIBC_INLINE_VAR constexpr MsgTable<76> POSIX_ERRORS = {
MsgMapping(EPROTO, "Protocol error"),
MsgMapping(EMULTIHOP, "Multihop attempted"),
MsgMapping(EBADMSG, "Bad message"),
#ifdef __EMSCRIPTEN__
// For now, match the musl string
MsgMapping(EOVERFLOW, "Value too large for data type"),
#else
MsgMapping(EOVERFLOW, "Value too large for defined data type"),
#endif
MsgMapping(ENOTSOCK, "Socket operation on non-socket"),
MsgMapping(EDESTADDRREQ, "Destination address required"),
MsgMapping(EMSGSIZE, "Message too long"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,7 @@
namespace LIBC_NAMESPACE_DECL {

LIBC_INLINE_VAR constexpr const MsgTable<4> STDC_ERRORS = {
#ifdef __EMSCRIPTEN__
// For now, match the musl name for errno 0.
MsgMapping(0, "No error information"),
#else
MsgMapping(0, "Success"),
#endif
MsgMapping(EDOM, "Numerical argument out of domain"),
MsgMapping(ERANGE, "Numerical result out of range"),
MsgMapping(EILSEQ, "Invalid or incomplete multibyte or wide character"),
Expand Down
8 changes: 4 additions & 4 deletions test/code_size/test_codesize_cxx_except.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"a.out.js": 23414,
"a.out.js.gz": 9144,
"a.out.nodebug.wasm": 171285,
"a.out.nodebug.wasm.gz": 57342,
"total": 194699,
"total_gz": 66486,
"a.out.nodebug.wasm": 171270,
"a.out.nodebug.wasm.gz": 57331,
"total": 194684,
"total_gz": 66475,
"sent": [
"__cxa_begin_catch",
"__cxa_end_catch",
Expand Down
4 changes: 2 additions & 2 deletions test/code_size/test_codesize_cxx_except_wasm.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"a.out.js": 19642,
"a.out.js.gz": 8109,
"a.out.nodebug.wasm": 144643,
"a.out.nodebug.wasm": 144629,
"a.out.nodebug.wasm.gz": 54892,
"total": 164285,
"total": 164271,
"total_gz": 63001,
"sent": [
"_abort_js",
Expand Down
8 changes: 4 additions & 4 deletions test/code_size/test_codesize_cxx_except_wasm_legacy.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"a.out.js": 19642,
"a.out.js.gz": 8109,
"a.out.nodebug.wasm": 142232,
"a.out.nodebug.wasm.gz": 54356,
"total": 161874,
"total_gz": 62465,
"a.out.nodebug.wasm": 142218,
"a.out.nodebug.wasm.gz": 54353,
"total": 161860,
"total_gz": 62462,
"sent": [
"_abort_js",
"_tzset_js",
Expand Down
8 changes: 4 additions & 4 deletions test/code_size/test_codesize_cxx_mangle.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"a.out.js": 23465,
"a.out.js.gz": 9164,
"a.out.nodebug.wasm": 235325,
"a.out.nodebug.wasm.gz": 78943,
"total": 258790,
"total_gz": 88107,
"a.out.nodebug.wasm": 235311,
"a.out.nodebug.wasm.gz": 78929,
"total": 258776,
"total_gz": 88093,
"sent": [
"__cxa_begin_catch",
"__cxa_end_catch",
Expand Down
8 changes: 4 additions & 4 deletions test/code_size/test_codesize_hello_O0.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"a.out.js": 22497,
"a.out.js.gz": 8329,
"a.out.nodebug.wasm": 15143,
"a.out.nodebug.wasm.gz": 7452,
"total": 37640,
"total_gz": 15781,
"a.out.nodebug.wasm": 15127,
"a.out.nodebug.wasm.gz": 7448,
"total": 37624,
"total_gz": 15777,
"sent": [
"fd_write"
],
Expand Down
4 changes: 2 additions & 2 deletions test/code_size/test_codesize_hello_dylink_all.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"a.out.js": 246640,
"a.out.nodebug.wasm": 597718,
"total": 844358,
"a.out.nodebug.wasm": 597702,
"total": 844342,
"sent": [
"IMG_Init",
"IMG_Load",
Expand Down
12 changes: 6 additions & 6 deletions test/code_size/test_unoptimized_code_size.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
{
"hello_world.js": 53809,
"hello_world.js.gz": 17016,
"hello_world.wasm": 15143,
"hello_world.wasm.gz": 7452,
"hello_world.wasm": 15127,
"hello_world.wasm.gz": 7448,
"no_asserts.js": 26387,
"no_asserts.js.gz": 8797,
"no_asserts.wasm": 12227,
"no_asserts.wasm.gz": 6008,
"strict.js": 51847,
"strict.js.gz": 16341,
"strict.wasm": 15143,
"strict.wasm.gz": 7438,
"total": 174556,
"total_gz": 63052
"strict.wasm": 15127,
"strict.wasm.gz": 7445,
"total": 174524,
"total_gz": 63055
}
4 changes: 2 additions & 2 deletions test/fcntl/test_fcntl_misc.out
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ st_size: 10

posix_fallocate 3: Invalid argument
posix_fallocate 4: Invalid argument
posix_fallocate 5: Value too large for data type
posix_fallocate 6: Value too large for data type
posix_fallocate 5: Value too large for defined data type
posix_fallocate 6: Value too large for defined data type
2 changes: 1 addition & 1 deletion test/pthread/test_pthread_mutex_robust.out
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[original owner] Setting lock...
[original owner] Locked. Now exiting without unlocking.
[main] Attempting to lock the robust mutex.
[main] pthread_mutex_lock -> Previous owner died.
[main] pthread_mutex_lock -> Owner died.
[main] Now make the mutex consistent
[main] Mutex is now consistent; unlocking
8 changes: 4 additions & 4 deletions test/unistd/curdir.out
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
getcwd: /
errno: No error information
errno: Success

chdir(file): -1
errno: Not a directory
Expand All @@ -11,16 +11,16 @@ chdir(device): -1
errno: Not a directory

chdir(folder): 0
errno: No error information
errno: Success
getcwd: /folder

chdir(nonexistent): -1
errno: No such file or directory

chdir(link): 0
errno: No error information
errno: Success
getcwd: /folder

fchdir(/): 0
errno: No error information
errno: Success
getcwd: /
4 changes: 2 additions & 2 deletions test/unistd/dup.out
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
DUP
errno: No error information
errno: Success
f: 1
f2,f3: 1
close(f1): 0
close(f2): 0
close(f3): 0

DUP2
errno: No error information
errno: Success
f: 1
f2,f3: 1
close(f1): 0
Expand Down
2 changes: 1 addition & 1 deletion test/unistd/links.out
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
readlink: 'link'
errno: No error information
errno: Success

readlink: 'file'
errno: Invalid argument
Expand Down
6 changes: 3 additions & 3 deletions test/unistd/test_unistd_write_broken_link.out
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
link result: 0
source_fd: 3, errno: 0 No error information
target_fd: 3, errno: 0 No error information
source_fd: 3, errno: 0 Success
target_fd: 3, errno: 0 Success
buf: 'abc'
target_fd: 3, errno: 0 No error information
target_fd: 3, errno: 0 Success
buf: 'abc'
8 changes: 4 additions & 4 deletions test/unistd/truncate.out
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
st_size: 6

ftruncate(10): 0
errno: No error information
errno: Success
st_size: 10

ftruncate(4): 0
errno: No error information
errno: Success
st_size: 4

ftruncate(-1): -1
errno: Invalid argument
st_size: 4

truncate(2): 0
errno: No error information
errno: Success
st_size: 2

open(O_TRUNC)
errno: No error information
errno: Success
st_size: 0

truncate(readonly, 2): -1
Expand Down
2 changes: 1 addition & 1 deletion test/wasmfs/wasmfs_chdir.out
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Current working dir: /
Current working dir: /working/test
Errno: No such file or directory
Current working dir is still: /working/test
Errno: No error information
Errno: Success
Current working dir is now: /working
Errno: No such file or directory
Current working dir is still: /working
Expand Down
2 changes: 1 addition & 1 deletion test/wasmfs/wasmfs_create.out
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Test
Errno: File exists
Errno: Not a directory
Errno: No error information
Errno: Success
Read 0 bytes
Wrote 0 bytes
Wrote 25 bytes
Expand Down
6 changes: 3 additions & 3 deletions test/wasmfs/wasmfs_mkdir.out
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Errno: No error information
Errno: No error information
Errno: Success
Errno: Success
Test
Errno: File exists
Errno: No such file or directory
Errno: No error information
Errno: Success