From 4300e053618fc4ef54eaaf6229d747489e44fe99 Mon Sep 17 00:00:00 2001 From: Warner Losh Date: Sun, 26 May 2024 11:38:55 -0600 Subject: [PATCH] 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 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 --- tools/build/fcntl.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tools/build/fcntl.h b/tools/build/fcntl.h index 6aaf3eef2804..f59f5f7fb20a 100644 --- a/tools/build/fcntl.h +++ b/tools/build/fcntl.h @@ -29,6 +29,13 @@ #include_next +/* + * 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 + struct spacectl_range { off_t r_offset; off_t r_len;