4.1155-freebsd-126-freebsd-12freebsd-9.3
Line | |
---|
1 | /** |
---|
2 | * @file |
---|
3 | * |
---|
4 | * @ingroup rtems_bsd_rtems |
---|
5 | * |
---|
6 | * @brief TODO. |
---|
7 | * |
---|
8 | * File origin from FreeBSD 'lib/libc/gen/sysctlbyname.c'. |
---|
9 | */ |
---|
10 | |
---|
11 | /* |
---|
12 | * ---------------------------------------------------------------------------- |
---|
13 | * "THE BEER-WARE LICENSE" (Revision 42): |
---|
14 | * <phk@FreeBSD.org> wrote this file. As long as you retain this notice you |
---|
15 | * can do whatever you want with this stuff. If we meet some day, and you think |
---|
16 | * this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp |
---|
17 | * ---------------------------------------------------------------------------- |
---|
18 | * |
---|
19 | */ |
---|
20 | |
---|
21 | #include <machine/rtems-bsd-kernel-space.h> |
---|
22 | #include <machine/rtems-bsd-syscall-api.h> |
---|
23 | |
---|
24 | #include <sys/cdefs.h> |
---|
25 | __FBSDID("$FreeBSD$"); |
---|
26 | |
---|
27 | #include <rtems/bsd/sys/types.h> |
---|
28 | #include <sys/sysctl.h> |
---|
29 | |
---|
30 | int |
---|
31 | sysctlbyname(const char *name, void *oldp, size_t *oldlenp, |
---|
32 | const void *newp, size_t newlen) |
---|
33 | { |
---|
34 | int real_oid[CTL_MAXNAME+2]; |
---|
35 | int error; |
---|
36 | size_t oidlen; |
---|
37 | |
---|
38 | oidlen = sizeof(real_oid) / sizeof(int); |
---|
39 | error = sysctlnametomib(name, real_oid, &oidlen); |
---|
40 | if (error < 0) |
---|
41 | return (error); |
---|
42 | error = sysctl(real_oid, oidlen, oldp, oldlenp, newp, newlen); |
---|
43 | return (error); |
---|
44 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.