Skip to content

Commit ba629f8

Browse files
committed
Avoid using WASI-specific calls
1 parent 302d38a commit ba629f8

File tree

1 file changed

+4
-16
lines changed

1 file changed

+4
-16
lines changed

system/lib/compiler-rt/lib/sanitizer_common/sanitizer_emscripten.cpp

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,6 @@
3131

3232
#include <emscripten.h>
3333
#include <emscripten/stack.h>
34-
#include <wasi/api.h>
35-
#include <wasi/wasi-helpers.h>
3634

3735
#include "emscripten_internal.h"
3836

@@ -141,7 +139,7 @@ int internal_madvise(uptr addr, uptr length, int advice) {
141139
}
142140

143141
uptr internal_close(fd_t fd) {
144-
return __wasi_fd_close(fd);
142+
return close(fd);
145143
}
146144

147145
uptr internal_open(const char *filename, int flags) {
@@ -153,21 +151,11 @@ uptr internal_open(const char *filename, int flags, u32 mode) {
153151
}
154152

155153
uptr internal_read(fd_t fd, void *buf, uptr count) {
156-
__wasi_iovec_t iov = { (uint8_t*)buf, count };
157-
size_t num;
158-
if (__wasi_syscall_ret(__wasi_fd_read(fd, &iov, 1, &num))) {
159-
return -1;
160-
}
161-
return num;
154+
return read(fd, buf, count);
162155
}
163156

164157
uptr internal_write(fd_t fd, const void *buf, uptr count) {
165-
__wasi_ciovec_t iov = { (const uint8_t*)buf, count };
166-
size_t num;
167-
if (__wasi_syscall_ret(__wasi_fd_write(fd, &iov, 1, &num))) {
168-
return -1;
169-
}
170-
return num;
158+
return write(fd, buf, count);
171159
}
172160

173161
uptr internal_stat(const char *path, void *buf) {
@@ -211,7 +199,7 @@ void internal_usleep(u64 useconds) {
211199
}
212200

213201
void internal__exit(int exitcode) {
214-
__wasi_proc_exit(exitcode);
202+
_exit(exitcode);
215203
}
216204

217205
tid_t GetTid() {

0 commit comments

Comments
 (0)