public inbox for linux-arch@vger.kernel.org
 help / color / mirror / Atom feed
* x86-64-waitid-compat-fix
@ 2004-09-21  3:40 Andrew Morton
  2004-09-21  3:46 ` x86-64-waitid-compat-fix Andrew Morton
  2004-09-21  8:54 ` x86-64-waitid-compat-fix Andi Kleen
  0 siblings, 2 replies; 4+ messages in thread
From: Andrew Morton @ 2004-09-21  3:40 UTC (permalink / raw)
  To: David S. Miller; +Cc: linux-arch


I guess I'll merge this into Linus's tree this evening.  It breaks sparc64
and probably other architectures.  The fix will be simple; probably the
same as x86_64..


From: Roland McGrath <roland@redhat.com>

This patch updates the x86-64's compat code to handle the new argument to
waitid.

Signed-off-by: Andrew Morton <akpm@osdl.org>
---

 25-akpm/arch/x86_64/ia32/sys_ia32.c |   11 +++++++++--
 25-akpm/include/linux/syscalls.h    |    3 ++-
 2 files changed, 11 insertions(+), 3 deletions(-)

diff -puN arch/x86_64/ia32/sys_ia32.c~x86-64-waitid-compat-fix arch/x86_64/ia32/sys_ia32.c
--- 25/arch/x86_64/ia32/sys_ia32.c~x86-64-waitid-compat-fix	Mon Sep 20 14:58:27 2004
+++ 25-akpm/arch/x86_64/ia32/sys_ia32.c	Mon Sep 20 14:58:27 2004
@@ -1152,19 +1152,26 @@ asmlinkage long sys32_clone(unsigned int
 }
 
 asmlinkage long sys32_waitid(int which, compat_pid_t pid,
-			     siginfo_t32 __user *uinfo, int options)
+			     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);
+	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 ia32_copy_siginfo_to_user(uinfo, &info);
diff -puN include/linux/syscalls.h~x86-64-waitid-compat-fix include/linux/syscalls.h
--- 25/include/linux/syscalls.h~x86-64-waitid-compat-fix	Mon Sep 20 14:58:27 2004
+++ 25-akpm/include/linux/syscalls.h	Mon Sep 20 14:58:27 2004
@@ -163,7 +163,8 @@ asmlinkage void sys_exit_group(int error
 asmlinkage long sys_wait4(pid_t pid, unsigned int __user *stat_addr,
 				int options, struct rusage __user *ru);
 asmlinkage long sys_waitid(int which, pid_t pid,
-			   	struct siginfo __user *infop, int options);
+			   struct siginfo __user *infop,
+			   int options, struct rusage __user *ru);
 asmlinkage long sys_waitpid(pid_t pid, unsigned int __user *stat_addr, int options);
 asmlinkage long sys_set_tid_address(int __user *tidptr);
 asmlinkage long sys_futex(u32 __user *uaddr, int op, int val,
_

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: x86-64-waitid-compat-fix
  2004-09-21  3:40 x86-64-waitid-compat-fix Andrew Morton
@ 2004-09-21  3:46 ` Andrew Morton
  2004-09-21  6:17   ` x86-64-waitid-compat-fix David S. Miller
  2004-09-21  8:54 ` x86-64-waitid-compat-fix Andi Kleen
  1 sibling, 1 reply; 4+ messages in thread
From: Andrew Morton @ 2004-09-21  3:46 UTC (permalink / raw)
  To: davem, linux-arch

Andrew Morton <akpm@osdl.org> wrote:
>
> I guess I'll merge this into Linus's tree this evening.  It breaks sparc64
>  and probably other architectures.  The fix will be simple; probably the
>  same as x86_64..

This sparc64 fix compiles.

All (or most of) those casts in the sys_waitid() call seem to be unneeded -
we have a prototype in scope...


--- 25-sparc64/arch/sparc64/kernel/sys_sparc32.c~sparc64-waitid-compat-fix	2004-09-20 20:41:25.867863424 -0700
+++ 25-sparc64-akpm/arch/sparc64/kernel/sys_sparc32.c	2004-09-20 20:44:59.847333600 -0700
@@ -1737,21 +1737,28 @@ sys32_timer_create(u32 clock, struct sig
 }
 
 asmlinkage long compat_sys_waitid(u32 which, u32 pid,
-				  struct siginfo32 __user *uinfo, u32 options)
+			struct siginfo32 __user *uinfo, int options,
+			struct compat_rusage __user *uru)
 {
 	siginfo_t info;
+	struct rusage ru;
 	long ret;
 	mm_segment_t old_fs = get_fs();
 
 	memset(&info, 0, sizeof(info));
 
-	set_fs (KERNEL_DS);
-	ret = sys_waitid((int)which, (compat_pid_t) pid,
-			 (siginfo_t __user *) &info, (int) options);
-	set_fs (old_fs);
+	set_fs(KERNEL_DS);
+	ret = sys_waitid((int)which, (compat_pid_t)pid,
+			(siginfo_t __user *)&info, (int)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);
_

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: x86-64-waitid-compat-fix
  2004-09-21  3:46 ` x86-64-waitid-compat-fix Andrew Morton
@ 2004-09-21  6:17   ` David S. Miller
  0 siblings, 0 replies; 4+ messages in thread
From: David S. Miller @ 2004-09-21  6:17 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-arch

On Mon, 20 Sep 2004 20:46:37 -0700
Andrew Morton <akpm@osdl.org> wrote:

> This sparc64 fix compiles.

Looks fine.

> All (or most of) those casts in the sys_waitid() call seem to be unneeded -
> we have a prototype in scope...

You're probably right.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: x86-64-waitid-compat-fix
  2004-09-21  3:40 x86-64-waitid-compat-fix Andrew Morton
  2004-09-21  3:46 ` x86-64-waitid-compat-fix Andrew Morton
@ 2004-09-21  8:54 ` Andi Kleen
  1 sibling, 0 replies; 4+ messages in thread
From: Andi Kleen @ 2004-09-21  8:54 UTC (permalink / raw)
  To: Andrew Morton; +Cc: David S. Miller, linux-arch

On Mon, Sep 20, 2004 at 08:40:55PM -0700, Andrew Morton wrote:
> 
> I guess I'll merge this into Linus's tree this evening.  It breaks sparc64
> and probably other architectures.  The fix will be simple; probably the
> same as x86_64..

Yes, looks good to me. 

Thanks,
-Andi

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2004-09-21  8:57 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-09-21  3:40 x86-64-waitid-compat-fix Andrew Morton
2004-09-21  3:46 ` x86-64-waitid-compat-fix Andrew Morton
2004-09-21  6:17   ` x86-64-waitid-compat-fix David S. Miller
2004-09-21  8:54 ` x86-64-waitid-compat-fix Andi Kleen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox