diff options
author | Christoph Hellwig <hch@lst.de> | 2008-10-16 01:02:06 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-10-16 14:21:33 -0400 |
commit | b418da16dd44810e5d5a22bba377cca80512a524 (patch) | |
tree | 20ac32ea027bb8d978a22fbfaf6580fd34518aa5 /arch/ia64/ia32 | |
parent | f7a5000f7a8924e9c5fad1801616601d6dc65a17 (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')
-rw-r--r-- | arch/ia64/ia32/ia32_entry.S | 4 | ||||
-rw-r--r-- | arch/ia64/ia32/sys_ia32.c | 56 |
2 files changed, 2 insertions, 58 deletions
diff --git a/arch/ia64/ia32/ia32_entry.S b/arch/ia64/ia32/ia32_entry.S index ff88c48c5d19..53505bb04771 100644 --- a/arch/ia64/ia32/ia32_entry.S +++ b/arch/ia64/ia32/ia32_entry.S | |||
@@ -251,8 +251,8 @@ ia32_syscall_table: | |||
251 | data8 compat_sys_setrlimit /* 75 */ | 251 | data8 compat_sys_setrlimit /* 75 */ |
252 | data8 compat_sys_old_getrlimit | 252 | data8 compat_sys_old_getrlimit |
253 | data8 compat_sys_getrusage | 253 | data8 compat_sys_getrusage |
254 | data8 sys32_gettimeofday | 254 | data8 compat_sys_gettimeofday |
255 | data8 sys32_settimeofday | 255 | data8 compat_sys_settimeofday |
256 | data8 sys32_getgroups16 /* 80 */ | 256 | data8 sys32_getgroups16 /* 80 */ |
257 | data8 sys32_setgroups16 | 257 | data8 sys32_setgroups16 |
258 | data8 sys32_old_select | 258 | data8 sys32_old_select |
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 | ||
1116 | static inline long | ||
1117 | get_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 | |||
1123 | static inline long | ||
1124 | put_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 | |||
1130 | asmlinkage unsigned long | 1116 | asmlinkage unsigned long |
1131 | sys32_alarm (unsigned int seconds) | 1117 | sys32_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 | |||
1139 | extern struct timezone sys_tz; | ||
1140 | |||
1141 | asmlinkage long | ||
1142 | sys32_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 | |||
1157 | asmlinkage long | ||
1158 | sys32_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 | |||
1178 | struct sel_arg_struct { | 1122 | struct sel_arg_struct { |
1179 | unsigned int n; | 1123 | unsigned int n; |
1180 | unsigned int inp; | 1124 | unsigned int inp; |