aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/um/include/shared/os.h2
-rw-r--r--arch/um/os-Linux/process.c12
-rw-r--r--arch/um/os-Linux/signal.c17
-rw-r--r--arch/um/os-Linux/skas/process.c2
4 files changed, 21 insertions, 12 deletions
diff --git a/arch/um/include/shared/os.h b/arch/um/include/shared/os.h
index 598ca825ea9f..caa66619a9b4 100644
--- a/arch/um/include/shared/os.h
+++ b/arch/um/include/shared/os.h
@@ -225,7 +225,7 @@ extern char *get_umid(void);
225extern void timer_init(void); 225extern void timer_init(void);
226extern void set_sigstack(void *sig_stack, int size); 226extern void set_sigstack(void *sig_stack, int size);
227extern void remove_sigstack(void); 227extern void remove_sigstack(void);
228extern void set_handler(int sig, void (*handler)(int)); 228extern void set_handler(int sig);
229extern int change_sig(int signal, int on); 229extern int change_sig(int signal, int on);
230extern void block_signals(void); 230extern void block_signals(void);
231extern void unblock_signals(void); 231extern void unblock_signals(void);
diff --git a/arch/um/os-Linux/process.c b/arch/um/os-Linux/process.c
index 075ae920143d..e08fe305beb1 100644
--- a/arch/um/os-Linux/process.c
+++ b/arch/um/os-Linux/process.c
@@ -235,13 +235,13 @@ out:
235 235
236void init_new_thread_signals(void) 236void init_new_thread_signals(void)
237{ 237{
238 set_handler(SIGSEGV, (__sighandler_t) sig_handler); 238 set_handler(SIGSEGV);
239 set_handler(SIGTRAP, (__sighandler_t) sig_handler); 239 set_handler(SIGTRAP);
240 set_handler(SIGFPE, (__sighandler_t) sig_handler); 240 set_handler(SIGFPE);
241 set_handler(SIGILL, (__sighandler_t) sig_handler); 241 set_handler(SIGILL);
242 set_handler(SIGBUS, (__sighandler_t) sig_handler); 242 set_handler(SIGBUS);
243 signal(SIGHUP, SIG_IGN); 243 signal(SIGHUP, SIG_IGN);
244 set_handler(SIGIO, (__sighandler_t) sig_handler); 244 set_handler(SIGIO);
245 signal(SIGWINCH, SIG_IGN); 245 signal(SIGWINCH, SIG_IGN);
246 signal(SIGTERM, SIG_DFL); 246 signal(SIGTERM, SIG_DFL);
247} 247}
diff --git a/arch/um/os-Linux/signal.c b/arch/um/os-Linux/signal.c
index f248fb2ab58c..c4a4e2026630 100644
--- a/arch/um/os-Linux/signal.c
+++ b/arch/um/os-Linux/signal.c
@@ -111,7 +111,7 @@ void alarm_handler(int sig, struct sigcontext *sc)
111 111
112void timer_init(void) 112void timer_init(void)
113{ 113{
114 set_handler(SIGVTALRM, (__sighandler_t) alarm_handler); 114 set_handler(SIGVTALRM);
115} 115}
116 116
117void set_sigstack(void *sig_stack, int size) 117void set_sigstack(void *sig_stack, int size)
@@ -124,7 +124,17 @@ void set_sigstack(void *sig_stack, int size)
124 panic("enabling signal stack failed, errno = %d\n", errno); 124 panic("enabling signal stack failed, errno = %d\n", errno);
125} 125}
126 126
127static void (*handlers[_NSIG])(int sig, struct sigcontext *sc); 127static void (*handlers[_NSIG])(int sig, struct sigcontext *sc) = {
128 [SIGSEGV] = sig_handler,
129 [SIGBUS] = sig_handler,
130 [SIGILL] = sig_handler,
131 [SIGFPE] = sig_handler,
132 [SIGTRAP] = sig_handler,
133
134 [SIGIO] = sig_handler,
135 [SIGWINCH] = sig_handler,
136 [SIGVTALRM] = alarm_handler
137};
128 138
129static void handle_signal(int sig, struct sigcontext *sc) 139static void handle_signal(int sig, struct sigcontext *sc)
130{ 140{
@@ -173,13 +183,12 @@ static void hard_handler(int sig, siginfo_t *info, void *p)
173 handle_signal(sig, (struct sigcontext *) &uc->uc_mcontext); 183 handle_signal(sig, (struct sigcontext *) &uc->uc_mcontext);
174} 184}
175 185
176void set_handler(int sig, void (*handler)(int)) 186void set_handler(int sig)
177{ 187{
178 struct sigaction action; 188 struct sigaction action;
179 int flags = SA_SIGINFO | SA_ONSTACK; 189 int flags = SA_SIGINFO | SA_ONSTACK;
180 sigset_t sig_mask; 190 sigset_t sig_mask;
181 191
182 handlers[sig] = (void (*)(int, struct sigcontext *)) handler;
183 action.sa_sigaction = hard_handler; 192 action.sa_sigaction = hard_handler;
184 193
185 /* block irq ones */ 194 /* block irq ones */
diff --git a/arch/um/os-Linux/skas/process.c b/arch/um/os-Linux/skas/process.c
index 31743f1d1195..f4e02ad72e12 100644
--- a/arch/um/os-Linux/skas/process.c
+++ b/arch/um/os-Linux/skas/process.c
@@ -659,7 +659,7 @@ int start_idle_thread(void *stack, jmp_buf *switch_buf)
659{ 659{
660 int n; 660 int n;
661 661
662 set_handler(SIGWINCH, (__sighandler_t) sig_handler); 662 set_handler(SIGWINCH);
663 663
664 /* 664 /*
665 * Can't use UML_SETJMP or UML_LONGJMP here because they save 665 * Can't use UML_SETJMP or UML_LONGJMP here because they save