patch-2.4.0-test3 linux/arch/mips/kernel/irixsig.c
Next file: linux/arch/mips/kernel/irq.c
Previous file: linux/arch/mips/kernel/irixioctl.c
Back to the patch index
Back to the overall index
- Lines: 347
- Date:
Sun Jul 9 22:18:15 2000
- Orig file:
v2.4.0-test2/linux/arch/mips/kernel/irixsig.c
- Orig date:
Tue May 23 15:31:33 2000
diff -u --recursive --new-file v2.4.0-test2/linux/arch/mips/kernel/irixsig.c linux/arch/mips/kernel/irixsig.c
@@ -2,10 +2,9 @@
* irixsig.c: WHEEE, IRIX signals! YOW, am I compatable or what?!?!
*
* Copyright (C) 1996 David S. Miller (dm@engr.sgi.com)
- *
- * $Id: irixsig.c,v 1.13 1999/10/09 00:00:58 ralf Exp $
+ * Copyright (C) 1997 - 2000 Ralf Baechle (ralf@gnu.org)
+ * Copyright (C) 2000 Silicon Graphics, Inc.
*/
-
#include <linux/kernel.h>
#include <linux/sched.h>
#include <linux/mm.h>
@@ -19,6 +18,7 @@
asmlinkage int sys_wait4(pid_t pid, unsigned long *stat_addr,
int options, unsigned long *ru);
+extern asmlinkage void syscall_trace(void);
#undef DEBUG_SIG
@@ -131,10 +131,8 @@
setup_irix_rt_frame(struct k_sigaction * ka, struct pt_regs *regs,
int signr, sigset_t *oldmask, siginfo_t *info)
{
- lock_kernel();
printk("Aiee: setup_tr_frame wants to be written");
do_exit(SIGSEGV);
- unlock_kernel();
}
static inline void handle_signal(unsigned long sig, struct k_sigaction *ka,
@@ -193,7 +191,7 @@
if (!signr)
break;
- if ((current->flags & PF_PTRACED) && signr != SIGKILL) {
+ if ((current->ptrace & PT_PTRACED) && signr != SIGKILL) {
/* Let the debugger run. */
current->exit_code = signr;
current->state = TASK_STOPPED;
@@ -266,8 +264,8 @@
/* FALLTHRU */
default:
- lock_kernel();
sigaddset(¤t->signal, signr);
+ recalc_sigpending(current);
current->flags |= PF_SIGNALED;
do_exit(exit_code);
/* NOTREACHED */
@@ -354,6 +352,8 @@
/*
* Don't let your children do this ...
*/
+ if (current->ptrace & PT_TRACESYS)
+ syscall_trace();
__asm__ __volatile__(
"move\t$29,%0\n\t"
"j\tret_from_sys_call"
@@ -429,23 +429,24 @@
asmlinkage int irix_sigpending(irix_sigset_t *set)
{
- lock_kernel();
+ int err;
+
if (verify_area(VERIFY_WRITE, set, sizeof(*set)) < 0)
return -EFAULT;
/* fill in "set" with signals pending but blocked. */
spin_lock_irq(¤t->sigmask_lock);
- __put_user(current->blocked.sig[0] & current->signal.sig[0],
- &set->sig[0]);
- __put_user(current->blocked.sig[1] & current->signal.sig[1],
- &set->sig[1]);
- __put_user(current->blocked.sig[2] & current->signal.sig[2],
- &set->sig[2]);
- __put_user(current->blocked.sig[3] & current->signal.sig[3],
- &set->sig[3]);
+ err = __put_user(current->blocked.sig[0] & current->signal.sig[0],
+ &set->sig[0]);
+ err |= __put_user(current->blocked.sig[1] & current->signal.sig[1],
+ &set->sig[1]);
+ err |= __put_user(current->blocked.sig[2] & current->signal.sig[2],
+ &set->sig[2]);
+ err |= __put_user(current->blocked.sig[3] & current->signal.sig[3],
+ &set->sig[3]);
spin_unlock_irq(¤t->sigmask_lock);
- return 0;
+ return err;
}
asmlinkage int irix_sigprocmask(int how, irix_sigset_t *new, irix_sigset_t *old)
@@ -453,10 +454,9 @@
sigset_t oldbits, newbits;
int error;
-
- if(new) {
+ if (new) {
error = verify_area(VERIFY_READ, new, sizeof(*new));
- if(error)
+ if (error)
return error;
__copy_from_user(&newbits, new, sizeof(unsigned long)*4);
sigdelsetmask(&newbits, ~_BLOCKABLE);
@@ -565,7 +565,6 @@
sigset_t kset;
int i, sig, error, timeo = 0;
- lock_kernel();
#ifdef DEBUG_SIG
printk("[%s:%d] irix_sigpoll_sys(%p,%p,%p)\n",
current->comm, current->pid, set, info, tp);
@@ -636,7 +635,6 @@
error = -EINTR;
out:
- unlock_kernel();
return error;
}
@@ -662,44 +660,45 @@
DECLARE_WAITQUEUE(wait, current);
struct task_struct *p;
- lock_kernel();
- if(!info) {
+ if (!info) {
retval = -EINVAL;
goto out;
}
retval = verify_area(VERIFY_WRITE, info, sizeof(*info));
if(retval)
goto out;
- if(ru) {
+ if (ru) {
retval = verify_area(VERIFY_WRITE, ru, sizeof(*ru));
if(retval)
goto out;
}
- if(options & ~(W_MASK)) {
+ if (options & ~(W_MASK)) {
retval = -EINVAL;
goto out;
}
- if(type != P_PID && type != P_PGID && type != P_ALL) {
+ if (type != P_PID && type != P_PGID && type != P_ALL) {
retval = -EINVAL;
goto out;
}
add_wait_queue(¤t->wait_chldexit, &wait);
repeat:
flag = 0;
- for(p = current->p_cptr; p; p = p->p_osptr) {
- if((type == P_PID) && p->pid != pid)
+ current->state = TASK_INTERRUPTIBLE;
+ read_lock(&tasklist_lock);
+ for (p = current->p_cptr; p; p = p->p_osptr) {
+ if ((type == P_PID) && p->pid != pid)
continue;
- if((type == P_PGID) && p->pgrp != pid)
+ if ((type == P_PGID) && p->pgrp != pid)
continue;
- if((p->exit_signal != SIGCHLD))
+ if ((p->exit_signal != SIGCHLD))
continue;
flag = 1;
- switch(p->state) {
+ switch (p->state) {
case TASK_STOPPED:
if (!p->exit_code)
continue;
if (!(options & (W_TRAPPED|W_STOPPED)) &&
- !(p->flags & PF_PTRACED))
+ !(p->ptrace & PT_PTRACED))
continue;
if (ru != NULL)
getrusage(p, RUSAGE_BOTH, ru);
@@ -740,12 +739,13 @@
continue;
}
}
- if(flag) {
+ read_unlock(&tasklist_lock);
+ if (flag) {
retval = 0;
- if(options & W_NOHANG)
+ if (options & W_NOHANG)
goto end_waitsys;
retval = -ERESTARTSYS;
- if(signal_pending(current))
+ if (signal_pending(current))
goto end_waitsys;
current->state = TASK_INTERRUPTIBLE;
schedule();
@@ -753,10 +753,10 @@
}
retval = -ECHILD;
end_waitsys:
+ current->state = TASK_RUNNING;
remove_wait_queue(¤t->wait_chldexit, &wait);
out:
- unlock_kernel();
return retval;
}
@@ -779,8 +779,7 @@
struct irix5_context *ctx;
unsigned long flags;
- lock_kernel();
- if(regs->regs[2] == 1000)
+ if (regs->regs[2] == 1000)
base = 1;
ctx = (struct irix5_context *) regs->regs[base + 4];
@@ -803,7 +802,7 @@
__put_user(0, &ctx->weird_graphics_thing);
__put_user(0, &ctx->regs[0]);
- for(i = 1; i < 32; i++)
+ for (i = 1; i < 32; i++)
__put_user(regs->regs[i], &ctx->regs[i]);
__put_user(regs->lo, &ctx->regs[32]);
__put_user(regs->hi, &ctx->regs[33]);
@@ -821,7 +820,6 @@
error = 0;
out:
- unlock_kernel();
return error;
}
@@ -830,7 +828,6 @@
int error, base = 0;
struct irix5_context *ctx;
- lock_kernel();
if(regs->regs[2] == 1000)
base = 1;
ctx = (struct irix5_context *) regs->regs[base + 4];
@@ -841,15 +838,15 @@
#endif
error = verify_area(VERIFY_READ, ctx, sizeof(*ctx));
- if(error)
+ if (error)
goto out;
- if(ctx->flags & 0x02) {
+ if (ctx->flags & 0x02) {
/* XXX sigstack garbage, todo... */
printk("Wheee, cannot do sigstack stuff in setcontext\n");
}
- if(ctx->flags & 0x04) {
+ if (ctx->flags & 0x04) {
int i;
/* XXX extra control block stuff... todo... */
@@ -860,7 +857,7 @@
regs->cp0_epc = ctx->regs[35];
}
- if(ctx->flags & 0x08) {
+ if (ctx->flags & 0x08) {
/* XXX fpu context, blah... */
printk("Wheee, cannot restore FPU context yet...\n");
}
@@ -868,7 +865,6 @@
error = regs->regs[2];
out:
- unlock_kernel();
return error;
}
@@ -878,7 +874,6 @@
{
int error;
- lock_kernel();
#ifdef DEBUG_SIG
printk("[%s:%d] irix_sigstack(%p,%p)\n",
current->comm, current->pid, new, old);
@@ -895,8 +890,8 @@
goto out;
}
error = 0;
+
out:
- unlock_kernel();
return error;
}
@@ -907,18 +902,17 @@
{
int error;
- lock_kernel();
#ifdef DEBUG_SIG
printk("[%s:%d] irix_sigaltstack(%p,%p)\n",
current->comm, current->pid, new, old);
#endif
- if(new) {
+ if (new) {
error = verify_area(VERIFY_READ, new, sizeof(*new));
if(error)
goto out;
}
- if(old) {
+ if (old) {
error = verify_area(VERIFY_WRITE, old, sizeof(*old));
if(error)
goto out;
@@ -927,7 +921,6 @@
out:
error = 0;
- unlock_kernel();
return error;
}
@@ -940,7 +933,6 @@
{
int error;
- lock_kernel();
error = verify_area(VERIFY_READ, pset, sizeof(*pset));
if(error)
goto out;
@@ -950,10 +942,8 @@
pset->cmd, pset->ltype, pset->lid, pset->rtype, pset->rid,
sig);
#endif
-
error = -EINVAL;
out:
- unlock_kernel();
return error;
}
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)