[SPARC64]: Kill asm-sparc64/pbm.h
[safe/jmp/linux-2.6] / arch / sparc64 / kernel / sys_sparc32.c
index 48f02f2..692e46a 100644 (file)
@@ -8,7 +8,6 @@
  * environment.
  */
 
-#include <linux/config.h>
 #include <linux/kernel.h>
 #include <linux/sched.h>
 #include <linux/capability.h>
@@ -19,7 +18,6 @@
 #include <linux/resource.h>
 #include <linux/times.h>
 #include <linux/utsname.h>
-#include <linux/timex.h>
 #include <linux/smp.h>
 #include <linux/smp_lock.h>
 #include <linux/sem.h>
@@ -63,6 +61,7 @@
 #include <asm/semaphore.h>
 #include <asm/mmu_context.h>
 #include <asm/a.out.h>
+#include <asm/compat_signal.h>
 
 asmlinkage long sys32_chown16(const char __user * filename, u16 user, u16 group)
 {
@@ -339,12 +338,17 @@ asmlinkage long sys32_ftruncate64(unsigned int fd, unsigned long high, unsigned
 
 int cp_compat_stat(struct kstat *stat, struct compat_stat __user *statbuf)
 {
+       compat_ino_t ino;
        int err;
 
        if (stat->size > MAX_NON_LFS || !old_valid_dev(stat->dev) ||
            !old_valid_dev(stat->rdev))
                return -EOVERFLOW;
 
+       ino = stat->ino;
+       if (sizeof(ino) < sizeof(stat->ino) && ino != stat->ino)
+               return -EOVERFLOW;
+
        err  = put_user(old_encode_dev(stat->dev), &statbuf->st_dev);
        err |= put_user(stat->ino, &statbuf->st_ino);
        err |= put_user(stat->mode, &statbuf->st_mode);
@@ -455,70 +459,6 @@ asmlinkage long compat_sys_sysfs(int option, u32 arg1, u32 arg2)
        return sys_sysfs(option, arg1, arg2);
 }
 
-struct sysinfo32 {
-        s32 uptime;
-        u32 loads[3];
-        u32 totalram;
-        u32 freeram;
-        u32 sharedram;
-        u32 bufferram;
-        u32 totalswap;
-        u32 freeswap;
-        unsigned short procs;
-       unsigned short pad;
-       u32 totalhigh;
-       u32 freehigh;
-       u32 mem_unit;
-       char _f[20-2*sizeof(int)-sizeof(int)];
-};
-
-asmlinkage long sys32_sysinfo(struct sysinfo32 __user *info)
-{
-       struct sysinfo s;
-       int ret, err;
-       int bitcount = 0;
-       mm_segment_t old_fs = get_fs ();
-       
-       set_fs(KERNEL_DS);
-       ret = sys_sysinfo((struct sysinfo __user *) &s);
-       set_fs(old_fs);
-       /* Check to see if any memory value is too large for 32-bit and
-         * scale down if needed.
-         */
-       if ((s.totalram >> 32) || (s.totalswap >> 32)) {
-               while (s.mem_unit < PAGE_SIZE) {
-                       s.mem_unit <<= 1;
-                       bitcount++;
-               }
-               s.totalram >>= bitcount;
-               s.freeram >>= bitcount;
-               s.sharedram >>= bitcount;
-               s.bufferram >>= bitcount;
-               s.totalswap >>= bitcount;
-               s.freeswap >>= bitcount;
-               s.totalhigh >>= bitcount;
-               s.freehigh >>= bitcount;
-       }
-
-       err = put_user (s.uptime, &info->uptime);
-       err |= __put_user (s.loads[0], &info->loads[0]);
-       err |= __put_user (s.loads[1], &info->loads[1]);
-       err |= __put_user (s.loads[2], &info->loads[2]);
-       err |= __put_user (s.totalram, &info->totalram);
-       err |= __put_user (s.freeram, &info->freeram);
-       err |= __put_user (s.sharedram, &info->sharedram);
-       err |= __put_user (s.bufferram, &info->bufferram);
-       err |= __put_user (s.totalswap, &info->totalswap);
-       err |= __put_user (s.freeswap, &info->freeswap);
-       err |= __put_user (s.procs, &info->procs);
-       err |= __put_user (s.totalhigh, &info->totalhigh);
-       err |= __put_user (s.freehigh, &info->freehigh);
-       err |= __put_user (s.mem_unit, &info->mem_unit);
-       if (err)
-               return -EFAULT;
-       return ret;
-}
-
 asmlinkage long compat_sys_sched_rr_get_interval(compat_pid_t pid, struct compat_timespec __user *interval)
 {
        struct timespec t;
@@ -835,15 +775,25 @@ asmlinkage long sys32_settimeofday(struct compat_timeval __user *tv,
 asmlinkage long sys32_utimes(char __user *filename,
                             struct compat_timeval __user *tvs)
 {
-       struct timeval ktvs[2];
+       struct timespec tv[2];
 
        if (tvs) {
+               struct timeval ktvs[2];
                if (get_tv32(&ktvs[0], tvs) ||
                    get_tv32(&ktvs[1], 1+tvs))
                        return -EFAULT;
+
+               if (ktvs[0].tv_usec < 0 || ktvs[0].tv_usec >= 1000000 ||
+                   ktvs[1].tv_usec < 0 || ktvs[1].tv_usec >= 1000000)
+                       return -EINVAL;
+
+               tv[0].tv_sec = ktvs[0].tv_sec;
+               tv[0].tv_nsec = 1000 * ktvs[0].tv_usec;
+               tv[1].tv_sec = ktvs[1].tv_sec;
+               tv[1].tv_nsec = 1000 * ktvs[1].tv_usec;
        }
 
-       return do_utimes(AT_FDCWD, filename, (tvs ? &ktvs[0] : NULL));
+       return do_utimes(AT_FDCWD, filename, tvs ? tv : NULL);
 }
 
 /* These are here just in case some old sparc32 binary calls it. */
@@ -945,66 +895,6 @@ asmlinkage long compat_sys_sendfile64(int out_fd, int in_fd,
        return ret;
 }
 
-/* Handle adjtimex compatibility. */
-
-extern int do_adjtimex(struct timex *);
-
-asmlinkage long sys32_adjtimex(struct compat_timex __user *utp)
-{
-       struct timex txc;
-       int ret;
-
-       memset(&txc, 0, sizeof(struct timex));
-
-       if (get_user(txc.modes, &utp->modes) ||
-           __get_user(txc.offset, &utp->offset) ||
-           __get_user(txc.freq, &utp->freq) ||
-           __get_user(txc.maxerror, &utp->maxerror) ||
-           __get_user(txc.esterror, &utp->esterror) ||
-           __get_user(txc.status, &utp->status) ||
-           __get_user(txc.constant, &utp->constant) ||
-           __get_user(txc.precision, &utp->precision) ||
-           __get_user(txc.tolerance, &utp->tolerance) ||
-           __get_user(txc.time.tv_sec, &utp->time.tv_sec) ||
-           __get_user(txc.time.tv_usec, &utp->time.tv_usec) ||
-           __get_user(txc.tick, &utp->tick) ||
-           __get_user(txc.ppsfreq, &utp->ppsfreq) ||
-           __get_user(txc.jitter, &utp->jitter) ||
-           __get_user(txc.shift, &utp->shift) ||
-           __get_user(txc.stabil, &utp->stabil) ||
-           __get_user(txc.jitcnt, &utp->jitcnt) ||
-           __get_user(txc.calcnt, &utp->calcnt) ||
-           __get_user(txc.errcnt, &utp->errcnt) ||
-           __get_user(txc.stbcnt, &utp->stbcnt))
-               return -EFAULT;
-
-       ret = do_adjtimex(&txc);
-
-       if (put_user(txc.modes, &utp->modes) ||
-           __put_user(txc.offset, &utp->offset) ||
-           __put_user(txc.freq, &utp->freq) ||
-           __put_user(txc.maxerror, &utp->maxerror) ||
-           __put_user(txc.esterror, &utp->esterror) ||
-           __put_user(txc.status, &utp->status) ||
-           __put_user(txc.constant, &utp->constant) ||
-           __put_user(txc.precision, &utp->precision) ||
-           __put_user(txc.tolerance, &utp->tolerance) ||
-           __put_user(txc.time.tv_sec, &utp->time.tv_sec) ||
-           __put_user(txc.time.tv_usec, &utp->time.tv_usec) ||
-           __put_user(txc.tick, &utp->tick) ||
-           __put_user(txc.ppsfreq, &utp->ppsfreq) ||
-           __put_user(txc.jitter, &utp->jitter) ||
-           __put_user(txc.shift, &utp->shift) ||
-           __put_user(txc.stabil, &utp->stabil) ||
-           __put_user(txc.jitcnt, &utp->jitcnt) ||
-           __put_user(txc.calcnt, &utp->calcnt) ||
-           __put_user(txc.errcnt, &utp->errcnt) ||
-           __put_user(txc.stbcnt, &utp->stbcnt))
-               ret = -EFAULT;
-
-       return ret;
-}
-
 /* This is just a version for 32-bit applications which does
  * not force O_LARGEFILE on.
  */
@@ -1078,7 +968,7 @@ struct __sysctl_args32 {
 
 asmlinkage long sys32_sysctl(struct __sysctl_args32 __user *args)
 {
-#ifndef CONFIG_SYSCTL
+#ifndef CONFIG_SYSCTL_SYSCALL
        return -ENOSYS;
 #else
        struct __sysctl_args32 tmp;
@@ -1130,3 +1020,11 @@ long sys32_lookup_dcookie(unsigned long cookie_high,
        return sys_lookup_dcookie((cookie_high << 32) | cookie_low,
                                  buf, len);
 }
+
+long compat_sync_file_range(int fd, unsigned long off_high, unsigned long off_low, unsigned long nb_high, unsigned long nb_low, int flags)
+{
+       return sys_sync_file_range(fd,
+                                  (off_high << 32) | off_low,
+                                  (nb_high << 32) | nb_low,
+                                  flags);
+}