linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] prctl: implement PR_GET_ENDIAN for all architectures
@ 2017-01-28 11:13 Helge Deller
  2017-02-01  0:26 ` Andrew Morton
  0 siblings, 1 reply; 9+ messages in thread
From: Helge Deller @ 2017-01-28 11:13 UTC (permalink / raw)
  To: linux-kernel, Andrew Morton; +Cc: linux-parisc

The prctl(PR_GET_ENDIAN) syscall was added to Kernel 2.6.18, but
implemented for PowerPC only.
This trivial patch adds support for this syscall for all other architectures.

Signed-off-by: Helge Deller <deller@gmx.de>

diff --git a/kernel/sys.c b/kernel/sys.c
index 842914e..5818e5e 100644
--- a/kernel/sys.c
+++ b/kernel/sys.c
@@ -79,9 +79,6 @@
 #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
@@ -2136,7 +2133,13 @@ SYSCALL_DEFINE5(prctl, int, option, unsigned long, arg2, unsigned long, arg3,
 			return -EFAULT;
 		break;
 	case PR_GET_ENDIAN:
+#ifdef GET_ENDIAN
 		error = GET_ENDIAN(me, arg2);
+#elif defined(__BIG_ENDIAN)
+		error = put_user(PR_ENDIAN_BIG, (unsigned int __user *)arg2);
+#else
+		error = put_user(PR_ENDIAN_LITTLE, (unsigned int __user *)arg2);
+#endif
 		break;
 	case PR_SET_ENDIAN:
 		error = SET_ENDIAN(me, arg2);

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

end of thread, other threads:[~2017-02-15  5:20 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-28 11:13 [PATCH] prctl: implement PR_GET_ENDIAN for all architectures Helge Deller
2017-02-01  0:26 ` Andrew Morton
2017-02-01 19:47   ` Helge Deller
2017-02-01 22:03     ` Andrew Morton
2017-02-01 23:12   ` James Bottomley
2017-02-02  5:08     ` Andy Lutomirski
2017-02-05 11:48     ` Matt Turner
2017-02-05 13:15       ` Maciej W. Rozycki
2017-02-15  5:20         ` Michael Ellerman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).