Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(270)

Unified Diff: fusl/src/signal/block.c

Issue 1573973002: Add a "fork" of musl as //fusl. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « fusl/src/signal/arm/sigsetjmp.s ('k') | fusl/src/signal/getitimer.c » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: fusl/src/signal/block.c
diff --git a/fusl/src/signal/block.c b/fusl/src/signal/block.c
new file mode 100644
index 0000000000000000000000000000000000000000..d7f6100134572aeaa42131dc001ff287ffc9fbbd
--- /dev/null
+++ b/fusl/src/signal/block.c
@@ -0,0 +1,44 @@
+#include "pthread_impl.h"
+#include "syscall.h"
+#include <signal.h>
+
+static const unsigned long all_mask[] = {
+#if ULONG_MAX == 0xffffffff && _NSIG == 129
+ -1UL, -1UL, -1UL, -1UL
+#elif ULONG_MAX == 0xffffffff
+ -1UL, -1UL
+#else
+ -1UL
+#endif
+};
+
+static const unsigned long app_mask[] = {
+#if ULONG_MAX == 0xffffffff
+#if _NSIG == 65
+ 0x7fffffff, 0xfffffffc
+#else
+ 0x7fffffff, 0xfffffffc, -1UL, -1UL
+#endif
+#else
+#if _NSIG == 65
+ 0xfffffffc7fffffff
+#else
+ 0xfffffffc7fffffff, -1UL
+#endif
+#endif
+};
+
+void __block_all_sigs(void *set)
+{
+ __syscall(SYS_rt_sigprocmask, SIG_BLOCK, &all_mask, set, _NSIG/8);
+}
+
+void __block_app_sigs(void *set)
+{
+ __syscall(SYS_rt_sigprocmask, SIG_BLOCK, &app_mask, set, _NSIG/8);
+}
+
+void __restore_sigs(void *set)
+{
+ __syscall(SYS_rt_sigprocmask, SIG_SETMASK, set, 0, _NSIG/8);
+}
« no previous file with comments | « fusl/src/signal/arm/sigsetjmp.s ('k') | fusl/src/signal/getitimer.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698