- Alan Cox: synch. PA-RISC arch and bitops cleanups
[davej-history.git] / arch / parisc / kernel / sys_parisc.c
blob85aca70afc1dc5e6f4de99f2250b9264dd6841e8
1 /*
2 * linux/arch/parisc/kernel/sys_parisc.c
4 * this implements the missing syscalls.
5 */
7 #include <asm/uaccess.h>
8 #include <linux/file.h>
9 #include <linux/fs.h>
10 #include <linux/linkage.h>
11 #include <linux/mm.h>
12 #include <linux/mman.h>
13 #include <linux/smp_lock.h>
15 /* for some reason, "old_readdir" is the only syscall which does not begin
16 * with "sys_", which breaks the ENTRY_* macros in syscall.S so I "fixed"
17 * it here.
20 int sys_old_readdir(unsigned int fd, void *dirent, unsigned int count)
22 return old_readdir(fd, dirent, count);
25 int sys_pipe(int *fildes)
27 int fd[2];
28 int error;
30 lock_kernel();
31 error = do_pipe(fd);
32 unlock_kernel();
33 if (!error) {
34 if (copy_to_user(fildes, fd, 2*sizeof(int)))
35 error = -EFAULT;
37 return error;
40 int sys_pause(void)
42 current->state = TASK_INTERRUPTIBLE;
43 schedule();
44 return -ERESTARTNOHAND;
47 int sys_mmap(unsigned long addr, unsigned long len,
48 unsigned long prot, unsigned long flags, unsigned long fd,
49 unsigned long offset)
51 struct file * file = NULL;
52 int error;
54 down(&current->mm->mmap_sem);
55 lock_kernel();
56 if (!(flags & MAP_ANONYMOUS)) {
57 error = -EBADF;
58 file = fget(fd);
59 if (!file)
60 goto out;
62 flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE);
63 error = do_mmap(file, addr, len, prot, flags, offset);
64 if (file != NULL)
65 fput(file);
66 out:
67 unlock_kernel();
68 up(&current->mm->mmap_sem);
69 return error;
72 int sys_ioperm(unsigned long from, unsigned long num, int on)
74 return -ENOSYS;
77 long sys_shmat_wrapper(int shmid, void *shmaddr, int shmflag)
79 extern int sys_shmat(int shmid, char *shmaddr, int shmflg,
80 unsigned long * raddr);
81 unsigned long raddr;
82 int r;
84 r = sys_shmat(shmid, shmaddr, shmflag, &raddr);
85 if (r < 0)
86 return r;
87 return raddr;