[PATCH] Add prctl to change endian of a task

From: Anton Blanchard
Date: Sat Apr 01 2006 - 17:27:47 EST



Add a prctl to change a tasks endian. While we only have powerpc code to
implement this so far, it seems like something that warrants a generic
interface (like setting floating point mode bits).

Signed-off-by: Anton Blanchard <anton@xxxxxxxxx>
---

Index: build/kernel/sys.c
===================================================================
--- build.orig/kernel/sys.c 2006-04-02 08:11:40.000000000 +1000
+++ build/kernel/sys.c 2006-04-02 08:13:13.000000000 +1000
@@ -57,6 +57,12 @@
#ifndef GET_FPEXC_CTL
# define GET_FPEXC_CTL(a,b) (-EINVAL)
#endif
+#ifndef GET_ENDIAN
+# define GET_ENDIAN(a,b) (-EINVAL)
+#endif
+#ifndef SET_ENDIAN
+# define SET_ENDIAN(a,b) (-EINVAL)
+#endif

/*
* this is where the system-wide overflow UID and GID are defined, for
@@ -2057,6 +2063,13 @@ asmlinkage long sys_prctl(int option, un
return -EFAULT;
return 0;
}
+ case PR_GET_ENDIAN:
+ error = GET_ENDIAN(current, arg2);
+ break;
+ case PR_SET_ENDIAN:
+ error = SET_ENDIAN(current, arg2);
+ break;
+
default:
error = -EINVAL;
break;
Index: build/include/linux/prctl.h
===================================================================
--- build.orig/include/linux/prctl.h 2006-04-02 08:11:40.000000000 +1000
+++ build/include/linux/prctl.h 2006-04-02 08:13:13.000000000 +1000
@@ -52,4 +52,10 @@
#define PR_SET_NAME 15 /* Set process name */
#define PR_GET_NAME 16 /* Get process name */

+/* Get/set process endian */
+#define PR_GET_ENDIAN 19
+#define PR_SET_ENDIAN 20
+# define PR_ENDIAN_BIG 0
+# define PR_ENDIAN_LITTLE 1
+
#endif /* _LINUX_PRCTL_H */
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/