shithub: npe

Download patch

ref: 041d3c9d8de4ed92c5cafc3c12c5170113e55677
parent: 528220319a7a051794d73df31d2e8cc9d47287e2
author: Sigrid Solveig Haflínudóttir <sigrid@ftrv.se>
date: Wed Aug 16 22:17:48 EDT 2023

npe: sigemptyset and more signal stuff

--- a/include/npe/signal.h
+++ b/include/npe/signal.h
@@ -7,19 +7,27 @@
 	SA_RESETHAND = 1<<0, /* not used */
 
 	/* all are treated as SIGSEGV */
+	SIGINT = 2,
 	SIGILL = 4,
 	SIGABRT = 6,
 	SIGFPE = 8,
 	SIGSEGV = 11,
+	SIGTERM = 15,
 };
 
+typedef u64int sigset_t;
+
 typedef void (*sa_handler)(int);
 
 struct sigaction {
 	sa_handler sa_handler;
 	int sa_flags;
+	sigset_t sa_mask;
 };
 
+extern sa_handler SIG_DFL, SIG_IGN;
+
 void sigaction(int, struct sigaction *, struct sigaction *);
+int sigemptyset(sigset_t *set);
 
 #endif
--- a/libnpe/mkfile
+++ b/libnpe/mkfile
@@ -50,6 +50,7 @@
 	round.$O\
 	setenv.$O\
 	sigaction.$O\
+	sigemptyset.$O\
 	stat.$O\
 	strerror.$O\
 	strftime.$O\
--- a/libnpe/sigaction.c
+++ b/libnpe/sigaction.c
@@ -4,6 +4,7 @@
 /* FIXME this only supports a single handler */
 
 static sa_handler last;
+sa_handler SIG_DFL = (void*)1, SIG_IGN = nil;
 
 static int
 handler(void*, char *s)
--- /dev/null
+++ b/libnpe/sigemptyset.c
@@ -1,0 +1,8 @@
+#include <signal.h>
+
+int
+sigemptyset(sigset_t *set)
+{
+	*set = 0;
+	return 0;
+}