rtems-libbsd/rtemsbsd/src/rtems-bsd-sysctl.c
2012-03-08 10:31:56 -06:00

65 lines
958 B
C

/**
* @file
*
* @ingroup rtems_bsd_rtems
*
* @brief TODO.
*/
/*
* Copyright (c) 2010 embedded brains GmbH. All rights reserved.
*
* embedded brains GmbH
* Obere Lagerstr. 30
* 82178 Puchheim
* Germany
* <rtems@embedded-brains.de>
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://www.rtems.com/license/LICENSE.
*/
#include <freebsd/machine/rtems-bsd-config.h>
#include <freebsd/sys/types.h>
#include <freebsd/sys/sysctl.h>
int sysctl(
int *name,
u_int namelen,
void *oldp,
size_t *oldlenp,
void *newp,
size_t newlen
)
{
int eno = EINVAL;
if (namelen <= CTL_MAXNAME) {
int namedup [CTL_MAXNAME];
memcpy(namedup, name, namelen * sizeof(*name));
eno = kernel_sysctl(
NULL,
namedup,
namelen,
oldp,
oldlenp,
newp,
newlen,
oldlenp,
0
);
}
if (eno == 0) {
return 0;
} else {
errno = eno;
return -1;
}
}