Add proper const keywords to sysctl(3) parameters.
Import some sysctl(3) patches from FreeBSD.
- r204170 change the sysctl(3) and sysctlbyname(3) interfaces so they
are in sync with FreeBSD and NetBSD.
- r240176 Avoid a potential segfault in libc when the `name' argument
is invalid.
- r204172 & r244153 are cosmetics changes.
Here follow the commit message from r204170 and r240176:
- r204170: Add proper const keywords to sysctl(3) parameters.
The `name' and `newp' arguments can be marked const, because the
buffers
they refer to are never changed. While there, perform some other
cleanups:
* Implement sysctlbyname() using sysctlnametomib() to prevent
duplication of an undocumented kernel interface.
* Fix some whitespace nits.
- r240176: Avoid segfault if name is invalid.
Basically, only check for CTL_USER if the sysctl fails with ENOENT.