git: Add proper const keywords to sysctl(3) parameters.

Sascha Wildner swildner at
Sun Nov 24 15:12:33 PST 2013

commit 00f0918d338a0f863b786ed4565f12971eaecdc8
Author: Alexandre Perrin <alex at>
Date:   Fri Nov 22 19:48:23 2013 +0100

    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
      they refer to are never changed. While there, perform some other
      * 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.

Summary of changes:
 lib/libc/gen/sysctl.3          |  7 +++----
 lib/libc/gen/sysctl.c          | 18 ++++++++++--------
 lib/libc/gen/sysctlbyname.c    | 26 +++++++-------------------
 lib/libc/gen/sysctlnametomib.c |  9 ++++-----
 sys/sys/sysctl.h               |  6 +++---
 5 files changed, 27 insertions(+), 39 deletions(-)

DragonFly BSD source repository

More information about the Commits mailing list