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, Apr 10, 12:52 AM
Unknown Object (File)
Tue, Apr 9, 8:16 PM
Unknown Object (File)
Thu, Apr 4, 3:54 AM
Unknown Object (File)
Feb 19 2024, 10:10 PM
Unknown Object (File)
Feb 17 2024, 1:55 PM
Unknown Object (File)
Feb 15 2024, 2:12 PM
Unknown Object (File)
Feb 13 2024, 11:08 AM
Unknown Object (File)
Feb 10 2024, 11:55 PM
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
rS FreeBSD src repository - subversion
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 41359
Build 38248: arc lint + arc unit

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.