From: Anton Blanchard 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 Cc: Michael Kerrisk Signed-off-by: Andrew Morton --- include/linux/prctl.h | 6 ++++++ kernel/sys.c | 13 +++++++++++++ 2 files changed, 19 insertions(+) diff -puN include/linux/prctl.h~add-prctl-to-change-endian-of-a-task include/linux/prctl.h --- devel/include/linux/prctl.h~add-prctl-to-change-endian-of-a-task 2006-04-01 16:55:12.000000000 -0800 +++ devel-akpm/include/linux/prctl.h 2006-04-01 16:55:12.000000000 -0800 @@ -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 */ diff -puN kernel/sys.c~add-prctl-to-change-endian-of-a-task kernel/sys.c --- devel/kernel/sys.c~add-prctl-to-change-endian-of-a-task 2006-04-01 16:55:12.000000000 -0800 +++ devel-akpm/kernel/sys.c 2006-04-01 16:55:12.000000000 -0800 @@ -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 @@ -2045,6 +2051,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; _