[PATCH] create struct compat_timex and use it everywhere
[platform/adaptation/renesas_rcar/renesas_kernel.git] / arch / x86_64 / ia32 / sys_ia32.c
index 54481af..b13121e 100644 (file)
@@ -180,6 +180,28 @@ sys32_fstat64(unsigned int fd, struct stat64 __user *statbuf)
        return ret;
 }
 
+asmlinkage long
+sys32_fstatat(unsigned int dfd, char __user *filename,
+             struct stat64 __user* statbuf, int flag)
+{
+       struct kstat stat;
+       int error = -EINVAL;
+
+       if ((flag & ~AT_SYMLINK_NOFOLLOW) != 0)
+               goto out;
+
+       if (flag & AT_SYMLINK_NOFOLLOW)
+               error = vfs_lstat_fd(dfd, filename, &stat);
+       else
+               error = vfs_stat_fd(dfd, filename, &stat);
+
+       if (!error)
+               error = cp_stat64(statbuf, &stat);
+
+out:
+       return error;
+}
+
 /*
  * Linux/i386 didn't use to be able to handle more than
  * 4 system call parameters, so these system calls used a memory
@@ -408,24 +430,12 @@ put_tv32(struct compat_timeval __user *o, struct timeval *i)
        return err; 
 }
 
-extern int do_setitimer(int which, struct itimerval *, struct itimerval *);
+extern unsigned int alarm_setitimer(unsigned int seconds);
 
 asmlinkage long
 sys32_alarm(unsigned int seconds)
 {
-       struct itimerval it_new, it_old;
-       unsigned int oldalarm;
-
-       it_new.it_interval.tv_sec = it_new.it_interval.tv_usec = 0;
-       it_new.it_value.tv_sec = seconds;
-       it_new.it_value.tv_usec = 0;
-       do_setitimer(ITIMER_REAL, &it_new, &it_old);
-       oldalarm = it_old.it_value.tv_sec;
-       /* ehhh.. We can't return 0 if we have an alarm pending.. */
-       /* And we'd better return too much than too little anyway */
-       if (it_old.it_value.tv_usec)
-               oldalarm++;
-       return oldalarm;
+       return alarm_setitimer(seconds);
 }
 
 /* Translations due to time_t size differences.  Which affects all
@@ -759,30 +769,17 @@ sys32_sendfile(int out_fd, int in_fd, compat_off_t __user *offset, s32 count)
 
 /* Handle adjtimex compatibility. */
 
-struct timex32 {
-       u32 modes;
-       s32 offset, freq, maxerror, esterror;
-       s32 status, constant, precision, tolerance;
-       struct compat_timeval time;
-       s32 tick;
-       s32 ppsfreq, jitter, shift, stabil;
-       s32 jitcnt, calcnt, errcnt, stbcnt;
-       s32  :32; s32  :32; s32  :32; s32  :32;
-       s32  :32; s32  :32; s32  :32; s32  :32;
-       s32  :32; s32  :32; s32  :32; s32  :32;
-};
-
 extern int do_adjtimex(struct timex *);
 
 asmlinkage long
-sys32_adjtimex(struct timex32 __user *utp)
+sys32_adjtimex(struct compat_timex __user *utp)
 {
        struct timex txc;
        int ret;
 
        memset(&txc, 0, sizeof(struct timex));
 
-       if (!access_ok(VERIFY_READ, utp, sizeof(struct timex32)) ||
+       if (!access_ok(VERIFY_READ, utp, sizeof(struct compat_timex)) ||
           __get_user(txc.modes, &utp->modes) ||
           __get_user(txc.offset, &utp->offset) ||
           __get_user(txc.freq, &utp->freq) ||
@@ -807,7 +804,7 @@ sys32_adjtimex(struct timex32 __user *utp)
 
        ret = do_adjtimex(&txc);
 
-       if (!access_ok(VERIFY_WRITE, utp, sizeof(struct timex32)) ||
+       if (!access_ok(VERIFY_WRITE, utp, sizeof(struct compat_timex)) ||
           __put_user(txc.modes, &utp->modes) ||
           __put_user(txc.offset, &utp->offset) ||
           __put_user(txc.freq, &utp->freq) ||