summaryrefslogtreecommitdiff
path: root/src/signal/signal.c
diff options
context:
space:
mode:
authorJakob Kaivo <jkk@ung.org>2019-02-08 18:42:39 -0500
committerJakob Kaivo <jkk@ung.org>2019-02-08 18:42:39 -0500
commit7ef8a7379f7f7d09e71ccae2a0b688c3cd80423f (patch)
tree092ab0aed1769117fd7b28b8592f6f96b0e0d5af /src/signal/signal.c
parent6acf19370e8adff79cd83b257d3f04aeaf2a59dd (diff)
merge sources into single tree
Diffstat (limited to 'src/signal/signal.c')
-rw-r--r--src/signal/signal.c42
1 files changed, 42 insertions, 0 deletions
diff --git a/src/signal/signal.c b/src/signal/signal.c
new file mode 100644
index 00000000..373fddc5
--- /dev/null
+++ b/src/signal/signal.c
@@ -0,0 +1,42 @@
+#if defined _POSIX_SOURCE
+#include "sys/types.h"
+#endif
+
+#include <signal.h>
+
+/** set a signal handler **/
+void (*signal(int sig, void (*func)(int)))(int)
+{
+ (void)sig;
+ /* TODO */
+ /*
+ RETURN_SUCCESS(a pointer to the signal handler);
+ RETURN_FAILURE(CONSTANT(SIG_ERR), the request could not be honored);
+ */
+ return func;
+}
+
+/***
+sets the signal handler for the signal specified by ARGUMENT(sig) to
+ARGUMENT(func).
+
+Specifying CONSTANT(SIG_DFL) for ARGUMENT(func) resets the signal handler
+to its default behavior.
+
+Specifying CONSTANT(SIG_IGN) for ARGUMENT(func) causes the signal
+ARGUMENT(sig) to be ignored.
+
+Otherwise, ARGUMENT(func) must be a pointer to a function which takes a
+single TYPE(int) argument and does not return a value.
+***/
+
+/*
+UNDEFINED(A signal handler for CONSTANT(SIGFPE) returns)
+UNDEFINED(A signal handler calling standard library functions other than THIS() if the signal occurs as other than as a result of calling FUNCTION(abort) or FUNCTION(raise))
+UNDEFINED(FIXME: some function calls from signal handlers)
+IMPLEMENTATION(Whether signal blocking is performed when a signal occurs)
+IMPLEMENTATION(Other signals corresponding to computation exceptions for which signal handlers must not return)
+*/
+/*
+STDC(1)
+*/