X-Git-Url: https://git.openpandora.org/cgi-bin/gitweb.cgi?p=pandora-kernel.git;a=blobdiff_plain;f=arch%2Fum%2Fkernel%2Fsignal.c;h=b0fce720c4d08378afba4f642ec97b712ca482c3;hp=2a32e5e8e9c963f041fe7334bda569c1c2966591;hb=dd07a8db7283f52f347aee468007556944b5b393;hpb=12e36b2f41b6cbc67386fcb9c59c32a3e2033905 diff --git a/arch/um/kernel/signal.c b/arch/um/kernel/signal.c index 2a32e5e8e9c9..b0fce720c4d0 100644 --- a/arch/um/kernel/signal.c +++ b/arch/um/kernel/signal.c @@ -1,30 +1,17 @@ /* - * Copyright (C) 2000, 2001, 2002 Jeff Dike (jdike@karaya.com) + * Copyright (C) 2000 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) * Licensed under the GPL */ -#include "linux/stddef.h" -#include "linux/sys.h" -#include "linux/sched.h" -#include "linux/wait.h" -#include "linux/kernel.h" -#include "linux/smp_lock.h" -#include "linux/module.h" -#include "linux/slab.h" -#include "linux/tty.h" -#include "linux/binfmts.h" -#include "linux/ptrace.h" -#include "asm/signal.h" -#include "asm/uaccess.h" -#include "asm/unistd.h" -#include "user_util.h" -#include "asm/ucontext.h" -#include "kern_util.h" -#include "signal_kern.h" -#include "kern.h" +#include +#include +#include +#include +#include +#include #include "frame_kern.h" +#include "kern_util.h" #include "sigcontext.h" -#include "mode.h" EXPORT_SYMBOL(block_signals); EXPORT_SYMBOL(unblock_signals); @@ -47,9 +34,9 @@ static int handle_signal(struct pt_regs *regs, unsigned long signr, current_thread_info()->restart_block.fn = do_no_restart_syscall; /* Did we come from a system call? */ - if(PT_REGS_SYSCALL_NR(regs) >= 0){ + if (PT_REGS_SYSCALL_NR(regs) >= 0) { /* If so, check system call restarting.. */ - switch(PT_REGS_SYSCALL_RET(regs)){ + switch (PT_REGS_SYSCALL_RET(regs)) { case -ERESTART_RESTARTBLOCK: case -ERESTARTNOHAND: PT_REGS_SYSCALL_RET(regs) = -EINTR; @@ -69,17 +56,17 @@ static int handle_signal(struct pt_regs *regs, unsigned long signr, } sp = PT_REGS_SP(regs); - if((ka->sa.sa_flags & SA_ONSTACK) && (sas_ss_flags(sp) == 0)) + if ((ka->sa.sa_flags & SA_ONSTACK) && (sas_ss_flags(sp) == 0)) sp = current->sas_ss_sp + current->sas_ss_size; #ifdef CONFIG_ARCH_HAS_SC_SIGNALS - if(!(ka->sa.sa_flags & SA_SIGINFO)) + if (!(ka->sa.sa_flags & SA_SIGINFO)) err = setup_signal_stack_sc(sp, signr, ka, regs, oldset); else #endif err = setup_signal_stack_si(sp, signr, ka, regs, info, oldset); - if(err){ + if (err) { spin_lock_irq(¤t->sighand->siglock); current->blocked = *oldset; recalc_sigpending(); @@ -89,7 +76,7 @@ static int handle_signal(struct pt_regs *regs, unsigned long signr, spin_lock_irq(¤t->sighand->siglock); sigorsets(¤t->blocked, ¤t->blocked, &ka->sa.sa_mask); - if(!(ka->sa.sa_flags & SA_NODEFER)) + if (!(ka->sa.sa_flags & SA_NODEFER)) sigaddset(¤t->blocked, signr); recalc_sigpending(); spin_unlock_irq(¤t->sighand->siglock); @@ -110,14 +97,16 @@ static int kern_do_signal(struct pt_regs *regs) else oldset = ¤t->blocked; - while((sig = get_signal_to_deliver(&info, &ka_copy, regs, NULL)) > 0){ + while ((sig = get_signal_to_deliver(&info, &ka_copy, regs, NULL)) > 0) { handled_sig = 1; /* Whee! Actually deliver the signal. */ - if(!handle_signal(regs, sig, &ka_copy, &info, oldset)){ - /* a signal was successfully delivered; the saved + if (!handle_signal(regs, sig, &ka_copy, &info, oldset)) { + /* + * a signal was successfully delivered; the saved * sigmask will have been stored in the signal frame, * and will be restored by sigreturn, so we can simply - * clear the TIF_RESTORE_SIGMASK flag */ + * clear the TIF_RESTORE_SIGMASK flag + */ if (test_thread_flag(TIF_RESTORE_SIGMASK)) clear_thread_flag(TIF_RESTORE_SIGMASK); break; @@ -125,9 +114,9 @@ static int kern_do_signal(struct pt_regs *regs) } /* Did we come from a system call? */ - if(!handled_sig && (PT_REGS_SYSCALL_NR(regs) >= 0)){ + if (!handled_sig && (PT_REGS_SYSCALL_NR(regs) >= 0)) { /* Restart the system call - no handlers present */ - switch(PT_REGS_SYSCALL_RET(regs)){ + switch (PT_REGS_SYSCALL_RET(regs)) { case -ERESTARTNOHAND: case -ERESTARTSYS: case -ERESTARTNOINTR: @@ -138,32 +127,35 @@ static int kern_do_signal(struct pt_regs *regs) PT_REGS_ORIG_SYSCALL(regs) = __NR_restart_syscall; PT_REGS_RESTART_SYSCALL(regs); break; - } + } } - /* This closes a way to execute a system call on the host. If + /* + * This closes a way to execute a system call on the host. If * you set a breakpoint on a system call instruction and singlestep * from it, the tracing thread used to PTRACE_SINGLESTEP the process * rather than PTRACE_SYSCALL it, allowing the system call to execute * on the host. The tracing thread will check this flag and * PTRACE_SYSCALL if necessary. */ - if(current->ptrace & PT_DTRACE) + if (current->ptrace & PT_DTRACE) current->thread.singlestep_syscall = is_syscall(PT_REGS_IP(¤t->thread.regs)); - /* if there's no signal to deliver, we just put the saved sigmask - * back */ + /* + * if there's no signal to deliver, we just put the saved sigmask + * back + */ if (!handled_sig && test_thread_flag(TIF_RESTORE_SIGMASK)) { clear_thread_flag(TIF_RESTORE_SIGMASK); sigprocmask(SIG_SETMASK, ¤t->saved_sigmask, NULL); } - return(handled_sig); + return handled_sig; } int do_signal(void) { - return(kern_do_signal(¤t->thread.regs)); + return kern_do_signal(¤t->thread.regs); } /* @@ -186,5 +178,5 @@ long sys_sigsuspend(int history0, int history1, old_sigset_t mask) long sys_sigaltstack(const stack_t __user *uss, stack_t __user *uoss) { - return(do_sigaltstack(uss, uoss, PT_REGS_SP(¤t->thread.regs))); + return do_sigaltstack(uss, uoss, PT_REGS_SP(¤t->thread.regs)); }