Take two of is_compat_task... Add a default function that will get
optimized away in the !CONFIG_COMPAT case. Modify x86-64's
is_compat_task to take a struct task_struct * argument. parisc
at least can use the arg in several places in arch-dependant code to
clean up ugliness (fixing the fact that it uses PER_LINUX32 is also on
the agenda for later). There's only one arch indep user in the kernel
(drivers/input/evdev.c) right now, so it can be moved as architectures
which need it add the is_compat_task helper.

diff --git a/include/asm-parisc/compat.h b/include/asm-parisc/compat.h
index 38b918f..58ada24 100644
--- a/include/asm-parisc/compat.h
+++ b/include/asm-parisc/compat.h
@@ -5,6 +5,7 @@
  */
 #include <linux/types.h>
 #include <linux/sched.h>
+#include <linux/personality.h>
 
 #define COMPAT_USER_HZ 100
 
@@ -144,4 +145,9 @@ static __inline__ void __user *compat_al
        return (void __user *)regs->gr[30];
 }
 
+static inline int is_compat_task(struct task_struct *t)
+{
+       return (personality(t->personality) == PER_LINUX32);
+}
+
 #endif /* _ASM_PARISC_COMPAT_H */
diff --git a/include/asm-x86_64/compat.h b/include/asm-x86_64/compat.h
index b37ab82..4ade2a6 100644
--- a/include/asm-x86_64/compat.h
+++ b/include/asm-x86_64/compat.h
@@ -202,9 +202,9 @@ static __inline__ void __user *compat_al
        return (void __user *)regs->rsp - len; 
 }
 
-static inline int is_compat_task(void)
+static inline int is_compat_task(struct task_struct *t)
 {
-       return current_thread_info()->status & TS_COMPAT;
+       return t->thread_info->status & TS_COMPAT;
 }
 
 #endif /* _ASM_X86_64_COMPAT_H */
diff --git a/include/linux/compat.h b/include/linux/compat.h
index f9ca534..1b70e49 100644
--- a/include/linux/compat.h
+++ b/include/linux/compat.h
@@ -161,5 +161,12 @@ int copy_siginfo_to_user32(struct compat
 int get_compat_sigevent(struct sigevent *event,
                const struct compat_sigevent __user *u_event);
 
+#else /* !CONFIG_COMPAT */
+
+static inline int is_compat_task(struct task_struct *t) {
+       return 0;
+}
+
 #endif /* CONFIG_COMPAT */
+
 #endif /* _LINUX_COMPAT_H */
-
To unsubscribe from this list: send the line "unsubscribe linux-arch" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to