iwm: Fix S:N reporting in ifconfig(8)
[dragonfly.git] / lib / libc / gen / sysctlbyname.c
1 /*
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  * ----------------------------------------------------------------------------
8  *
9  * $FreeBSD: head/lib/libc/gen/sysctlbyname.c 244153 2012-12-12 15:27:33Z pjd $
10  *
11  */
12 #include <sys/types.h>
13 #include <sys/sysctl.h>
14
15 int
16 sysctlbyname(const char *name, void *oldp, size_t *oldlenp,
17     const void *newp, size_t newlen)
18 {
19         int real_oid[CTL_MAXNAME+2];
20         size_t oidlen;
21
22         oidlen = sizeof(real_oid) / sizeof(int);
23         if (sysctlnametomib(name, real_oid, &oidlen) < 0)
24                 return (-1);
25         return (sysctl(real_oid, oidlen, oldp, oldlenp, newp, newlen));
26 }