From 3eabdce585e0eb5989ad134c3b7e63d9cf59ca59 Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Mon, 23 May 2022 16:09:29 +0200 Subject: libbsd.txt: Move system control hints Generalize hint. --- CONTRIBUTING.rst | 7 +++++++ libbsd.txt | 39 --------------------------------------- 2 files changed, 7 insertions(+), 39 deletions(-) diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst index 99c778f6..c7c35df9 100644 --- a/CONTRIBUTING.rst +++ b/CONTRIBUTING.rst @@ -592,3 +592,10 @@ Here you see that the SYSINIT(9) entries are no longer static. The ``*_REFERENCE()`` macros will create references to the corresponding modules which are later resolved by the linker. The application has to provide an object file with references to all required FreeBSD modules. + +System Control Hints +==================== + +If you get undefined references to ``_bsd_sysctl_*`` symbols, then you have to +locate and add the associated system control node, see +`SYSCTL(9) `_. diff --git a/libbsd.txt b/libbsd.txt index 33033c4c..706faeb6 100644 --- a/libbsd.txt +++ b/libbsd.txt @@ -112,45 +112,6 @@ The devices form a tree with the Nexus device at a high-level. This Nexus device is architecture specific in FreeBSD. In RTEMS we have our own Nexus device, see `rtemsbsd/bsp/bsp-bsd-nexus-devices.c`. -=== SYSCTL_NODE Example - -During development, we had an undefined reference to -_bsd_sysctl__net_children that we had trouble tracking down. Thanks to -Chris Johns, we located it. He explained how to read SYSCTL_NODE -definitions. This line from freebsd/netinet/in_proto.c is attempting -to add the "inet" node to the parent node "_net". - ----- -SYSCTL_NODE(_net, PF_INET, inet, CTLFLAG_RW, 0, - "Internet Family"); ----- - -Our problem was that we could not find where _bsd_sysctl__net_children -was defined. Chris suggested that when in doubt compile with -save-temps -and look at the preprocessed .i files. But he did not need that. He -explained that this the symbol name _bsd_sysctl__net_children was -automatically generated by a SYSCTL_NODE as follows: - -* _bsd_ - added by RTEMS modifications to SYSCTL_NODE macro -* sysctl_ - boilerplace added by SYSCTL_NODE macro -* "" - empty string for parent node -* net - name of SYSCTL_NODE -* children - added by SYSCTL macros - -This was all generated by a support macro declaring the node as this: - ----- -struct sysctl_oid_list SYSCTL_NODE_CHILDREN(parent, name); ----- - -Given this information, we located this SYSCTL_NODE declaration in -kern/kern_mib.c - ----- -SYSCTL_NODE(, CTL_KERN, kern, CTLFLAG_RW, 0, - "High kernel, proc, limits &c"); ----- - === devfs (Device file system) === There is a minimal implementation based on IMFS. The mount point is fixed to -- cgit v1.2.3