source: rtems-libbsd/rtemsbsd/rtems/rtems-kernel-sysctlbyname.c @ dd35ec5

55-freebsd-126-freebsd-12
Last change on this file since dd35ec5 was 3d1e767, checked in by Sebastian Huber <sebastian.huber@…>, on 04/27/16 at 08:25:22

Directly use <sys/types.h> provided by Newlib

  • Property mode set to 100644
File size: 1.1 KB
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 <sys/types.h>
28#include <sys/sysctl.h>
29
30int
31sysctlbyname(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.