libbsd.txt: Move system control hints

Generalize hint.
This commit is contained in:
Sebastian Huber
2022-05-23 16:09:29 +02:00
parent 96c01bff09
commit 3eabdce585
2 changed files with 7 additions and 39 deletions

View File

@@ -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) <http://www.freebsd.org/cgi/man.cgi?query=SYSCTL_DECL&sektion=9>`_.

View File

@@ -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