Page MenuHomeFreeBSD

Reduce reliance on sys/sysproto.h pollution
ClosedPublic

Authored by brooks on Mar 21 2024, 11:38 PM.
Tags
None
Referenced Files
Unknown Object (File)
Wed, Nov 6, 7:17 PM
Unknown Object (File)
Wed, Oct 23, 10:34 PM
Unknown Object (File)
Wed, Oct 23, 10:33 PM
Unknown Object (File)
Wed, Oct 23, 10:33 PM
Unknown Object (File)
Wed, Oct 23, 10:32 PM
Unknown Object (File)
Wed, Oct 23, 10:32 PM
Unknown Object (File)
Wed, Oct 23, 10:31 PM
Unknown Object (File)
Wed, Oct 23, 10:17 PM
Subscribers

Details

Summary

Add sys/errno.h, sys/malloc.h, and vm/uma.h as needed.

sysproto.h currently includes sys/acl.h which currently includes
sys/param.h, sys/queue.h, and vm/uma.h which in turn bring in
sys/errno.h sys/malloc.h.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 56731
Build 53619: arc lint + arc unit

Event Timeline

This review stack is the result of trying to remove sys/acl.h from sys/sysproto.h after 27676ae365f62c22f8daa816bf7a07d22bd081d9 and discovering that there were a lot of things that depended on its header pollution.

kib added inline comments.
sys/kern/kern_time.c
40

This is excessive. Or, at least in other places, the patch depends on vm/uma.h including sys/malloc.h.

This revision is now accepted and ready to land.Mar 22 2024, 3:09 AM
  • Add a sys/queue.h include after _KERNEL ifdef of sys/malloc.h in sys/acl.h
  • Explain sys/malloc.h include in kern_time.c
This revision now requires review to proceed.Mar 22 2024, 8:23 PM

Actually squash in sys/queue.h include

brooks added inline comments.
sys/kern/kern_time.c
40

It took a little poking around, but it turns out we need sys/malloc.h before sys/proc.h for the M_ macros we need to be declared. Arguably that's a bug in sys/proc.h.

sys/kern/kern_time.c
40

The proc.h M_ declarations are under the #ifdef brace. I suspect they could be moved to sys/malloc.h without much hassle.

brooks marked an inline comment as done.

Drop sys/malloc.h in kern_time.c (depends on D44766)

This revision is now accepted and ready to land.Apr 12 2024, 11:36 PM
This revision was automatically updated to reflect the committed changes.