2 * linux/arch/sh/kernel/sys_sh.c
4 * This file contains various random system calls that
5 * have a non-standard calling sequence on the Linux/SuperH
8 * Taken from i386 version.
10 #include <linux/errno.h>
11 #include <linux/sched.h>
13 #include <linux/smp.h>
14 #include <linux/sem.h>
15 #include <linux/msg.h>
16 #include <linux/shm.h>
17 #include <linux/stat.h>
18 #include <linux/syscalls.h>
19 #include <linux/mman.h>
20 #include <linux/file.h>
21 #include <linux/utsname.h>
22 #include <linux/module.h>
24 #include <linux/ipc.h>
25 #include <asm/syscalls.h>
26 #include <asm/uaccess.h>
27 #include <asm/unistd.h>
30 do_mmap2(unsigned long addr, unsigned long len, unsigned long prot,
31 unsigned long flags, int fd, unsigned long pgoff)
34 struct file *file = NULL;
36 flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE);
37 if (!(flags & MAP_ANONYMOUS)) {
43 down_write(¤t->mm->mmap_sem);
44 error = do_mmap_pgoff(file, addr, len, prot, flags, pgoff);
45 up_write(¤t->mm->mmap_sem);
53 asmlinkage int old_mmap(unsigned long addr, unsigned long len,
54 unsigned long prot, unsigned long flags,
55 int fd, unsigned long off)
59 return do_mmap2(addr, len, prot, flags, fd, off>>PAGE_SHIFT);
62 asmlinkage long sys_mmap2(unsigned long addr, unsigned long len,
63 unsigned long prot, unsigned long flags,
64 unsigned long fd, unsigned long pgoff)
66 return do_mmap2(addr, len, prot, flags, fd, pgoff);
70 * sys_ipc() is the de-multiplexer for the SysV IPC calls..
72 * This is really horribly ugly.
74 asmlinkage int sys_ipc(uint call, int first, int second,
75 int third, void __user *ptr, long fifth)
79 version = call >> 16; /* hack for backward compatibility */
82 trace_mark(kernel_arch_ipc_call, "call %u first %d", call, first);
84 if (call <= SEMTIMEDOP)
87 return sys_semtimedop(first,
88 (struct sembuf __user *)ptr,
91 return sys_semtimedop(first,
92 (struct sembuf __user *)ptr, second,
93 (const struct timespec __user *)fifth);
95 return sys_semget (first, second, third);
100 if (get_user(fourth.__pad, (void __user * __user *) ptr))
102 return sys_semctl (first, second, third, fourth);
111 return sys_msgsnd (first, (struct msgbuf __user *) ptr,
117 struct ipc_kludge tmp;
122 if (copy_from_user(&tmp,
123 (struct ipc_kludge __user *) ptr,
127 return sys_msgrcv (first, tmp.msgp, second,
131 return sys_msgrcv (first,
132 (struct msgbuf __user *) ptr,
133 second, fifth, third);
136 return sys_msgget ((key_t) first, second);
138 return sys_msgctl (first, second,
139 (struct msqid_ds __user *) ptr);
149 ret = do_shmat (first, (char __user *) ptr,
153 return put_user (raddr, (ulong __user *) third);
155 case 1: /* iBCS2 emulator entry point */
156 if (!segment_eq(get_fs(), get_ds()))
158 return do_shmat (first, (char __user *) ptr,
159 second, (ulong *) third);
162 return sys_shmdt ((char __user *)ptr);
164 return sys_shmget (first, second, third);
166 return sys_shmctl (first, second,
167 (struct shmid_ds __user *) ptr);
175 asmlinkage int sys_uname(struct old_utsname __user *name)
181 err = copy_to_user(name, utsname(), sizeof(*name));
183 return err?-EFAULT:0;