From 87880da124c54975215d9baa44e61653c7a4ddb9 Mon Sep 17 00:00:00 2001 From: Martin Schwidefsky Date: Thu, 26 Jun 2003 19:59:58 -0700 Subject: [PATCH] [PATCH] s390: 31 bit compat. - Add missing includes to compat_ioctl.c. - Fix 32 bit emulation of sys_settimeofday. --- arch/s390/kernel/compat_ioctl.c | 3 +++ arch/s390/kernel/compat_linux.c | 21 +++++++++++++++++---- include/asm-s390/compat.h | 1 + 3 files changed, 21 insertions(+), 4 deletions(-) diff --git a/arch/s390/kernel/compat_ioctl.c b/arch/s390/kernel/compat_ioctl.c index 01437938cae35..04116286f882a 100644 --- a/arch/s390/kernel/compat_ioctl.c +++ b/arch/s390/kernel/compat_ioctl.c @@ -42,12 +42,15 @@ #include #include #include +#include #include #include #include +#include #include #include +#include #include #include diff --git a/arch/s390/kernel/compat_linux.c b/arch/s390/kernel/compat_linux.c index fc131aa5d8ba1..05f6e5caffc9d 100644 --- a/arch/s390/kernel/compat_linux.c +++ b/arch/s390/kernel/compat_linux.c @@ -2193,7 +2193,6 @@ done: sorts of things, like timeval and itimerval. */ extern struct timezone sys_tz; -extern int do_sys_settimeofday(struct timeval *tv, struct timezone *tz); asmlinkage int sys32_gettimeofday(struct compat_timeval *tv, struct timezone *tz) { @@ -2210,13 +2209,27 @@ asmlinkage int sys32_gettimeofday(struct compat_timeval *tv, struct timezone *tz return 0; } +static inline long get_ts32(struct timespec *o, struct compat_timeval *i) +{ + long usec; + + if (!access_ok(VERIFY_READ, i, sizeof(*i))) + return -EFAULT; + if (__get_user(o->tv_sec, &i->tv_sec)) + return -EFAULT; + if (__get_user(usec, &i->tv_usec)) + return -EFAULT; + o->tv_nsec = usec * 1000; + return 0; +} + asmlinkage int sys32_settimeofday(struct compat_timeval *tv, struct timezone *tz) { - struct timeval ktv; + struct timespec kts; struct timezone ktz; if (tv) { - if (get_tv32(&ktv, tv)) + if (get_ts32(&kts, tv)) return -EFAULT; } if (tz) { @@ -2224,7 +2237,7 @@ asmlinkage int sys32_settimeofday(struct compat_timeval *tv, struct timezone *tz return -EFAULT; } - return do_sys_settimeofday(tv ? &ktv : NULL, tz ? &ktz : NULL); + return do_sys_settimeofday(tv ? &kts : NULL, tz ? &ktz : NULL); } asmlinkage int sys_utimes(char *, struct timeval *); diff --git a/include/asm-s390/compat.h b/include/asm-s390/compat.h index 594d31bc2ae46..1b564c5624628 100644 --- a/include/asm-s390/compat.h +++ b/include/asm-s390/compat.h @@ -94,6 +94,7 @@ struct compat_statfs { s32 f_ffree; compat_fsid_t f_fsid; s32 f_namelen; + s32 f_frsize; s32 f_spare[6]; }; -- 2.53.0