diff options
author | Al Viro <viro@ftp.linux.org.uk> | 2011-08-18 15:04:39 -0400 |
---|---|---|
committer | Richard Weinberger <richard@nod.at> | 2011-11-02 09:14:57 -0400 |
commit | 00361683ce562402a189362f43370a459b166645 (patch) | |
tree | 2e0ca27bb455c671331113efcb2d1b78c14844b3 | |
parent | e87df986ed053d25dbd57b8b137edec5022874f8 (diff) |
um: fill the handlers array at build time
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Richard Weinberger <richard@nod.at>
-rw-r--r-- | arch/um/include/shared/os.h | 2 | ||||
-rw-r--r-- | arch/um/os-Linux/process.c | 12 | ||||
-rw-r--r-- | arch/um/os-Linux/signal.c | 17 | ||||
-rw-r--r-- | arch/um/os-Linux/skas/process.c | 2 |
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); | |||
225 | extern void timer_init(void); | 225 | extern void timer_init(void); |
226 | extern void set_sigstack(void *sig_stack, int size); | 226 | extern void set_sigstack(void *sig_stack, int size); |
227 | extern void remove_sigstack(void); | 227 | extern void remove_sigstack(void); |
228 | extern void set_handler(int sig, void (*handler)(int)); | 228 | extern void set_handler(int sig); |
229 | extern int change_sig(int signal, int on); | 229 | extern int change_sig(int signal, int on); |
230 | extern void block_signals(void); | 230 | extern void block_signals(void); |
231 | extern void unblock_signals(void); | 231 | extern 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 | ||
236 | void init_new_thread_signals(void) | 236 | void 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 | ||
112 | void timer_init(void) | 112 | void timer_init(void) |
113 | { | 113 | { |
114 | set_handler(SIGVTALRM, (__sighandler_t) alarm_handler); | 114 | set_handler(SIGVTALRM); |
115 | } | 115 | } |
116 | 116 | ||
117 | void set_sigstack(void *sig_stack, int size) | 117 | void 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 | ||
127 | static void (*handlers[_NSIG])(int sig, struct sigcontext *sc); | 127 | static 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 | ||
129 | static void handle_signal(int sig, struct sigcontext *sc) | 139 | static 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 | ||
176 | void set_handler(int sig, void (*handler)(int)) | 186 | void 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 |