diff options
author | Andrea Bastoni <bastoni@cs.unc.edu> | 2010-05-30 19:16:45 -0400 |
---|---|---|
committer | Andrea Bastoni <bastoni@cs.unc.edu> | 2010-05-30 19:16:45 -0400 |
commit | ada47b5fe13d89735805b566185f4885f5a3f750 (patch) | |
tree | 644b88f8a71896307d71438e9b3af49126ffb22b /arch/mn10300/kernel/sys_mn10300.c | |
parent | 43e98717ad40a4ae64545b5ba047c7b86aa44f4f (diff) | |
parent | 3280f21d43ee541f97f8cda5792150d2dbec20d5 (diff) |
Merge branch 'wip-2.6.34' into old-private-masterarchived-private-master
Diffstat (limited to 'arch/mn10300/kernel/sys_mn10300.c')
-rw-r--r-- | arch/mn10300/kernel/sys_mn10300.c | 142 |
1 files changed, 1 insertions, 141 deletions
diff --git a/arch/mn10300/kernel/sys_mn10300.c b/arch/mn10300/kernel/sys_mn10300.c index 8ca5af00334c..815f1355fad4 100644 --- a/arch/mn10300/kernel/sys_mn10300.c +++ b/arch/mn10300/kernel/sys_mn10300.c | |||
@@ -23,151 +23,11 @@ | |||
23 | 23 | ||
24 | #include <asm/uaccess.h> | 24 | #include <asm/uaccess.h> |
25 | 25 | ||
26 | #define MIN_MAP_ADDR PAGE_SIZE /* minimum fixed mmap address */ | ||
27 | |||
28 | /* | ||
29 | * memory mapping syscall | ||
30 | */ | ||
31 | asmlinkage long sys_mmap2(unsigned long addr, unsigned long len, | ||
32 | unsigned long prot, unsigned long flags, | ||
33 | unsigned long fd, unsigned long pgoff) | ||
34 | { | ||
35 | struct file *file = NULL; | ||
36 | long error = -EINVAL; | ||
37 | |||
38 | flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE); | ||
39 | |||
40 | if (flags & MAP_FIXED && addr < MIN_MAP_ADDR) | ||
41 | goto out; | ||
42 | |||
43 | error = -EBADF; | ||
44 | if (!(flags & MAP_ANONYMOUS)) { | ||
45 | file = fget(fd); | ||
46 | if (!file) | ||
47 | goto out; | ||
48 | } | ||
49 | |||
50 | down_write(¤t->mm->mmap_sem); | ||
51 | error = do_mmap_pgoff(file, addr, len, prot, flags, pgoff); | ||
52 | up_write(¤t->mm->mmap_sem); | ||
53 | |||
54 | if (file) | ||
55 | fput(file); | ||
56 | out: | ||
57 | return error; | ||
58 | } | ||
59 | |||
60 | asmlinkage long old_mmap(unsigned long addr, unsigned long len, | 26 | asmlinkage long old_mmap(unsigned long addr, unsigned long len, |
61 | unsigned long prot, unsigned long flags, | 27 | unsigned long prot, unsigned long flags, |
62 | unsigned long fd, unsigned long offset) | 28 | unsigned long fd, unsigned long offset) |
63 | { | 29 | { |
64 | if (offset & ~PAGE_MASK) | 30 | if (offset & ~PAGE_MASK) |
65 | return -EINVAL; | 31 | return -EINVAL; |
66 | return sys_mmap2(addr, len, prot, flags, fd, offset >> PAGE_SHIFT); | 32 | return sys_mmap_pgoff(addr, len, prot, flags, fd, offset >> PAGE_SHIFT); |
67 | } | ||
68 | |||
69 | struct sel_arg_struct { | ||
70 | unsigned long n; | ||
71 | fd_set *inp; | ||
72 | fd_set *outp; | ||
73 | fd_set *exp; | ||
74 | struct timeval *tvp; | ||
75 | }; | ||
76 | |||
77 | asmlinkage int old_select(struct sel_arg_struct __user *arg) | ||
78 | { | ||
79 | struct sel_arg_struct a; | ||
80 | |||
81 | if (copy_from_user(&a, arg, sizeof(a))) | ||
82 | return -EFAULT; | ||
83 | /* sys_select() does the appropriate kernel locking */ | ||
84 | return sys_select(a.n, a.inp, a.outp, a.exp, a.tvp); | ||
85 | } | ||
86 | |||
87 | /* | ||
88 | * sys_ipc() is the de-multiplexer for the SysV IPC calls.. | ||
89 | * | ||
90 | * This is really horribly ugly. | ||
91 | */ | ||
92 | asmlinkage long sys_ipc(uint call, int first, int second, | ||
93 | int third, void __user *ptr, long fifth) | ||
94 | { | ||
95 | int version, ret; | ||
96 | |||
97 | version = call >> 16; /* hack for backward compatibility */ | ||
98 | call &= 0xffff; | ||
99 | |||
100 | switch (call) { | ||
101 | case SEMOP: | ||
102 | return sys_semtimedop(first, (struct sembuf __user *)ptr, | ||
103 | second, NULL); | ||
104 | case SEMTIMEDOP: | ||
105 | return sys_semtimedop(first, (struct sembuf __user *)ptr, | ||
106 | second, | ||
107 | (const struct timespec __user *)fifth); | ||
108 | case SEMGET: | ||
109 | return sys_semget(first, second, third); | ||
110 | case SEMCTL: { | ||
111 | union semun fourth; | ||
112 | if (!ptr) | ||
113 | return -EINVAL; | ||
114 | if (get_user(fourth.__pad, (void __user * __user *) ptr)) | ||
115 | return -EFAULT; | ||
116 | return sys_semctl(first, second, third, fourth); | ||
117 | } | ||
118 | |||
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 | struct ipc_kludge tmp; | ||
126 | if (!ptr) | ||
127 | return -EINVAL; | ||
128 | |||
129 | if (copy_from_user(&tmp, | ||
130 | (struct ipc_kludge __user *) ptr, | ||
131 | sizeof(tmp))) | ||
132 | return -EFAULT; | ||
133 | return sys_msgrcv(first, tmp.msgp, second, | ||
134 | tmp.msgtyp, third); | ||
135 | } | ||
136 | default: | ||
137 | return sys_msgrcv(first, | ||
138 | (struct msgbuf __user *) ptr, | ||
139 | second, fifth, third); | ||
140 | } | ||
141 | case MSGGET: | ||
142 | return sys_msgget((key_t) first, second); | ||
143 | case MSGCTL: | ||
144 | return sys_msgctl(first, second, | ||
145 | (struct msqid_ds __user *) ptr); | ||
146 | |||
147 | case SHMAT: | ||
148 | switch (version) { | ||
149 | default: { | ||
150 | ulong raddr; | ||
151 | ret = do_shmat(first, (char __user *) ptr, second, | ||
152 | &raddr); | ||
153 | if (ret) | ||
154 | return ret; | ||
155 | return put_user(raddr, (ulong *) third); | ||
156 | } | ||
157 | case 1: /* iBCS2 emulator entry point */ | ||
158 | if (!segment_eq(get_fs(), get_ds())) | ||
159 | return -EINVAL; | ||
160 | return do_shmat(first, (char __user *) ptr, second, | ||
161 | (ulong *) third); | ||
162 | } | ||
163 | case SHMDT: | ||
164 | return sys_shmdt((char __user *)ptr); | ||
165 | case SHMGET: | ||
166 | return sys_shmget(first, second, third); | ||
167 | case SHMCTL: | ||
168 | return sys_shmctl(first, second, | ||
169 | (struct shmid_ds __user *) ptr); | ||
170 | default: | ||
171 | return -EINVAL; | ||
172 | } | ||
173 | } | 33 | } |