Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions base/cvd/cuttlefish/host/graphics_detector/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
14 changes: 13 additions & 1 deletion base/cvd/cuttlefish/host/graphics_detector/subprocess.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,23 @@
#include "cuttlefish/host/graphics_detector/subprocess.h"

#include <dlfcn.h>
#include <errno.h>
#include <poll.h>
#include <signal.h>
#include <string.h>
#include <sys/prctl.h>
#include <sys/wait.h>
#include <unistd.h>
#if defined(__linux__)
#include <sys/syscall.h>
#endif

#include <condition_variable>
#include <functional>
#include <mutex>
#include <thread>

#include "cuttlefish/posix/temp_failure_retry.h" // IWYU pragma: keep

namespace gfxstream {
namespace {

Expand All @@ -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<Ok, std::string> WaitForChild(pid_t pid) {
Expand Down
Loading