]> git.corax.cc Git - corax/commitdiff
Correct/amend signal.h
authorMatthias Kruk <m@m10k.eu>
Tue, 14 Jan 2020 10:53:28 +0000 (19:53 +0900)
committerMatthias Kruk <m@m10k.eu>
Tue, 14 Jan 2020 10:53:28 +0000 (19:53 +0900)
 - Add the correct definitions of sigset_t and sigval_t
 - Wrap struct sigaction's sa_handler and sa_sigaction members in a union
 - Add the prototype for sigaction()

include/signal.h

index 59b45d3d5b5044938de961e2028ed2d3c986f144..1a9a1bd4f10aed3631da7db8f77c827b4b34bd57 100644 (file)
@@ -1,6 +1,7 @@
 #ifndef __SIGNAL_H
 #define __SIGNAL_H
 
+#define SIGHWINT  0 /* Corax specific: hardware interrupt signal */
 #define SIGHUP    1
 #define SIGINT    2
 #define SIGQUIT   3
@@ -50,9 +51,14 @@ typedef struct siginfo siginfo_t;
 /* FIXME: move definition of clock_t into the proper header file */
 typedef unsigned int clock_t;
 
-/* FIXME: add the correct definition for sigval_t and sigset_t */
-typedef unsigned int sigval_t;
-typedef unsigned int sigset_t;
+typedef struct {
+       unsigned long int val[1024 / 8 * sizeof(unsigned long int)];
+} sigset_t;
+
+typedef union {
+       int  sival_int;
+       void *sival_void;
+} sigval_t;
 
 struct siginfo {
        int          si_signo;
@@ -79,18 +85,25 @@ struct siginfo {
 };
 
 struct sigaction {
-       void     (*sa_handler)(int);
-       void     (*sa_sigaction)(int, siginfo_t*, void*);
+       union {
+               void     (*__sa_handler)(int);
+               void     (*__sa_sigaction)(int, siginfo_t*, void*);
+       } __sigaction_u;
        sigset_t sa_mask;
        int      sa_flags;
        void     (*sa_restorer)(void);
 };
 
+#define sa_handler   __sigaction_u.__sa_handler
+#define sa_sigaction __sigaction_u.__sa_sigaction
+
 typedef void (*sighandler_t)(int);
 
 #define SIG_IGN ((sighandler_t)0x1) /* "ignore" handler */
 #define SIG_DFL ((sighandler_t)0x0) /* default handler */
 
+extern int sigaction(int, const struct sigaction*, struct sigaction*);
+
 #endif /* __ASSEMBLY_SOURCE */
 
 #endif /* __SIGNAL_H */