mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH][COMPAT] consolidate sys32_times - architecture independent
@ 2002-12-10  6:35 Stephen Rothwell
  2002-12-10  6:38 ` [PATCH][COMPAT] consolidate sys32_times - ppc64 Stephen Rothwell
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: Stephen Rothwell @ 2002-12-10  6:35 UTC (permalink / raw)
  To: Linus; +Cc: LKML, anton, David S. Miller, ak, davidm, schwidefsky, ralf, willy

Hi Linus,

This is the next in the series.  This patch creates compat_sys_times and
a few more compability types.  Across all the architectures, the
diffstat looks like this:

 arch/ia64/ia32/ia32_entry.S       |    2 +-
 arch/ia64/ia32/sys_ia32.c         |   31 -------------------------------
 arch/mips64/kernel/linux32.c      |   29 -----------------------------
 arch/mips64/kernel/scall_o32.S    |    2 +-
 arch/parisc/kernel/sys_parisc32.c |   26 --------------------------
 arch/ppc64/kernel/misc.S          |    2 +-
 arch/ppc64/kernel/sys_ppc32.c     |   31 -------------------------------
 arch/s390x/kernel/entry.S         |    2 +-
 arch/s390x/kernel/linux32.c       |   30 ------------------------------
 arch/s390x/kernel/linux32.h       |    6 ++----
 arch/s390x/kernel/wrapper32.S     |    8 ++++----
 arch/sparc64/kernel/sys_sparc32.c |   30 ------------------------------
 arch/sparc64/kernel/systbls.S     |    2 +-
 arch/x86_64/ia32/ia32entry.S      |    2 +-
 arch/x86_64/ia32/sys_ia32.c       |   31 -------------------------------
 include/asm-ia64/compat.h         |    3 +++
 include/asm-ia64/ia32.h           |    8 +++-----
 include/asm-mips64/compat.h       |    3 +++
 include/asm-mips64/posix_types.h  |    3 ---
 include/asm-parisc/compat.h       |    3 +++
 include/asm-parisc/posix_types.h  |    3 ---
 include/asm-ppc64/compat.h        |    3 +++
 include/asm-ppc64/ppc32.h         |    6 ++----
 include/asm-s390x/compat.h        |    3 +++
 include/asm-sparc64/compat.h      |    3 +++
 include/asm-sparc64/posix_types.h |    2 --
 include/asm-sparc64/siginfo.h     |    6 ++++--
 include/asm-x86_64/compat.h       |    3 +++
 include/asm-x86_64/ia32.h         |    8 ++++----
 include/linux/compat.h            |   13 +++++++++++--
 kernel/compat.c                   |   20 ++++++++++++++++++++
 31 files changed, 77 insertions(+), 247 deletions(-)

This is the architecture independent part of the patch.
-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/

diff -ruN 2.5.51-32bit.base/include/linux/compat.h 2.5.51-32bit.1/include/linux/compat.h
--- 2.5.51-32bit.base/include/linux/compat.h	2002-12-10 15:10:40.000000000 +1100
+++ 2.5.51-32bit.1/include/linux/compat.h	2002-12-10 16:40:20.000000000 +1100
@@ -1,8 +1,8 @@
 #ifndef _LINUX_COMPAT_H
 #define _LINUX_COMPAT_H
 /*
- * These are the type definitions for the arhitecure sepcific
- * compatibility layer.
+ * These are the type definitions for the architecture specific
+ * syscall compatibility layer.
  */
 #include <linux/config.h>
 
@@ -10,6 +10,8 @@
 
 #include <asm/compat.h>
 
+#define compat_jiffies_to_clock_t(x)	((x) / (HZ / COMPAT_USER_HZ))
+
 struct compat_utimbuf {
 	compat_time_t		actime;
 	compat_time_t		modtime;
@@ -20,5 +22,12 @@
 	struct compat_timeval	it_value;
 };
 
+struct compat_tms {
+	compat_clock_t		tms_utime;
+	compat_clock_t		tms_stime;
+	compat_clock_t		tms_cutime;
+	compat_clock_t		tms_cstime;
+};
+
 #endif /* CONFIG_COMPAT */
 #endif /* _LINUX_COMPAT_H */
diff -ruN 2.5.51-32bit.base/kernel/compat.c 2.5.51-32bit.1/kernel/compat.c
--- 2.5.51-32bit.base/kernel/compat.c	2002-12-10 15:10:41.000000000 +1100
+++ 2.5.51-32bit.1/kernel/compat.c	2002-12-10 16:45:09.000000000 +1100
@@ -161,3 +161,23 @@
 		return -EFAULT;
 	return 0;
 }
+
+asmlinkage long compat_sys_times(struct compat_tms *tbuf)
+{
+	/*
+	 *	In the SMP world we might just be unlucky and have one of
+	 *	the times increment as we use it. Since the value is an
+	 *	atomically safe type this is just fine. Conceptually its
+	 *	as if the syscall took an instant longer to occur.
+	 */
+	if (tbuf) {
+		struct compat_tms tmp;
+		tmp.tms_utime = compat_jiffies_to_clock_t(current->utime);
+		tmp.tms_stime = compat_jiffies_to_clock_t(current->stime);
+		tmp.tms_cutime = compat_jiffies_to_clock_t(current->cutime);
+		tmp.tms_cstime = compat_jiffies_to_clock_t(current->cstime);
+		if (copy_to_user(tbuf, &tmp, sizeof(tmp)))
+			return -EFAULT;
+	}
+	return compat_jiffies_to_clock_t(jiffies);
+}

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

* [PATCH][COMPAT] consolidate sys32_times - ppc64
  2002-12-10  6:35 [PATCH][COMPAT] consolidate sys32_times - architecture independent Stephen Rothwell
@ 2002-12-10  6:38 ` Stephen Rothwell
  2002-12-10  6:39 ` [PATCH][COMPAT] consolidate sys32_times - sparc64 Stephen Rothwell
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Stephen Rothwell @ 2002-12-10  6:38 UTC (permalink / raw)
  To: anton; +Cc: linux-kernel

Hi Anton,

This is the ppc specific patch ...

-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/

diff -ruN 2.5.51-32bit.base/arch/ppc64/kernel/misc.S 2.5.51-32bit.1/arch/ppc64/kernel/misc.S
--- 2.5.51-32bit.base/arch/ppc64/kernel/misc.S	2002-12-10 15:10:16.000000000 +1100
+++ 2.5.51-32bit.1/arch/ppc64/kernel/misc.S	2002-12-10 17:06:50.000000000 +1100
@@ -551,7 +551,7 @@
 	.llong .sys_rmdir		/* 40 */
 	.llong .sys_dup
 	.llong .sys_pipe
-	.llong .sys32_times
+	.llong .compat_sys_times
 	.llong .sys_ni_syscall		/* old prof syscall */
 	.llong .sys_brk			/* 45 */
 	.llong .sys_setgid
diff -ruN 2.5.51-32bit.base/arch/ppc64/kernel/sys_ppc32.c 2.5.51-32bit.1/arch/ppc64/kernel/sys_ppc32.c
--- 2.5.51-32bit.base/arch/ppc64/kernel/sys_ppc32.c	2002-12-10 15:10:16.000000000 +1100
+++ 2.5.51-32bit.1/arch/ppc64/kernel/sys_ppc32.c	2002-12-10 17:07:08.000000000 +1100
@@ -2076,37 +2076,6 @@
 }
 
 
-struct tms32 {
-	__kernel_clock_t32 tms_utime;
-	__kernel_clock_t32 tms_stime;
-	__kernel_clock_t32 tms_cutime;
-	__kernel_clock_t32 tms_cstime;
-};
-                                
-extern asmlinkage long sys_times(struct tms * tbuf);
-
-asmlinkage long sys32_times(struct tms32 *tbuf)
-{
-	struct tms t;
-	long ret;
-	mm_segment_t old_fs = get_fs ();
-	int err;
-	
-	set_fs (KERNEL_DS);
-	ret = sys_times(tbuf ? &t : NULL);
-	set_fs (old_fs);
-	if (tbuf) {
-		err = put_user (t.tms_utime, &tbuf->tms_utime);
-		err |= __put_user (t.tms_stime, &tbuf->tms_stime);
-		err |= __put_user (t.tms_cutime, &tbuf->tms_cutime);
-		err |= __put_user (t.tms_cstime, &tbuf->tms_cstime);
-		if (err)
-			ret = -EFAULT;
-	}
-	
-	return ret;
-}
-
 struct msgbuf32 { s32 mtype; char mtext[1]; };
 
 struct semid_ds32 {
diff -ruN 2.5.51-32bit.base/include/asm-ppc64/compat.h 2.5.51-32bit.1/include/asm-ppc64/compat.h
--- 2.5.51-32bit.base/include/asm-ppc64/compat.h	2002-12-10 15:10:39.000000000 +1100
+++ 2.5.51-32bit.1/include/asm-ppc64/compat.h	2002-12-10 16:38:13.000000000 +1100
@@ -5,9 +5,12 @@
  */
 #include <linux/types.h>
 
+#define COMPAT_USER_HZ	100
+
 typedef u32		compat_size_t;
 typedef s32		compat_ssize_t;
 typedef s32		compat_time_t;
+typedef s32		compat_clock_t;
 
 struct compat_timespec {
 	compat_time_t	tv_sec;
diff -ruN 2.5.51-32bit.base/include/asm-ppc64/ppc32.h 2.5.51-32bit.1/include/asm-ppc64/ppc32.h
--- 2.5.51-32bit.base/include/asm-ppc64/ppc32.h	2002-12-10 15:10:39.000000000 +1100
+++ 2.5.51-32bit.1/include/asm-ppc64/ppc32.h	2002-12-10 15:44:11.000000000 +1100
@@ -44,8 +44,6 @@
 })
 
 /* These are here to support 32-bit syscalls on a 64-bit kernel. */
-typedef int		__kernel_ptrdiff_t32;
-typedef int		__kernel_clock_t32;
 typedef int		__kernel_pid_t32;
 typedef unsigned short	__kernel_ipc_pid_t32;
 typedef unsigned int	__kernel_uid_t32;
@@ -110,8 +108,8 @@
 			__kernel_pid_t32 _pid;		/* which child */
 			__kernel_uid_t32 _uid;		/* sender's uid */
 			int _status;			/* exit code */
-			__kernel_clock_t32 _utime;
-			__kernel_clock_t32 _stime;
+			compat_clock_t _utime;
+			compat_clock_t _stime;
 		} _sigchld;
 
 		/* SIGILL, SIGFPE, SIGSEGV, SIGBUS, SIGEMT */

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

* Re: [PATCH][COMPAT] consolidate sys32_times - sparc64
  2002-12-10  6:35 [PATCH][COMPAT] consolidate sys32_times - architecture independent Stephen Rothwell
  2002-12-10  6:38 ` [PATCH][COMPAT] consolidate sys32_times - ppc64 Stephen Rothwell
