aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2010-03-10 18:21:21 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2010-03-12 18:52:32 -0500
commit5cacdb4add1b1e50fe75edc50ebbb7bddd9cf5e7 (patch)
treebd6595bb8c5c7e20ad01ed7ef766d873e5d26db3
parente28cbf22933d0c0ccaf3c4c27a1a263b41f73859 (diff)
Add generic sys_olduname()
Add generic implementations of the old and really old uname system calls. Note that sh only implements sys_olduname but not sys_oldolduname, but I'm not going to bother with another ifdef for that special case. m32r implemented an old uname but never wired it up, so kill it, too. Signed-off-by: Christoph Hellwig <hch@lst.de> Cc: Ralf Baechle <ralf@linux-mips.org> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org> Cc: Paul Mundt <lethal@linux-sh.org> Cc: Jeff Dike <jdike@addtoit.com> Cc: Hirokazu Takata <takata@linux-m32r.org> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Ingo Molnar <mingo@elte.hu> Cc: H. Peter Anvin <hpa@zytor.com> Cc: Al Viro <viro@zeniv.linux.org.uk> Cc: Arnd Bergmann <arnd@arndb.de> Cc: Heiko Carstens <heiko.carstens@de.ibm.com> Cc: Martin Schwidefsky <schwidefsky@de.ibm.com> Cc: "Luck, Tony" <tony.luck@intel.com> Cc: James Morris <jmorris@namei.org> Cc: Andreas Schwab <schwab@linux-m68k.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--arch/m32r/kernel/sys_m32r.c11
-rw-r--r--arch/mips/include/asm/unistd.h1
-rw-r--r--arch/mips/kernel/syscall.c42
-rw-r--r--arch/powerpc/include/asm/unistd.h1
-rw-r--r--arch/powerpc/kernel/syscalls.c57
-rw-r--r--arch/sh/include/asm/syscalls.h3
-rw-r--r--arch/sh/include/asm/unistd_32.h1
-rw-r--r--arch/sh/include/asm/unistd_64.h1
-rw-r--r--arch/sh/kernel/sys_sh.c11
-rw-r--r--arch/um/kernel/syscall.c45
-rw-r--r--arch/x86/ia32/ia32entry.S4
-rw-r--r--arch/x86/ia32/sys_ia32.c52
-rw-r--r--arch/x86/include/asm/sys_ia32.h5
-rw-r--r--arch/x86/include/asm/syscalls.h7
-rw-r--r--arch/x86/include/asm/unistd_32.h1
-rw-r--r--arch/x86/include/asm/unistd_64.h1
-rw-r--r--arch/x86/kernel/sys_i386_32.c49
-rw-r--r--include/linux/syscalls.h4
-rw-r--r--kernel/sys.c54
19 files changed, 66 insertions, 284 deletions
diff --git a/arch/m32r/kernel/sys_m32r.c b/arch/m32r/kernel/sys_m32r.c
index cf2e7279ce9b..0a00f467edfa 100644
--- a/arch/m32r/kernel/sys_m32r.c
+++ b/arch/m32r/kernel/sys_m32r.c
@@ -76,17 +76,6 @@ asmlinkage int sys_tas(int __user *addr)
76 return oldval; 76 return oldval;
77} 77}
78 78
79asmlinkage int sys_uname(struct old_utsname __user * name)
80{
81 int err;
82 if (!name)
83 return -EFAULT;
84 down_read(&uts_sem);
85 err = copy_to_user(name, utsname(), sizeof (*name));
86 up_read(&uts_sem);
87 return err?-EFAULT:0;
88}
89
90asmlinkage int sys_cacheflush(void *addr, int bytes, int cache) 79asmlinkage int sys_cacheflush(void *addr, int bytes, int cache)
91{ 80{
92 /* This should flush more selectively ... */ 81 /* This should flush more selectively ... */
diff --git a/arch/mips/include/asm/unistd.h b/arch/mips/include/asm/unistd.h
index 97fe472095f2..1b5a6648eb86 100644
--- a/arch/mips/include/asm/unistd.h
+++ b/arch/mips/include/asm/unistd.h
@@ -1014,6 +1014,7 @@
1014#define __ARCH_WANT_SYS_LLSEEK 1014#define __ARCH_WANT_SYS_LLSEEK
1015#define __ARCH_WANT_SYS_NICE 1015#define __ARCH_WANT_SYS_NICE
1016#define __ARCH_WANT_SYS_OLD_GETRLIMIT 1016#define __ARCH_WANT_SYS_OLD_GETRLIMIT
1017#define __ARCH_WANT_SYS_OLD_UNAME
1017#define __ARCH_WANT_SYS_OLDUMOUNT 1018#define __ARCH_WANT_SYS_OLDUMOUNT
1018#define __ARCH_WANT_SYS_SIGPENDING 1019#define __ARCH_WANT_SYS_SIGPENDING
1019#define __ARCH_WANT_SYS_SIGPROCMASK 1020#define __ARCH_WANT_SYS_SIGPROCMASK
diff --git a/arch/mips/kernel/syscall.c b/arch/mips/kernel/syscall.c
index 257bf0141775..e96b1c30c7aa 100644
--- a/arch/mips/kernel/syscall.c
+++ b/arch/mips/kernel/syscall.c
@@ -215,48 +215,6 @@ out:
215 return error; 215 return error;
216} 216}
217 217
218/*
219 * Compacrapability ...
220 */
221SYSCALL_DEFINE1(uname, struct old_utsname __user *, name)
222{
223 if (name && !copy_to_user(name, utsname(), sizeof (*name)))
224 return 0;
225 return -EFAULT;
226}
227
228/*
229 * Compacrapability ...
230 */
231SYSCALL_DEFINE1(olduname, struct oldold_utsname __user *, name)
232{
233 int error;
234
235 if (!name)
236 return -EFAULT;
237 if (!access_ok(VERIFY_WRITE, name, sizeof(struct oldold_utsname)))
238 return -EFAULT;
239
240 error = __copy_to_user(&name->sysname, &utsname()->sysname,
241 __OLD_UTS_LEN);
242 error -= __put_user(0, name->sysname + __OLD_UTS_LEN);
243 error -= __copy_to_user(&name->nodename, &utsname()->nodename,
244 __OLD_UTS_LEN);
245 error -= __put_user(0, name->nodename + __OLD_UTS_LEN);
246 error -= __copy_to_user(&name->release, &utsname()->release,
247 __OLD_UTS_LEN);
248 error -= __put_user(0, name->release + __OLD_UTS_LEN);
249 error -= __copy_to_user(&name->version, &utsname()->version,
250 __OLD_UTS_LEN);
251 error -= __put_user(0, name->version + __OLD_UTS_LEN);
252 error -= __copy_to_user(&name->machine, &utsname()->machine,
253 __OLD_UTS_LEN);
254 error = __put_user(0, name->machine + __OLD_UTS_LEN);
255 error = error ? -EFAULT : 0;
256
257 return error;
258}
259
260SYSCALL_DEFINE1(set_thread_area, unsigned long, addr) 218SYSCALL_DEFINE1(set_thread_area, unsigned long, addr)
261{ 219{
262 struct thread_info *ti = task_thread_info(current); 220 struct thread_info *ti = task_thread_info(current);
diff --git a/arch/powerpc/include/asm/unistd.h b/arch/powerpc/include/asm/unistd.h
index c13821fe8741..f0a10266e7f7 100644
--- a/arch/powerpc/include/asm/unistd.h
+++ b/arch/powerpc/include/asm/unistd.h
@@ -377,6 +377,7 @@
377#define __ARCH_WANT_SYS_LLSEEK 377#define __ARCH_WANT_SYS_LLSEEK
378#define __ARCH_WANT_SYS_NICE 378#define __ARCH_WANT_SYS_NICE
379#define __ARCH_WANT_SYS_OLD_GETRLIMIT 379#define __ARCH_WANT_SYS_OLD_GETRLIMIT
380#define __ARCH_WANT_SYS_OLD_UNAME
380#define __ARCH_WANT_SYS_OLDUMOUNT 381#define __ARCH_WANT_SYS_OLDUMOUNT
381#define __ARCH_WANT_SYS_SIGPENDING 382#define __ARCH_WANT_SYS_SIGPENDING
382#define __ARCH_WANT_SYS_SIGPROCMASK 383#define __ARCH_WANT_SYS_SIGPROCMASK
diff --git a/arch/powerpc/kernel/syscalls.c b/arch/powerpc/kernel/syscalls.c
index 69d3c5d50a54..f2496f2faecc 100644
--- a/arch/powerpc/kernel/syscalls.c
+++ b/arch/powerpc/kernel/syscalls.c
@@ -116,63 +116,6 @@ long ppc64_personality(unsigned long personality)
116} 116}
117#endif 117#endif
118 118
119#ifdef CONFIG_PPC64
120#define OVERRIDE_MACHINE (personality(current->personality) == PER_LINUX32)
121#else
122#define OVERRIDE_MACHINE 0
123#endif
124
125static inline int override_machine(char __user *mach)
126{
127 if (OVERRIDE_MACHINE) {
128 /* change ppc64 to ppc */
129 if (__put_user(0, mach+3) || __put_user(0, mach+4))
130 return -EFAULT;
131 }
132 return 0;
133}
134
135int sys_uname(struct old_utsname __user *name)
136{
137 int err = 0;
138
139 down_read(&uts_sem);
140 if (copy_to_user(name, utsname(), sizeof(*name)))
141 err = -EFAULT;
142 up_read(&uts_sem);
143 if (!err)
144 err = override_machine(name->machine);
145 return err;
146}
147
148int sys_olduname(struct oldold_utsname __user *name)
149{
150 int error;
151
152 if (!access_ok(VERIFY_WRITE, name, sizeof(struct oldold_utsname)))
153 return -EFAULT;
154
155 down_read(&uts_sem);
156 error = __copy_to_user(&name->sysname, &utsname()->sysname,
157 __OLD_UTS_LEN);
158 error |= __put_user(0, name->sysname + __OLD_UTS_LEN);
159 error |= __copy_to_user(&name->nodename, &utsname()->nodename,
160 __OLD_UTS_LEN);
161 error |= __put_user(0, name->nodename + __OLD_UTS_LEN);
162 error |= __copy_to_user(&name->release, &utsname()->release,
163 __OLD_UTS_LEN);
164 error |= __put_user(0, name->release + __OLD_UTS_LEN);
165 error |= __copy_to_user(&name->version, &utsname()->version,
166 __OLD_UTS_LEN);
167 error |= __put_user(0, name->version + __OLD_UTS_LEN);
168 error |= __copy_to_user(&name->machine, &utsname()->machine,
169 __OLD_UTS_LEN);
170 error |= override_machine(name->machine);
171 up_read(&uts_sem);
172
173 return error? -EFAULT: 0;
174}
175
176long ppc_fadvise64_64(int fd, int advice, u32 offset_high, u32 offset_low, 119long ppc_fadvise64_64(int fd, int advice, u32 offset_high, u32 offset_low,
177 u32 len_high, u32 len_low) 120 u32 len_high, u32 len_low)
178{ 121{
diff --git a/arch/sh/include/asm/syscalls.h b/arch/sh/include/asm/syscalls.h
index c1ce2862f7be..507725af2e54 100644
--- a/arch/sh/include/asm/syscalls.h
+++ b/arch/sh/include/asm/syscalls.h
@@ -3,15 +3,12 @@
3 3
4#ifdef __KERNEL__ 4#ifdef __KERNEL__
5 5
6struct old_utsname;
7
8asmlinkage int old_mmap(unsigned long addr, unsigned long len, 6asmlinkage int old_mmap(unsigned long addr, unsigned long len,
9 unsigned long prot, unsigned long flags, 7 unsigned long prot, unsigned long flags,
10 int fd, unsigned long off); 8 int fd, unsigned long off);
11asmlinkage long sys_mmap2(unsigned long addr, unsigned long len, 9asmlinkage long sys_mmap2(unsigned long addr, unsigned long len,
12 unsigned long prot, unsigned long flags, 10 unsigned long prot, unsigned long flags,
13 unsigned long fd, unsigned long pgoff); 11 unsigned long fd, unsigned long pgoff);
14asmlinkage int sys_uname(struct old_utsname __user *name);
15 12
16#ifdef CONFIG_SUPERH32 13#ifdef CONFIG_SUPERH32
17# include "syscalls_32.h" 14# include "syscalls_32.h"
diff --git a/arch/sh/include/asm/unistd_32.h b/arch/sh/include/asm/unistd_32.h
index a48f65e2e429..0e7f0fc8f086 100644
--- a/arch/sh/include/asm/unistd_32.h
+++ b/arch/sh/include/asm/unistd_32.h
@@ -371,6 +371,7 @@
371#define __ARCH_WANT_SYS_LLSEEK 371#define __ARCH_WANT_SYS_LLSEEK
372#define __ARCH_WANT_SYS_NICE 372#define __ARCH_WANT_SYS_NICE
373#define __ARCH_WANT_SYS_OLD_GETRLIMIT 373#define __ARCH_WANT_SYS_OLD_GETRLIMIT
374#define __ARCH_WANT_SYS_OLD_UNAME
374#define __ARCH_WANT_SYS_OLDUMOUNT 375#define __ARCH_WANT_SYS_OLDUMOUNT
375#define __ARCH_WANT_SYS_SIGPENDING 376#define __ARCH_WANT_SYS_SIGPENDING
376#define __ARCH_WANT_SYS_SIGPROCMASK 377#define __ARCH_WANT_SYS_SIGPROCMASK
diff --git a/arch/sh/include/asm/unistd_64.h b/arch/sh/include/asm/unistd_64.h
index 7709b2b8f752..0580c33a1e04 100644
--- a/arch/sh/include/asm/unistd_64.h
+++ b/arch/sh/include/asm/unistd_64.h
@@ -411,6 +411,7 @@
411#define __ARCH_WANT_SYS_LLSEEK 411#define __ARCH_WANT_SYS_LLSEEK
412#define __ARCH_WANT_SYS_NICE 412#define __ARCH_WANT_SYS_NICE
413#define __ARCH_WANT_SYS_OLD_GETRLIMIT 413#define __ARCH_WANT_SYS_OLD_GETRLIMIT
414#define __ARCH_WANT_SYS_OLD_UNAME
414#define __ARCH_WANT_SYS_OLDUMOUNT 415#define __ARCH_WANT_SYS_OLDUMOUNT
415#define __ARCH_WANT_SYS_SIGPENDING 416#define __ARCH_WANT_SYS_SIGPENDING
416#define __ARCH_WANT_SYS_SIGPROCMASK 417#define __ARCH_WANT_SYS_SIGPROCMASK
diff --git a/arch/sh/kernel/sys_sh.c b/arch/sh/kernel/sys_sh.c
index c18cfaa67fdd..81f58371613d 100644
--- a/arch/sh/kernel/sys_sh.c
+++ b/arch/sh/kernel/sys_sh.c
@@ -93,14 +93,3 @@ asmlinkage int sys_cacheflush(unsigned long addr, unsigned long len, int op)
93 up_read(&current->mm->mmap_sem); 93 up_read(&current->mm->mmap_sem);
94 return 0; 94 return 0;
95} 95}
96
97asmlinkage int sys_uname(struct old_utsname __user *name)
98{
99 int err;
100 if (!name)
101 return -EFAULT;
102 down_read(&uts_sem);
103 err = copy_to_user(name, utsname(), sizeof(*name));
104 up_read(&uts_sem);
105 return err?-EFAULT:0;
106}
diff --git a/arch/um/kernel/syscall.c b/arch/um/kernel/syscall.c
index cccab850c27e..4393173923f5 100644
--- a/arch/um/kernel/syscall.c
+++ b/arch/um/kernel/syscall.c
@@ -51,51 +51,6 @@ long old_mmap(unsigned long addr, unsigned long len,
51 return err; 51 return err;
52} 52}
53 53
54long sys_uname(struct old_utsname __user * name)
55{
56 long err;
57 if (!name)
58 return -EFAULT;
59 down_read(&uts_sem);
60 err = copy_to_user(name, utsname(), sizeof (*name));
61 up_read(&uts_sem);
62 return err?-EFAULT:0;
63}
64
65long sys_olduname(struct oldold_utsname __user * name)
66{
67 long error;
68
69 if (!name)
70 return -EFAULT;
71 if (!access_ok(VERIFY_WRITE,name,sizeof(struct oldold_utsname)))
72 return -EFAULT;
73
74 down_read(&uts_sem);
75
76 error = __copy_to_user(&name->sysname, &utsname()->sysname,
77 __OLD_UTS_LEN);
78 error |= __put_user(0, name->sysname + __OLD_UTS_LEN);
79 error |= __copy_to_user(&name->nodename, &utsname()->nodename,
80 __OLD_UTS_LEN);
81 error |= __put_user(0, name->nodename + __OLD_UTS_LEN);
82 error |= __copy_to_user(&name->release, &utsname()->release,
83 __OLD_UTS_LEN);
84 error |= __put_user(0, name->release + __OLD_UTS_LEN);
85 error |= __copy_to_user(&name->version, &utsname()->version,
86 __OLD_UTS_LEN);
87 error |= __put_user(0, name->version + __OLD_UTS_LEN);
88 error |= __copy_to_user(&name->machine, &utsname()->machine,
89 __OLD_UTS_LEN);
90 error |= __put_user(0, name->machine + __OLD_UTS_LEN);
91
92 up_read(&uts_sem);
93
94 error = error ? -EFAULT : 0;
95
96 return error;
97}
98
99int kernel_execve(const char *filename, char *const argv[], char *const envp[]) 54int kernel_execve(const char *filename, char *const argv[], char *const envp[])
100{ 55{
101 mm_segment_t fs; 56 mm_segment_t fs;
diff --git a/arch/x86/ia32/ia32entry.S b/arch/x86/ia32/ia32entry.S
index 34f821802c23..59b4556a5b92 100644
--- a/arch/x86/ia32/ia32entry.S
+++ b/arch/x86/ia32/ia32entry.S
@@ -563,7 +563,7 @@ ia32_sys_call_table:
563 .quad quiet_ni_syscall /* old mpx syscall holder */ 563 .quad quiet_ni_syscall /* old mpx syscall holder */
564 .quad sys_setpgid 564 .quad sys_setpgid
565 .quad quiet_ni_syscall /* old ulimit syscall holder */ 565 .quad quiet_ni_syscall /* old ulimit syscall holder */
566 .quad sys32_olduname 566 .quad sys_olduname
567 .quad sys_umask /* 60 */ 567 .quad sys_umask /* 60 */
568 .quad sys_chroot 568 .quad sys_chroot
569 .quad compat_sys_ustat 569 .quad compat_sys_ustat
@@ -613,7 +613,7 @@ ia32_sys_call_table:
613 .quad compat_sys_newstat 613 .quad compat_sys_newstat
614 .quad compat_sys_newlstat 614 .quad compat_sys_newlstat
615 .quad compat_sys_newfstat 615 .quad compat_sys_newfstat
616 .quad sys32_uname 616 .quad sys_uname
617 .quad stub32_iopl /* 110 */ 617 .quad stub32_iopl /* 110 */
618 .quad sys_vhangup 618 .quad sys_vhangup
619 .quad quiet_ni_syscall /* old "idle" system call */ 619 .quad quiet_ni_syscall /* old "idle" system call */
diff --git a/arch/x86/ia32/sys_ia32.c b/arch/x86/ia32/sys_ia32.c
index 56c99f46e289..74c35431b7d8 100644
--- a/arch/x86/ia32/sys_ia32.c
+++ b/arch/x86/ia32/sys_ia32.c
@@ -448,58 +448,6 @@ asmlinkage long sys32_sendfile(int out_fd, int in_fd,
448 return ret; 448 return ret;
449} 449}
450 450
451asmlinkage long sys32_olduname(struct oldold_utsname __user *name)
452{
453 char *arch = "x86_64";
454 int err;
455
456 if (!name)
457 return -EFAULT;
458 if (!access_ok(VERIFY_WRITE, name, sizeof(struct oldold_utsname)))
459 return -EFAULT;
460
461 down_read(&uts_sem);
462
463 err = __copy_to_user(&name->sysname, &utsname()->sysname,
464 __OLD_UTS_LEN);
465 err |= __put_user(0, name->sysname+__OLD_UTS_LEN);
466 err |= __copy_to_user(&name->nodename, &utsname()->nodename,
467 __OLD_UTS_LEN);
468 err |= __put_user(0, name->nodename+__OLD_UTS_LEN);
469 err |= __copy_to_user(&name->release, &utsname()->release,
470 __OLD_UTS_LEN);
471 err |= __put_user(0, name->release+__OLD_UTS_LEN);
472 err |= __copy_to_user(&name->version, &utsname()->version,
473 __OLD_UTS_LEN);
474 err |= __put_user(0, name->version+__OLD_UTS_LEN);
475
476 if (personality(current->personality) == PER_LINUX32)
477 arch = "i686";
478
479 err |= __copy_to_user(&name->machine, arch, strlen(arch) + 1);
480
481 up_read(&uts_sem);
482
483 err = err ? -EFAULT : 0;
484
485 return err;
486}
487
488long sys32_uname(struct old_utsname __user *name)
489{
490 int err;
491
492 if (!name)
493 return -EFAULT;
494 down_read(&uts_sem);
495 err = copy_to_user(name, utsname(), sizeof(*name));
496 up_read(&uts_sem);
497 if (personality(current->personality) == PER_LINUX32)
498 err |= copy_to_user(&name->machine, "i686", 5);
499
500 return err ? -EFAULT : 0;
501}
502
503asmlinkage long sys32_execve(char __user *name, compat_uptr_t __user *argv, 451asmlinkage long sys32_execve(char __user *name, compat_uptr_t __user *argv,
504 compat_uptr_t __user *envp, struct pt_regs *regs) 452 compat_uptr_t __user *envp, struct pt_regs *regs)
505{ 453{
diff --git a/arch/x86/include/asm/sys_ia32.h b/arch/x86/include/asm/sys_ia32.h
index 7d348d803669..3ad421784ae7 100644
--- a/arch/x86/include/asm/sys_ia32.h
+++ b/arch/x86/include/asm/sys_ia32.h
@@ -54,11 +54,6 @@ asmlinkage long sys32_pwrite(unsigned int, char __user *, u32, u32, u32);
54asmlinkage long sys32_personality(unsigned long); 54asmlinkage long sys32_personality(unsigned long);
55asmlinkage long sys32_sendfile(int, int, compat_off_t __user *, s32); 55asmlinkage long sys32_sendfile(int, int, compat_off_t __user *, s32);
56 56
57struct oldold_utsname;
58struct old_utsname;
59asmlinkage long sys32_olduname(struct oldold_utsname __user *);
60long sys32_uname(struct old_utsname __user *);
61
62asmlinkage long sys32_execve(char __user *, compat_uptr_t __user *, 57asmlinkage long sys32_execve(char __user *, compat_uptr_t __user *,
63 compat_uptr_t __user *, struct pt_regs *); 58 compat_uptr_t __user *, struct pt_regs *);
64asmlinkage long sys32_clone(unsigned int, unsigned int, struct pt_regs *); 59asmlinkage long sys32_clone(unsigned int, unsigned int, struct pt_regs *);
diff --git a/arch/x86/include/asm/syscalls.h b/arch/x86/include/asm/syscalls.h
index 47cd606c3537..5c044b43e9a7 100644
--- a/arch/x86/include/asm/syscalls.h
+++ b/arch/x86/include/asm/syscalls.h
@@ -50,13 +50,6 @@ asmlinkage int sys_sigaction(int, const struct old_sigaction __user *,
50 struct old_sigaction __user *); 50 struct old_sigaction __user *);
51unsigned long sys_sigreturn(struct pt_regs *); 51unsigned long sys_sigreturn(struct pt_regs *);
52 52
53/* kernel/sys_i386_32.c */
54struct oldold_utsname;
55struct old_utsname;
56
57asmlinkage int sys_uname(struct old_utsname __user *);
58asmlinkage int sys_olduname(struct oldold_utsname __user *);
59
60/* kernel/vm86_32.c */ 53/* kernel/vm86_32.c */
61int sys_vm86old(struct vm86_struct __user *, struct pt_regs *); 54int sys_vm86old(struct vm86_struct __user *, struct pt_regs *);
62int sys_vm86(unsigned long, unsigned long, struct pt_regs *); 55int sys_vm86(unsigned long, unsigned long, struct pt_regs *);
diff --git a/arch/x86/include/asm/unistd_32.h b/arch/x86/include/asm/unistd_32.h
index 45e64a17b86e..beb9b5f8f8a4 100644
--- a/arch/x86/include/asm/unistd_32.h
+++ b/arch/x86/include/asm/unistd_32.h
@@ -367,6 +367,7 @@
367#define __ARCH_WANT_SYS_LLSEEK 367#define __ARCH_WANT_SYS_LLSEEK
368#define __ARCH_WANT_SYS_NICE 368#define __ARCH_WANT_SYS_NICE
369#define __ARCH_WANT_SYS_OLD_GETRLIMIT 369#define __ARCH_WANT_SYS_OLD_GETRLIMIT
370#define __ARCH_WANT_SYS_OLD_UNAME
370#define __ARCH_WANT_SYS_OLD_MMAP 371#define __ARCH_WANT_SYS_OLD_MMAP
371#define __ARCH_WANT_SYS_OLD_SELECT 372#define __ARCH_WANT_SYS_OLD_SELECT
372#define __ARCH_WANT_SYS_OLDUMOUNT 373#define __ARCH_WANT_SYS_OLDUMOUNT
diff --git a/arch/x86/include/asm/unistd_64.h b/arch/x86/include/asm/unistd_64.h
index 83e2d6dc5038..ff4307b0e81e 100644
--- a/arch/x86/include/asm/unistd_64.h
+++ b/arch/x86/include/asm/unistd_64.h
@@ -680,6 +680,7 @@ __SYSCALL(__NR_recvmmsg, sys_recvmmsg)
680#define __ARCH_WANT_SYS_LLSEEK 680#define __ARCH_WANT_SYS_LLSEEK
681#define __ARCH_WANT_SYS_NICE 681#define __ARCH_WANT_SYS_NICE
682#define __ARCH_WANT_SYS_OLD_GETRLIMIT 682#define __ARCH_WANT_SYS_OLD_GETRLIMIT
683#define __ARCH_WANT_SYS_OLD_UNAME
683#define __ARCH_WANT_SYS_OLDUMOUNT 684#define __ARCH_WANT_SYS_OLDUMOUNT
684#define __ARCH_WANT_SYS_SIGPENDING 685#define __ARCH_WANT_SYS_SIGPENDING
685#define __ARCH_WANT_SYS_SIGPROCMASK 686#define __ARCH_WANT_SYS_SIGPROCMASK
diff --git a/arch/x86/kernel/sys_i386_32.c b/arch/x86/kernel/sys_i386_32.c
index 8b5c348fdcf2..196552bb412c 100644
--- a/arch/x86/kernel/sys_i386_32.c
+++ b/arch/x86/kernel/sys_i386_32.c
@@ -25,55 +25,6 @@
25#include <asm/syscalls.h> 25#include <asm/syscalls.h>
26 26
27/* 27/*
28 * Old cruft
29 */
30asmlinkage int sys_uname(struct old_utsname __user *name)
31{
32 int err;
33 if (!name)
34 return -EFAULT;
35 down_read(&uts_sem);
36 err = copy_to_user(name, utsname(), sizeof(*name));
37 up_read(&uts_sem);
38 return err? -EFAULT:0;
39}
40
41asmlinkage int sys_olduname(struct oldold_utsname __user *name)
42{
43 int error;
44
45 if (!name)
46 return -EFAULT;
47 if (!access_ok(VERIFY_WRITE, name, sizeof(struct oldold_utsname)))
48 return -EFAULT;
49
50 down_read(&uts_sem);
51
52 error = __copy_to_user(&name->sysname, &utsname()->sysname,
53 __OLD_UTS_LEN);
54 error |= __put_user(0, name->sysname + __OLD_UTS_LEN);
55 error |= __copy_to_user(&name->nodename, &utsname()->nodename,
56 __OLD_UTS_LEN);
57 error |= __put_user(0, name->nodename + __OLD_UTS_LEN);
58 error |= __copy_to_user(&name->release, &utsname()->release,
59 __OLD_UTS_LEN);
60 error |= __put_user(0, name->release + __OLD_UTS_LEN);
61 error |= __copy_to_user(&name->version, &utsname()->version,
62 __OLD_UTS_LEN);
63 error |= __put_user(0, name->version + __OLD_UTS_LEN);
64 error |= __copy_to_user(&name->machine, &utsname()->machine,
65 __OLD_UTS_LEN);
66 error |= __put_user(0, name->machine + __OLD_UTS_LEN);
67
68 up_read(&uts_sem);
69
70 error = error ? -EFAULT : 0;
71
72 return error;
73}
74
75
76/*
77 * Do a system call from kernel instead of calling sys_execve so we 28 * Do a system call from kernel instead of calling sys_execve so we
78 * end up with proper pt_regs. 29 * end up with proper pt_regs.
79 */ 30 */
diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h
index fbb61ae70e06..44f2ad0e8825 100644
--- a/include/linux/syscalls.h
+++ b/include/linux/syscalls.h
@@ -31,6 +31,8 @@ struct msqid_ds;
31struct new_utsname; 31struct new_utsname;
32struct nfsctl_arg; 32struct nfsctl_arg;
33struct __old_kernel_stat; 33struct __old_kernel_stat;
34struct oldold_utsname;
35struct old_utsname;
34struct pollfd; 36struct pollfd;
35struct rlimit; 37struct rlimit;
36struct rusage; 38struct rusage;
@@ -655,6 +657,8 @@ asmlinkage long sys_gethostname(char __user *name, int len);
655asmlinkage long sys_sethostname(char __user *name, int len); 657asmlinkage long sys_sethostname(char __user *name, int len);
656asmlinkage long sys_setdomainname(char __user *name, int len); 658asmlinkage long sys_setdomainname(char __user *name, int len);
657asmlinkage long sys_newuname(struct new_utsname __user *name); 659asmlinkage long sys_newuname(struct new_utsname __user *name);
660asmlinkage long sys_uname(struct old_utsname __user *);
661asmlinkage long sys_olduname(struct oldold_utsname __user *);
658 662
659asmlinkage long sys_getrlimit(unsigned int resource, 663asmlinkage long sys_getrlimit(unsigned int resource,
660 struct rlimit __user *rlim); 664 struct rlimit __user *rlim);
diff --git a/kernel/sys.c b/kernel/sys.c
index e483eb5530e4..8298878f4f71 100644
--- a/kernel/sys.c
+++ b/kernel/sys.c
@@ -1138,6 +1138,60 @@ SYSCALL_DEFINE1(newuname, struct new_utsname __user *, name)
1138 return errno; 1138 return errno;
1139} 1139}
1140 1140
1141#ifdef __ARCH_WANT_SYS_OLD_UNAME
1142/*
1143 * Old cruft
1144 */
1145SYSCALL_DEFINE1(uname, struct old_utsname __user *, name)
1146{
1147 int error = 0;
1148
1149 if (!name)
1150 return -EFAULT;
1151
1152 down_read(&uts_sem);
1153 if (copy_to_user(name, utsname(), sizeof(*name)))
1154 error = -EFAULT;
1155 up_read(&uts_sem);
1156
1157 if (!error && override_architecture(name))
1158 error = -EFAULT;
1159 return error;
1160}
1161
1162SYSCALL_DEFINE1(olduname, struct oldold_utsname __user *, name)
1163{
1164 int error;
1165
1166 if (!name)
1167 return -EFAULT;
1168 if (!access_ok(VERIFY_WRITE, name, sizeof(struct oldold_utsname)))
1169 return -EFAULT;
1170
1171 down_read(&uts_sem);
1172 error = __copy_to_user(&name->sysname, &utsname()->sysname,
1173 __OLD_UTS_LEN);
1174 error |= __put_user(0, name->sysname + __OLD_UTS_LEN);
1175 error |= __copy_to_user(&name->nodename, &utsname()->nodename,
1176 __OLD_UTS_LEN);
1177 error |= __put_user(0, name->nodename + __OLD_UTS_LEN);
1178 error |= __copy_to_user(&name->release, &utsname()->release,
1179 __OLD_UTS_LEN);
1180 error |= __put_user(0, name->release + __OLD_UTS_LEN);
1181 error |= __copy_to_user(&name->version, &utsname()->version,
1182 __OLD_UTS_LEN);
1183 error |= __put_user(0, name->version + __OLD_UTS_LEN);
1184 error |= __copy_to_user(&name->machine, &utsname()->machine,
1185 __OLD_UTS_LEN);
1186 error |= __put_user(0, name->machine + __OLD_UTS_LEN);
1187 up_read(&uts_sem);
1188
1189 if (!error && override_architecture(name))
1190 error = -EFAULT;
1191 return error ? -EFAULT : 0;
1192}
1193#endif
1194
1141SYSCALL_DEFINE2(sethostname, char __user *, name, int, len) 1195SYSCALL_DEFINE2(sethostname, char __user *, name, int, len)
1142{ 1196{
1143 int errno; 1197 int errno;