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 /arch/um/os-Linux/signal.c | |
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>
Diffstat (limited to 'arch/um/os-Linux/signal.c')
-rw-r--r-- | arch/um/os-Linux/signal.c | 17 |
1 files changed, 13 insertions, 4 deletions
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 */ |