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/powerpc | |
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/powerpc')
-rw-r--r-- | arch/powerpc/kernel/sys_ppc32.c | 63 |
1 files changed, 0 insertions, 63 deletions
diff --git a/arch/powerpc/kernel/sys_ppc32.c b/arch/powerpc/kernel/sys_ppc32.c index d00599bb24a1..bb1cfcfdbbbb 100644 --- a/arch/powerpc/kernel/sys_ppc32.c +++ b/arch/powerpc/kernel/sys_ppc32.c | |||
@@ -71,69 +71,6 @@ asmlinkage long compat_sys_sysfs(u32 option, u32 arg1, u32 arg2) | |||
71 | return sys_sysfs((int)option, arg1, arg2); | 71 | return sys_sysfs((int)option, arg1, arg2); |
72 | } | 72 | } |
73 | 73 | ||
74 | static inline long get_ts32(struct timespec *o, struct compat_timeval __user *i) | ||
75 | { | ||
76 | long usec; | ||
77 | |||
78 | if (!access_ok(VERIFY_READ, i, sizeof(*i))) | ||
79 | return -EFAULT; | ||
80 | if (__get_user(o->tv_sec, &i->tv_sec)) | ||
81 | return -EFAULT; | ||
82 | if (__get_user(usec, &i->tv_usec)) | ||
83 | return -EFAULT; | ||
84 | o->tv_nsec = usec * 1000; | ||
85 | return 0; | ||
86 | } | ||
87 | |||
88 | static inline long put_tv32(struct compat_timeval __user *o, struct timeval *i) | ||
89 | { | ||
90 | return (!access_ok(VERIFY_WRITE, o, sizeof(*o)) || | ||
91 | (__put_user(i->tv_sec, &o->tv_sec) | | ||
92 | __put_user(i->tv_usec, &o->tv_usec))); | ||
93 | } | ||
94 | |||
95 | |||
96 | |||
97 | |||
98 | /* Translations due to time_t size differences. Which affects all | ||
99 | sorts of things, like timeval and itimerval. */ | ||
100 | extern struct timezone sys_tz; | ||
101 | |||
102 | asmlinkage long compat_sys_gettimeofday(struct compat_timeval __user *tv, struct timezone __user *tz) | ||
103 | { | ||
104 | if (tv) { | ||
105 | struct timeval ktv; | ||
106 | do_gettimeofday(&ktv); | ||
107 | if (put_tv32(tv, &ktv)) | ||
108 | return -EFAULT; | ||
109 | } | ||
110 | if (tz) { | ||
111 | if (copy_to_user(tz, &sys_tz, sizeof(sys_tz))) | ||
112 | return -EFAULT; | ||
113 | } | ||
114 | |||
115 | return 0; | ||
116 | } | ||
117 | |||
118 | |||
119 | |||
120 | asmlinkage long compat_sys_settimeofday(struct compat_timeval __user *tv, struct timezone __user *tz) | ||
121 | { | ||
122 | struct timespec kts; | ||
123 | struct timezone ktz; | ||
124 | |||
125 | if (tv) { | ||
126 | if (get_ts32(&kts, tv)) | ||
127 | return -EFAULT; | ||
128 | } | ||
129 | if (tz) { | ||
130 | if (copy_from_user(&ktz, tz, sizeof(ktz))) | ||
131 | return -EFAULT; | ||
132 | } | ||
133 | |||
134 | return do_sys_settimeofday(tv ? &kts : NULL, tz ? &ktz : NULL); | ||
135 | } | ||
136 | |||
137 | #ifdef CONFIG_SYSVIPC | 74 | #ifdef CONFIG_SYSVIPC |
138 | long compat_sys_ipc(u32 call, u32 first, u32 second, u32 third, compat_uptr_t ptr, | 75 | long compat_sys_ipc(u32 call, u32 first, u32 second, u32 third, compat_uptr_t ptr, |
139 | u32 fifth) | 76 | u32 fifth) |