提交 e64bd134 编写于 作者: J Jeff Dike 提交者: Linus Torvalds

[PATCH] uml: signal initialization cleanup

It turns out that init_new_thread_signals is always called with altstack == 1,
so we can eliminate the parameter.
Signed-off-by: NJeff Dike <jdike@addtoit.com>
Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: NAndrew Morton <akpm@osdl.org>
Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
上级 9914aee8
...@@ -199,7 +199,7 @@ extern int os_getpid(void); ...@@ -199,7 +199,7 @@ extern int os_getpid(void);
extern int os_getpgrp(void); extern int os_getpgrp(void);
extern void init_new_thread_stack(void *sig_stack, void (*usr1_handler)(int)); extern void init_new_thread_stack(void *sig_stack, void (*usr1_handler)(int));
extern void init_new_thread_signals(int altstack); extern void init_new_thread_signals(void);
extern int run_kernel_thread(int (*fn)(void *), void *arg, void **jmp_ptr); extern int run_kernel_thread(int (*fn)(void *), void *arg, void **jmp_ptr);
extern int os_map_memory(void *virt, int fd, unsigned long long off, extern int os_map_memory(void *virt, int fd, unsigned long long off,
......
...@@ -177,7 +177,7 @@ int start_uml_skas(void) ...@@ -177,7 +177,7 @@ int start_uml_skas(void)
if(proc_mm) if(proc_mm)
userspace_pid[0] = start_userspace(0); userspace_pid[0] = start_userspace(0);
init_new_thread_signals(1); init_new_thread_signals();
init_task.thread.request.u.thread.proc = start_kernel_proc; init_task.thread.request.u.thread.proc = start_kernel_proc;
init_task.thread.request.u.thread.arg = NULL; init_task.thread.request.u.thread.arg = NULL;
......
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
static int exec_tramp(void *sig_stack) static int exec_tramp(void *sig_stack)
{ {
init_new_thread_stack(sig_stack, NULL); init_new_thread_stack(sig_stack, NULL);
init_new_thread_signals(1); init_new_thread_signals();
os_stop_process(os_getpid()); os_stop_process(os_getpid());
return(0); return(0);
} }
......
...@@ -142,7 +142,7 @@ static void new_thread_handler(int sig) ...@@ -142,7 +142,7 @@ static void new_thread_handler(int sig)
schedule_tail(current->thread.prev_sched); schedule_tail(current->thread.prev_sched);
current->thread.prev_sched = NULL; current->thread.prev_sched = NULL;
init_new_thread_signals(1); init_new_thread_signals();
enable_timer(); enable_timer();
free_page(current->thread.temp_stack); free_page(current->thread.temp_stack);
set_cmdline("(kernel thread)"); set_cmdline("(kernel thread)");
......
...@@ -250,25 +250,24 @@ void init_new_thread_stack(void *sig_stack, void (*usr1_handler)(int)) ...@@ -250,25 +250,24 @@ void init_new_thread_stack(void *sig_stack, void (*usr1_handler)(int))
if(usr1_handler) set_handler(SIGUSR1, usr1_handler, flags, -1); if(usr1_handler) set_handler(SIGUSR1, usr1_handler, flags, -1);
} }
void init_new_thread_signals(int altstack) void init_new_thread_signals(void)
{ {
int flags = altstack ? SA_ONSTACK : 0; set_handler(SIGSEGV, (__sighandler_t) sig_handler, SA_ONSTACK,
set_handler(SIGSEGV, (__sighandler_t) sig_handler, flags,
SIGUSR1, SIGIO, SIGWINCH, SIGALRM, SIGVTALRM, -1); SIGUSR1, SIGIO, SIGWINCH, SIGALRM, SIGVTALRM, -1);
set_handler(SIGTRAP, (__sighandler_t) sig_handler, flags, set_handler(SIGTRAP, (__sighandler_t) sig_handler, SA_ONSTACK,
SIGUSR1, SIGIO, SIGWINCH, SIGALRM, SIGVTALRM, -1); SIGUSR1, SIGIO, SIGWINCH, SIGALRM, SIGVTALRM, -1);
set_handler(SIGFPE, (__sighandler_t) sig_handler, flags, set_handler(SIGFPE, (__sighandler_t) sig_handler, SA_ONSTACK,
SIGUSR1, SIGIO, SIGWINCH, SIGALRM, SIGVTALRM, -1); SIGUSR1, SIGIO, SIGWINCH, SIGALRM, SIGVTALRM, -1);
set_handler(SIGILL, (__sighandler_t) sig_handler, flags, set_handler(SIGILL, (__sighandler_t) sig_handler, SA_ONSTACK,
SIGUSR1, SIGIO, SIGWINCH, SIGALRM, SIGVTALRM, -1); SIGUSR1, SIGIO, SIGWINCH, SIGALRM, SIGVTALRM, -1);
set_handler(SIGBUS, (__sighandler_t) sig_handler, flags, set_handler(SIGBUS, (__sighandler_t) sig_handler, SA_ONSTACK,
SIGUSR1, SIGIO, SIGWINCH, SIGALRM, SIGVTALRM, -1); SIGUSR1, SIGIO, SIGWINCH, SIGALRM, SIGVTALRM, -1);
set_handler(SIGUSR2, (__sighandler_t) sig_handler, set_handler(SIGUSR2, (__sighandler_t) sig_handler,
flags, SIGUSR1, SIGIO, SIGWINCH, SIGALRM, SIGVTALRM, -1); SA_ONSTACK, SIGUSR1, SIGIO, SIGWINCH, SIGALRM, SIGVTALRM,
-1);
signal(SIGHUP, SIG_IGN); signal(SIGHUP, SIG_IGN);
init_irq_signals(altstack); init_irq_signals(1);
} }
int run_kernel_thread(int (*fn)(void *), void *arg, void **jmp_ptr) int run_kernel_thread(int (*fn)(void *), void *arg, void **jmp_ptr)
......
...@@ -159,7 +159,7 @@ static int userspace_tramp(void *stack) ...@@ -159,7 +159,7 @@ static int userspace_tramp(void *stack)
ptrace(PTRACE_TRACEME, 0, 0, 0); ptrace(PTRACE_TRACEME, 0, 0, 0);
init_new_thread_signals(1); init_new_thread_signals();
enable_timer(); enable_timer();
if(!proc_mm){ if(!proc_mm){
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册