times(2): move compat to native
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
28
kernel/sys.c
28
kernel/sys.c
@@ -886,7 +886,7 @@ SYSCALL_DEFINE0(getegid)
|
||||
return from_kgid_munged(current_user_ns(), current_egid());
|
||||
}
|
||||
|
||||
void do_sys_times(struct tms *tms)
|
||||
static void do_sys_times(struct tms *tms)
|
||||
{
|
||||
u64 tgutime, tgstime, cutime, cstime;
|
||||
|
||||
@@ -912,6 +912,32 @@ SYSCALL_DEFINE1(times, struct tms __user *, tbuf)
|
||||
return (long) jiffies_64_to_clock_t(get_jiffies_64());
|
||||
}
|
||||
|
||||
#ifdef CONFIG_COMPAT
|
||||
static compat_clock_t clock_t_to_compat_clock_t(clock_t x)
|
||||
{
|
||||
return compat_jiffies_to_clock_t(clock_t_to_jiffies(x));
|
||||
}
|
||||
|
||||
COMPAT_SYSCALL_DEFINE1(times, struct compat_tms __user *, tbuf)
|
||||
{
|
||||
if (tbuf) {
|
||||
struct tms tms;
|
||||
struct compat_tms tmp;
|
||||
|
||||
do_sys_times(&tms);
|
||||
/* Convert our struct tms to the compat version. */
|
||||
tmp.tms_utime = clock_t_to_compat_clock_t(tms.tms_utime);
|
||||
tmp.tms_stime = clock_t_to_compat_clock_t(tms.tms_stime);
|
||||
tmp.tms_cutime = clock_t_to_compat_clock_t(tms.tms_cutime);
|
||||
tmp.tms_cstime = clock_t_to_compat_clock_t(tms.tms_cstime);
|
||||
if (copy_to_user(tbuf, &tmp, sizeof(tmp)))
|
||||
return -EFAULT;
|
||||
}
|
||||
force_successful_syscall_return();
|
||||
return compat_jiffies_to_clock_t(jiffies);
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* This needs some heavy checking ...
|
||||
* I just haven't the stomach for it. I also don't fully
|
||||
|
||||
Reference in New Issue
Block a user