|
@@ -13,8 +13,9 @@
|
|
#include "kern_util.h"
|
|
#include "kern_util.h"
|
|
#include "os.h"
|
|
#include "os.h"
|
|
#include "sysdep/mcontext.h"
|
|
#include "sysdep/mcontext.h"
|
|
|
|
+#include "internal.h"
|
|
|
|
|
|
-void (*sig_info[NSIG])(int, struct uml_pt_regs *) = {
|
|
|
|
|
|
+void (*sig_info[NSIG])(int, siginfo_t *, struct uml_pt_regs *) = {
|
|
[SIGTRAP] = relay_signal,
|
|
[SIGTRAP] = relay_signal,
|
|
[SIGFPE] = relay_signal,
|
|
[SIGFPE] = relay_signal,
|
|
[SIGILL] = relay_signal,
|
|
[SIGILL] = relay_signal,
|
|
@@ -24,7 +25,7 @@ void (*sig_info[NSIG])(int, struct uml_pt_regs *) = {
|
|
[SIGIO] = sigio_handler,
|
|
[SIGIO] = sigio_handler,
|
|
[SIGVTALRM] = timer_handler };
|
|
[SIGVTALRM] = timer_handler };
|
|
|
|
|
|
-static void sig_handler_common(int sig, mcontext_t *mc)
|
|
|
|
|
|
+static void sig_handler_common(int sig, siginfo_t *si, mcontext_t *mc)
|
|
{
|
|
{
|
|
struct uml_pt_regs r;
|
|
struct uml_pt_regs r;
|
|
int save_errno = errno;
|
|
int save_errno = errno;
|
|
@@ -40,7 +41,7 @@ static void sig_handler_common(int sig, mcontext_t *mc)
|
|
if ((sig != SIGIO) && (sig != SIGWINCH) && (sig != SIGVTALRM))
|
|
if ((sig != SIGIO) && (sig != SIGWINCH) && (sig != SIGVTALRM))
|
|
unblock_signals();
|
|
unblock_signals();
|
|
|
|
|
|
- (*sig_info[sig])(sig, &r);
|
|
|
|
|
|
+ (*sig_info[sig])(sig, si, &r);
|
|
|
|
|
|
errno = save_errno;
|
|
errno = save_errno;
|
|
}
|
|
}
|
|
@@ -60,7 +61,7 @@ static void sig_handler_common(int sig, mcontext_t *mc)
|
|
static int signals_enabled;
|
|
static int signals_enabled;
|
|
static unsigned int signals_pending;
|
|
static unsigned int signals_pending;
|
|
|
|
|
|
-void sig_handler(int sig, mcontext_t *mc)
|
|
|
|
|
|
+void sig_handler(int sig, siginfo_t *si, mcontext_t *mc)
|
|
{
|
|
{
|
|
int enabled;
|
|
int enabled;
|
|
|
|
|
|
@@ -72,7 +73,7 @@ void sig_handler(int sig, mcontext_t *mc)
|
|
|
|
|
|
block_signals();
|
|
block_signals();
|
|
|
|
|
|
- sig_handler_common(sig, mc);
|
|
|
|
|
|
+ sig_handler_common(sig, si, mc);
|
|
|
|
|
|
set_signals(enabled);
|
|
set_signals(enabled);
|
|
}
|
|
}
|
|
@@ -85,10 +86,10 @@ static void real_alarm_handler(mcontext_t *mc)
|
|
get_regs_from_mc(®s, mc);
|
|
get_regs_from_mc(®s, mc);
|
|
regs.is_user = 0;
|
|
regs.is_user = 0;
|
|
unblock_signals();
|
|
unblock_signals();
|
|
- timer_handler(SIGVTALRM, ®s);
|
|
|
|
|
|
+ timer_handler(SIGVTALRM, NULL, ®s);
|
|
}
|
|
}
|
|
|
|
|
|
-void alarm_handler(int sig, mcontext_t *mc)
|
|
|
|
|
|
+void alarm_handler(int sig, struct siginfo *unused_si, mcontext_t *mc)
|
|
{
|
|
{
|
|
int enabled;
|
|
int enabled;
|
|
|
|
|
|
@@ -119,7 +120,7 @@ void set_sigstack(void *sig_stack, int size)
|
|
panic("enabling signal stack failed, errno = %d\n", errno);
|
|
panic("enabling signal stack failed, errno = %d\n", errno);
|
|
}
|
|
}
|
|
|
|
|
|
-static void (*handlers[_NSIG])(int sig, mcontext_t *mc) = {
|
|
|
|
|
|
+static void (*handlers[_NSIG])(int sig, siginfo_t *si, mcontext_t *mc) = {
|
|
[SIGSEGV] = sig_handler,
|
|
[SIGSEGV] = sig_handler,
|
|
[SIGBUS] = sig_handler,
|
|
[SIGBUS] = sig_handler,
|
|
[SIGILL] = sig_handler,
|
|
[SIGILL] = sig_handler,
|
|
@@ -132,7 +133,7 @@ static void (*handlers[_NSIG])(int sig, mcontext_t *mc) = {
|
|
};
|
|
};
|
|
|
|
|
|
|
|
|
|
-static void hard_handler(int sig, siginfo_t *info, void *p)
|
|
|
|
|
|
+static void hard_handler(int sig, siginfo_t *si, void *p)
|
|
{
|
|
{
|
|
struct ucontext *uc = p;
|
|
struct ucontext *uc = p;
|
|
mcontext_t *mc = &uc->uc_mcontext;
|
|
mcontext_t *mc = &uc->uc_mcontext;
|
|
@@ -161,7 +162,7 @@ static void hard_handler(int sig, siginfo_t *info, void *p)
|
|
while ((sig = ffs(pending)) != 0){
|
|
while ((sig = ffs(pending)) != 0){
|
|
sig--;
|
|
sig--;
|
|
pending &= ~(1 << sig);
|
|
pending &= ~(1 << sig);
|
|
- (*handlers[sig])(sig, mc);
|
|
|
|
|
|
+ (*handlers[sig])(sig, si, mc);
|
|
}
|
|
}
|
|
|
|
|
|
/*
|
|
/*
|
|
@@ -273,9 +274,12 @@ void unblock_signals(void)
|
|
* Deal with SIGIO first because the alarm handler might
|
|
* Deal with SIGIO first because the alarm handler might
|
|
* schedule, leaving the pending SIGIO stranded until we come
|
|
* schedule, leaving the pending SIGIO stranded until we come
|
|
* back here.
|
|
* back here.
|
|
|
|
+ *
|
|
|
|
+ * SIGIO's handler doesn't use siginfo or mcontext,
|
|
|
|
+ * so they can be NULL.
|
|
*/
|
|
*/
|
|
if (save_pending & SIGIO_MASK)
|
|
if (save_pending & SIGIO_MASK)
|
|
- sig_handler_common(SIGIO, NULL);
|
|
|
|
|
|
+ sig_handler_common(SIGIO, NULL, NULL);
|
|
|
|
|
|
if (save_pending & SIGVTALRM_MASK)
|
|
if (save_pending & SIGVTALRM_MASK)
|
|
real_alarm_handler(NULL);
|
|
real_alarm_handler(NULL);
|