remove include/asm-*/ipc.h
[safe/jmp/linux-2.6] / arch / mips / kernel / linux32.c
index b701ecb..2b8ec11 100644 (file)
 #include <linux/security.h>
 #include <linux/compat.h>
 #include <linux/vfs.h>
+#include <linux/ipc.h>
 
 #include <net/sock.h>
 #include <net/scm.h>
 
 #include <asm/compat-signal.h>
-#include <asm/ipc.h>
 #include <asm/sim.h>
 #include <asm/uaccess.h>
 #include <asm/mmu_context.h>
 #define AA(__x) ((unsigned long)((int)__x))
 
 #ifdef __MIPSEB__
-#define merge_64(r1,r2)        ((((r1) & 0xffffffffUL) << 32) + ((r2) & 0xffffffffUL))
+#define merge_64(r1, r2) ((((r1) & 0xffffffffUL) << 32) + ((r2) & 0xffffffffUL))
 #endif
 #ifdef __MIPSEL__
-#define merge_64(r1,r2)        ((((r2) & 0xffffffffUL) << 32) + ((r1) & 0xffffffffUL))
+#define merge_64(r1, r2) ((((r2) & 0xffffffffUL) << 32) + ((r1) & 0xffffffffUL))
 #endif
 
 /*
@@ -96,7 +96,7 @@ int cp_compat_stat(struct kstat *stat, struct compat_stat __user *statbuf)
 #endif
        tmp.st_blocks = stat->blocks;
        tmp.st_blksize = stat->blksize;
-       return copy_to_user(statbuf,&tmp,sizeof(tmp)) ? -EFAULT : 0;
+       return copy_to_user(statbuf, &tmp, sizeof(tmp)) ? -EFAULT : 0;
 }
 
 asmlinkage unsigned long
@@ -300,19 +300,21 @@ asmlinkage int sys32_sched_rr_get_interval(compat_pid_t pid,
 {
        struct timespec t;
        int ret;
-       mm_segment_t old_fs = get_fs ();
+       mm_segment_t old_fs = get_fs();
 
-       set_fs (KERNEL_DS);
+       set_fs(KERNEL_DS);
        ret = sys_sched_rr_get_interval(pid, (struct timespec __user *)&t);
-       set_fs (old_fs);
+       set_fs(old_fs);
        if (put_user (t.tv_sec, &interval->tv_sec) ||
-           __put_user (t.tv_nsec, &interval->tv_nsec))
+           __put_user(t.tv_nsec, &interval->tv_nsec))
                return -EFAULT;
        return ret;
 }
 
+#ifdef CONFIG_SYSVIPC
+
 asmlinkage long
-sys32_ipc (u32 call, int first, int second, int third, u32 ptr, u32 fifth)
+sys32_ipc(u32 call, int first, int second, int third, u32 ptr, u32 fifth)
 {
        int version, err;
 
@@ -368,6 +370,16 @@ sys32_ipc (u32 call, int first, int second, int third, u32 ptr, u32 fifth)
        return err;
 }
 
+#else
+
+asmlinkage long
+sys32_ipc(u32 call, int first, int second, int third, u32 ptr, u32 fifth)
+{
+       return -ENOSYS;
+}
+
+#endif /* CONFIG_SYSVIPC */
+
 #ifdef CONFIG_MIPS32_N32
 asmlinkage long sysn32_semctl(int semid, int semnum, int cmd, u32 arg)
 {
@@ -493,16 +505,16 @@ asmlinkage int sys32_ustat(dev_t dev, struct ustat32 __user * ubuf32)
 
        set_fs(KERNEL_DS);
        err = sys_ustat(dev, (struct ustat __user *)&tmp);
-       set_fs (old_fs);
+       set_fs(old_fs);
 
        if (err)
                goto out;
 
-       memset(&tmp32,0,sizeof(struct ustat32));
+       memset(&tmp32, 0, sizeof(struct ustat32));
        tmp32.f_tfree = tmp.f_tfree;
        tmp32.f_tinode = tmp.f_tinode;
 
-       err = copy_to_user(ubuf32,&tmp32,sizeof(struct ustat32)) ? -EFAULT : 0;
+       err = copy_to_user(ubuf32, &tmp32, sizeof(struct ustat32)) ? -EFAULT : 0;
 
 out:
        return err;
@@ -544,39 +556,25 @@ asmlinkage long sys32_sync_file_range(int fd, int __pad,
                        flags);
 }
 