@ 2002-12-10  6:39 ` Stephen Rothwell
  2002-12-10  6:41 ` [PATCH][COMPAT] consolidate sys32_times - x86_64 Stephen Rothwell
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Stephen Rothwell @ 2002-12-10  6:39 UTC (permalink / raw)
  To: davem; +Cc: linux-kernel

Hi Dave,

The sparc64 patch ...
-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/

diff -ruN 2.5.51-32bit.base/arch/sparc64/kernel/sys_sparc32.c 2.5.51-32bit.1/arch/sparc64/kernel/sys_sparc32.c
--- 2.5.51-32bit.base/arch/sparc64/kernel/sys_sparc32.c	2002-12-10 15:10:17.000000000 +1100
+++ 2.5.51-32bit.1/arch/sparc64/kernel/sys_sparc32.c	2002-12-10 17:06:24.000000000 +1100
@@ -1986,36 +1986,6 @@
 	return ret;
 }
 
-struct tms32 {
-	__kernel_clock_t32 tms_utime;
-	__kernel_clock_t32 tms_stime;
-	__kernel_clock_t32 tms_cutime;
-	__kernel_clock_t32 tms_cstime;
-};
-                                
-extern asmlinkage long sys_times(struct tms * tbuf);
-
-asmlinkage long sys32_times(struct tms32 *tbuf)
-{
-	struct tms t;
-	long ret;
-	mm_segment_t old_fs = get_fs ();
-	int err;
-	
-	set_fs (KERNEL_DS);
-	ret = sys_times(tbuf ? &t : NULL);
-	set_fs (old_fs);
-	if (tbuf) {
-		err = put_user (t.tms_utime, &tbuf->tms_utime);
-		err |= __put_user (t.tms_stime, &tbuf->tms_stime);
-		err |= __put_user (t.tms_cutime, &tbuf->tms_cutime);
-		err |= __put_user (t.tms_cstime, &tbuf->tms_cstime);
-		if (err)
-			ret = -EFAULT;
-	}
-	return ret;
-}
-
 #define RLIM_INFINITY32	0x7fffffff
 #define RESOURCE32(x) ((x > RLIM_INFINITY32) ? RLIM_INFINITY32 : x)
 
