diff --git a/system/lib/libc/musl/arch/emscripten/bits/alltypes.h b/system/lib/libc/musl/arch/emscripten/bits/alltypes.h index 051245ed475d9..713e0816a9645 100644 --- a/system/lib/libc/musl/arch/emscripten/bits/alltypes.h +++ b/system/lib/libc/musl/arch/emscripten/bits/alltypes.h @@ -400,8 +400,15 @@ typedef struct __locale_struct * locale_t; #endif +// Musl uses 128 bytes for sigset_t, presumably for some kind of ABI +// compatability with the kernel or GLIBC, but in emscripten we can be precise. +// Since we have _NSIG = 65 which only need 2 `long`s for the bitmask. +// The signals we support are +// 1 - 31 - standard POSIX signals (see emscripten/bits/signal.h) +// 32 - 34 - pthread-specific signals (see pthread_impl.h> +// 35 - 65 - user-defined RT signals (we don't currently have any test coverage of these). #if defined(__NEED_sigset_t) && !defined(__DEFINED_sigset_t) -typedef struct __sigset_t { unsigned long __bits[128/sizeof(long)]; } sigset_t; +typedef struct __sigset_t { unsigned long __bits[2]; } sigset_t; #define __DEFINED_sigset_t #endif diff --git a/system/lib/libc/musl/include/alltypes.h.in b/system/lib/libc/musl/include/alltypes.h.in index d47aeea9aa8b8..79a1eca366306 100644 --- a/system/lib/libc/musl/include/alltypes.h.in +++ b/system/lib/libc/musl/include/alltypes.h.in @@ -73,7 +73,14 @@ TYPEDEF struct __mbstate_t { unsigned __opaque1, __opaque2; } mbstate_t; TYPEDEF struct __locale_struct * locale_t; -TYPEDEF struct __sigset_t { unsigned long __bits[128/sizeof(long)]; } sigset_t; +// Musl uses 128 bytes for sigset_t, presumably for some kind of ABI +// compatability with the kernel or GLIBC, but in emscripten we can be precise. +// Since we have _NSIG = 65 which only need 2 `long`s for the bitmask. +// The signals we support are +// 1 - 31 - standard POSIX signals (see emscripten/bits/signal.h) +// 32 - 34 - pthread-specific signals (see pthread_impl.h> +// 35 - 65 - user-defined RT signals (we don't currently have any test coverage of these). +TYPEDEF struct __sigset_t { unsigned long __bits[2]; } sigset_t; STRUCT iovec { void *iov_base; size_t iov_len; }; diff --git a/test/codesize/test_codesize_cxx_lto.json b/test/codesize/test_codesize_cxx_lto.json index f92589e8aecc0..7bea9337c40d2 100644 --- a/test/codesize/test_codesize_cxx_lto.json +++ b/test/codesize/test_codesize_cxx_lto.json @@ -2,9 +2,9 @@ "a.out.js": 18563, "a.out.js.gz": 7666, "a.out.nodebug.wasm": 101956, - "a.out.nodebug.wasm.gz": 39461, + "a.out.nodebug.wasm.gz": 39460, "total": 120519, - "total_gz": 47127, + "total_gz": 47126, "sent": [ "a (emscripten_resize_heap)", "b (_setitimer_js)", diff --git a/test/codesize/test_codesize_hello_dylink_all.json b/test/codesize/test_codesize_hello_dylink_all.json index 50b862122bb1a..acfb97308b036 100644 --- a/test/codesize/test_codesize_hello_dylink_all.json +++ b/test/codesize/test_codesize_hello_dylink_all.json @@ -1,7 +1,7 @@ { "a.out.js": 244300, - "a.out.nodebug.wasm": 577451, - "total": 821751, + "a.out.nodebug.wasm": 577444, + "total": 821744, "sent": [ "IMG_Init", "IMG_Load", diff --git a/test/core/test_signals.c b/test/core/test_signals.c index 12506bae9c0b3..61bbf6d5757d5 100644 --- a/test/core/test_signals.c +++ b/test/core/test_signals.c @@ -146,6 +146,7 @@ void test_sigaction() { void test_sigemptyset() { sigset_t s = { 0 }; + printf("sizeof sigset_t: %zu\n", sizeof(sigset_t)); assert(sigisemptyset(&s)); sigaddset(&s, SIGUSR1); assert(!sigisemptyset(&s));