From: Helge Deller <deller@gmx.de>
To: linux-kernel@vger.kernel.org, Andrew Morton <akpm@linux-foundation.org>
Cc: linux-parisc@vger.kernel.org
Subject: [PATCH] prctl: implement PR_GET_ENDIAN for all architectures
Date: Sat, 28 Jan 2017 12:13:10 +0100 [thread overview]
Message-ID: <20170128111310.GA13389@ls3530.fritz.box> (raw)
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);
next reply other threads:[~2017-01-28 11:13 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-28 11:13 Helge Deller [this message]
2017-02-01 0:26 ` [PATCH] prctl: implement PR_GET_ENDIAN for all architectures Andrew Morton
[not found] ` <20170131162624.5a85ec47c6ee22e5cc03c4eb-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org>
2017-02-01 19:47 ` Helge Deller
[not found] ` <7c60f97a-4b63-5eff-e837-186f9a31c5a2-Mmb7MZpHnFY@public.gmane.org>
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170128111310.GA13389@ls3530.fritz.box \
--to=deller@gmx.de \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-parisc@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox