git: e8a6686252b4 - stable/13 - cross-build: Fix bmake bootstrap with glibc 2.34

From: Jessica Clarke <jrtc27_at_FreeBSD.org>
Date: Tue, 25 Jan 2022 01:40:12 UTC
The branch stable/13 has been updated by jrtc27:

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

commit e8a6686252b4eecea4565d6013b8cfb844a9a603
Author:     Jessica Clarke <jrtc27@FreeBSD.org>
AuthorDate: 2021-12-15 05:52:13 +0000
Commit:     Jessica Clarke <jrtc27@FreeBSD.org>
CommitDate: 2022-01-24 23:59:42 +0000

    cross-build: Fix bmake bootstrap with glibc 2.34
    
    As of glibc 2.34, our unistd.h wrapper's inclusion of stdlib.h exposes
    fragility in glibc's sys/wait.h and corresponding part of stdlib.h,
    leading to "error: use of undeclared identifier 'WNOHANG'" and similar
    errors when bootstrapping bmake.
    
    Work around this by wrapping sys/wait.h to force stdlib.h's inclusion
    first before it's implicitly included during the problematic window in
    sys/wait.h.
    
    MFC after:      1 week
    
    (cherry picked from commit 9e5b0d9eac5b240dc0ee280870291fd11d499046)
---
 tools/build/cross-build/include/linux/sys/wait.h | 31 ++++++++++++++++++++++++
 1 file changed, 31 insertions(+)

diff --git a/tools/build/cross-build/include/linux/sys/wait.h b/tools/build/cross-build/include/linux/sys/wait.h
new file mode 100644
index 000000000000..2721218a83d4
--- /dev/null
+++ b/tools/build/cross-build/include/linux/sys/wait.h
@@ -0,0 +1,31 @@
+/*-
+ * SPDX-License-Identifier: BSD-2-Clause
+ *
+ * Copyright 2021 Jessica Clarke <jrtc27@FreeBSD.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include <stdlib.h>
+#include_next <sys/wait.h>