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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, 28 Jan 2017 12:13:10 +0100 Helge Deller <deller@xxxxxx> 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.  Why is this needed?

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

> 
> 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);
--
To unsubscribe from this list: send the line "unsubscribe linux-parisc" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux SoC]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux