Skip to content

Commit

Permalink
Fix uname() machine on wasm64 (#17589)
Browse files Browse the repository at this point in the history
Correct a typo in `__syscall_uname` code. wasm64 builds now correctly
report `utsname->machine` as `"wasm64"`.
  • Loading branch information
tiran authored Aug 15, 2022
1 parent 7ad06f6 commit 087db24
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion system/lib/libc/emscripten_syscall_stubs.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ int __syscall_uname(intptr_t buf) {
strcpy(utsname->nodename, "emscripten");
strcpy(utsname->release, full_version);
strcpy(utsname->version, "#1");
#ifdef __wams64__
#ifdef __wasm64__
strcpy(utsname->machine, "wasm64");
#else
strcpy(utsname->machine, "wasm32");
Expand Down
8 changes: 8 additions & 0 deletions test/core/test_uname.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
* found in the LICENSE file.
*/

#include <assert.h>
#include <stdio.h>
#include <string.h>
#include <sys/utsname.h>

int main() {
Expand All @@ -16,6 +18,12 @@ int main() {
printf("release: %s\n", u.release);
printf("version: %s\n", u.version);
printf("machine: %s\n", u.machine);
#ifdef __wasm64__
assert(strcmp(u.machine, "wasm64") == 0);
#else
assert(strcmp(u.machine, "wasm32") == 0);
#endif
printf("invalid: %d\n", uname(0));

return 0;
}
2 changes: 1 addition & 1 deletion test/core/test_uname.out
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ sysname: Emscripten
nodename: emscripten
release: \d+.\d+.\d+
version: #1
machine: wasm32
machine: wasm(32|64)

0 comments on commit 087db24

Please sign in to comment.