aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips/kernel
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>2005-02-16 16:21:29 -0500
committerRalf Baechle <ralf@linux-mips.org>2005-10-29 14:30:35 -0400
commit54f2da755b7f0bf022ea204240cba824af4d80ad (patch)
tree06c6a800c1023cab23566f33fccb05d9f1de9e73 /arch/mips/kernel
parenta19050f301c55313826a649943d492c65f977479 (diff)
Implement 32-bit compatibility for waitid(2).
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch/mips/kernel')
-rw-r--r--arch/mips/kernel/linux32.c22
-rw-r--r--arch/mips/kernel/scall64-n32.S2
-rw-r--r--arch/mips/kernel/scall64-o32.S2
-rw-r--r--arch/mips/kernel/signal32.c27
4 files changed, 51 insertions, 2 deletions
diff --git a/arch/mips/kernel/linux32.c b/arch/mips/kernel/linux32.c
index dfb448c015e1..120dd897162e 100644
--- a/arch/mips/kernel/linux32.c
+++ b/arch/mips/kernel/linux32.c
@@ -221,6 +221,28 @@ sys32_waitpid(compat_pid_t pid, unsigned int *stat_addr, int options)
221 return compat_sys_wait4(pid, stat_addr, options, NULL); 221 return compat_sys_wait4(pid, stat_addr, options, NULL);
222} 222}
223 223
224asmlinkage long
225sysn32_waitid(int which, compat_pid_t pid,
226 siginfo_t __user *uinfo, int options,
227 struct compat_rusage __user *uru)
228{
229 struct rusage ru;
230 long ret;
231 mm_segment_t old_fs = get_fs();
232
233 set_fs (KERNEL_DS);
234 ret = sys_waitid(which, pid, uinfo, options,
235 uru ? (struct rusage __user *) &ru : NULL);
236 set_fs (old_fs);
237
238 if (ret < 0 || uinfo->si_signo == 0)
239 return ret;
240
241 if (uru)
242 ret = put_compat_rusage(&ru, uru);
243 return ret;
244}
245
224struct sysinfo32 { 246struct sysinfo32 {
225 s32 uptime; 247 s32 uptime;
226 u32 loads[3]; 248 u32 loads[3];
diff --git a/arch/mips/kernel/scall64-n32.S b/arch/mips/kernel/scall64-n32.S
index 3a56056d8125..982248a17393 100644
--- a/arch/mips/kernel/scall64-n32.S
+++ b/arch/mips/kernel/scall64-n32.S
@@ -358,7 +358,7 @@ EXPORT(sysn32_call_table)
358 PTR compat_sys_mq_notify 358 PTR compat_sys_mq_notify
359 PTR compat_sys_mq_getsetattr 359 PTR compat_sys_mq_getsetattr
360 PTR sys_ni_syscall /* 6240, sys_vserver */ 360 PTR sys_ni_syscall /* 6240, sys_vserver */
361 PTR sys_waitid 361 PTR sysn32_waitid
362 PTR sys_ni_syscall /* available, was setaltroot */ 362 PTR sys_ni_syscall /* available, was setaltroot */
363 PTR sys_add_key 363 PTR sys_add_key
364 PTR sys_request_key 364 PTR sys_request_key
diff --git a/arch/mips/kernel/scall64-o32.S b/arch/mips/kernel/scall64-o32.S
index 271b2cb14da0..00e0d2b8fd8e 100644
--- a/arch/mips/kernel/scall64-o32.S
+++ b/arch/mips/kernel/scall64-o32.S
@@ -480,7 +480,7 @@ sys_call_table:
480 PTR compat_sys_mq_notify /* 4275 */ 480 PTR compat_sys_mq_notify /* 4275 */
481 PTR compat_sys_mq_getsetattr 481 PTR compat_sys_mq_getsetattr
482 PTR sys_ni_syscall /* sys_vserver */ 482 PTR sys_ni_syscall /* sys_vserver */
483 PTR sys_waitid 483 PTR sys32_waitid
484 PTR sys_ni_syscall /* available, was setaltroot */ 484 PTR sys_ni_syscall /* available, was setaltroot */
485 PTR sys_add_key /* 4280 */ 485 PTR sys_add_key /* 4280 */
486 PTR sys_request_key 486 PTR sys_request_key
diff --git a/arch/mips/kernel/signal32.c b/arch/mips/kernel/signal32.c
index 8ddfbd8d425a..d50daee51fba 100644
--- a/arch/mips/kernel/signal32.c
+++ b/arch/mips/kernel/signal32.c
@@ -902,3 +902,30 @@ asmlinkage int sys32_rt_sigqueueinfo(int pid, int sig, compat_siginfo_t *uinfo)
902 set_fs (old_fs); 902 set_fs (old_fs);
903 return ret; 903 return ret;
904} 904}
905
906asmlinkage long
907sys32_waitid(int which, compat_pid_t pid,
908 compat_siginfo_t __user *uinfo, int options,
909 struct compat_rusage __user *uru)
910{
911 siginfo_t info;
912 struct rusage ru;
913 long ret;
914 mm_segment_t old_fs = get_fs();
915
916 info.si_signo = 0;
917 set_fs (KERNEL_DS);
918 ret = sys_waitid(which, pid, (siginfo_t __user *) &info, options,
919 uru ? (struct rusage __user *) &ru : NULL);
920 set_fs (old_fs);
921
922 if (ret < 0 || info.si_signo == 0)
923 return ret;
924
925 if (uru && (ret = put_compat_rusage(&ru, uru)))
926 return ret;
927
928 BUG_ON(info.si_code & __SI_MASK);
929 info.si_code |= __SI_CHLD;
930 return copy_siginfo_to_user32(uinfo, &info);
931}