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

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
Reviewed by:		val_packett.cool
Differential Revision:	https://reviews.freebsd.org/D45351
This commit is contained in:
Warner Losh 2024-05-26 11:38:55 -06:00
parent 917c0541e4
commit 4300e05361

View File

@ -29,6 +29,13 @@
#include_next <fcntl.h>
/*
* On FreeBSD fcntl.h indirectly brings in cdefs.h. On Linux with musl, it does
* not. Unconditionally inlude it here since there's no harm in including it
* multiple times since we use __BEGIN_DECLS and __END_DECLS from it below.
*/
#include <sys/cdefs.h>
struct spacectl_range {
off_t r_offset;
off_t r_len;