Page MenuHomeFreeBSD

build: Include sys/cdefs.h in our fcntl.h shim
ClosedPublic

Authored by imp on May 24 2024, 9:07 PM.
Tags
None
Referenced Files
Unknown Object (File)
Mon, Jun 3, 9:54 PM
Unknown Object (File)
May 26 2024, 7:51 PM
Unknown Object (File)
May 25 2024, 5:55 PM
Subscribers
None

Details

Summary

On Linux with musl, sys/cdefs.h isn't included with fcntl.h, so when we
use BEGIN_DECL and END_DECL in this file, it fails. There's no harm
in unconditionally including sys/cdefs.h here, so do that to avoid
encoding exactly where it is or isn't needed so we don't have to know
too much about the internal state of other libc implementations.

Co-authored-by: Val Packett <val@packett.cool>
Sponsored by: Netflix
Pull Request: https://github.com/freebsd/freebsd-src/pull/1066

Diff Detail

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

Event Timeline

imp requested review of this revision.May 24 2024, 9:07 PM
imp created this revision.
This revision is now accepted and ready to land.May 25 2024, 5:05 PM
This revision was automatically updated to reflect the committed changes.
tools/build/fcntl.h
37

I was slow to get to reviewing these over the weekend, but this feels like it should be in tools/build/cross-build/include/linux/fcntl.h (which does already exist)

tools/build/fcntl.h
37

I thought that at first but landed here due to proximity.

What's your thinking on the way you suggest? What makes that a better place?

tools/build/fcntl.h
37

Confines the bits that aren't needed on FreeBSD to somewhere out the way. Helps to declutter FreeBSD sources / avoid the ugliness spreading too far, and more clearly signposts why they're there (this looks redundant on FreeBSD, so you'd have to consult git to find out). Not such a big deal in this case compared to a lot of the cross-build hacks as it's just a lone include, but I'd like to keep it principled.

37

(I mean, the comment addresses the signposting of course, but having it in a directory that says linux in it makes it somewhat self-documenting :))