Merge to Fedora kernel-2.6.18-1.2255_FC5-vs2.0.2.2-rc9 patched with stable patch...
[linux-2.6.git] / arch / ia64 / ia32 / sys_ia32.c
index 1b653da..bb86b8a 100644 (file)
@@ -6,7 +6,7 @@
  * Copyright (C) 1999          Arun Sharma <arun.sharma@intel.com>
  * Copyright (C) 1997,1998     Jakub Jelinek (jj@sunsite.mff.cuni.cz)
  * Copyright (C) 1997          David S. Miller (davem@caip.rutgers.edu)
- * Copyright (C) 2000-2003 Hewlett-Packard Co
+ * Copyright (C) 2000-2003, 2005 Hewlett-Packard Co
  *     David Mosberger-Tang <davidm@hpl.hp.com>
  * Copyright (C) 2004          Gordon Jin <gordon.jin@intel.com>
  *
@@ -14,7 +14,6 @@
  * environment.
  */
 
-#include <linux/config.h>
 #include <linux/kernel.h>
 #include <linux/syscalls.h>
 #include <linux/sysctl.h>
@@ -25,7 +24,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>
@@ -36,6 +34,7 @@
 #include <linux/uio.h>
 #include <linux/nfs_fs.h>
 #include <linux/quota.h>
+#include <linux/syscalls.h>
 #include <linux/sunrpc/svc.h>
 #include <linux/nfsd/nfsd.h>
 #include <linux/nfsd/cache.h>
 #include <linux/ptrace.h>
 #include <linux/stat.h>
 #include <linux/ipc.h>
+#include <linux/capability.h>
 #include <linux/compat.h>
 #include <linux/vfs.h>
 #include <linux/mman.h>
+#include <linux/mutex.h>
 
 #include <asm/intrinsics.h>
-#include <asm/semaphore.h>
 #include <asm/types.h>
 #include <asm/uaccess.h>
 #include <asm/unistd.h>
@@ -84,7 +84,7 @@
  * while doing so.
  */
 /* XXX make per-mm: */
