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


Groups > linux.kernel > #1571925

Re: [PATCH] prctl: implement PR_GET_ENDIAN for all architectures

From Helge Deller <deller@gmx.de>
Newsgroups linux.kernel
Subject Re: [PATCH] prctl: implement PR_GET_ENDIAN for all architectures
Date 2017-02-01 20:50 +0100
Message-ID <t694K-1Kd-23@gated-at.bofh.it> (permalink)
References <t4zmG-Km-19@gated-at.bofh.it> <t5QY9-7lX-1@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Hi Andrew,

On 01.02.2017 01:26, Andrew Morton wrote:
> On Sat, 28 Jan 2017 12:13:10 +0100 Helge Deller <deller@gmx.de> wrote:
> 
>> 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.
> 
> Seems reasonable.  I guess.

Heck, I did forgot but I submitted a similar patch 8 years ago:
http://www.serverphorums.com/read.php?12,51902

> Why is this needed?

It's not actually needed beside the trivial reason of providing an interface
not just for one single architecture.

After reading the discussion from 2009 again, I'm fine if 
you would simply drop the patch. The decision up to you.

> The man page will need updating.  It says "PowerPC only".

In case you would include the patch I'd send patches to update
the manpage.

Thanks,
Helge

>> 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);

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Re: [PATCH] prctl: implement PR_GET_ENDIAN for all architectures Andrew Morton <akpm@linux-foundation.org> - 2017-02-01 01:30 +0100
  Re: [PATCH] prctl: implement PR_GET_ENDIAN for all architectures Helge Deller <deller@gmx.de> - 2017-02-01 20:50 +0100
    Re: [PATCH] prctl: implement PR_GET_ENDIAN for all architectures Andrew Morton <akpm@linux-foundation.org> - 2017-02-01 23:10 +0100
  Re: [PATCH] prctl: implement PR_GET_ENDIAN for all architectures James Bottomley <James.Bottomley@HansenPartnership.com> - 2017-02-02 00:20 +0100
    Re: [PATCH] prctl: implement PR_GET_ENDIAN for all architectures Andy Lutomirski <luto@kernel.org> - 2017-02-02 06:10 +0100
    Re: [PATCH] prctl: implement PR_GET_ENDIAN for all architectures Matt Turner <mattst88@gmail.com> - 2017-02-05 12:50 +0100
      Re: [PATCH] prctl: implement PR_GET_ENDIAN for all architectures "Maciej W. Rozycki" <macro@linux-mips.org> - 2017-02-05 14:20 +0100

csiph-web