Skip to content

Commit ffc3c5d

Browse files
committed
Minor improvements
1 parent 8a7299d commit ffc3c5d

File tree

5 files changed

+16
-17
lines changed

5 files changed

+16
-17
lines changed

src/lib/libnoderawfs.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ addToLibrary({
5757
// generic function for all node creation
5858
cwd() { return process.cwd(); },
5959
chdir(...args) { process.chdir(...args); },
60-
mknod(path, mode) {
60+
mknod(path, mode/*, dev */) {
6161
if (FS.isDir(path)) {
6262
fs.mkdirSync(path, mode);
6363
} else {

src/lib/libwasi.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -509,13 +509,13 @@ var WasiLibrary = {
509509
var type = stream.tty ? {{{ cDefs.__WASI_FILETYPE_CHARACTER_DEVICE }}} :
510510
FS.isDir(stream.mode) ? {{{ cDefs.__WASI_FILETYPE_DIRECTORY }}} :
511511
FS.isLink(stream.mode) ? {{{ cDefs.__WASI_FILETYPE_SYMBOLIC_LINK }}} :
512-
{{{ cDefs.__WASI_FILETYPE_REGULAR_FILE }}};
512+
FS.isFile(stream.mode) ? {{{ cDefs.__WASI_FILETYPE_REGULAR_FILE }}} :
513+
-1;
514+
if (type === -1) return -{{{ cDefs.EBADF }}};
513515
#else
514516
// Hack to support printf in SYSCALLS_REQUIRE_FILESYSTEM=0. We support at
515517
// least stdin, stdout, stderr in a simple way.
516-
#if ASSERTIONS
517-
assert(fd == 0 || fd == 1 || fd == 2);
518-
#endif
518+
if (fd < 0 || fd > 2) return -{{{ cDefs.EBADF }}};
519519
var type = {{{ cDefs.__WASI_FILETYPE_CHARACTER_DEVICE }}};
520520
if (fd == 0) {
521521
rightsBase = {{{ cDefs.__WASI_RIGHTS_FD_READ }}};

system/lib/compiler-rt/lib/asan/asan_interceptors.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,10 @@ void InitializePlatformInterceptors();
2626

2727
} // namespace __asan
2828

29-
// There is no general interception at all on Fuchsia.
29+
// There is no general interception at all on Fuchsia and Emscripten.
3030
// Only the functions in asan_interceptors_memintrinsics.h are
3131
// really defined to replace libc functions.
32-
#if !SANITIZER_FUCHSIA
32+
#if !SANITIZER_FUCHSIA && !SANITIZER_EMSCRIPTEN
3333

3434
// Use macro to describe if specific function should be
3535
// intercepted on a given platform.
@@ -162,6 +162,6 @@ DECLARE_REAL(char*, strstr, const char *s1, const char *s2)
162162
(void) ctx;
163163
#define COMMON_INTERCEPT_FUNCTION(name) ASAN_INTERCEPT_FUNC(name)
164164

165-
#endif // !SANITIZER_FUCHSIA
165+
#endif // !SANITIZER_FUCHSIA && !SANITIZER_EMSCRIPTEN
166166

167167
#endif // ASAN_INTERCEPTORS_H

system/lib/compiler-rt/lib/lsan/lsan_common_emscripten.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,11 +119,12 @@ void LockStuffAndStopTheWorld(StopTheWorldCallback callback,
119119
// Finally, we can only obtain the stack pointer for the current thread,
120120
// so we scan the full stack for other threads.
121121
static void ProcessThreadsCallback(ThreadContextBase *tctx, void *arg) {
122+
tid_t os_id = tctx->os_id;
123+
LOG_THREADS("Processing thread %llu\n", os_id);
122124
if (tctx->status != ThreadStatusRunning)
123125
return;
124126

125127
Frontier *frontier = reinterpret_cast<Frontier *>(arg);
126-
tid_t os_id = tctx->os_id;
127128

128129
uptr stack_begin, stack_end, tls_begin, tls_end, cache_begin, cache_end;
129130
DTLS *dtls;
@@ -154,6 +155,7 @@ static void ProcessThreadsCallback(ThreadContextBase *tctx, void *arg) {
154155
}
155156

156157
ScanRangeForPointers(stack_begin, stack_end, frontier, "STACK", kReachable);
158+
//ForEachExtraStackRange(os_id, ForEachExtraStackRangeCb, frontier);
157159
}
158160

159161
if (flags()->use_tls && tls_begin) {

system/lib/compiler-rt/lib/lsan/lsan_interceptors.cpp

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -560,9 +560,8 @@ INTERCEPTOR(void, _exit, int status) {
560560
namespace __lsan {
561561

562562
void InitializeInterceptors() {
563-
// Fuchsia doesn't use interceptors that require any setup.
564-
#if !SANITIZER_FUCHSIA
565-
#if !SANITIZER_EMSCRIPTEN
563+
// Fuchsia and Emscripten doesn't use interceptors that require any setup.
564+
#if !SANITIZER_FUCHSIA && !SANITIZER_EMSCRIPTEN
566565
__interception::DoesNotSupportStaticLinking();
567566
InitializeSignalInterceptors();
568567

@@ -596,17 +595,15 @@ void InitializeInterceptors() {
596595
LSAN_MAYBE_INTERCEPT_PTHREAD_ATFORK;
597596

598597
LSAN_MAYBE_INTERCEPT_STRERROR;
599-
#endif // !SANITIZER_EMSCRIPTEN
598+
#endif // !SANITIZER_FUCHSIA && !SANITIZER_EMSCRIPTEN
600599

601-
#if !SANITIZER_NETBSD && !SANITIZER_FREEBSD
600+
#if !SANITIZER_NETBSD && !SANITIZER_FREEBSD && !SANITIZER_FUCHSIA
602601
if (pthread_key_create(&g_thread_finalize_key, &thread_finalize)) {
603602
Report("LeakSanitizer: failed to create thread key.\n");
604603
Die();
605604
}
606605
#endif
607-
608-
#endif // !SANITIZER_FUCHSIA
609606
}
610607

611608
} // namespace __lsan
612-
#endif // SANITIZER_EMSCRIPTEN
609+
#endif // SANITIZER_POSIX

0 commit comments

Comments
 (0)