Add hostname related sysctls conditionally

This helps to the reduce code size for USB only use cases.
This commit is contained in:
Sebastian Huber 2019-05-13 10:11:39 +02:00
parent e9b8413133
commit ac9974c358

View File

@ -59,6 +59,9 @@ __FBSDID("$FreeBSD$");
#include <sys/sysctl.h> #include <sys/sysctl.h>
#include <sys/systm.h> #include <sys/systm.h>
#include <rtems/bsd/sys/unistd.h> #include <rtems/bsd/sys/unistd.h>
#ifdef __rtems__
#include <rtems/bsd/modules.h>
#endif /* __rtems__ */
SYSCTL_ROOT_NODE(0, sysctl, CTLFLAG_RW, 0, SYSCTL_ROOT_NODE(0, sysctl, CTLFLAG_RW, 0,
"Sysctl internal magic"); "Sysctl internal magic");
@ -280,6 +283,7 @@ SYSCTL_STRING(_kern, OID_AUTO, supported_archs, CTLFLAG_RD | CTLFLAG_MPSAFE,
MACHINE_ARCH, 0, "Supported architectures for binaries"); MACHINE_ARCH, 0, "Supported architectures for binaries");
#endif #endif
#if defined(RTEMS_BSD_MODULE_NETINET) || defined(RTEMS_BSD_MODULE_NETINET6)
static int static int
sysctl_hostname(SYSCTL_HANDLER_ARGS) sysctl_hostname(SYSCTL_HANDLER_ARGS)
{ {
@ -356,6 +360,7 @@ SYSCTL_PROC(_kern, KERN_HOSTUUID, hostuuid,
CTLTYPE_STRING | CTLFLAG_RW | CTLFLAG_PRISON | CTLFLAG_CAPRD | CTLFLAG_MPSAFE, CTLTYPE_STRING | CTLFLAG_RW | CTLFLAG_PRISON | CTLFLAG_CAPRD | CTLFLAG_MPSAFE,
(void *)(offsetof(struct prison, pr_hostuuid)), HOSTUUIDLEN, (void *)(offsetof(struct prison, pr_hostuuid)), HOSTUUIDLEN,
sysctl_hostname, "A", "Host UUID"); sysctl_hostname, "A", "Host UUID");
#endif /* RTEMS_BSD_MODULE_NETINET || RTEMS_BSD_MODULE_NETINET6 */
#ifndef __rtems__ #ifndef __rtems__
static int regression_securelevel_nonmonotonic = 0; static int regression_securelevel_nonmonotonic = 0;