]>
git.saurik.com Git - apple/libc.git/blob - gen/FreeBSD/sysctlbyname.c
2 * ----------------------------------------------------------------------------
3 * "THE BEER-WARE LICENSE" (Revision 42):
4 * <phk@FreeBSD.org> wrote this file. As long as you retain this notice you
5 * can do whatever you want with this stuff. If we meet some day, and you think
6 * this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp
7 * ----------------------------------------------------------------------------
11 #include <sys/cdefs.h>
12 __FBSDID("$FreeBSD: src/lib/libc/gen/sysctlbyname.c,v 1.5 2002/02/01 00:57:29 obrien Exp $");
14 #include <sys/types.h>
15 #include <sys/sysctl.h>
19 sysctlbyname(const char *name
, void *oldp
, size_t *oldlenp
, void *newp
,
23 int real_oid
[CTL_MAXNAME
+2];
27 name2oid_oid
[0] = 0; /* This is magic & undocumented! */
30 oidlen
= sizeof(real_oid
);
31 error
= sysctl(name2oid_oid
, 2, real_oid
, &oidlen
, (void *)name
,
35 oidlen
/= sizeof (int);
36 error
= sysctl(real_oid
, oidlen
, oldp
, oldlenp
, newp
, newlen
);