signal.c (e63340ae6b6205fef26b40a75673d1c9c0c8bb90) | signal.c (4a177cbf84f827cf9f1d6cfa5264fafd3cc33ce0) |
---|---|
1/* 2 * Architecture-specific signal handling support. 3 * 4 * Copyright (C) 1999-2004 Hewlett-Packard Co 5 * David Mosberger-Tang <davidm@hpl.hp.com> 6 * 7 * Derived from i386 and Alpha versions. 8 */ 9 10#include <linux/errno.h> 11#include <linux/kernel.h> 12#include <linux/mm.h> 13#include <linux/ptrace.h> 14#include <linux/sched.h> 15#include <linux/signal.h> 16#include <linux/smp.h> | 1/* 2 * Architecture-specific signal handling support. 3 * 4 * Copyright (C) 1999-2004 Hewlett-Packard Co 5 * David Mosberger-Tang <davidm@hpl.hp.com> 6 * 7 * Derived from i386 and Alpha versions. 8 */ 9 10#include <linux/errno.h> 11#include <linux/kernel.h> 12#include <linux/mm.h> 13#include <linux/ptrace.h> 14#include <linux/sched.h> 15#include <linux/signal.h> 16#include <linux/smp.h> |
17#include <linux/smp_lock.h> |
|
17#include <linux/stddef.h> 18#include <linux/tty.h> 19#include <linux/binfmts.h> 20#include <linux/unistd.h> 21#include <linux/wait.h> 22 23#include <asm/ia32.h> 24#include <asm/intrinsics.h> --- 10 unchanged lines hidden (view full) --- 35#if _NSIG_WORDS > 1 36# define PUT_SIGSET(k,u) __copy_to_user((u)->sig, (k)->sig, sizeof(sigset_t)) 37# define GET_SIGSET(k,u) __copy_from_user((k)->sig, (u)->sig, sizeof(sigset_t)) 38#else 39# define PUT_SIGSET(k,u) __put_user((k)->sig[0], &(u)->sig[0]) 40# define GET_SIGSET(k,u) __get_user((k)->sig[0], &(u)->sig[0]) 41#endif 42 | 18#include <linux/stddef.h> 19#include <linux/tty.h> 20#include <linux/binfmts.h> 21#include <linux/unistd.h> 22#include <linux/wait.h> 23 24#include <asm/ia32.h> 25#include <asm/intrinsics.h> --- 10 unchanged lines hidden (view full) --- 36#if _NSIG_WORDS > 1 37# define PUT_SIGSET(k,u) __copy_to_user((u)->sig, (k)->sig, sizeof(sigset_t)) 38# define GET_SIGSET(k,u) __copy_from_user((k)->sig, (u)->sig, sizeof(sigset_t)) 39#else 40# define PUT_SIGSET(k,u) __put_user((k)->sig[0], &(u)->sig[0]) 41# define GET_SIGSET(k,u) __get_user((k)->sig[0], &(u)->sig[0]) 42#endif 43 |
43long 44ia64_rt_sigsuspend (sigset_t __user *uset, size_t sigsetsize, struct sigscratch *scr) 45{ 46 sigset_t oldset, set; 47 48 /* XXX: Don't preclude handling different sized sigset_t's. */ 49 if (sigsetsize != sizeof(sigset_t)) 50 return -EINVAL; 51 52 if (!access_ok(VERIFY_READ, uset, sigsetsize)) 53 return -EFAULT; 54 55 if (GET_SIGSET(&set, uset)) 56 return -EFAULT; 57 58 sigdelsetmask(&set, ~_BLOCKABLE); 59 60 spin_lock_irq(¤t->sighand->siglock); 61 { 62 oldset = current->blocked; 63 current->blocked = set; 64 recalc_sigpending(); 65 } 66 spin_unlock_irq(¤t->sighand->siglock); 67 68 /* 69 * The return below usually returns to the signal handler. We need to 70 * pre-set the correct error code here to ensure that the right values 71 * get saved in sigcontext by ia64_do_signal. 72 */ 73 scr->pt.r8 = EINTR; 74 scr->pt.r10 = -1; 75 76 while (1) { 77 current->state = TASK_INTERRUPTIBLE; 78 schedule(); 79 if (ia64_do_signal(&oldset, scr, 1)) 80 return -EINTR; 81 } 82} 83 | |
84asmlinkage long 85sys_sigaltstack (const stack_t __user *uss, stack_t __user *uoss, long arg2, 86 long arg3, long arg4, long arg5, long arg6, long arg7, 87 struct pt_regs regs) 88{ 89 return do_sigaltstack(uss, uoss, regs.r12); 90} 91 --- 380 unchanged lines hidden (view full) --- 472 spin_unlock_irq(¤t->sighand->siglock); 473 return 1; 474} 475 476/* 477 * Note that `init' is a special process: it doesn't get signals it doesn't want to 478 * handle. Thus you cannot kill init even with a SIGKILL even by mistake. 479 */ | 44asmlinkage long 45sys_sigaltstack (const stack_t __user *uss, stack_t __user *uoss, long arg2, 46 long arg3, long arg4, long arg5, long arg6, long arg7, 47 struct pt_regs regs) 48{ 49 return do_sigaltstack(uss, uoss, regs.r12); 50} 51 --- 380 unchanged lines hidden (view full) --- 432 spin_unlock_irq(¤t->sighand->siglock); 433 return 1; 434} 435 436/* 437 * Note that `init' is a special process: it doesn't get signals it doesn't want to 438 * handle. Thus you cannot kill init even with a SIGKILL even by mistake. 439 */ |
480long 481ia64_do_signal (sigset_t *oldset, struct sigscratch *scr, long in_syscall) | 440void 441ia64_do_signal (struct sigscratch *scr, long in_syscall) |
482{ 483 struct k_sigaction ka; | 442{ 443 struct k_sigaction ka; |
444 sigset_t *oldset; |
|
484 siginfo_t info; 485 long restart = in_syscall; 486 long errno = scr->pt.r8; 487# define ERR_CODE(c) (IS_IA32_PROCESS(&scr->pt) ? -(c) : (c)) 488 489 /* 490 * In the ia64_leave_kernel code path, we want the common case to go fast, which 491 * is why we may in certain cases get here from kernel mode. Just return without 492 * doing anything if so. 493 */ 494 if (!user_mode(&scr->pt)) | 445 siginfo_t info; 446 long restart = in_syscall; 447 long errno = scr->pt.r8; 448# define ERR_CODE(c) (IS_IA32_PROCESS(&scr->pt) ? -(c) : (c)) 449 450 /* 451 * In the ia64_leave_kernel code path, we want the common case to go fast, which 452 * is why we may in certain cases get here from kernel mode. Just return without 453 * doing anything if so. 454 */ 455 if (!user_mode(&scr->pt)) |
495 return 0; | 456 return; |
496 | 457 |
497 if (!oldset) | 458 if (test_thread_flag(TIF_RESTORE_SIGMASK)) 459 oldset = ¤t->saved_sigmask; 460 else |
498 oldset = ¤t->blocked; 499 500 /* 501 * This only loops in the rare cases of handle_signal() failing, in which case we 502 * need to push through a forced SIGSEGV. 503 */ 504 while (1) { 505 int signr = get_signal_to_deliver(&info, &ka, &scr->pt, NULL); --- 46 unchanged lines hidden (view full) --- 552 restart = 0; /* don't restart twice if handle_signal() fails... */ 553 } 554 } 555 556 /* 557 * Whee! Actually deliver the signal. If the delivery failed, we need to 558 * continue to iterate in this loop so we can deliver the SIGSEGV... 559 */ | 461 oldset = ¤t->blocked; 462 463 /* 464 * This only loops in the rare cases of handle_signal() failing, in which case we 465 * need to push through a forced SIGSEGV. 466 */ 467 while (1) { 468 int signr = get_signal_to_deliver(&info, &ka, &scr->pt, NULL); --- 46 unchanged lines hidden (view full) --- 515 restart = 0; /* don't restart twice if handle_signal() fails... */ 516 } 517 } 518 519 /* 520 * Whee! Actually deliver the signal. If the delivery failed, we need to 521 * continue to iterate in this loop so we can deliver the SIGSEGV... 522 */ |
560 if (handle_signal(signr, &ka, &info, oldset, scr)) 561 return 1; | 523 if (handle_signal(signr, &ka, &info, oldset, scr)) { 524 /* a signal was successfully delivered; the saved 525 * sigmask will have been stored in the signal frame, 526 * and will be restored by sigreturn, so we can simply 527 * clear the TIF_RESTORE_SIGMASK flag */ 528 if (test_thread_flag(TIF_RESTORE_SIGMASK)) 529 clear_thread_flag(TIF_RESTORE_SIGMASK); 530 return; 531 } |
562 } 563 564 /* Did we come from a system call? */ 565 if (restart) { 566 /* Restart the system call - no handlers present */ 567 if (errno == ERESTARTNOHAND || errno == ERESTARTSYS || errno == ERESTARTNOINTR 568 || errno == ERESTART_RESTARTBLOCK) 569 { --- 9 unchanged lines hidden (view full) --- 579 * the "break" instruction gets re-executed. 580 */ 581 ia64_decrement_ip(&scr->pt); 582 if (errno == ERESTART_RESTARTBLOCK) 583 scr->pt.r15 = __NR_restart_syscall; 584 } 585 } 586 } | 532 } 533 534 /* Did we come from a system call? */ 535 if (restart) { 536 /* Restart the system call - no handlers present */ 537 if (errno == ERESTARTNOHAND || errno == ERESTARTSYS || errno == ERESTARTNOINTR 538 || errno == ERESTART_RESTARTBLOCK) 539 { --- 9 unchanged lines hidden (view full) --- 549 * the "break" instruction gets re-executed. 550 */ 551 ia64_decrement_ip(&scr->pt); 552 if (errno == ERESTART_RESTARTBLOCK) 553 scr->pt.r15 = __NR_restart_syscall; 554 } 555 } 556 } |
587 return 0; | 557 558 /* if there's no signal to deliver, we just put the saved sigmask 559 * back */ 560 if (test_thread_flag(TIF_RESTORE_SIGMASK)) { 561 clear_thread_flag(TIF_RESTORE_SIGMASK); 562 sigprocmask(SIG_SETMASK, ¤t->saved_sigmask, NULL); 563 } |
588} | 564} |