diff options
author | Joel Sherrill <joel.sherrill@oarcorp.com> | 2012-03-27 13:51:45 -0500 |
---|---|---|
committer | Joel Sherrill <joel.sherrill@oarcorp.com> | 2012-03-27 13:52:38 -0500 |
commit | 00ee241553768a40a356208e0402fefb93a508bf (patch) | |
tree | ee7f4305a6201288ab830e6b951d35d434390127 | |
parent | Commented out methods to prevent linker errors. (diff) | |
download | rtems-libbsd-00ee241553768a40a356208e0402fefb93a508bf.tar.bz2 |
Add example on SYSCTL_NODE expansion for _bsd_sysctl__net_children
-rw-r--r-- | libbsd.txt | 43 |
1 files changed, 43 insertions, 0 deletions
@@ -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"); +---- + |