aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/kernel/syscalls.c
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 /arch/powerpc/kernel/syscalls.c
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>
Diffstat (limited to 'arch/powerpc/kernel/syscalls.c')
-rw-r--r--arch/powerpc/kernel/syscalls.c57
1 files changed, 0 insertions, 57 deletions
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{