From c4f6f6db31c1d0bc8bee42e92a9a44a708f28b56 Mon Sep 17 00:00:00 2001 From: Matthias Kruk Date: Tue, 14 Jan 2020 19:53:28 +0900 Subject: [PATCH] Correct/amend signal.h - 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 | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/include/signal.h b/include/signal.h index 59b45d3..1a9a1bd 100644 --- a/include/signal.h +++ b/include/signal.h @@ -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 */ -- 2.47.3