|
@@ -2299,12 +2299,6 @@ long do_no_restart_syscall(struct restart_block *param)
|
|
return -EINTR;
|
|
return -EINTR;
|
|
}
|
|
}
|
|
|
|
|
|
-/*
|
|
|
|
- * We don't need to get the kernel lock - this is all local to this
|
|
|
|
- * particular thread.. (and that's good, because this is _heavily_
|
|
|
|
- * used by various programs)
|
|
|
|
- */
|
|
|
|
-
|
|
|
|
/*
|
|
/*
|
|
* This is also useful for kernel threads that want to temporarily
|
|
* This is also useful for kernel threads that want to temporarily
|
|
* (or permanently) block certain signals.
|
|
* (or permanently) block certain signals.
|
|
@@ -2315,30 +2309,33 @@ long do_no_restart_syscall(struct restart_block *param)
|
|
*/
|
|
*/
|
|
int sigprocmask(int how, sigset_t *set, sigset_t *oldset)
|
|
int sigprocmask(int how, sigset_t *set, sigset_t *oldset)
|
|
{
|
|
{
|
|
- int error;
|
|
|
|
|
|
+ struct task_struct *tsk = current;
|
|
|
|
+ sigset_t newset;
|
|
|
|
|
|
- spin_lock_irq(¤t->sighand->siglock);
|
|
|
|
|
|
+ /* Lockless, only current can change ->blocked, never from irq */
|
|
if (oldset)
|
|
if (oldset)
|
|
- *oldset = current->blocked;
|
|
|
|
|
|
+ *oldset = tsk->blocked;
|
|
|
|
|
|
- error = 0;
|
|
|
|
switch (how) {
|
|
switch (how) {
|
|
case SIG_BLOCK:
|
|
case SIG_BLOCK:
|
|
- sigorsets(¤t->blocked, ¤t->blocked, set);
|
|
|
|
|
|
+ sigorsets(&newset, &tsk->blocked, set);
|
|
break;
|
|
break;
|
|
case SIG_UNBLOCK:
|
|
case SIG_UNBLOCK:
|
|
- signandsets(¤t->blocked, ¤t->blocked, set);
|
|
|
|
|
|
+ signandsets(&newset, &tsk->blocked, set);
|
|
break;
|
|
break;
|
|
case SIG_SETMASK:
|
|
case SIG_SETMASK:
|
|
- current->blocked = *set;
|
|
|
|
|
|
+ newset = *set;
|
|
break;
|
|
break;
|
|
default:
|
|
default:
|
|
- error = -EINVAL;
|
|
|
|
|
|
+ return -EINVAL;
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ spin_lock_irq(&tsk->sighand->siglock);
|
|
|
|
+ tsk->blocked = newset;
|
|
recalc_sigpending();
|
|
recalc_sigpending();
|
|
- spin_unlock_irq(¤t->sighand->siglock);
|
|
|
|
|
|
+ spin_unlock_irq(&tsk->sighand->siglock);
|
|
|
|
|
|
- return error;
|
|
|
|
|
|
+ return 0;
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|