-static DECLARE_MUTEX(ia32_mmap_sem);
+static DEFINE_MUTEX(ia32_mmap_mutex);
 
 asmlinkage long
 sys32_execve (char __user *name, compat_uptr_t __user *argv, compat_uptr_t __user *envp,
@@ -125,6 +125,7 @@ sys32_execve (char __user *name, compat_uptr_t __user *argv, compat_uptr_t __use
 
 int cp_compat_stat(struct kstat *stat, struct compat_stat __user *ubuf)
 {
+       compat_ino_t ino;
        int err;
 
        if ((u64) stat->size > MAX_NON_LFS ||
@@ -132,11 +133,15 @@ int cp_compat_stat(struct kstat *stat, struct compat_stat __user *ubuf)
            !old_valid_dev(stat->rdev))
                return -EOVERFLOW;
 
+       ino = stat->ino;
+       if (sizeof(ino) < sizeof(stat->ino) && ino != stat->ino)
+               return -EOVERFLOW;
+
        if (clear_user(ubuf, sizeof(*ubuf)))
                return -EFAULT;
 
        err  = __put_user(old_encode_dev(stat->dev), &ubuf->st_dev);
-       err |= __put_user(stat->ino, &ubuf->st_ino);
+       err |= __put_user(ino, &ubuf->st_ino);
        err |= __put_user(stat->mode, &ubuf->st_mode);
        err |= __put_user(stat->nlink, &ubuf->st_nlink);
        err |= __put_user(high2lowuid(stat->uid), &ubuf->st_uid);
@@ -893,11 +898,11 @@ ia32_do_mmap (struct file *file, unsigned long addr, unsigned long len, int prot
        prot = get_prot32(prot);
 
 #if PAGE_SHIFT > IA32_PAGE_SHIFT
-       down(&ia32_mmap_sem);
+       mutex_lock(&ia32_mmap_mutex);
        {
                addr = emulate_mmap(file, addr, len, prot, flags, offset);
        }
-       up(&ia32_mmap_sem);
+       mutex_unlock(&ia32_mmap_mutex);
 #else
        down_write(&current->mm->mmap_sem);
        {
@@ -998,11 +1003,9 @@ sys32_munmap (unsigned int start, unsigned int len)
        if (start >= end)
                return 0;
 
-       down(&ia32_mmap_sem);
-       {
-               ret = sys_munmap(start, end - start);
-       }
-       up(&ia32_mmap_sem);
+       mutex_lock(&ia32_mmap_mutex);
+       ret = sys_munmap(start, end - start);
+       mutex_unlock(&ia32_mmap_mutex);
 #endif
        return ret;
 }
@@ -1054,7 +1057,7 @@ sys32_mprotect (unsigned int start, unsigned int len, int prot)
        if (retval < 0)
                return retval;
 
-       down(&ia32_mmap_sem);
+       mutex_lock(&ia32_mmap_mutex);
        {
                if (offset_in_page(start)) {
                        /* start address is 4KB aligned but not page aligned. */
@@ -1078,7 +1081,7 @@ sys32_mprotect (unsigned int start, unsigned int len, int prot)
                retval = sys_mprotect(start, end - start, prot);
        }
   out:
-       up(&ia32_mmap_sem);
+       mutex_unlock(&ia32_mmap_mutex);
        return retval;
 #endif
 }
@@ -1122,11 +1125,9 @@ sys32_mremap (unsigned int addr, unsigned int old_len, unsigned int new_len,
        old_len = PAGE_ALIGN(old_end) - addr;
        new_len = PAGE_ALIGN(new_end) - addr;
 
-       down(&ia32_mmap_sem);
-       {
-               ret = sys_mremap(addr, old_len, new_len, flags, new_addr);
-       }
-       up(&ia32_mmap_sem);
+       mutex_lock(&ia32_mmap_mutex);
+       ret = sys_mremap(addr, old_len, new_len, flags, new_addr);
+       mutex_unlock(&ia32_mmap_mutex);
 
        if ((ret >= 0) && (old_len < new_len)) {
                /* mremap expanded successfully */
@@ -1168,19 +1169,7 @@ put_tv32 (struct compat_timeval __user *o, struct timeval *i)
 asmlinkage unsigned 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
@@ -1238,16 +1227,20 @@ struct readdir32_callback {
 };
 
 static int
-filldir32 (void *__buf, const char *name, int namlen, loff_t offset, ino_t ino,
+filldir32 (void *__buf, const char *name, int namlen, loff_t offset, u64 ino,
           unsigned int d_type)
 {
        struct compat_dirent __user * dirent;
        struct getdents32_callback * buf = (struct getdents32_callback *) __buf;
        int reclen = ROUND_UP(offsetof(struct compat_dirent, d_name) + namlen + 1, 4);
+       u32 d_ino;
 
        buf->error = -EINVAL;   /* only used if we fail.. */
        if (reclen > buf->count)
                return -EINVAL;
+       d_ino = ino;
+       if (sizeof(d_ino) < sizeof(ino) && d_ino != ino)
+               return -EOVERFLOW;
        buf->error = -EFAULT;   /* only used if we fail.. */
        dirent = buf->previous;
        if (dirent)
@@ -1255,7 +1248,7 @@ filldir32 (void *__buf, const char *name, int namlen, loff_t offset, ino_t ino,
                        return -EFAULT;
        dirent = buf->current_dir;
        buf->previous = dirent;
-       if (put_user(ino, &dirent->d_ino)
+       if (put_user(d_ino, &dirent->d_ino)
            || put_user(reclen, &dirent->d_reclen)
            || copy_to_user(dirent->d_name, name, namlen)
            || put_user(0, dirent->d_name + namlen))
@@ -1303,17 +1296,21 @@ out:
 }
 
 static int
-fillonedir32 (void * __buf, const char * name, int namlen, loff_t offset, ino_t ino,
+fillonedir32 (void * __buf, const char * name, int namlen, loff_t offset, u64 ino,
              unsigned int d_type)
 {
        struct readdir32_callback * buf = (struct readdir32_callback *) __buf;
        struct old_linux32_dirent __user * dirent;
+       u32 d_ino;
 
        if (buf->count)
                return -EINVAL;
+       d_ino = ino;
+       if (sizeof(d_ino) < sizeof(ino) && d_ino != ino)
+               return -EOVERFLOW;
        buf->count++;
        dirent = buf->dirent;
-       if (put_user(ino, &dirent->d_ino)
+       if (put_user(d_ino, &dirent->d_ino)
            || put_user(offset, &dirent->d_offset)
            || put_user(namlen, &dirent->d_namlen)
            || copy_to_user(dirent->d_name, name, namlen)
@@ -1415,7 +1412,7 @@ sys32_ipc(u32 call, int first, int second, int third, u32 ptr, u32 fifth)
              case SHMDT:
                return sys_shmdt(compat_ptr(ptr));
              case SHMGET:
-               return sys_shmget(first, second, third);
+               return sys_shmget(first, (unsigned)second, third);
              case SHMCTL:
                return compat_sys_shmctl(first, second, compat_ptr(ptr));
 
@@ -1425,27 +1422,6 @@ sys32_ipc(u32 call, int first, int second, int third, u32 ptr, u32 fifth)
        return -EINVAL;
 }
 
-/*
- * sys_time() can be implemented in user-level using
- * sys_gettimeofday().  IA64 did this but i386 Linux did not
- * so we have to implement this system call here.
- */
-asmlinkage long
-sys32_time (int __user *tloc)
-{
-       int i;
-       struct timeval tv;
-
-       do_gettimeofday(&tv);
-       i = tv.tv_sec;
-
-       if (tloc) {
-               if (put_user(i, tloc))
-                       i = -EFAULT;
-       }
-       return i;
-}
-
 asmlinkage long
 compat_sys_wait4 (compat_pid_t pid, compat_uint_t * stat_addr, int options,
                 struct compat_rusage *ru);
@@ -1457,7 +1433,7 @@ sys32_waitpid (int pid, unsigned int *stat_addr, int options)
 }
 
 static unsigned int
-ia32_peek (struct pt_regs *regs, struct task_struct *child, unsigned long addr, unsigned int *val)
+ia32_peek (struct task_struct *child, unsigned long addr, unsigned int *val)
 {
        size_t copied;
        unsigned int ret;
@@ -1467,7 +1443,7 @@ ia32_peek (struct pt_regs *regs, struct task_struct *child, unsigned long addr,
 }
 
 static unsigned int
-ia32_poke (struct pt_regs *regs, struct task_struct *child, unsigned long addr, unsigned int val)
+ia32_poke (struct task_struct *child, unsigned long addr, unsigned int val)
 {
 
        if (access_process_vm(child, addr, &val, sizeof(val), 1) != sizeof(val))
@@ -1501,7 +1477,7 @@ getreg (struct task_struct *child, int regno)
 {
        struct pt_regs *child_regs;
 
-       child_regs = ia64_task_regs(child);
+       child_regs = task_pt_regs(child);
        switch (regno / sizeof(int)) {
              case PT_EBX: return child_regs->r11;
              case PT_ECX: return child_regs->r9;
@@ -1529,7 +1505,7 @@ putreg (struct task_struct *child, int regno, unsigned int value)
 {
        struct pt_regs *child_regs;
 
-       child_regs = ia64_task_regs(child);
+       child_regs = task_pt_regs(child);
        switch (regno / sizeof(int)) {
              case PT_EBX: child_regs->r11 = value; break;
              case PT_ECX: child_regs->r9 = value; break;
@@ -1645,7 +1621,7 @@ save_ia32_fpstate (struct task_struct *tsk, struct ia32_user_i387_struct __user
         *  Stack frames start with 16-bytes of temp space
         */
        swp = (struct switch_stack *)(tsk->thread.ksp + 16);
-       ptp = ia64_task_regs(tsk);
+       ptp = task_pt_regs(tsk);
        tos = (tsk->thread.fsr >> 11) & 7;
        for (i = 0; i < 8; i++)
                put_fpreg(i, &save->st_space[i], ptp, swp, tos);
@@ -1678,7 +1654,7 @@ restore_ia32_fpstate (struct task_struct *tsk, struct ia32_user_i387_struct __us
         *  Stack frames start with 16-bytes of temp space
         */
        swp = (struct switch_stack *)(tsk->thread.ksp + 16);
-       ptp = ia64_task_regs(tsk);
+       ptp = task_pt_regs(tsk);
        tos = (tsk->thread.fsr >> 11) & 7;
        for (i = 0; i < 8; i++)
                get_fpreg(i, &save->st_space[i], ptp, swp, tos);
@@ -1709,7 +1685,7 @@ save_ia32_fpxstate (struct task_struct *tsk, struct ia32_user_fxsr_struct __user
          *  Stack frames start with 16-bytes of temp space
          */
         swp = (struct switch_stack *)(tsk->thread.ksp + 16);
-        ptp = ia64_task_regs(tsk);
+        ptp = task_pt_regs(tsk);
        tos = (tsk->thread.fsr >> 11) & 7;
         for (i = 0; i < 8; i++)
                put_fpreg(i, (struct _fpreg_ia32 __user *)&save->st_space[4*i], ptp, swp, tos);
@@ -1753,7 +1729,7 @@ restore_ia32_fpxstate (struct task_struct *tsk, struct ia32_user_fxsr_struct __u
         *  Stack frames start with 16-bytes of temp space
         */
        swp = (struct switch_stack *)(tsk->thread.ksp + 16);
-       ptp = ia64_task_regs(tsk);
+       ptp = task_pt_regs(tsk);
        tos = (tsk->thread.fsr >> 11) & 7;
        for (i = 0; i < 8; i++)
        get_fpreg(i, (struct _fpreg_ia32 __user *)&save->st_space[4*i], ptp, swp, tos);
@@ -1772,42 +1748,27 @@ restore_ia32_fpxstate (struct task_struct *tsk, struct ia32_user_fxsr_struct __u
        return 0;
 }
 
-/*
- *  Note that the IA32 version of `ptrace' calls the IA64 routine for
- *    many of the requests.  This will only work for requests that do
- *    not need access to the calling processes `pt_regs' which is located
- *    at the address of `stack'.  Once we call the IA64 `sys_ptrace' then
- *    the address of `stack' will not be the address of the `pt_regs'.
- */
 asmlinkage long
-sys32_ptrace (int request, pid_t pid, unsigned int addr, unsigned int data,
-             long arg4, long arg5, long arg6, long arg7, long stack)
+sys32_ptrace (int request, pid_t pid, unsigned int addr, unsigned int data)
 {
-       struct pt_regs *regs = (struct pt_regs *) &stack;
        struct task_struct *child;
        unsigned int value, tmp;
        long i, ret;
 
        lock_kernel();
        if (request == PTRACE_TRACEME) {
-               ret = sys_ptrace(request, pid, addr, data, arg4, arg5, arg6, arg7, stack);
+               ret = ptrace_traceme();
                goto out;
        }
 
-       ret = -ESRCH;
-       read_lock(&tasklist_lock);
-       child = find_task_by_pid(pid);
-       if (child)
-               get_task_struct(child);
-       read_unlock(&tasklist_lock);
-       if (!child)
+       child = ptrace_get_task_struct(pid);
+       if (IS_ERR(child)) {
+               ret = PTR_ERR(child);
                goto out;
-       ret = -EPERM;
-       if (pid == 1)           /* no messing around with init! */
-               goto out_tsk;
+       }
 
        if (request == PTRACE_ATTACH) {
-               ret = sys_ptrace(request, pid, addr, data, arg4, arg5, arg6, arg7, stack);
+               ret = sys_ptrace(request, pid, addr, data);
                goto out_tsk;
        }
 
@@ -1818,7 +1779,7 @@ sys32_ptrace (int request, pid_t pid, unsigned int addr, unsigned int data,
        switch (request) {
              case PTRACE_PEEKTEXT:
              case PTRACE_PEEKDATA:     /* read word at location addr */
-               ret = ia32_peek(regs, child, addr, &value);
+               ret = ia32_peek(child, addr, &value);
                if (ret == 0)
                        ret = put_user(value, (unsigned int __user *) compat_ptr(data));
                else
@@ -1827,7 +1788,7 @@ sys32_ptrace (int request, pid_t pid, unsigned int addr, unsigned int data,
 
              case PTRACE_POKETEXT:
              case PTRACE_POKEDATA:     /* write the word at location addr */
-               ret = ia32_poke(regs, child, addr, data);
+               ret = ia32_poke(child, addr, data);
                goto out_tsk;
 
              case PTRACE_PEEKUSR:      /* read word at addr in USER area */
@@ -1894,12 +1855,16 @@ sys32_ptrace (int request, pid_t pid, unsigned int addr, unsigned int data,
                                            compat_ptr(data));
                break;
 
+             case PTRACE_GETEVENTMSG:   
+               ret = put_user(child->ptrace_message, (unsigned int __user *) compat_ptr(data));
+               break;
+
              case PTRACE_SYSCALL:      /* continue, stop after next syscall */
              case PTRACE_CONT:         /* restart after signal. */
              case PTRACE_KILL:
              case PTRACE_SINGLESTEP:   /* execute chile for one instruction */
              case PTRACE_DETACH:       /* detach a process */
-               ret = sys_ptrace(request, pid, addr, data, arg4, arg5, arg6, arg7, stack);
+               ret = sys_ptrace(request, pid, addr, data);
                break;
 
              default:
@@ -1922,9 +1887,9 @@ typedef struct {
 
 asmlinkage long
 sys32_sigaltstack (ia32_stack_t __user *uss32, ia32_stack_t __user *uoss32,
-                  long arg2, long arg3, long arg4, long arg5, long arg6, long arg7, long stack)
+                  long arg2, long arg3, long arg4, long arg5, long arg6,
+                  long arg7, struct pt_regs pt)
 {
-       struct pt_regs *pt = (struct pt_regs *) &stack;
        stack_t uss, uoss;
        ia32_stack_t buf32;
        int ret;
@@ -1945,7 +1910,7 @@ sys32_sigaltstack (ia32_stack_t __user *uss32, ia32_stack_t __user *uoss32,
        }
        set_fs(KERNEL_DS);
        ret = do_sigaltstack(uss32 ? (stack_t __user *) &uss : NULL,
-                            (stack_t __user *) &uoss, pt->r12);
+                            (stack_t __user *) &uoss, pt.r12);
        current->sas_ss_size = buf32.ss_size;
        set_fs(old_fs);
 out:
@@ -1990,10 +1955,10 @@ struct sysctl32 {
        unsigned int    __unused[4];
 };
 
+#ifdef CONFIG_SYSCTL
 asmlinkage long
 sys32_sysctl (struct sysctl32 __user *args)
 {
-#ifdef CONFIG_SYSCTL
        struct sysctl32 a32;
        mm_segment_t old_fs = get_fs ();
        void __user *oldvalp, *newvalp;
@@ -2032,10 +1997,8 @@ sys32_sysctl (struct sysctl32 __user *args)
                return -EFAULT;
 
        return ret;
-#else
-       return -ENOSYS;
-#endif
 }
+#endif
 
 asmlinkage long
 sys32_newuname (struct new_utsname __user *name)
@@ -2355,7 +2318,7 @@ sys32_sendfile (int out_fd, int in_fd, int __user *offset, unsigned int count)
        ret = sys_sendfile(out_fd, in_fd, offset ? (off_t __user *) &of : NULL, count);
        set_fs(old_fs);
 
-       if (!ret && offset && put_user(of, offset))
+       if (offset && put_user(of, offset))
                return -EFAULT;
 
        return ret;
@@ -2387,37 +2350,6 @@ sys32_brk (unsigned int brk)
        return ret;
 }
 
-/*
- * Exactly like fs/open.c:sys_open(), except that it doesn't set the O_LARGEFILE flag.
- */
-asmlinkage long
-sys32_open (const char __user * filename, int flags, int mode)
-{
-       char * tmp;
-       int fd, error;
-
-       tmp = getname(filename);
-       fd = PTR_ERR(tmp);
-       if (!IS_ERR(tmp)) {
-               fd = get_unused_fd();
-               if (fd >= 0) {
-                       struct file *f = filp_open(tmp, flags, mode);
-                       error = PTR_ERR(f);
-                       if (IS_ERR(f))
-                               goto out_error;
-                       fd_install(fd, f);
-               }
-out:
-               putname(tmp);
-       }
-       return fd;
-
-out_error:
-       put_unused_fd(fd);
-       fd = error;
-       goto out;
-}
-
 /* Structure for ia32 emulation on ia64 */
 struct epoll_event32
 {
@@ -2430,12 +2362,11 @@ sys32_epoll_ctl(int epfd, int op, int fd, struct epoll_event32 __user *event)
 {
        mm_segment_t old_fs = get_fs();
        struct epoll_event event64;
-       int error = -EFAULT;
+       int error;
        u32 data_halfword;
 
-       if ((error = verify_area(VERIFY_READ, event,
-                                sizeof(struct epoll_event32))))
-               return error;
+       if (!access_ok(VERIFY_READ, event, sizeof(struct epoll_event32)))
+               return -EFAULT;
 
        __get_user(event64.events, &event->events);
        __get_user(data_halfword, &event->data[0]);
@@ -2456,7 +2387,7 @@ sys32_epoll_wait(int epfd, struct epoll_event32 __user * events, int maxevents,
 {
        struct epoll_event *events64 = NULL;
        mm_segment_t old_fs = get_fs();
-       int error, numevents, size;
+       int numevents, size;
        int evt_idx;
        int do_free_pages = 0;
 
@@ -2465,9 +2396,8 @@ sys32_epoll_wait(int epfd, struct epoll_event32 __user * events, int maxevents,
        }
 
        /* Verify that the area passed by the user is writeable */
-       if ((error = verify_area(VERIFY_WRITE, events,
-                                maxevents * sizeof(struct epoll_event32))))
-               return error;
+       if (!access_ok(VERIFY_WRITE, events, maxevents * sizeof(struct epoll_event32)))
+               return -EFAULT;
 
        /*
         * Allocate space for the intermediate copy.  If the space needed
@@ -2619,39 +2549,6 @@ sys32_get_thread_area (struct ia32_user_desc __user *u_info)
        return 0;
 }
 
-asmlinkage long
-sys32_timer_create(u32 clock, struct sigevent32 __user *se32, timer_t __user *timer_id)
-{
-       struct sigevent se;
-       mm_segment_t oldfs;
-       timer_t t;
-       long err;
-
-       if (se32 == NULL)
-               return sys_timer_create(clock, NULL, timer_id);
-
-       memset(&se, 0, sizeof(struct sigevent));
-       if (get_user(se.sigev_value.sival_int,  &se32->sigev_value.sival_int) ||
-           __get_user(se.sigev_signo, &se32->sigev_signo) ||
-           __get_user(se.sigev_notify, &se32->sigev_notify) ||
-           __copy_from_user(&se._sigev_un._pad, &se32->_sigev_un._pad,
-           sizeof(se._sigev_un._pad)))
-               return -EFAULT;
-
-       if (!access_ok(VERIFY_WRITE,timer_id,sizeof(timer_t)))
-               return -EFAULT;
-
-       oldfs = get_fs();
-       set_fs(KERNEL_DS);
-       err = sys_timer_create(clock, (struct sigevent __user *) &se, (timer_t __user *) &t);
-       set_fs(oldfs);
-
-       if (!err)
-               err = __put_user (t, timer_id);
-
-       return err;
-}
-
 long sys32_fadvise64_64(int fd, __u32 offset_low, __u32 offset_high, 
                        __u32 len_low, __u32 len_high, int advice)
 { 
@@ -2661,32 +2558,6 @@ long sys32_fadvise64_64(int fd, __u32 offset_low, __u32 offset_high,
                               advice); 
 } 
 
-asmlinkage long sys32_waitid(int which, compat_pid_t pid,
-                            siginfo_t32 __user *uinfo, int options,
-                            struct compat_rusage __user *uru)
-{
-       siginfo_t info;
-       struct rusage ru;
-       long ret;
-       mm_segment_t old_fs = get_fs();
-
-       info.si_signo = 0;
-       set_fs (KERNEL_DS);
-       ret = sys_waitid(which, pid, (siginfo_t __user *) &info, options,
-                        uru ? &ru : NULL);
-       set_fs (old_fs);
-
-       if (ret < 0 || info.si_signo == 0)
-               return ret;
-
-       if (uru && (ret = put_compat_rusage(&ru, uru)))
-               return ret;
-
-       BUG_ON(info.si_code & __SI_MASK);
-       info.si_code |= __SI_CHLD;
-       return copy_siginfo_to_user32(uinfo, &info);
-}
-
 #ifdef NOTYET  /* UNTESTED FOR IA64 FROM HERE DOWN */
 
 asmlinkage long sys32_setreuid(compat_uid_t ruid, compat_uid_t euid)
@@ -2731,78 +2602,4 @@ sys32_setresgid(compat_gid_t rgid, compat_gid_t egid,
        ssgid = (sgid == (compat_gid_t)-1) ? ((gid_t)-1) : ((gid_t)sgid);
        return sys_setresgid(srgid, segid, ssgid);
 }
-
-/* 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 *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;
-}
 #endif /* NOTYET */