Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 23 Feb 2001 16:19:16 -0800
From:      "Jonathan Graehl" <jonathan@graehl.org>
To:        "freebsd-Arch" <freebsd-arch@FreeBSD.ORG>
Subject:   RE: sysctl kern.fallback_elf_brand
Message-ID:  <NCBBLOALCKKINBNNEDDLIEGMDLAA.jonathan@graehl.org>
In-Reply-To: <XFMail.010223143315.jhb@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help
> > Yes, I thought about doing that as well, but thought it might be
> > clearer to have the '-1' documented somewhere, especially since
> > it is visible to the user via a sysctl.
>
> Then write a SYSCTL_PROC that uses strings to interface to the user
> rather than
> numbers...

Speaking of sysctl without a defined numeric code ...

#include <netinet/tcp.h>
#include <netinet/tcp_var.h>

#include <netinet/ip_var.h>
#include <netinet/udp.h>
#include <netinet/udp_var.h>

#include <netinet/in_systm.h>
#include <netinet/ip.h>
#include <netinet/ip_icmp.h>
#include <netinet/icmp_var.h>

I had to include all that kernel junk (grep, parse error messages, repeat - if
there are dependencies, why can't *_var.h include them for me?) just to get a
few codes for some net.inet.* sysctls.  I was going to come up with a patch to
properly #ifdef _KERNEL the offending nonsense, but then I discovered by
searching kernel source that a few of the sysctls I wanted could only be
referenced by strings ...

man sysctl(3) does not mention any of this.  sysctl should be prominently marked
as deprecated in favor of sysctlbyname, since many of the sysctl-code-containing
include files don't aren't vetted properly for inclusion by user code.

I wanted to use the numeric codes to benefit from compile-time checking.  I was
not concerned with "optimization" of a one-off call.  Overall, I was isappointed
with my wild-goose-chase encouraged by the misleading documentation for sysctl.

-Jonathan


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-arch" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?NCBBLOALCKKINBNNEDDLIEGMDLAA.jonathan>