linux-cvs-patches
[Top] [All Lists]

CVS Update@linux-mips.org: linux

To: linux-cvs-patches@linux-mips.org
Subject: CVS Update@linux-mips.org: linux
From: ralf@linux-mips.org
Date: Wed, 16 Feb 2005 21:21:36 +0000
Reply-to: linux-mips@linux-mips.org
Sender: linux-cvs-patches-bounce@linux-mips.org
CVSROOT:        /home/cvs
Module name:    linux
Changes by:     ralf@ftp.linux-mips.org 05/02/16 21:21:30

Modified files:
        arch/mips/kernel: linux32.c scall64-n32.S scall64-o32.S 
                          signal32.c 

Log message:
        Implement 32-bit compatibility for waitid(2).

diff -urN linux/arch/mips/kernel/linux32.c linux/arch/mips/kernel/linux32.c
--- linux/arch/mips/kernel/linux32.c    2005/02/16 21:18:52     1.25
+++ linux/arch/mips/kernel/linux32.c    2005/02/16 21:21:29     1.26
@@ -224,6 +224,28 @@
        return compat_sys_wait4(pid, stat_addr, options, NULL);
 }
 
+asmlinkage long
+sysn32_waitid(int which, compat_pid_t pid,
+             siginfo_t __user *uinfo, int options,
+             struct compat_rusage __user *uru)
+{
+       struct rusage ru;
+       long ret;
+       mm_segment_t old_fs = get_fs();
+
+       set_fs (KERNEL_DS);
+       ret = sys_waitid(which, pid, uinfo, options,
+                        uru ? (struct rusage __user *) &ru : NULL);
+       set_fs (old_fs);
+
+       if (ret < 0 || uinfo->si_signo == 0)
+               return ret;
+
+       if (uru)
+               ret = put_compat_rusage(&ru, uru);
+       return ret;
+}
+
 struct sysinfo32 {
         s32 uptime;
         u32 loads[3];
diff -urN linux/arch/mips/kernel/scall64-n32.S 
linux/arch/mips/kernel/scall64-n32.S
--- linux/arch/mips/kernel/scall64-n32.S        2005/02/16 21:18:52     1.26
+++ linux/arch/mips/kernel/scall64-n32.S        2005/02/16 21:21:30     1.27
@@ -358,7 +358,7 @@
        PTR     compat_sys_mq_notify
        PTR     compat_sys_mq_getsetattr
        PTR     sys_ni_syscall                  /* 6240, sys_vserver */
-       PTR     sys_waitid
+       PTR     sysn32_waitid
        PTR     sys_ni_syscall                  /* available, was setaltroot */
        PTR     sys_add_key
        PTR     sys_request_key
diff -urN linux/arch/mips/kernel/scall64-o32.S 
linux/arch/mips/kernel/scall64-o32.S
--- linux/arch/mips/kernel/scall64-o32.S        2005/02/16 21:18:52     1.33
+++ linux/arch/mips/kernel/scall64-o32.S        2005/02/16 21:21:30     1.34
@@ -480,7 +480,7 @@
        PTR     compat_sys_mq_notify            /* 4275 */
        PTR     compat_sys_mq_getsetattr
        PTR     sys_ni_syscall                  /* sys_vserver */
-       PTR     sys_waitid
+       PTR     sys32_waitid
        PTR     sys_ni_syscall                  /* available, was setaltroot */
        PTR     sys_add_key                     /* 4280 */
        PTR     sys_request_key
diff -urN linux/arch/mips/kernel/signal32.c linux/arch/mips/kernel/signal32.c
--- linux/arch/mips/kernel/signal32.c   2005/02/07 02:54:34     1.23
+++ linux/arch/mips/kernel/signal32.c   2005/02/16 21:21:30     1.24
@@ -908,3 +908,30 @@
        set_fs (old_fs);
        return ret;
 }
+
+asmlinkage long
+sys32_waitid(int which, compat_pid_t pid,
+            compat_siginfo_t __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 ? (struct rusage __user *) &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);
+}

<Prev in Thread] Current Thread [Next in Thread>