aboutsummaryrefslogtreecommitdiffstats
path: root/arch/ia64/ia32/sys_ia32.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2008-10-16 01:02:06 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-10-16 14:21:33 -0400
commitb418da16dd44810e5d5a22bba377cca80512a524 (patch)
tree20ac32ea027bb8d978a22fbfaf6580fd34518aa5 /arch/ia64/ia32/sys_ia32.c
parentf7a5000f7a8924e9c5fad1801616601d6dc65a17 (diff)
compat: generic compat get/settimeofday
Nothing arch specific in get/settimeofday. The details of the timeval conversion varied a little from arch to arch, but all with the same results. Also add an extern declaration for sys_tz to linux/time.h because externs in .c files are fowned upon. I'll kill the externs in various other files in a sparate patch. [akpm@linux-foundation.org: coding-style fixes] Signed-off-by: Christoph Hellwig <hch@lst.de> Acked-by: David S. Miller <davem@davemloft.net> [ sparc bits ] Cc: "Luck, Tony" <tony.luck@intel.com> Cc: Ralf Baechle <ralf@linux-mips.org> Acked-by: Kyle McMartin <kyle@mcmartin.ca> Cc: Matthew Wilcox <matthew@wil.cx> Cc: Grant Grundler <grundler@parisc-linux.org> Cc: Paul Mackerras <paulus@samba.org> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org> Cc: Martin Schwidefsky <schwidefsky@de.ibm.com> Cc: Heiko Carstens <heiko.carstens@de.ibm.com> Cc: Ingo Molnar <mingo@elte.hu> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: "H. Peter Anvin" <hpa@zytor.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'arch/ia64/ia32/sys_ia32.c')
-rw-r--r--arch/ia64/ia32/sys_ia32.c56
1 files changed, 0 insertions, 56 deletions
diff --git a/arch/ia64/ia32/sys_ia32.c b/arch/ia64/ia32/sys_ia32.c
index 2362a8eefb30..f4430bb4bbdc 100644
--- a/arch/ia64/ia32/sys_ia32.c
+++ b/arch/ia64/ia32/sys_ia32.c
@@ -1113,68 +1113,12 @@ sys32_pipe (int __user *fd)
1113 return retval; 1113 return retval;
1114} 1114}
1115 1115
1116static inline long
1117get_tv32 (struct timeval *o, struct compat_timeval __user *i)
1118{
1119 return (!access_ok(VERIFY_READ, i, sizeof(*i)) ||
1120 (__get_user(o->tv_sec, &i->tv_sec) | __get_user(o->tv_usec, &i->tv_usec)));
1121}
1122
1123static inline long
1124put_tv32 (struct compat_timeval __user *o, struct timeval *i)
1125{
1126 return (!access_ok(VERIFY_WRITE, o, sizeof(*o)) ||
1127 (__put_user(i->tv_sec, &o->tv_sec) | __put_user(i->tv_usec, &o->tv_usec)));
1128}
1129
1130asmlinkage unsigned long 1116asmlinkage unsigned long
1131sys32_alarm (unsigned int seconds) 1117sys32_alarm (unsigned int seconds)
1132{ 1118{
1133 return alarm_setitimer(seconds); 1119 return alarm_setitimer(seconds);
1134} 1120}
1135 1121
1136/* Translations due to time_t size differences. Which affects all
1137 sorts of things, like timeval and itimerval. */
1138
1139extern struct timezone sys_tz;
1140
1141asmlinkage long
1142sys32_gettimeofday (struct compat_timeval __user *tv, struct timezone __user *tz)
1143{
1144 if (tv) {
1145 struct timeval ktv;
1146 do_gettimeofday(&ktv);
1147 if (put_tv32(tv, &ktv))
1148 return -EFAULT;
1149 }
1150 if (tz) {
1151 if (copy_to_user(tz, &sys_tz, sizeof(sys_tz)))
1152 return -EFAULT;
1153 }
1154 return 0;
1155}
1156
1157asmlinkage long
1158sys32_settimeofday (struct compat_timeval __user *tv, struct timezone __user *tz)
1159{
1160 struct timeval ktv;
1161 struct timespec kts;
1162 struct timezone ktz;
1163
1164 if (tv) {
1165 if (get_tv32(&ktv, tv))
1166 return -EFAULT;
1167 kts.tv_sec = ktv.tv_sec;
1168 kts.tv_nsec = ktv.tv_usec * 1000;
1169 }
1170 if (tz) {
1171 if (copy_from_user(&ktz, tz, sizeof(ktz)))
1172 return -EFAULT;
1173 }
1174
1175 return do_sys_settimeofday(tv ? &kts : NULL, tz ? &ktz : NULL);
1176}
1177
1178struct sel_arg_struct { 1122struct sel_arg_struct {
1179 unsigned int n; 1123 unsigned int n;
1180 unsigned int inp; 1124 unsigned int inp;