[PATCH] Linux: Remove <sys/sysctl.h> and the sysctl function
Zack Weinberg
zackw@panix.com
Wed Mar 11 18:49:37 GMT 2020
On Wed, Mar 11, 2020 at 2:36 PM Florian Weimer <fw@deneb.enyo.de> wrote:
> > However, I think that glibc should continue to provide sysctl(3) and
> > should actively work to make it more like the fully-supported
> > sysctl(3) that the BSDs have. It follows that we should continue to
> > install <sys/sysctl.h>. It would be reasonable for us to treat
> > sysctlbyname() as the primary interface and provide compatibility
> > MIB-to-name mappings only for the set of MIB vectors that were
> > historically supported by Linux's sysctl(2).
>
> I'm sorry, but I strongly disagree with this. Our MIBs were never
> compatible with the FreeBSD MIBs, resulting in application bugs due to
> incomplete porting.
To me that's a reason to fix the MIBs to provide source compatibility,
not a reason to scrap the entire idea. Since the Linux kernel *has*
abandoned the idea, we are free to rearrange things so that
applications that expect the FreeBSD MIBs do in fact work.
> I don't see value in maintaining this interface.
The value I see is principally that 'sysctlbyname("kern.osrelease",
buf, sizeof buf, 0, 0)' is a heck of a lot simpler for applications
than 'int fd = open("/proc/sys/kernel/osrelease"); read(fd, buf,
sizeof(buf)); close(fd)' particularly when you include all of the
error checking, and secondarily that it *could* work when /proc isn't
mounted. The hypothetical implementation that translated to accessing
files in /proc/sys *wouldn't* work, but if we had it, we could see
more easily whether there was demand.
zw
More information about the Libc-alpha
mailing list