Commit a9ff25c8 authored by Stephen Rothwell's avatar Stephen Rothwell Committed by Linus Torvalds

[PATCH] consolidate sys32_times - architecture independent

This patch creates compat_sys_times and a few more compability types.
parent 136839a1
#ifndef _LINUX_COMPAT_H #ifndef _LINUX_COMPAT_H
#define _LINUX_COMPAT_H #define _LINUX_COMPAT_H
/* /*
* These are the type definitions for the arhitecure sepcific * These are the type definitions for the architecture specific
* compatibility layer. * syscall compatibility layer.
*/ */
#include <linux/config.h> #include <linux/config.h>
...@@ -10,6 +10,8 @@ ...@@ -10,6 +10,8 @@
#include <asm/compat.h> #include <asm/compat.h>
#define compat_jiffies_to_clock_t(x) ((x) / (HZ / COMPAT_USER_HZ))
struct compat_utimbuf { struct compat_utimbuf {
compat_time_t actime; compat_time_t actime;
compat_time_t modtime; compat_time_t modtime;
...@@ -20,5 +22,12 @@ struct compat_itimerval { ...@@ -20,5 +22,12 @@ struct compat_itimerval {
struct compat_timeval it_value; struct compat_timeval it_value;
}; };
struct compat_tms {
compat_clock_t tms_utime;
compat_clock_t tms_stime;
compat_clock_t tms_cutime;
compat_clock_t tms_cstime;
};
#endif /* CONFIG_COMPAT */ #endif /* CONFIG_COMPAT */
#endif /* _LINUX_COMPAT_H */ #endif /* _LINUX_COMPAT_H */
...@@ -156,3 +156,23 @@ asmlinkage long compat_sys_setitimer(int which, struct compat_itimerval *in, ...@@ -156,3 +156,23 @@ asmlinkage long compat_sys_setitimer(int which, struct compat_itimerval *in,
return -EFAULT; return -EFAULT;
return 0; return 0;
} }
asmlinkage long compat_sys_times(struct compat_tms *tbuf)
{
/*
* In the SMP world we might just be unlucky and have one of
* the times increment as we use it. Since the value is an
* atomically safe type this is just fine. Conceptually its
* as if the syscall took an instant longer to occur.
*/
if (tbuf) {
struct compat_tms tmp;
tmp.tms_utime = compat_jiffies_to_clock_t(current->utime);
tmp.tms_stime = compat_jiffies_to_clock_t(current->stime);
tmp.tms_cutime = compat_jiffies_to_clock_t(current->cutime);
tmp.tms_cstime = compat_jiffies_to_clock_t(current->cstime);
if (copy_to_user(tbuf, &tmp, sizeof(tmp)))
return -EFAULT;
}
return compat_jiffies_to_clock_t(jiffies);
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment