diff options
author | android-build-team Robot <android-build-team-robot@google.com> | 2020-08-19 23:13:00 +0000 |
---|---|---|
committer | android-build-team Robot <android-build-team-robot@google.com> | 2020-08-19 23:13:00 +0000 |
commit | 9b0b94872f48fa9b05b15409c75cae6c61da3fc8 (patch) | |
tree | e3c3bbf680a570950f707b5b3f9777d09bdd23a5 | |
parent | ad1800a20c72141ccdfef4c50b343fcb8b1369bc (diff) | |
parent | 3eec5b9bee837e8a5454682902978ecfe5c1866d (diff) | |
download | libhidl-android11-qpr1-d-s1-release.tar.gz |
Snap for 6777077 from 3eec5b9bee837e8a5454682902978ecfe5c1866d to rvc-qpr1-releaseandroid-11.0.0_r31android-11.0.0_r29android-11.0.0_r28android-11.0.0_r27android-11.0.0_r26android-11.0.0_r24android-11.0.0_r23android-11.0.0_r22android-11.0.0_r21android-11.0.0_r20android-11.0.0_r19android-11.0.0_r18android11-qpr1-s2-releaseandroid11-qpr1-s1-releaseandroid11-qpr1-releaseandroid11-qpr1-d-s1-releaseandroid11-qpr1-d-release
Change-Id: Ifaafd0443f4f3246a60bc149baee5b6789873bf9
-rw-r--r-- | transport/ServiceManagement.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/transport/ServiceManagement.cpp b/transport/ServiceManagement.cpp index d7faa6d..7de5c78 100644 --- a/transport/ServiceManagement.cpp +++ b/transport/ServiceManagement.cpp @@ -87,7 +87,7 @@ static void waitForHwServiceManager() { static std::string binaryName() { std::ifstream ifs("/proc/self/cmdline"); std::string cmdline; - if (!ifs.is_open()) { + if (!ifs) { return ""; } ifs >> cmdline; @@ -106,7 +106,7 @@ static std::string packageWithoutVersion(const std::string& packageAndVersion) { return packageAndVersion.substr(0, at); } -static void tryShortenProcessName(const std::string& descriptor) { +__attribute__((noinline)) static void tryShortenProcessName(const std::string& descriptor) { const static std::string kTasks = "/proc/self/task/"; // make sure that this binary name is in the same package @@ -135,17 +135,17 @@ static void tryShortenProcessName(const std::string& descriptor) { if (dp->d_name[0] == '.') continue; std::fstream fs(kTasks + dp->d_name + "/comm"); - if (!fs.is_open()) { + if (!fs) { ALOGI("Could not rename process, failed read comm for %s.", dp->d_name); continue; } std::string oldComm; - fs >> oldComm; + if (!(fs >> oldComm)) continue; // don't rename if it already has an explicit name if (base::StartsWith(descriptor, oldComm)) { - fs.seekg(0, fs.beg); + if (!fs.seekg(0, fs.beg)) continue; fs << newName; } } @@ -157,7 +157,7 @@ namespace details { * Returns the age of the current process by reading /proc/self/stat and comparing starttime to the * current time. This is useful for measuring how long it took a HAL to register itself. */ -static long getProcessAgeMs() { +__attribute__((noinline)) static long getProcessAgeMs() { constexpr const int PROCFS_STAT_STARTTIME_INDEX = 21; std::string content; android::base::ReadFileToString("/proc/self/stat", &content, false); |