[PATCH v2] Linux: Remove <sys/sysctl.h> and the sysctl function

Adhemerval Zanella adhemerval.zanella@linaro.org
Fri Mar 13 17:50:38 GMT 2020



On 13/03/2020 10:19, Florian Weimer wrote:
> diff --git a/sysdeps/unix/sysv/linux/sysctl.c b/sysdeps/unix/sysv/linux/sysctl.c
> index 5ea8be8da1..389b958226 100644
> --- a/sysdeps/unix/sysv/linux/sysctl.c
> +++ b/sysdeps/unix/sysv/linux/sysctl.c
> @@ -1,4 +1,4 @@
> -/* Read or write system information.  Linux version.
> +/* sysctl function stub.
>     Copyright (C) 1996-2020 Free Software Foundation, Inc.
>     This file is part of the GNU C Library.
>  
> @@ -17,25 +17,20 @@
>     <https://www.gnu.org/licenses/>.  */
>  
>  #include <errno.h>
> -#include <linux/sysctl.h>
> +#include <shlib-compat.h>
>  
> -#include <sysdep.h>
> -#include <sys/syscall.h>
> -
> -int
> -__sysctl (int *name, int nlen, void *oldval, size_t *oldlenp,
> -	  void *newval, size_t newlen)
> +#if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_32)
> +int attribute_compat_text_section
> +___sysctl (int *name, int nlen, void *oldval, size_t *oldlenp,
> +           void *newval, size_t newlen)
>  {
> -  struct __sysctl_args args =
> -  {
> -    .name = name,
> -    .nlen = nlen,
> -    .oldval = oldval,
> -    .oldlenp = oldlenp,
> -    .newval = newval,
> -    .newlen = newlen
> -  };
> -
> -  return INLINE_SYSCALL (_sysctl, 1, &args);
> +  __set_errno (ENOSYS);
> +  return -1;
>  }
> -weak_alias (__sysctl, sysctl)
> +compat_symbol (libc, ___sysctl, sysctl, GLIBC_2_0);
> +
> +# if SHLIB_COMPAT (libc, GLIBC_2_2, GLIBC_2_17)
> +strong_alias (___sysctl, ___sysctl2)
> +compat_symbol (libc, ___sysctl2, __sysctl, GLIBC_2_2);
> +# endif
> +#endif

I still think we should keep the syscall call on compat symbol
for architecture that do not return ENOSYS.


More information about the Libc-alpha mailing list