SYSCTL_XXX(9) manual page deficiency

Giorgos Keramidas keramida at freebsd.org
Mon May 17 00:30:50 UTC 2010


On Wed, 21 Apr 2010 13:10:23 -0700, Maxim Sobolev <sobomax at FreeBSD.org> wrote:
> Hi,
>
> According to the manual page for the SYSCTL_XXX(9) family of
> functions, in order to use them one needs to include sys/types.h and
> sys/sysctl.h. However, if you do just that the code doesn't compile
> due to missing DATA_SET() macros, which is defined in
> sys/linker_set.h. My question is whether or not sysctl.h should
> include sys/linker_set.h or manual page to be extended to also
> suggests that this include is required to use those functions?

linker_set.h is a relatively small header that defines only a minimal
amount of macros in the public namespace.

Some of these symbols are a bit generic, e.g. SET_BEGIN, SET_END,
SET_ENTRY, SET_FOREACH and SET_ITEM might conflict with symbol names
from other code.

On the other hand, the XXX_SET() code is only visible at the end of the
SYSCTL_XXX() macros only for kernel code, and it has been there for a
*very* long time: since phk committed revision 11863 in 1995.  If there
ever was a consumer of the kernel API of sysctl.h who had problems with
the generic XXX_SET() macros in linker_set.h we'd probably know by now.

IMO adding linker_set.h to sysctl.h is fine.



More information about the freebsd-current mailing list