source: rtems-libbsd/rtemsbsd/rtems/rtems-bsd-sysctlbyname.c @ e599318

4.1155-freebsd-126-freebsd-12freebsd-9.3
Last change on this file since e599318 was e599318, checked in by Sebastian Huber <sebastian.huber@…>, on 10/09/13 at 20:52:54

Update files to match FreeBSD layout

Add compatibility with Newlib header files. Some FreeBSD header files
are mapped by the translation script:

o rtems/bsd/sys/_types.h
o rtems/bsd/sys/errno.h
o rtems/bsd/sys/lock.h
o rtems/bsd/sys/param.h
o rtems/bsd/sys/resource.h
o rtems/bsd/sys/time.h
o rtems/bsd/sys/timespec.h
o rtems/bsd/sys/types.h
o rtems/bsd/sys/unistd.h

It is now possible to include <sys/socket.h> directly for example.

Generate one Makefile which builds everything including tests.

  • 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-config.h>
22
23#include <sys/cdefs.h>
24__FBSDID("$FreeBSD$");
25
26#include <rtems/bsd/sys/types.h>
27#include <sys/sysctl.h>
28
29int
30sysctlbyname(const char *name, void *oldp, size_t *oldlenp,
31    void *newp, size_t newlen)
32{
33        int real_oid[CTL_MAXNAME+2];
34        int error;
35        size_t oidlen;
36
37        oidlen = sizeof(real_oid) / sizeof(int);
38        error = sysctlnametomib(name, real_oid, &oidlen);
39        if (error < 0)
40                return (error);
41        error = sysctl(real_oid, oidlen, oldp, oldlenp, newp, newlen);
42        return (error);
43}
Note: See TracBrowser for help on using the repository browser.