diff --git a/base/cvd/cuttlefish/host/graphics_detector/BUILD.bazel b/base/cvd/cuttlefish/host/graphics_detector/BUILD.bazel index 538ad118797..344ce664b57 100644 --- a/base/cvd/cuttlefish/host/graphics_detector/BUILD.bazel +++ b/base/cvd/cuttlefish/host/graphics_detector/BUILD.bazel @@ -63,6 +63,7 @@ cf_cc_binary( deps = [ ":graphics_detector_cc_proto", "//cuttlefish/host/graphics_detector/shaders:graphics_detector_shaders", + "//cuttlefish/posix:temp_failure_retry", "@abseil-cpp//absl/log", "@egl_headers", "@opengl_headers//:GLES2_headers", diff --git a/base/cvd/cuttlefish/host/graphics_detector/subprocess.cpp b/base/cvd/cuttlefish/host/graphics_detector/subprocess.cpp index 01b6e697954..80755f61e1a 100644 --- a/base/cvd/cuttlefish/host/graphics_detector/subprocess.cpp +++ b/base/cvd/cuttlefish/host/graphics_detector/subprocess.cpp @@ -17,17 +17,23 @@ #include "cuttlefish/host/graphics_detector/subprocess.h" #include +#include #include +#include #include -#include #include #include +#if defined(__linux__) +#include +#endif #include #include #include #include +#include "cuttlefish/posix/temp_failure_retry.h" // IWYU pragma: keep + namespace gfxstream { namespace { @@ -50,11 +56,17 @@ class ScopedCloser { }; int PidfdOpen(pid_t pid) { +#if defined(__linux__) // There is no glibc wrapper for pidfd_open. #ifndef SYS_pidfd_open constexpr int SYS_pidfd_open = 434; #endif return syscall(SYS_pidfd_open, pid, /*flags=*/0); +#else + (void)pid; + errno = ENOSYS; + return -1; +#endif } gfxstream::expected WaitForChild(pid_t pid) {