[rtems-libbsd commit] Add hostname related sysctls conditionally

Sebastian Huber sebh at rtems.org
Mon May 13 08:19:53 UTC 2019


Module:    rtems-libbsd
Branch:    5-freebsd-12
Commit:    2f9d60c61333a84c28630c04376c3e76913246d5
Changeset: http://git.rtems.org/rtems-libbsd/commit/?id=2f9d60c61333a84c28630c04376c3e76913246d5

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Mon May 13 10:11:39 2019 +0200

Add hostname related sysctls conditionally

This helps to the reduce code size for USB only use cases.

---

 freebsd/sys/kern/kern_mib.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/freebsd/sys/kern/kern_mib.c b/freebsd/sys/kern/kern_mib.c
index 59f025c..1933af9 100644
--- a/freebsd/sys/kern/kern_mib.c
+++ b/freebsd/sys/kern/kern_mib.c
@@ -60,6 +60,9 @@ __FBSDID("$FreeBSD$");
 #include <sys/sysctl.h>
 #include <sys/systm.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 internal magic");
@@ -291,6 +294,7 @@ SYSCTL_STRING(_kern, OID_AUTO, supported_archs, CTLFLAG_RD | CTLFLAG_MPSAFE,
     MACHINE_ARCH, 0, "Supported architectures for binaries");
 #endif
 
+#if defined(RTEMS_BSD_MODULE_NETINET) || defined(RTEMS_BSD_MODULE_NETINET6)
 static int
 sysctl_hostname(SYSCTL_HANDLER_ARGS)
 {
@@ -367,6 +371,7 @@ SYSCTL_PROC(_kern, KERN_HOSTUUID, hostuuid,
     CTLTYPE_STRING | CTLFLAG_RW | CTLFLAG_PRISON | CTLFLAG_CAPRD | CTLFLAG_MPSAFE,
     (void *)(offsetof(struct prison, pr_hostuuid)), HOSTUUIDLEN,
     sysctl_hostname, "A", "Host UUID");
+#endif /* RTEMS_BSD_MODULE_NETINET || RTEMS_BSD_MODULE_NETINET6 */
 
 #ifndef __rtems__
 static int	regression_securelevel_nonmonotonic = 0;



More information about the vc mailing list