Index: libiberty/pex-common.h
--- a/libiberty/pex-common.h
+++ b/libiberty/pex-common.h
@@ -1,3 +1,12 @@
+#ifndef _XOPEN_SOURCE
+#define _XOPEN_SOURCE 600
+#endif
+#ifndef _POSIX_C_SOURCE
+#define _POSIX_C_SOURCE 200112L
+#endif
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
 /* Utilities to execute a program in a subprocess (possibly linked by pipes
    with other subprocesses), and wait for it.  Shared logic.
    Copyright (C) 1996-2022 Free Software Foundation, Inc.