diff -ruN 2.5.51-32bit.base/arch/sparc64/kernel/systbls.S 2.5.51-32bit.1/arch/sparc64/kernel/systbls.S
--- 2.5.51-32bit.base/arch/sparc64/kernel/systbls.S	2002-12-10 15:10:17.000000000 +1100
+++ 2.5.51-32bit.1/arch/sparc64/kernel/systbls.S	2002-12-10 17:06:07.000000000 +1100
@@ -27,7 +27,7 @@
 /*25*/	.word sys_time, sys_ptrace, sys_alarm, sys32_sigaltstack, sys32_pause
 /*30*/	.word compat_sys_utime, sys_lchown, sys_fchown, sys_access, sys_nice
 	.word sys_chown, sys_sync, sys_kill, sys32_newstat, sys32_sendfile
-/*40*/	.word sys32_newlstat, sys_dup, sys_pipe, sys32_times, sys_getuid
+/*40*/	.word sys32_newlstat, sys_dup, sys_pipe, compat_sys_times, sys_getuid
 	.word sys_umount, sys32_setgid16, sys32_getgid16, sys_signal, sys32_geteuid16
 /*50*/	.word sys32_getegid16, sys_acct, sys_nis_syscall, sys_getgid, sys32_ioctl
 	.word sys_reboot, sys32_mmap2, sys_symlink, sys_readlink, sys32_execve
diff -ruN 2.5.51-32bit.base/include/asm-sparc64/compat.h 2.5.51-32bit.1/include/asm-sparc64/compat.h
--- 2.5.51-32bit.base/include/asm-sparc64/compat.h	2002-12-10 15:10:40.000000000 +1100
+++ 2.5.51-32bit.1/include/asm-sparc64/compat.h	2002-12-10 16:38:22.000000000 +1100
@@ -5,9 +5,12 @@
  */
 #include <linux/types.h>
 
+#define COMPAT_USER_HZ	100
+
 typedef u32		compat_size_t;
 typedef s32		compat_ssize_t;
 typedef s32		compat_time_t;
+typedef s32		compat_clock_t;
 
 struct compat_timespec {
 	compat_time_t	tv_sec;
diff -ruN 2.5.51-32bit.base/include/asm-sparc64/posix_types.h 2.5.51-32bit.1/include/asm-sparc64/posix_types.h
--- 2.5.51-32bit.base/include/asm-sparc64/posix_types.h	2002-12-10 15:10:40.000000000 +1100
+++ 2.5.51-32bit.1/include/asm-sparc64/posix_types.h	2002-12-10 15:42:57.000000000 +1100
@@ -48,8 +48,6 @@
 } __kernel_fsid_t;
 
 /* Now 32bit compatibility types */
-typedef int                    __kernel_ptrdiff_t32;
-typedef int                    __kernel_clock_t32;
 typedef int                    __kernel_pid_t32;
 typedef unsigned short         __kernel_ipc_pid_t32;
 typedef unsigned short         __kernel_uid_t32;
diff -ruN 2.5.51-32bit.base/include/asm-sparc64/siginfo.h 2.5.51-32bit.1/include/asm-sparc64/siginfo.h
--- 2.5.51-32bit.base/include/asm-sparc64/siginfo.h	2002-10-21 01:02:53.000000000 +1000
+++ 2.5.51-32bit.1/include/asm-sparc64/siginfo.h	2002-12-10 15:43:53.000000000 +1100
@@ -13,6 +13,8 @@
 
 #ifdef __KERNEL__
 
+#include <linux/compat.h>
+
 typedef union sigval32 {
 	int sival_int;
 	u32 sival_ptr;
@@ -50,8 +52,8 @@
 			__kernel_pid_t32 _pid;		/* which child */
 			unsigned int _uid;		/* sender's uid */
 			int _status;			/* exit code */
-			__kernel_clock_t32 _utime;
-			__kernel_clock_t32 _stime;
+			compat_clock_t _utime;
+			compat_clock_t _stime;
 		} _sigchld;
 
 		/* SIGILL, SIGFPE, SIGSEGV, SIGBUS, SIGEMT */

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

