summaryrefslogtreecommitdiffstats
path: root/libbsd.txt
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@oarcorp.com>2012-03-27 13:51:45 -0500
committerJoel Sherrill <joel.sherrill@oarcorp.com>2012-03-27 13:52:38 -0500
commit00ee241553768a40a356208e0402fefb93a508bf (patch)
treeee7f4305a6201288ab830e6b951d35d434390127 /libbsd.txt
parentCommented out methods to prevent linker errors. (diff)
downloadrtems-libbsd-00ee241553768a40a356208e0402fefb93a508bf.tar.bz2
Add example on SYSCTL_NODE expansion for _bsd_sysctl__net_children
Diffstat (limited to 'libbsd.txt')
-rw-r--r--libbsd.txt43
1 files changed, 43 insertions, 0 deletions
diff --git a/libbsd.txt b/libbsd.txt
index 32e120ba..56b47f1a 100644
--- a/libbsd.txt
+++ b/libbsd.txt
@@ -272,3 +272,46 @@ time and the various initialization routines will thus be executed in'
the correct order.
XXX This needs more details.
+
+=== 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".
+
+[listing]
+----
+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:
+
+[listing]
+----
+struct sysctl_oid_list SYSCTL_NODE_CHILDREN(parent, name);
+----
+
+Given this information, we located this SYSCTL_NODE declaration in
+kern/kern_mib.c
+
+[listing]
+----
+SYSCTL_NODE(, CTL_KERN, kern, CTLFLAG_RW, 0,
+ "High kernel, proc, limits &c");
+----
+