aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sh/kernel/sys_sh.c
diff options
context:
space:
mode:
authorAndrea Bastoni <bastoni@cs.unc.edu>2010-05-30 19:16:45 -0400
committerAndrea Bastoni <bastoni@cs.unc.edu>2010-05-30 19:16:45 -0400
commitada47b5fe13d89735805b566185f4885f5a3f750 (patch)
tree644b88f8a71896307d71438e9b3af49126ffb22b /arch/sh/kernel/sys_sh.c
parent43e98717ad40a4ae64545b5ba047c7b86aa44f4f (diff)
parent3280f21d43ee541f97f8cda5792150d2dbec20d5 (diff)
Merge branch 'wip-2.6.34' into old-private-masterarchived-private-master
Diffstat (limited to 'arch/sh/kernel/sys_sh.c')
-rw-r--r--arch/sh/kernel/sys_sh.c143
1 files changed, 2 insertions, 141 deletions
diff --git a/arch/sh/kernel/sys_sh.c b/arch/sh/kernel/sys_sh.c
index 8aa5d1ceaf14..81f58371613d 100644
--- a/arch/sh/kernel/sys_sh.c
+++ b/arch/sh/kernel/sys_sh.c
@@ -28,37 +28,13 @@
28#include <asm/cacheflush.h> 28#include <asm/cacheflush.h>
29#include <asm/cachectl.h> 29#include <asm/cachectl.h>
30 30
31static inline long
32do_mmap2(unsigned long addr, unsigned long len, unsigned long prot,
33 unsigned long flags, int fd, unsigned long pgoff)
34{
35 int error = -EBADF;
36 struct file *file = NULL;
37
38 flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE);
39 if (!(flags & MAP_ANONYMOUS)) {
40 file = fget(fd);
41 if (!file)
42 goto out;
43 }
44
45 down_write(&current->mm->mmap_sem);
46 error = do_mmap_pgoff(file, addr, len, prot, flags, pgoff);
47 up_write(&current->mm->mmap_sem);
48
49 if (file)
50 fput(file);
51out:
52 return error;
53}
54
55asmlinkage int old_mmap(unsigned long addr, unsigned long len, 31asmlinkage int old_mmap(unsigned long addr, unsigned long len,
56 unsigned long prot, unsigned long flags, 32 unsigned long prot, unsigned long flags,
57 int fd, unsigned long off) 33 int fd, unsigned long off)
58{ 34{
59 if (off & ~PAGE_MASK) 35 if (off & ~PAGE_MASK)
60 return -EINVAL; 36 return -EINVAL;
61 return do_mmap2(addr, len, prot, flags, fd, off>>PAGE_SHIFT); 37 return sys_mmap_pgoff(addr, len, prot, flags, fd, off>>PAGE_SHIFT);
62} 38}
63 39
64asmlinkage long sys_mmap2(unsigned long addr, unsigned long len, 40asmlinkage long sys_mmap2(unsigned long addr, unsigned long len,
@@ -74,111 +50,7 @@ asmlinkage long sys_mmap2(unsigned long addr, unsigned long len,
74 50
75 pgoff >>= PAGE_SHIFT - 12; 51 pgoff >>= PAGE_SHIFT - 12;
76 52
77 return do_mmap2(addr, len, prot, flags, fd, pgoff); 53 return sys_mmap_pgoff(addr, len, prot, flags, fd, pgoff);
78}
79
80/*
81 * sys_ipc() is the de-multiplexer for the SysV IPC calls..
82 *
83 * This is really horribly ugly.
84 */
85asmlinkage int sys_ipc(uint call, int first, int second,
86 int third, void __user *ptr, long fifth)
87{
88 int version, ret;
89
90 version = call >> 16; /* hack for backward compatibility */
91 call &= 0xffff;
92
93 if (call <= SEMTIMEDOP)
94 switch (call) {
95 case SEMOP:
96 return sys_semtimedop(first,
97 (struct sembuf __user *)ptr,
98 second, NULL);
99 case SEMTIMEDOP:
100 return sys_semtimedop(first,
101 (struct sembuf __user *)ptr, second,
102 (const struct timespec __user *)fifth);
103 case SEMGET:
104 return sys_semget (first, second, third);
105 case SEMCTL: {
106 union semun fourth;
107 if (!ptr)
108 return -EINVAL;
109 if (get_user(fourth.__pad, (void __user * __user *) ptr))
110 return -EFAULT;
111 return sys_semctl (first, second, third, fourth);
112 }
113 default:
114 return -EINVAL;
115 }
116
117 if (call <= MSGCTL)
118 switch (call) {
119 case MSGSND:
120 return sys_msgsnd (first, (struct msgbuf __user *) ptr,
121 second, third);
122 case MSGRCV:
123 switch (version) {
124 case 0:
125 {
126 struct ipc_kludge tmp;
127
128 if (!ptr)
129 return -EINVAL;
130
131 if (copy_from_user(&tmp,
132 (struct ipc_kludge __user *) ptr,
133 sizeof (tmp)))
134 return -EFAULT;
135
136 return sys_msgrcv (first, tmp.msgp, second,
137 tmp.msgtyp, third);
138 }
139 default:
140 return sys_msgrcv (first,
141 (struct msgbuf __user *) ptr,
142 second, fifth, third);
143 }
144 case MSGGET:
145 return sys_msgget ((key_t) first, second);
146 case MSGCTL:
147 return sys_msgctl (first, second,
148 (struct msqid_ds __user *) ptr);
149 default:
150 return -EINVAL;
151 }
152 if (call <= SHMCTL)
153 switch (call) {
154 case SHMAT:
155 switch (version) {
156 default: {
157 ulong raddr;
158 ret = do_shmat (first, (char __user *) ptr,
159 second, &raddr);
160 if (ret)
161 return ret;
162 return put_user (raddr, (ulong __user *) third);
163 }
164 case 1: /* iBCS2 emulator entry point */
165 if (!segment_eq(get_fs(), get_ds()))
166 return -EINVAL;
167 return do_shmat (first, (char __user *) ptr,
168 second, (ulong *) third);
169 }
170 case SHMDT:
171 return sys_shmdt ((char __user *)ptr);
172 case SHMGET:
173 return sys_shmget (first, second, third);
174 case SHMCTL:
175 return sys_shmctl (first, second,
176 (struct shmid_ds __user *) ptr);
177 default:
178 return -EINVAL;
179 }
180
181 return -EINVAL;
182} 54}
183 55
184/* sys_cacheflush -- flush (part of) the processor cache. */ 56/* sys_cacheflush -- flush (part of) the processor cache. */
@@ -221,14 +93,3 @@ asmlinkage int sys_cacheflush(unsigned long addr, unsigned long len, int op)
221 up_read(&current->mm->mmap_sem); 93 up_read(&current->mm->mmap_sem);
222 return 0; 94 return 0;
223} 95}
224
225asmlinkage int sys_uname(struct old_utsname __user *name)
226{
227 int err;
228 if (!name)
229 return -EFAULT;
230 down_read(&uts_sem);
231 err = copy_to_user(name, utsname(), sizeof(*name));
232 up_read(&uts_sem);
233 return err?-EFAULT:0;
234}