* [PATCH][COMPAT] consolidate sys32_times - x86_64
  2002-12-10  6:35 [PATCH][COMPAT] consolidate sys32_times - architecture independent Stephen Rothwell
  2002-12-10  6:38 ` [PATCH][COMPAT] consolidate sys32_times - ppc64 Stephen Rothwell
  2002-12-10  6:39 ` [PATCH][COMPAT] consolidate sys32_times - sparc64 Stephen Rothwell
@ 2002-12-10  6:41 ` Stephen Rothwell
  2002-12-10  6:43 ` [PATCH][COMPAT] consolidate sys32_times - ia64 Stephen Rothwell
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Stephen Rothwell @ 2002-12-10  6:41 UTC (permalink / raw)
  To: ak; +Cc: linux-kernel

Hi Andi,

The x86_64 patch ...
-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/

diff -ruN 2.5.51-32bit.base/arch/x86_64/ia32/ia32entry.S 2.5.51-32bit.1/arch/x86_64/ia32/ia32entry.S
--- 2.5.51-32bit.base/arch/x86_64/ia32/ia32entry.S	2002-12-10 15:46:42.000000000 +1100
+++ 2.5.51-32bit.1/arch/x86_64/ia32/ia32entry.S	2002-12-10 17:07:24.000000000 +1100
@@ -164,7 +164,7 @@
 	.quad sys_rmdir		/* 40 */
 	.quad sys_dup
 	.quad sys32_pipe
-	.quad sys32_times
+	.quad compat_sys_times
 	.quad ni_syscall			/* old prof syscall holder */
 	.quad sys_brk		/* 45 */
 	.quad sys_setgid16
diff -ruN 2.5.51-32bit.base/arch/x86_64/ia32/sys_ia32.c 2.5.51-32bit.1/arch/x86_64/ia32/sys_ia32.c
--- 2.5.51-32bit.base/arch/x86_64/ia32/sys_ia32.c	2002-12-10 15:46:42.000000000 +1100
+++ 2.5.51-32bit.1/arch/x86_64/ia32/sys_ia32.c	2002-12-10 17:07:52.000000000 +1100
@@ -1107,37 +1107,6 @@
 	return ret;
 }
 
-struct tms32 {
-	__kernel_clock_t32 tms_utime;
-	__kernel_clock_t32 tms_stime;
-	__kernel_clock_t32 tms_cutime;
-	__kernel_clock_t32 tms_cstime;
-};
-                                
-extern int sys_times(struct tms *);
-
-asmlinkage long
-sys32_times(struct tms32 *tbuf)
-{
-	struct tms t;
-	long ret;
-	mm_segment_t old_fs = get_fs ();
-	
-	set_fs (KERNEL_DS);
-	ret = sys_times(tbuf ? &t : NULL);
-	set_fs (old_fs);
-	if (tbuf) {
-		if (verify_area(VERIFY_WRITE, tbuf, sizeof(struct tms32)) ||
-		    __put_user (t.tms_utime, &tbuf->tms_utime) ||
-		    __put_user (t.tms_stime, &tbuf->tms_stime) ||
-		    __put_user (t.tms_cutime, &tbuf->tms_cutime) ||
-		    __put_user (t.tms_cstime, &tbuf->tms_cstime))
-			return -EFAULT;
-	}
-	return ret;
-}
-
-
 static inline int get_flock(struct flock *kfl, struct flock32 *ufl)
 {
 	int err;
diff -ruN 2.5.51-32bit.base/include/asm-x86_64/compat.h 2.5.51-32bit.1/include/asm-x86_64/compat.h
--- 2.5.51-32bit.base/include/asm-x86_64/compat.h	2002-12-10 15:46:42.000000000 +1100
+++ 2.5.51-32bit.1/include/asm-x86_64/compat.h	2002-12-10 16:38:26.000000000 +1100
@@ -5,9 +5,12 @@
  */
 #include <linux/types.h>
 
+#define COMPAT_USER_HZ	100
+
 typedef u32		compat_size_t;
 typedef s32		compat_ssize_t;
 typedef s32		compat_time_t;
+typedef s32		compat_clock_t;
 
 struct compat_timespec {
 	compat_time_t	tv_sec;
diff -ruN 2.5.51-32bit.base/include/asm-x86_64/ia32.h 2.5.51-32bit.1/include/asm-x86_64/ia32.h
--- 2.5.51-32bit.base/include/asm-x86_64/ia32.h	2002-12-10 15:46:42.000000000 +1100
+++ 2.5.51-32bit.1/include/asm-x86_64/ia32.h	2002-12-10 15:44:49.000000000 +1100
@@ -5,13 +5,13 @@
 
 #ifdef CONFIG_IA32_EMULATION
 
+#include <compat.h>
+
 /*
  * 32 bit structures for IA32 support.
  */
 
 /* 32bit compatibility types */
-typedef int		       __kernel_ptrdiff_t32;
-typedef int		       __kernel_clock_t32;
 typedef int		       __kernel_pid_t32;
 typedef unsigned short	       __kernel_ipc_pid_t32;
 typedef unsigned short	       __kernel_uid_t32;
@@ -201,8 +201,8 @@
 			unsigned int _pid;	/* which child */
 			unsigned int _uid;	/* sender's uid */
 			int _status;		/* exit code */
-			__kernel_clock_t32 _utime;
-			__kernel_clock_t32 _stime;
+			compat_clock_t _utime;
+			compat_clock_t _stime;
 		} _sigchld;
 
 		/* SIGILL, SIGFPE, SIGSEGV, SIGBUS */

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

* [PATCH][COMPAT] consolidate sys32_times - ia64
  2002-12-10  6:35 [PATCH][COMPAT] consolidate sys32_times - architecture independent Stephen Rothwell
                   ` (2 preceding siblings ...)
  2002-12-10  6:41 ` [PATCH][COMPAT] consolidate sys32_times - x86_64 Stephen Rothwell
@ 2002-12-10  6:43 ` Stephen Rothwell
  2002-12-10  6:44 ` [PATCH][COMPAT] consolidate sys32_times - s390x Stephen Rothwell
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Stephen Rothwell @ 2002-12-10  6:43 UTC (permalink / raw)
  To: davidm; +Cc: linux-kernel

Hi David,

The ia64 patch ...
-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/

diff -ruN 2.5.51-32bit.base/arch/ia64/ia32/ia32_entry.S 2.5.51-32bit.1/arch/ia64/ia32/ia32_entry.S
--- 2.5.51-32bit.base/arch/ia64/ia32/ia32_entry.S	2002-12-10 15:46:41.000000000 +1100
+++ 2.5.51-32bit.1/arch/ia64/ia32/ia32_entry.S	2002-12-10 17:00:17.000000000 +1100
@@ -234,7 +234,7 @@
 	data8 sys_rmdir		  /* 40 */
 	data8 sys_dup
 	data8 sys32_pipe
-	data8 sys32_times
+	data8 compat_sys_times
 	data8 sys32_ni_syscall	  /* old prof syscall holder */
 	data8 sys32_brk		  /* 45 */
 	data8 sys_setgid	/* 16-bit version */
diff -ruN 2.5.51-32bit.base/arch/ia64/ia32/sys_ia32.c 2.5.51-32bit.1/arch/ia64/ia32/sys_ia32.c
--- 2.5.51-32bit.base/arch/ia64/ia32/sys_ia32.c	2002-12-10 15:46:41.000000000 +1100
+++ 2.5.51-32bit.1/arch/ia64/ia32/sys_ia32.c	2002-12-10 16:58:43.000000000 +1100
@@ -2585,37 +2585,6 @@
 	return ret;
 }
 
