Changeset 00ee241 in rtems-libbsd for libbsd.txt


Ignore:
Timestamp:
Mar 27, 2012, 6:51:45 PM (8 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.11, c1e05b9ea378b2971e3d7704779112b4bc4296da, freebsd-9.3, 4a77611a223ea883fb548679b516d326a020d447
Children:
27ae2dfc
Parents:
9fe8c97
git-author:
Joel Sherrill <joel.sherrill@…> (03/27/12 18:51:45)
git-committer:
Joel Sherrill <joel.sherrill@…> (03/27/12 18:52:38)
Message:

Add example on SYSCTL_NODE expansion for _bsd_sysctlnet_children

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libbsd.txt

    r9fe8c97 r00ee241  
    273273
    274274XXX This needs more details.
     275
     276=== SYSCTL_NODE Example
     277
     278During development, we had an undefined reference to
     279_bsd_sysctl__net_children that we had trouble tracking down. Thanks to
     280Chris Johns, we located it. He explained how to read SYSCTL_NODE
     281definitions. This line from freebsd/netinet/in_proto.c is attempting
     282to add the "inet" node to the parent node "_net".
     283
     284[listing]
     285----
     286SYSCTL_NODE(_net,      PF_INET,         inet,   CTLFLAG_RW, 0,
     287        "Internet Family");
     288----
     289
     290Our problem was that we could not find where _bsd_sysctl__net_children
     291was defined. Chris suggested that when in doubt compile with -save-temps
     292and look at the preprocessed .i files. But he did not need that. He
     293explained that this the symbol name _bsd_sysctl__net_children was
     294automatically generated by a SYSCTL_NODE as follows:
     295
     296* _bsd_ - added by RTEMS modifications to SYSCTL_NODE macro
     297* sysctl_ - boilerplace added by SYSCTL_NODE macro
     298* "" - empty string for parent node
     299* net - name of SYSCTL_NODE
     300* children - added by SYSCTL macros
     301 
     302This was all generated by a support macro declaring the node as this:
     303
     304[listing]
     305----
     306struct sysctl_oid_list SYSCTL_NODE_CHILDREN(parent, name);
     307----
     308
     309Given this information, we located this SYSCTL_NODE declaration in
     310kern/kern_mib.c
     311
     312[listing]
     313----
     314SYSCTL_NODE(, CTL_KERN,   kern,   CTLFLAG_RW, 0,
     315        "High kernel, proc, limits &c");
     316----
     317
Note: See TracChangeset for help on using the changeset viewer.