patch-2.1.23 linux/arch/mips/kernel/syscall.c
Next file: linux/arch/mips/kernel/sysmips.c
Previous file: linux/arch/mips/kernel/signal.c
Back to the patch index
Back to the overall index
- Lines: 114
- Date:
Sun Jan 26 12:07:05 1997
- Orig file:
v2.1.22/linux/arch/mips/kernel/syscall.c
- Orig date:
Fri Apr 12 09:49:30 1996
diff -u --recursive --new-file v2.1.22/linux/arch/mips/kernel/syscall.c linux/arch/mips/kernel/syscall.c
@@ -9,6 +9,8 @@
*/
#include <linux/linkage.h>
#include <linux/mm.h>
+#include <linux/smp.h>
+#include <linux/smp_lock.h>
#include <linux/mman.h>
#include <linux/sched.h>
#include <linux/unistd.h>
@@ -28,32 +30,43 @@
int fd[2];
int error;
+ lock_kernel();
error = do_pipe(fd);
if (error)
- return error;
+ goto out;
regs->reg2 = fd[0];
regs->reg3 = fd[1];
- return 0;
+out:
+ unlock_kernel();
+ return error;
}
asmlinkage unsigned long sys_mmap(unsigned long addr, size_t len, int prot,
int flags, int fd, off_t offset)
{
struct file * file = NULL;
+ int ret = -EBADF;
+ lock_kernel();
if (flags & MAP_RENAME) {
if (fd >= NR_OPEN || !(file = current->files->fd[fd]))
- return -EBADF;
+ goto out;
}
flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE);
- return do_mmap(file, addr, len, prot, flags, offset);
+ ret = do_mmap(file, addr, len, prot, flags, offset);
+out:
+ unlock_kernel();
+ return ret;
}
asmlinkage int sys_idle(void)
{
+ int ret = -EPERM;
+
+ lock_kernel();
if (current->pid != 0)
- return -EPERM;
+ goto out;
/* endless idle loop with no priority at all */
current->counter = -100;
@@ -67,23 +80,36 @@
".set\tmips0\n\t");
schedule();
}
+ ret = 0;
+out:
+ unlock_kernel();
+ return ret;
}
asmlinkage int sys_fork(struct pt_regs *regs)
{
- return do_fork(SIGCHLD, regs->reg29, regs);
+ int ret;
+
+ lock_kernel();
+ ret = do_fork(SIGCHLD, regs->reg29, regs);
+ unlock_kernel();
+ return ret;
}
asmlinkage int sys_clone(struct pt_regs *regs)
{
unsigned long clone_flags;
unsigned long newsp;
+ int ret;
+ lock_kernel();
clone_flags = regs->reg4;
newsp = regs->reg5;
if (!newsp)
newsp = regs->reg29;
- return do_fork(clone_flags, newsp, regs);
+ ret = do_fork(clone_flags, newsp, regs);
+ unlock_kernel();
+ return ret;
}
/*
@@ -94,12 +120,15 @@
int error;
char * filename;
+ lock_kernel();
error = getname((char *) regs->reg4, &filename);
if (error)
- return error;
+ goto out;
error = do_execve(filename, (char **) regs->reg5,
(char **) regs->reg6, regs);
putname(filename);
+out:
+ unlock_kernel();
return error;
}
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov