[PATCH 5/19] UML - signal initialization cleanup

From: Jeff Dike
Date: Thu Jul 06 2006 - 20:37:27 EST


It turns out that init_new_thread_signals is always called with
altstack == 1, so we can eliminate the parameter.

Signed-off-by: Jeff Dike <jdike@xxxxxxxxxxx>

Index: linux-2.6.17/arch/um/include/os.h
===================================================================
--- linux-2.6.17.orig/arch/um/include/os.h 2006-06-20 17:24:29.000000000 -0400
+++ linux-2.6.17/arch/um/include/os.h 2006-07-06 13:25:20.000000000 -0400
@@ -199,7 +199,7 @@ extern int os_getpid(void);
extern int os_getpgrp(void);

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 os_map_memory(void *virt, int fd, unsigned long long off,
Index: linux-2.6.17/arch/um/kernel/skas/process_kern.c
===================================================================
--- linux-2.6.17.orig/arch/um/kernel/skas/process_kern.c 2006-06-20 17:24:29.000000000 -0400
+++ linux-2.6.17/arch/um/kernel/skas/process_kern.c 2006-07-06 13:25:20.000000000 -0400
@@ -177,7 +177,7 @@ int start_uml_skas(void)
if(proc_mm)
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.arg = NULL;
Index: linux-2.6.17/arch/um/kernel/tt/exec_kern.c
===================================================================
--- linux-2.6.17.orig/arch/um/kernel/tt/exec_kern.c 2006-03-23 16:40:20.000000000 -0500
+++ linux-2.6.17/arch/um/kernel/tt/exec_kern.c 2006-07-06 13:25:20.000000000 -0400
@@ -21,7 +21,7 @@
static int exec_tramp(void *sig_stack)
{
init_new_thread_stack(sig_stack, NULL);
- init_new_thread_signals(1);
+ init_new_thread_signals();
os_stop_process(os_getpid());
return(0);
}
Index: linux-2.6.17/arch/um/kernel/tt/process_kern.c
===================================================================
--- linux-2.6.17.orig/arch/um/kernel/tt/process_kern.c 2006-07-06 13:22:13.000000000 -0400
+++ linux-2.6.17/arch/um/kernel/tt/process_kern.c 2006-07-06 13:25:20.000000000 -0400
@@ -142,7 +142,7 @@ static void new_thread_handler(int sig)
schedule_tail(current->thread.prev_sched);
current->thread.prev_sched = NULL;

- init_new_thread_signals(1);
+ init_new_thread_signals();
enable_timer();
free_page(current->thread.temp_stack);
set_cmdline("(kernel thread)");
Index: linux-2.6.17/arch/um/os-Linux/process.c
===================================================================
--- linux-2.6.17.orig/arch/um/os-Linux/process.c 2006-06-20 17:24:29.000000000 -0400
+++ linux-2.6.17/arch/um/os-Linux/process.c 2006-07-06 13:26:38.000000000 -0400
@@ -250,25 +250,24 @@ void init_new_thread_stack(void *sig_sta
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, flags,
+ set_handler(SIGSEGV, (__sighandler_t) sig_handler, SA_ONSTACK,
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);
- set_handler(SIGFPE, (__sighandler_t) sig_handler, flags,
+ set_handler(SIGFPE, (__sighandler_t) sig_handler, SA_ONSTACK,
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);
- set_handler(SIGBUS, (__sighandler_t) sig_handler, flags,
+ set_handler(SIGBUS, (__sighandler_t) sig_handler, SA_ONSTACK,
SIGUSR1, SIGIO, SIGWINCH, SIGALRM, SIGVTALRM, -1);
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);

- init_irq_signals(altstack);
+ init_irq_signals(1);
}

int run_kernel_thread(int (*fn)(void *), void *arg, void **jmp_ptr)
Index: linux-2.6.17/arch/um/os-Linux/skas/process.c
===================================================================
--- linux-2.6.17.orig/arch/um/os-Linux/skas/process.c 2006-06-20 17:24:29.000000000 -0400
+++ linux-2.6.17/arch/um/os-Linux/skas/process.c 2006-07-06 13:25:20.000000000 -0400
@@ -159,7 +159,7 @@ static int userspace_tramp(void *stack)

ptrace(PTRACE_TRACEME, 0, 0, 0);

- init_new_thread_signals(1);
+ init_new_thread_signals();
enable_timer();

if(!proc_mm){

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/