Page MenuHomeFreeBSD

sysctl: make sys/sysctl.h self contained
ClosedPublic

Authored by imp on Sep 3 2021, 6:57 PM.
Tags
None
Referenced Files
F106100473: D31827.diff
Wed, Dec 25, 10:02 AM
Unknown Object (File)
Wed, Dec 4, 9:04 PM
Unknown Object (File)
Sat, Nov 30, 7:23 AM
Unknown Object (File)
Nov 21 2024, 7:39 AM
Unknown Object (File)
Nov 20 2024, 11:05 AM
Unknown Object (File)
Nov 15 2024, 2:44 PM
Unknown Object (File)
Nov 15 2024, 12:43 PM
Unknown Object (File)
Nov 13 2024, 8:37 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 42077
Build 38965: 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.