diff options
author | 2023-11-01 13:49:41 -0700 | |
---|---|---|
committer | 2023-11-17 14:35:23 -0800 | |
commit | 639490b9ec6535cda7f24403237355c941e9fcb2 (patch) | |
tree | c3554b2f347302ee5ffb08ca0ee84b2fdb6f3db4 /libs/binder/UtilsHost.cpp | |
parent | 8f33166621a04db00e1c0ec6d67884bc0b7f8849 (diff) |
Binder unique_fd
Test: mma
Bug: 302723053
Change-Id: I52f14cadb027b3f854946d5315dce3d23aa21b19
Diffstat (limited to 'libs/binder/UtilsHost.cpp')
-rw-r--r-- | libs/binder/UtilsHost.cpp | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/libs/binder/UtilsHost.cpp b/libs/binder/UtilsHost.cpp index 3db038f03f..ae1a6c44d7 100644 --- a/libs/binder/UtilsHost.cpp +++ b/libs/binder/UtilsHost.cpp @@ -25,10 +25,13 @@ #include <log/log.h> +#include "FdUtils.h" #include "Utils.h" namespace android { +using android::binder::unique_fd; + CommandResult::~CommandResult() { if (!pid.has_value()) return; if (*pid == 0) { @@ -83,13 +86,13 @@ std::optional<CommandResult> execute(std::vector<std::string> argStringVec, argv.push_back(nullptr); CommandResult ret; - android::base::unique_fd outWrite; - if (!android::base::Pipe(&ret.outPipe, &outWrite)) { + unique_fd outWrite; + if (!binder::Pipe(&ret.outPipe, &outWrite)) { PLOGE("pipe() for outPipe"); return {}; } - android::base::unique_fd errWrite; - if (!android::base::Pipe(&ret.errPipe, &errWrite)) { + unique_fd errWrite; + if (!binder::Pipe(&ret.errPipe, &errWrite)) { PLOGE("pipe() for errPipe"); return {}; } @@ -120,7 +123,7 @@ std::optional<CommandResult> execute(std::vector<std::string> argStringVec, errWrite.reset(); ret.pid = pid; - auto handlePoll = [](android::base::unique_fd* fd, const pollfd* pfd, std::string* s) { + auto handlePoll = [](unique_fd* fd, const pollfd* pfd, std::string* s) { if (!fd->ok()) return true; if (pfd->revents & POLLIN) { char buf[1024]; |