Skip to content

Commit 2c3d78c

Browse files
committed
Modify musl errno messages to match llvm-libc
1 parent e515765 commit 2c3d78c

File tree

12 files changed

+31
-32
lines changed

12 files changed

+31
-32
lines changed

system/lib/libc/musl/src/errno/__strerror.h

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,12 @@
22
* This file is included multiple times to declare and define a structure
33
* with these messages, and then to define a lookup table translating
44
* error codes to offsets of corresponding fields in the structure. */
5-
5+
#if defined(__EMSCRIPTEN__)
6+
// This is intended to match the errno in llvm-libc.
7+
E(0, "Success")
8+
#else
69
E(0, "No error information")
10+
#endif
711

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

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

system/lib/llvm-libc/src/__support/StringUtil/tables/posix_errors.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -63,12 +63,7 @@ LIBC_INLINE_VAR constexpr MsgTable<76> POSIX_ERRORS = {
6363
MsgMapping(EPROTO, "Protocol error"),
6464
MsgMapping(EMULTIHOP, "Multihop attempted"),
6565
MsgMapping(EBADMSG, "Bad message"),
66-
#ifdef __EMSCRIPTEN__
67-
// For now, match the musl string
68-
MsgMapping(EOVERFLOW, "Value too large for data type"),
69-
#else
7066
MsgMapping(EOVERFLOW, "Value too large for defined data type"),
71-
#endif
7267
MsgMapping(ENOTSOCK, "Socket operation on non-socket"),
7368
MsgMapping(EDESTADDRREQ, "Destination address required"),
7469
MsgMapping(EMSGSIZE, "Message too long"),

system/lib/llvm-libc/src/__support/StringUtil/tables/stdc_errors.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,7 @@
1616
namespace LIBC_NAMESPACE_DECL {
1717

1818
LIBC_INLINE_VAR constexpr const MsgTable<4> STDC_ERRORS = {
19-
#ifdef __EMSCRIPTEN__
20-
// For now, match the musl name for errno 0.
21-
MsgMapping(0, "No error information"),
22-
#else
2319
MsgMapping(0, "Success"),
24-
#endif
2520
MsgMapping(EDOM, "Numerical argument out of domain"),
2621
MsgMapping(ERANGE, "Numerical result out of range"),
2722
MsgMapping(EILSEQ, "Invalid or incomplete multibyte or wide character"),

test/fcntl/test_fcntl_misc.out

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,5 @@ st_size: 10
88

99
posix_fallocate 3: Invalid argument
1010
posix_fallocate 4: Invalid argument
11-
posix_fallocate 5: Value too large for data type
12-
posix_fallocate 6: Value too large for data type
11+
posix_fallocate 5: Value too large for defined data type
12+
posix_fallocate 6: Value too large for defined data type

test/unistd/curdir.out

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
getcwd: /
2-
errno: No error information
2+
errno: Success
33

44
chdir(file): -1
55
errno: Not a directory
@@ -11,16 +11,16 @@ chdir(device): -1
1111
errno: Not a directory
1212

1313
chdir(folder): 0
14-
errno: No error information
14+
errno: Success
1515
getcwd: /folder
1616

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

2020
chdir(link): 0
21-
errno: No error information
21+
errno: Success
2222
getcwd: /folder
2323

2424
fchdir(/): 0
25-
errno: No error information
25+
errno: Success
2626
getcwd: /

test/unistd/dup.out

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
DUP
2-
errno: No error information
2+
errno: Success
33
f: 1
44
f2,f3: 1
55
close(f1): 0
66
close(f2): 0
77
close(f3): 0
88

99
DUP2
10-
errno: No error information
10+
errno: Success
1111
f: 1
1212
f2,f3: 1
1313
close(f1): 0

test/unistd/links.out

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
readlink: 'link'
2-
errno: No error information
2+
errno: Success
33

44
readlink: 'file'
55
errno: Invalid argument
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
link result: 0
2-
source_fd: 3, errno: 0 No error information
3-
target_fd: 3, errno: 0 No error information
2+
source_fd: 3, errno: 0 Success
3+
target_fd: 3, errno: 0 Success
44
buf: 'abc'
5-
target_fd: 3, errno: 0 No error information
5+
target_fd: 3, errno: 0 Success
66
buf: 'abc'

test/unistd/truncate.out

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
11
st_size: 6
22

33
ftruncate(10): 0
4-
errno: No error information
4+
errno: Success
55
st_size: 10
66

77
ftruncate(4): 0
8-
errno: No error information
8+
errno: Success
99
st_size: 4
1010

1111
ftruncate(-1): -1
1212
errno: Invalid argument
1313
st_size: 4
1414

1515
truncate(2): 0
16-
errno: No error information
16+
errno: Success
1717
st_size: 2
1818

1919
open(O_TRUNC)
20-
errno: No error information
20+
errno: Success
2121
st_size: 0
2222

2323
truncate(readonly, 2): -1

test/wasmfs/wasmfs_chdir.out

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Current working dir: /
55
Current working dir: /working/test
66
Errno: No such file or directory
77
Current working dir is still: /working/test
8-
Errno: No error information
8+
Errno: Success
99
Current working dir is now: /working
1010
Errno: No such file or directory
1111
Current working dir is still: /working

0 commit comments

Comments
 (0)