aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJessica Clarke <jrtc27@FreeBSD.org>2021-12-15 05:52:13 +0000
committerJessica Clarke <jrtc27@FreeBSD.org>2021-12-15 05:52:13 +0000
commit9e5b0d9eac5b240dc0ee280870291fd11d499046 (patch)
tree360d0ac12fa42d3888d5ac833c85b78a19839b50
parent6a2b72bf1a88ffc387b74456c4fdc81468752916 (diff)
downloadsrc-9e5b0d9eac5b240dc0ee280870291fd11d499046.tar.gz
src-9e5b0d9eac5b240dc0ee280870291fd11d499046.zip
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
-rw-r--r--tools/build/cross-build/include/linux/sys/wait.h31
1 files changed, 31 insertions, 0 deletions
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>