This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH 1/2] Deprecate sysctl syscall interface



On 30/04/2018 09:09, Zack Weinberg wrote:
> On Mon, Apr 30, 2018 at 7:09 AM, Adhemerval Zanella
> <adhemerval.zanella@linaro.org> wrote:
>>
>> * The obsolete function sysctl is no longer available to newly linkerd binaries;
>>   the header <sys/sysctl.h> has been removed.  This function has been deprecated
>>   since Linux 2.6.24 in favor of /proc/sys.
> 
> I've been thinking about this since you posted the original patch, and
> I don't think this is the right treatment of this specific function.
> sysctl still exists and is the preferred interface on the BSDs and I
> think also Solaris.  Linux may not support it at the kernel level but
> we should leave open the possibility of a future user-space shim, or
> of the kernel people changing their minds (frankly, I have never found
> the argument for /proc/sys instead of sysctl at all convincing).  That
> means:

I find it highly unlikely:

  * the deprecation occurred 10 years ago.

  * the kernel kernel/sysctl_binary.c was changed to be a compatibility wrapper 
    around /proc/sys (26a7034b40), the changes were only to *remove* deprecated
    fields and no new fields were added since then, meaning sysctl just
    provides a subset of /proc/sys (with unknown exceptions of 
    NET_IPV6_ACCEPT_RA_FROM_LOCAL (d93331965) and KERN_PANIC_ON_WARN (9e3961a097).

  * new ports do not provide the syscall (aarch64, nios2, riscv64, x86_64-x32)
    so portable programs should not rely on it.

  * although linux and bsd do share some object names, most are Linux specific
    and some vary between kernel versions and not all are properly documented.

  * sysctl for procps already uses /proc/sys.

> 
>  - Do still install a generic <sys/sysctl.h> that prototypes sysctl()
> and includes bits/sysctl.h but does nothing else.
>  - Do still install a generic <bits/sysctl.h> that declares nothing.
>  - Drop sysdeps/u/s/l/sysctl.c as in this patch, but move
> sysdeps/u/s/l/generic/sysctl.c to misc/, and *don't* make it a compat
> symbol.

I see no gain in continuing provide this symbol for the aforementioned reasons.
As mentioned in comment, the only real world usage I could is fail-proof way to
gather some entropy in cases where /dev/urandom or /proc is not available.
However even then Linux have moved to a more proper syscall (getentropy).


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]