Skip to content

Commit 4a3263e

Browse files
committed
Minor improvements
1 parent ddf2fb8 commit 4a3263e

File tree

7 files changed

+18
-19
lines changed

7 files changed

+18
-19
lines changed

src/library_noderawfs.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ addToLibrary({
5252
// generic function for all node creation
5353
cwd() { return process.cwd(); },
5454
chdir() { process.chdir.apply(void 0, arguments); },
55-
mknod(path, mode) {
55+
mknod(path, mode/*, dev */) {
5656
if (FS.isDir(path)) {
5757
fs.mkdirSync(path, mode);
5858
} else {

src/library_syscall.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -834,7 +834,7 @@ var SyscallsLibrary = {
834834
__syscall_fstatfs64__deps: ['__syscall_statfs64'],
835835
__syscall_fstatfs64: (fd, size, buf) => {
836836
var stream = SYSCALLS.getStreamFromFD(fd);
837-
return ___syscall_statfs64(0, size, buf);
837+
return ___syscall_statfs64(stream.path, size, buf);
838838
},
839839
__syscall_fadvise64__nothrow: true,
840840
__syscall_fadvise64__proxy: 'none',

src/library_wasi.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -508,13 +508,13 @@ var WasiLibrary = {
508508
var type = stream.tty ? {{{ cDefs.__WASI_FILETYPE_CHARACTER_DEVICE }}} :
509509
FS.isDir(stream.mode) ? {{{ cDefs.__WASI_FILETYPE_DIRECTORY }}} :
510510
FS.isLink(stream.mode) ? {{{ cDefs.__WASI_FILETYPE_SYMBOLIC_LINK }}} :
511-
{{{ cDefs.__WASI_FILETYPE_REGULAR_FILE }}};
511+
FS.isFile(stream.mode) ? {{{ cDefs.__WASI_FILETYPE_REGULAR_FILE }}} :
512+
-1;
513+
if (type === -1) return -{{{ cDefs.EBADF }}};
512514
#else
513515
// Hack to support printf in SYSCALLS_REQUIRE_FILESYSTEM=0. We support at
514516
// least stdin, stdout, stderr in a simple way.
515-
#if ASSERTIONS
516-
assert(fd == 0 || fd == 1 || fd == 2);
517-
#endif
517+
if (fd < 0 || fd > 2) return -{{{ cDefs.EBADF }}};
518518
var type = {{{ cDefs.__WASI_FILETYPE_CHARACTER_DEVICE }}};
519519
if (fd == 0) {
520520
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
@@ -34,10 +34,10 @@ void InitializePlatformInterceptors();
3434

3535
} // namespace __asan
3636

37-
// There is no general interception at all on Fuchsia.
37+
// There is no general interception at all on Fuchsia and Emscripten.
3838
// Only the functions in asan_interceptors_memintrinsics.h are
3939
// really defined to replace libc functions.
40-
#if !SANITIZER_FUCHSIA
40+
#if !SANITIZER_FUCHSIA && !SANITIZER_EMSCRIPTEN
4141

4242
// Use macro to describe if specific function should be
4343
// intercepted on a given platform.
@@ -170,6 +170,6 @@ DECLARE_REAL(char*, strstr, const char *s1, const char *s2)
170170
(void) ctx;
171171
#define COMMON_INTERCEPT_FUNCTION(name) ASAN_INTERCEPT_FUNC(name)
172172

173-
#endif // !SANITIZER_FUCHSIA
173+
#endif // !SANITIZER_FUCHSIA && !SANITIZER_EMSCRIPTEN
174174

175175
#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
@@ -121,11 +121,12 @@ u32 GetCurrentThreadId();
121121
// Finally, we can only obtain the stack pointer for the current thread,
122122
// so we scan the full stack for other threads.
123123
static void ProcessThreadsCallback(ThreadContextBase *tctx, void *arg) {
124+
tid_t os_id = tctx->os_id;
125+
LOG_THREADS("Processing thread %llu\n", os_id);
124126
if (tctx->status != ThreadStatusRunning)
125127
return;
126128

127129
Frontier *frontier = reinterpret_cast<Frontier *>(arg);
128-
tid_t os_id = tctx->os_id;
129130

130131
uptr stack_begin, stack_end, tls_begin, tls_end, cache_begin, cache_end;
131132
DTLS *dtls;
@@ -156,6 +157,7 @@ static void ProcessThreadsCallback(ThreadContextBase *tctx, void *arg) {
156157
}
157158

158159
ScanRangeForPointers(stack_begin, stack_end, frontier, "STACK", kReachable);
160+
//ForEachExtraStackRange(os_id, ForEachExtraStackRangeCb, frontier);
159161
}
160162

161163
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
@@ -561,9 +561,8 @@ INTERCEPTOR(void, _exit, int status) {
561561
namespace __lsan {
562562

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

569568
INTERCEPT_FUNCTION(malloc);
@@ -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

system/lib/compiler-rt/lib/sanitizer_common/sanitizer_platform_interceptors.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@
277277
#define SANITIZER_INTERCEPT_SENDMMSG SI_LINUX
278278
#define SANITIZER_INTERCEPT_SYSMSG SI_LINUX_NOT_ANDROID
279279
#define SANITIZER_INTERCEPT_GETPEERNAME SI_POSIX
280-
#define SANITIZER_INTERCEPT_IOCTL SI_POSIX && !SI_EMSCRIPTEN
280+
#define SANITIZER_INTERCEPT_IOCTL SI_POSIX_NOT_EMSCRIPTEN
281281
#define SANITIZER_INTERCEPT_INET_ATON SI_POSIX
282282
#define SANITIZER_INTERCEPT_SYSINFO SI_LINUX
283283
#define SANITIZER_INTERCEPT_READDIR SI_POSIX

0 commit comments

Comments
 (0)