Page MenuHomeFreeBSD

sysctl: make sys/sysctl.h self contained
ClosedPublic

Authored by imp on Sep 3 2021, 6:57 PM.
Tags
None
Referenced Files
Unknown Object (File)
Wed, Nov 13, 8:37 PM
Unknown Object (File)
Sat, Nov 2, 8:56 PM
Unknown Object (File)
Mon, Oct 21, 8:26 PM
Unknown Object (File)
Mon, Oct 21, 10:44 AM
Unknown Object (File)
Thu, Oct 17, 7:09 AM
Unknown Object (File)
Thu, Oct 17, 7:09 AM
Unknown Object (File)
Thu, Oct 17, 7:09 AM
Unknown Object (File)
Thu, Oct 17, 7:08 AM
Subscribers
None

Details

Summary

sys/sysctl.h only needs u_int and size_t from sys/types.h. When the
sysctl interface was designed, having one more more prerequisites
(especially sys/types.h) was the norm. Times have changed, and to make
things more portable, make sys/types.h optional. We do this by including
sys/_types.h, defining size_t if needed, and changing u_int to 'unsigned
int' in a prototype for userland builds. For kernel builds, sys/types.h
is still required.

Sponsored by: Netflix

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

imp requested review of this revision.Sep 3 2021, 6:57 PM
imp created this revision.
sys/sys/sysctl.h
45

I think this line should be moved under #ifdef _KERNEL, if you are cleaning the header for userspace.

64

I am not sure why this structure is defined for userspace.

More, I tried to find a use for it in src/ and failed (but I only grepped, I did not tried to compile world with the definition removed).

This revision is now accepted and ready to land.Sep 8 2021, 6:18 PM
sys/sys/sysctl.h
45

Excellent suggestion.

64

World and kernel both build w/o it. I'm going to remove it as a separate commit.

Finalize kib's comments

This revision now requires review to proceed.Oct 11 2021, 3:44 PM
This revision is now accepted and ready to land.Oct 11 2021, 4:11 PM
This revision was automatically updated to reflect the committed changes.