Loading adb/adb.cpp +4 −0 Original line number Diff line number Diff line Loading @@ -891,6 +891,10 @@ int launch_server(const std::string& socket_spec) { // child side of the fork pipe_read.reset(); // android::base::Pipe unconditionally opens the pipe with O_CLOEXEC. // Undo this manually. fcntl(pipe_write.get(), F_SETFD, 0); char reply_fd[30]; snprintf(reply_fd, sizeof(reply_fd), "%d", pipe_write.get()); // child process Loading adb/adb_unique_fd.cpp +3 −40 Original line number Diff line number Diff line Loading @@ -21,45 +21,8 @@ #include "sysdeps.h" #if !defined(_WIN32) bool Pipe(unique_fd* read, unique_fd* write, int flags) { int pipefd[2]; #if !defined(__APPLE__) if (pipe2(pipefd, flags) != 0) { return false; } #else // Darwin doesn't have pipe2. Implement it ourselves. if (flags != 0 && (flags & ~(O_CLOEXEC | O_NONBLOCK)) != 0) { errno = EINVAL; return false; } if (pipe(pipefd) != 0) { return false; } if (flags & O_CLOEXEC) { if (fcntl(pipefd[0], F_SETFD, FD_CLOEXEC) != 0 || fcntl(pipefd[1], F_SETFD, FD_CLOEXEC) != 0) { adb_close(pipefd[0]); adb_close(pipefd[1]); return false; } } if (flags & O_NONBLOCK) { if (fcntl(pipefd[0], F_SETFL, O_NONBLOCK) != 0 || fcntl(pipefd[1], F_SETFL, O_NONBLOCK) != 0) { adb_close(pipefd[0]); adb_close(pipefd[1]); return false; } } #endif read->reset(pipefd[0]); write->reset(pipefd[1]); return true; #if defined(_WIN32) void AdbCloser::Close(int fd) { adb_close(fd); } #endif adb/adb_unique_fd.h +3 −3 Original line number Diff line number Diff line Loading @@ -21,15 +21,15 @@ #include <android-base/unique_fd.h> #if defined(_WIN32) // Helper to automatically close an FD when it goes out of scope. struct AdbCloser { static void Close(int fd); }; using unique_fd = android::base::unique_fd_impl<AdbCloser>; #if !defined(_WIN32) bool Pipe(unique_fd* read, unique_fd* write, int flags = 0); #else using unique_fd = android::base::unique_fd; #endif template <typename T> Loading adb/adb_utils.cpp +0 −4 Original line number Diff line number Diff line Loading @@ -274,10 +274,6 @@ std::string adb_get_android_dir_path() { return android_dir; } void AdbCloser::Close(int fd) { adb_close(fd); } int syntax_error(const char* fmt, ...) { fprintf(stderr, "adb: usage: "); Loading debuggerd/Android.bp +4 −1 Original line number Diff line number Diff line Loading @@ -43,7 +43,7 @@ cc_library_shared { export_include_dirs: ["tombstoned/include"], } // Utility library to tombstoned and get an output fd. // Utility library to talk to tombstoned and get an output fd. cc_library_static { name: "libtombstoned_client_static", defaults: ["debuggerd_defaults"], Loading Loading @@ -166,6 +166,9 @@ cc_library_static { local_include_dirs: ["libdebuggerd/include"], export_include_dirs: ["libdebuggerd/include"], // Needed for private/bionic_fdsan.h include_dirs: ["bionic/libc"], static_libs: [ "libbacktrace", "libunwindstack", Loading Loading
adb/adb.cpp +4 −0 Original line number Diff line number Diff line Loading @@ -891,6 +891,10 @@ int launch_server(const std::string& socket_spec) { // child side of the fork pipe_read.reset(); // android::base::Pipe unconditionally opens the pipe with O_CLOEXEC. // Undo this manually. fcntl(pipe_write.get(), F_SETFD, 0); char reply_fd[30]; snprintf(reply_fd, sizeof(reply_fd), "%d", pipe_write.get()); // child process Loading
adb/adb_unique_fd.cpp +3 −40 Original line number Diff line number Diff line Loading @@ -21,45 +21,8 @@ #include "sysdeps.h" #if !defined(_WIN32) bool Pipe(unique_fd* read, unique_fd* write, int flags) { int pipefd[2]; #if !defined(__APPLE__) if (pipe2(pipefd, flags) != 0) { return false; } #else // Darwin doesn't have pipe2. Implement it ourselves. if (flags != 0 && (flags & ~(O_CLOEXEC | O_NONBLOCK)) != 0) { errno = EINVAL; return false; } if (pipe(pipefd) != 0) { return false; } if (flags & O_CLOEXEC) { if (fcntl(pipefd[0], F_SETFD, FD_CLOEXEC) != 0 || fcntl(pipefd[1], F_SETFD, FD_CLOEXEC) != 0) { adb_close(pipefd[0]); adb_close(pipefd[1]); return false; } } if (flags & O_NONBLOCK) { if (fcntl(pipefd[0], F_SETFL, O_NONBLOCK) != 0 || fcntl(pipefd[1], F_SETFL, O_NONBLOCK) != 0) { adb_close(pipefd[0]); adb_close(pipefd[1]); return false; } } #endif read->reset(pipefd[0]); write->reset(pipefd[1]); return true; #if defined(_WIN32) void AdbCloser::Close(int fd) { adb_close(fd); } #endif
adb/adb_unique_fd.h +3 −3 Original line number Diff line number Diff line Loading @@ -21,15 +21,15 @@ #include <android-base/unique_fd.h> #if defined(_WIN32) // Helper to automatically close an FD when it goes out of scope. struct AdbCloser { static void Close(int fd); }; using unique_fd = android::base::unique_fd_impl<AdbCloser>; #if !defined(_WIN32) bool Pipe(unique_fd* read, unique_fd* write, int flags = 0); #else using unique_fd = android::base::unique_fd; #endif template <typename T> Loading
adb/adb_utils.cpp +0 −4 Original line number Diff line number Diff line Loading @@ -274,10 +274,6 @@ std::string adb_get_android_dir_path() { return android_dir; } void AdbCloser::Close(int fd) { adb_close(fd); } int syntax_error(const char* fmt, ...) { fprintf(stderr, "adb: usage: "); Loading
debuggerd/Android.bp +4 −1 Original line number Diff line number Diff line Loading @@ -43,7 +43,7 @@ cc_library_shared { export_include_dirs: ["tombstoned/include"], } // Utility library to tombstoned and get an output fd. // Utility library to talk to tombstoned and get an output fd. cc_library_static { name: "libtombstoned_client_static", defaults: ["debuggerd_defaults"], Loading Loading @@ -166,6 +166,9 @@ cc_library_static { local_include_dirs: ["libdebuggerd/include"], export_include_dirs: ["libdebuggerd/include"], // Needed for private/bionic_fdsan.h include_dirs: ["bionic/libc"], static_libs: [ "libbacktrace", "libunwindstack", Loading