git: 4a0b7955fd72 - main - cross-build: Move fcntl.h workaround to Linux specific file

From: Warner Losh <imp_at_FreeBSD.org>
Date: Thu, 25 Jul 2024 02:47:01 UTC
The branch main has been updated by imp:

URL: https://cgit.FreeBSD.org/src/commit/?id=4a0b7955fd727754b853f6a346b8379e21bcb81f

commit 4a0b7955fd727754b853f6a346b8379e21bcb81f
Author:     Warner Losh <imp@FreeBSD.org>
AuthorDate: 2024-07-25 02:46:35 +0000
Commit:     Warner Losh <imp@FreeBSD.org>
CommitDate: 2024-07-25 02:47:26 +0000

    cross-build: Move fcntl.h workaround to Linux specific file
    
    Move the cdefs.h inclusion to the Linux specific file. Either place will
    work, but it makes more sense to do it in the Linux specific file since
    it's a Linux specific workaround.
    
    Fixes:                  4300e053618f
    Suggested by:           arichards, jrtc27
    Sponsored by:           Netflix
    Differential Revision:  https://reviews.freebsd.org/D45373
---
 tools/build/cross-build/include/linux/fcntl.h | 7 +++++++
 tools/build/fcntl.h                           | 7 -------
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/tools/build/cross-build/include/linux/fcntl.h b/tools/build/cross-build/include/linux/fcntl.h
index aafcfe43a325..e5718ce5e3ed 100644
--- a/tools/build/cross-build/include/linux/fcntl.h
+++ b/tools/build/cross-build/include/linux/fcntl.h
@@ -44,3 +44,10 @@
 #include "__unused_workaround_end.h"
 
 #include <sys/file.h>
+
+/*
+ * On FreeBSD fcntl.h indirectly brings in cdefs.h. On Linux with musl, it does
+ * not. It's needed in our fcntl.h for the cross build since we use
+ * __BEGIN_DECLS and __END_DECLS from it there.
+ */
+#include <sys/cdefs.h>
diff --git a/tools/build/fcntl.h b/tools/build/fcntl.h
index f59f5f7fb20a..6aaf3eef2804 100644
--- a/tools/build/fcntl.h
+++ b/tools/build/fcntl.h
@@ -29,13 +29,6 @@
 
 #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;