Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1568869 > unrolled thread

[PATCH] prctl: implement PR_GET_ENDIAN for all architectures

Started byHelge Deller <deller@gmx.de>
First post2017-01-28 12:30 +0100
Last post2017-01-28 12:30 +0100
Articles 1 — 1 participant

Back to article view | Back to linux.kernel


Contents

  [PATCH] prctl: implement PR_GET_ENDIAN for all architectures Helge Deller <deller@gmx.de> - 2017-01-28 12:30 +0100

#1568869 — [PATCH] prctl: implement PR_GET_ENDIAN for all architectures

FromHelge Deller <deller@gmx.de>
Date2017-01-28 12:30 +0100
Subject[PATCH] prctl: implement PR_GET_ENDIAN for all architectures
Message-ID<t4zmG-Km-19@gated-at.bofh.it>
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);

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web