-struct sigevent32 {
-       u32 sigev_value;
-       u32 sigev_signo;
-       u32 sigev_notify;
-       u32 payload[(64 / 4) - 3];
-};
+asmlinkage long sys32_fadvise64_64(int fd, int __pad,
+       unsigned long a2, unsigned long a3,
+       unsigned long a4, unsigned long a5,
+       int flags)
+{
+       return sys_fadvise64_64(fd,
+                       merge_64(a2, a3), merge_64(a4, a5),
+                       flags);
+}
 
-extern asmlinkage long
-sys_timer_create(clockid_t which_clock,
-                struct sigevent __user *timer_event_spec,
-                timer_t __user * created_timer_id);
-
-long
-sys32_timer_create(u32 clock, struct sigevent32 __user *se32, timer_t __user *timer_id)
-{
-       struct sigevent __user *p = NULL;
-       if (se32) {
-               struct sigevent se;
-               p = compat_alloc_user_space(sizeof(struct sigevent));
-               memset(&se, 0, sizeof(struct sigevent));
-               if (get_user(se.sigev_value.sival_int,  &se32->sigev_value) ||
-                   __get_user(se.sigev_signo, &se32->sigev_signo) ||
-                   __get_user(se.sigev_notify, &se32->sigev_notify) ||
-                   __copy_from_user(&se._sigev_un._pad, &se32->payload,
-                                    sizeof(se32->payload)) ||
-                   copy_to_user(p, &se, sizeof(se)))
-                       return -EFAULT;
-       }
-       return sys_timer_create(clock, p, timer_id);
+asmlinkage long sys32_fallocate(int fd, int mode, unsigned offset_a2,
+       unsigned offset_a3, unsigned len_a4, unsigned len_a5)
+{
+       return sys_fallocate(fd, mode, merge_64(offset_a2, offset_a3),
+                            merge_64(len_a4, len_a5));
 }
 
 save_static_function(sys32_clone);
-__attribute_used__ noinline static int
+static int noinline __used
 _sys32_clone(nabi_no_regargs struct pt_regs regs)
 {
        unsigned long clone_flags;
@@ -595,49 +593,3 @@ _sys32_clone(nabi_no_regargs struct pt_regs regs)
        return do_fork(clone_flags, newsp, &regs, 0,
                       parent_tidptr, child_tidptr);
 }
-
-/*
- * Implement the event wait interface for the eventpoll file. It is the kernel
- * part of the user space epoll_pwait(2).
- */
-asmlinkage long compat_sys_epoll_pwait(int epfd,
-       struct epoll_event __user *events, int maxevents, int timeout,
-       const compat_sigset_t __user *sigmask, size_t sigsetsize)
-{
-       int error;
-       sigset_t ksigmask, sigsaved;
-
-       /*
-        * If the caller wants a certain signal mask to be set during the wait,
-        * we apply it here.
-        */
-       if (sigmask) {
-               if (sigsetsize != sizeof(sigset_t))
-                       return -EINVAL;
-               if (!access_ok(VERIFY_READ, sigmask, sizeof(ksigmask)))
-                       return -EFAULT;
-               if (__copy_conv_sigset_from_user(&ksigmask, sigmask))
-                       return -EFAULT;
-               sigdelsetmask(&ksigmask, sigmask(SIGKILL) | sigmask(SIGSTOP));
-               sigprocmask(SIG_SETMASK, &ksigmask, &sigsaved);
-       }
-
-       error = sys_epoll_wait(epfd, events, maxevents, timeout);
-
-       /*
-        * If we changed the signal mask, we need to restore the original one.
-        * In case we've got a signal while waiting, we do not restore the
-        * signal mask yet, and we allow do_signal() to deliver the signal on
-        * the way back to userspace, before the signal mask is restored.
-        */
-       if (sigmask) {
-               if (error == -EINTR) {
-                       memcpy(&current->saved_sigmask, &sigsaved,
-                               sizeof(sigsaved));
-                       set_thread_flag(TIF_RESTORE_SIGMASK);
-               } else
-                       sigprocmask(SIG_SETMASK, &sigsaved, NULL);
-       }
-
-       return error;
-}