-struct tms32 {
-	__kernel_clock_t32 tms_utime;
-	__kernel_clock_t32 tms_stime;
-	__kernel_clock_t32 tms_cutime;
-	__kernel_clock_t32 tms_cstime;
-};
-
-extern asmlinkage long sys_times (struct tms * tbuf);
-
-asmlinkage long
-sys32_times (struct tms32 *tbuf)
-{
-	mm_segment_t old_fs = get_fs();
-	struct tms t;
-	long ret;
-	int err;
-
-	set_fs(KERNEL_DS);
-	ret = sys_times(tbuf ? &t : NULL);
-	set_fs(old_fs);
-	if (tbuf) {
-		err = put_user (IA32_TICK(t.tms_utime), &tbuf->tms_utime);
-		err |= put_user (IA32_TICK(t.tms_stime), &tbuf->tms_stime);
-		err |= put_user (IA32_TICK(t.tms_cutime), &tbuf->tms_cutime);
-		err |= put_user (IA32_TICK(t.tms_cstime), &tbuf->tms_cstime);
-		if (err)
-			ret = -EFAULT;
-	}
-	return IA32_TICK(ret);
-}
-
 static unsigned int
 ia32_peek (struct pt_regs *regs, struct task_struct *child, unsigned long addr, unsigned int *val)
 {
diff -ruN 2.5.51-32bit.base/include/asm-ia64/compat.h 2.5.51-32bit.1/include/asm-ia64/compat.h
--- 2.5.51-32bit.base/include/asm-ia64/compat.h	2002-12-10 15:46:42.000000000 +1100
+++ 2.5.51-32bit.1/include/asm-ia64/compat.h	2002-12-10 16:37:41.000000000 +1100
@@ -6,9 +6,12 @@
 
 #include <linux/types.h>
 
+#define COMPAT_USER_HZ	100
+
 typedef u32		compat_size_t;
 typedef s32		compat_ssize_t;
 typedef s32		compat_time_t;
+typedef s32		compat_clock_t;
 
 struct compat_timespec {
 	compat_time_t	tv_sec;
diff -ruN 2.5.51-32bit.base/include/asm-ia64/ia32.h 2.5.51-32bit.1/include/asm-ia64/ia32.h
--- 2.5.51-32bit.base/include/asm-ia64/ia32.h	2002-12-10 15:46:42.000000000 +1100
+++ 2.5.51-32bit.1/include/asm-ia64/ia32.h	2002-12-10 16:59:04.000000000 +1100
@@ -6,14 +6,13 @@
 #ifdef CONFIG_IA32_SUPPORT
 
 #include <linux/binfmts.h>
+#include <linux/compat.h>
 
 /*
  * 32 bit structures for IA32 support.
  */
 
 /* 32bit compatibility types */
-typedef int		__kernel_ptrdiff_t32;
-typedef int		__kernel_clock_t32;
 typedef int		__kernel_pid_t32;
 typedef unsigned short	__kernel_ipc_pid_t32;
 typedef unsigned short	__kernel_uid_t32;
@@ -36,7 +35,6 @@
 #define IA32_PAGE_MASK		(~(IA32_PAGE_SIZE - 1))
 #define IA32_PAGE_ALIGN(addr)	(((addr) + IA32_PAGE_SIZE - 1) & IA32_PAGE_MASK)
 #define IA32_CLOCKS_PER_SEC	100	/* Cast in stone for IA32 Linux */
-#define IA32_TICK(tick)		((unsigned long long)(tick) * IA32_CLOCKS_PER_SEC / CLOCKS_PER_SEC)
 
 /* fcntl.h */
 struct flock32 {
@@ -267,8 +265,8 @@
 			unsigned int _pid;	/* which child */
 			unsigned int _uid;	/* sender's uid */
 			int _status;		/* exit code */
-			__kernel_clock_t32 _utime;
-			__kernel_clock_t32 _stime;
+			compat_clock_t _utime;
+			compat_clock_t _stime;
 		} _sigchld;
 
 		/* SIGILL, SIGFPE, SIGSEGV, SIGBUS */

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

* [PATCH][COMPAT] consolidate sys32_times - s390x
  2002-12-10  6:35 [PATCH][COMPAT] consolidate sys32_times - architecture independent Stephen Rothwell
                   ` (3 preceding siblings ...)
  2002-12-10  6:43 ` [PATCH][COMPAT] consolidate sys32_times - ia64 Stephen Rothwell
@ 2002-12-10  6:44 ` Stephen Rothwell
  2002-12-10  6:47 ` [PATCH][COMPAT] consolidate sys32_times - mips64 Stephen Rothwell
  2002-12-10  6:48 ` [PATCH][COMPAT] consolidate sys32_times - parisc Stephen Rothwell
  6 siblings, 0 replies; 8+ messages in thread
From: Stephen Rothwell @ 2002-12-10  6:44 UTC (permalink / raw)
  To: schwidefsky; +Cc: linux-kernel

Hi Martin,

The s390x patch ...
-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/

diff -ruN 2.5.51-32bit.base/arch/s390x/kernel/entry.S 2.5.51-32bit.1/arch/s390x/kernel/entry.S
--- 2.5.51-32bit.base/arch/s390x/kernel/entry.S	2002-12-10 15:46:42.000000000 +1100
+++ 2.5.51-32bit.1/arch/s390x/kernel/entry.S	2002-12-10 17:05:19.000000000 +1100
@@ -419,7 +419,7 @@
         .long  SYSCALL(sys_rmdir,sys32_rmdir_wrapper)           /* 40 */
         .long  SYSCALL(sys_dup,sys32_dup_wrapper)
         .long  SYSCALL(sys_pipe,sys32_pipe_wrapper)
-        .long  SYSCALL(sys_times,sys32_times_wrapper)
+        .long  SYSCALL(sys_times,compat_sys_times_wrapper)
         .long  SYSCALL(sys_ni_syscall,sys_ni_syscall) /* old prof syscall */
         .long  SYSCALL(sys_brk,sys32_brk_wrapper)               /* 45 */
         .long  SYSCALL(sys_ni_syscall,sys32_setgid16)   /* old setgid16 syscall*/
diff -ruN 2.5.51-32bit.base/arch/s390x/kernel/linux32.c 2.5.51-32bit.1/arch/s390x/kernel/linux32.c
--- 2.5.51-32bit.base/arch/s390x/kernel/linux32.c	2002-12-10 15:46:42.000000000 +1100
+++ 2.5.51-32bit.1/arch/s390x/kernel/linux32.c	2002-12-10 17:05:51.000000000 +1100
@@ -1930,36 +1930,6 @@
 	return ret;
 }
 
-struct tms32 {
-	__kernel_clock_t32 tms_utime;
-	__kernel_clock_t32 tms_stime;
-	__kernel_clock_t32 tms_cutime;
-	__kernel_clock_t32 tms_cstime;
-};
-                                
-extern asmlinkage long sys_times(struct tms * tbuf);
-
-asmlinkage long sys32_times(struct tms32 *tbuf)
-{
-	struct tms t;
-	long ret;
-	mm_segment_t old_fs = get_fs ();
-	int err;
-	
-	set_fs (KERNEL_DS);
-	ret = sys_times(tbuf ? &t : NULL);
-	set_fs (old_fs);
-	if (tbuf) {
-		err = put_user (t.tms_utime, &tbuf->tms_utime);
-		err |= __put_user (t.tms_stime, &tbuf->tms_stime);
-		err |= __put_user (t.tms_cutime, &tbuf->tms_cutime);
-		err |= __put_user (t.tms_cstime, &tbuf->tms_cstime);
-		if (err)
-			ret = -EFAULT;
-	}
-	return ret;
-}
-
 #define RLIM_OLD_INFINITY32	0x7fffffff
 #define RLIM_INFINITY32		0xffffffff
 #define RESOURCE32_OLD(x)	((x > RLIM_OLD_INFINITY32) ? RLIM_OLD_INFINITY32 : x)
diff -ruN 2.5.51-32bit.base/arch/s390x/kernel/linux32.h 2.5.51-32bit.1/arch/s390x/kernel/linux32.h
--- 2.5.51-32bit.base/arch/s390x/kernel/linux32.h	2002-12-10 15:46:42.000000000 +1100
+++ 2.5.51-32bit.1/arch/s390x/kernel/linux32.h	2002-12-10 15:40:49.000000000 +1100
@@ -16,8 +16,6 @@
 	((unsigned long)(__x))
 
 /* Now 32bit compatibility types */
-typedef int                    __kernel_ptrdiff_t32;
-typedef int                    __kernel_clock_t32;
 typedef int                    __kernel_pid_t32;
 typedef unsigned short         __kernel_ipc_pid_t32;
 typedef unsigned short         __kernel_uid_t32;
@@ -139,8 +137,8 @@
 			pid_t			_pid;	/* which child */
 			uid_t			_uid;	/* sender's uid */
 			int			_status;/* exit code */
-			__kernel_clock_t32	_utime;
-			__kernel_clock_t32	_stime;
+			compat_clock_t		_utime;
+			compat_clock_t		_stime;
 		} _sigchld;
 
 		/* SIGILL, SIGFPE, SIGSEGV, SIGBUS */
diff -ruN 2.5.51-32bit.base/arch/s390x/kernel/wrapper32.S 2.5.51-32bit.1/arch/s390x/kernel/wrapper32.S
--- 2.5.51-32bit.base/arch/s390x/kernel/wrapper32.S	2002-12-10 15:46:42.000000000 +1100
+++ 2.5.51-32bit.1/arch/s390x/kernel/wrapper32.S	2002-12-10 17:04:36.000000000 +1100
@@ -182,10 +182,10 @@
 	llgtr	%r2,%r2			# u32 *
 	jg	sys_pipe		# branch to system call
 
-	.globl  sys32_times_wrapper 
-sys32_times_wrapper:
-	llgtr	%r2,%r2			# struct tms_emu31 *
-	jg	sys32_times		# branch to system call
+	.globl  compat_sys_times_wrapper 
+compat_sys_times_wrapper:
+	llgtr	%r2,%r2			# struct compat_tms *
+	jg	compat_sys_times	# branch to system call
 
 	.globl  sys32_brk_wrapper 
 sys32_brk_wrapper:
diff -ruN 2.5.51-32bit.base/include/asm-s390x/compat.h 2.5.51-32bit.1/include/asm-s390x/compat.h
--- 2.5.51-32bit.base/include/asm-s390x/compat.h	2002-12-10 15:46:42.000000000 +1100
+++ 2.5.51-32bit.1/include/asm-s390x/compat.h	2002-12-10 16:38:17.000000000 +1100
@@ -5,9 +5,12 @@
  */
 #include <linux/types.h>
 
+#define COMPAT_USER_HZ	100
+
 typedef u32		compat_size_t;
 typedef s32		compat_ssize_t;
 typedef s32		compat_time_t;
+typedef s32		compat_clock_t;
 
 struct compat_timespec {
 	compat_time_t	tv_sec;

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

* [PATCH][COMPAT] consolidate sys32_times - mips64
  2002-12-10  6:35 [PATCH][COMPAT] consolidate sys32_times - architecture independent Stephen Rothwell
                   ` (4 preceding siblings ...)
  2002-12-10  6:44 ` [PATCH][COMPAT] consolidate sys32_times - s390x Stephen Rothwell
@ 2002-12-10  6:47 ` Stephen Rothwell
  2002-12-10  6:48 ` [PATCH][COMPAT] consolidate sys32_times - parisc Stephen Rothwell
  6 siblings, 0 replies; 8+ messages in thread
From: Stephen Rothwell @ 2002-12-10  6:47 UTC (permalink / raw)
  To: ralf; +Cc: linux-kernel

Hi Ralf,

The mips64 patch ...
-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/

diff -ruN 2.5.51-32bit.base/arch/mips64/kernel/linux32.c 2.5.51-32bit.1/arch/mips64/kernel/linux32.c
--- 2.5.51-32bit.base/arch/mips64/kernel/linux32.c	2002-12-10 15:46:41.000000000 +1100
+++ 2.5.51-32bit.1/arch/mips64/kernel/linux32.c	2002-12-10 17:00:58.000000000 +1100
@@ -1125,35 +1125,6 @@
 }
 
 
-struct tms32 {
-	int tms_utime;
-	int tms_stime;
-	int tms_cutime;
-	int tms_cstime;
-};
-
-extern asmlinkage long sys_times(struct tms * tbuf);
-asmlinkage long sys32_times(struct tms32 *tbuf)
-{
-	struct tms t;
-	long ret;
-	mm_segment_t old_fs = get_fs();
-	int err;
-
-	set_fs(KERNEL_DS);
-	ret = sys_times(tbuf ? &t : NULL);
-	set_fs(old_fs);
-	if (tbuf) {
-		err = put_user (t.tms_utime, &tbuf->tms_utime);
-		err |= __put_user (t.tms_stime, &tbuf->tms_stime);
-		err |= __put_user (t.tms_cutime, &tbuf->tms_cutime);
-		err |= __put_user (t.tms_cstime, &tbuf->tms_cstime);
-		if (err)
-			ret = -EFAULT;
-	}
-	return ret;
-}
-
 extern asmlinkage int sys_setsockopt(int fd, int level, int optname,
 				     char *optval, int optlen);
 
diff -ruN 2.5.51-32bit.base/arch/mips64/kernel/scall_o32.S 2.5.51-32bit.1/arch/mips64/kernel/scall_o32.S
--- 2.5.51-32bit.base/arch/mips64/kernel/scall_o32.S	2002-12-10 15:46:41.000000000 +1100
+++ 2.5.51-32bit.1/arch/mips64/kernel/scall_o32.S	2002-12-10 17:02:02.000000000 +1100
@@ -276,7 +276,7 @@
 	sys	sys_rmdir	1			/* 4040 */
 	sys	sys_dup		1
 	sys	sys_pipe	0
-	sys	sys32_times	1
+	sys	compat_sys_times	1
 	sys	sys_ni_syscall	0
 	sys	sys_brk		1			/* 4045 */
 	sys	sys_setgid	1
diff -ruN 2.5.51-32bit.base/include/asm-mips64/compat.h 2.5.51-32bit.1/include/asm-mips64/compat.h
--- 2.5.51-32bit.base/include/asm-mips64/compat.h	2002-12-10 15:46:42.000000000 +1100
+++ 2.5.51-32bit.1/include/asm-mips64/compat.h	2002-12-10 16:37:59.000000000 +1100
@@ -5,9 +5,12 @@
  */
 #include <linux/types.h>
 
+#define COMPAT_USER_HZ	100
+
 typedef u32		compat_size_t;
 typedef s32		compat_ssize_t;
 typedef s32		compat_time_t;
+typedef s32		compat_clock_t;
 
 struct compat_timespec {
 	compat_time_t	tv_sec;
diff -ruN 2.5.51-32bit.base/include/asm-mips64/posix_types.h 2.5.51-32bit.1/include/asm-mips64/posix_types.h
--- 2.5.51-32bit.base/include/asm-mips64/posix_types.h	2002-12-10 15:46:42.000000000 +1100
+++ 2.5.51-32bit.1/include/asm-mips64/posix_types.h	2002-12-10 15:42:41.000000000 +1100
@@ -58,9 +58,6 @@
 typedef int		__kernel_ipc_pid_t32;
 typedef int		__kernel_uid_t32;
 typedef int		__kernel_gid_t32;
-typedef int		__kernel_ptrdiff_t32;
-typedef int		__kernel_suseconds_t32;
-typedef int		__kernel_clock_t32;
 typedef int		__kernel_daddr_t32;
 typedef unsigned int	__kernel_caddr_t32;
 typedef __kernel_fsid_t	__kernel_fsid_t32;

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

* [PATCH][COMPAT] consolidate sys32_times - parisc
  2002-12-10  6:35 [PATCH][COMPAT] consolidate sys32_times - architecture independent Stephen Rothwell
                   ` (5 preceding siblings ...)
  2002-12-10  6:47 ` [PATCH][COMPAT] consolidate sys32_times - mips64 Stephen Rothwell
@ 2002-12-10  6:48 ` Stephen Rothwell
  6 siblings, 0 replies; 8+ messages in thread
From: Stephen Rothwell @ 2002-12-10  6:48 UTC (permalink / raw)
  To: matthew; +Cc: linux-kernel

Hi Willy,

Here is the parisc patch ...
-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/

diff -ruN 2.5.51-32bit.base/arch/parisc/kernel/sys_parisc32.c 2.5.51-32bit.1/arch/parisc/kernel/sys_parisc32.c
--- 2.5.51-32bit.base/arch/parisc/kernel/sys_parisc32.c	2002-12-10 15:46:42.000000000 +1100
+++ 2.5.51-32bit.1/arch/parisc/kernel/sys_parisc32.c	2002-12-10 17:03:26.000000000 +1100
@@ -386,32 +386,6 @@
  * code available in case it's useful to others. -PB
  */
 
-struct tms32 {
-	__kernel_clock_t32 tms_utime;
-	__kernel_clock_t32 tms_stime;
-	__kernel_clock_t32 tms_cutime;
-	__kernel_clock_t32 tms_cstime;
-};
-                                
-asmlinkage long sys32_times(struct tms32 *tbuf)
-{
-	struct tms t;
-	long ret;
-	extern asmlinkage long sys_times(struct tms * tbuf);
-int err;
-	
-	KERNEL_SYSCALL(ret, sys_times, tbuf ? &t : NULL);
-	if (tbuf) {
-		err = put_user (t.tms_utime, &tbuf->tms_utime);
-		err |= __put_user (t.tms_stime, &tbuf->tms_stime);
-		err |= __put_user (t.tms_cutime, &tbuf->tms_cutime);
-		err |= __put_user (t.tms_cstime, &tbuf->tms_cstime);
-		if (err)
-			ret = -EFAULT;
-	}
-	return ret;
-}
-
 struct flock32 {
 	short l_type;
 	short l_whence;
diff -ruN 2.5.51-32bit.base/include/asm-parisc/compat.h 2.5.51-32bit.1/include/asm-parisc/compat.h
--- 2.5.51-32bit.base/include/asm-parisc/compat.h	2002-12-10 15:46:42.000000000 +1100
+++ 2.5.51-32bit.1/include/asm-parisc/compat.h	2002-12-10 16:38:08.000000000 +1100
@@ -5,9 +5,12 @@
  */
 #include <linux/types.h>
 
+#define COMPAT_USER_HZ	100
+
 typedef u32		compat_size_t;
 typedef s32		compat_ssize_t;
 typedef s32		compat_time_t;
+typedef s32		compat_clock_t;
 
 struct compat_timespec {
 	compat_time_t	tv_sec;
diff -ruN 2.5.51-32bit.base/include/asm-parisc/posix_types.h 2.5.51-32bit.1/include/asm-parisc/posix_types.h
--- 2.5.51-32bit.base/include/asm-parisc/posix_types.h	2002-12-10 15:46:42.000000000 +1100
+++ 2.5.51-32bit.1/include/asm-parisc/posix_types.h	2002-12-10 15:42:51.000000000 +1100
@@ -66,9 +66,6 @@
 typedef unsigned short		__kernel_ipc_pid_t32;
 typedef unsigned int		__kernel_uid_t32;
 typedef unsigned int		__kernel_gid_t32;
-typedef int			__kernel_ptrdiff_t32;
-typedef int			__kernel_suseconds_t32;
-typedef int			__kernel_clock_t32;
 typedef int			__kernel_daddr_t32;
 typedef unsigned int		__kernel_caddr_t32;
 #endif

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

end of thread, other threads:[~2002-12-10  6:41 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-12-10  6:35 [PATCH][COMPAT] consolidate sys32_times - architecture independent Stephen Rothwell
2002-12-10  6:38 ` [PATCH][COMPAT] consolidate sys32_times - ppc64 Stephen Rothwell
2002-12-10  6:39 ` [PATCH][COMPAT] consolidate sys32_times - sparc64 Stephen Rothwell
2002-12-10  6:41 ` [PATCH][COMPAT] consolidate sys32_times - x86_64 Stephen Rothwell
2002-12-10  6:43 ` [PATCH][COMPAT] consolidate sys32_times - ia64 Stephen Rothwell
2002-12-10  6:44 ` [PATCH][COMPAT] consolidate sys32_times - s390x Stephen Rothwell
2002-12-10  6:47 ` [PATCH][COMPAT] consolidate sys32_times - mips64 Stephen Rothwell
2002-12-10  6:48 ` [PATCH][COMPAT] consolidate sys32_times - parisc Stephen Rothwell

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

all inboxes | Powered by JetHome®