summaryrefslogtreecommitdiff
path: root/libartbase/base/utils.cc
diff options
context:
space:
mode:
author Android Build Coastguard Worker <android-build-coastguard-worker@google.com> 2025-01-24 18:02:00 -0800
committer Android Build Coastguard Worker <android-build-coastguard-worker@google.com> 2025-01-24 18:02:00 -0800
commitb0e55cccb49d459cbf63d8add1b60aa18fba52a2 (patch)
treef2db9d456ce877a4cf9a2ffdfc3844ff29e8846c /libartbase/base/utils.cc
parent35f3a8a1c34cb233fee43885cf4626dfb45f6bbe (diff)
parentf3c480ffeb31af6c99858b5608ed610018062dae (diff)
Snap for 12969164 from f3c480ffeb31af6c99858b5608ed610018062dae to 25Q2-release
Change-Id: I2c4aabe02793d21090d9f1c9e3a04f3dd1933364
Diffstat (limited to 'libartbase/base/utils.cc')
-rw-r--r--libartbase/base/utils.cc6
1 files changed, 3 insertions, 3 deletions
diff --git a/libartbase/base/utils.cc b/libartbase/base/utils.cc
index aca7a0d47d..e77d37d29b 100644
--- a/libartbase/base/utils.cc
+++ b/libartbase/base/utils.cc
@@ -411,17 +411,17 @@ size_t GetOsThreadStat(pid_t tid, char* buf, size_t len) {
}
std::string GetOsThreadStatQuick(pid_t tid) {
+#if defined(__linux__)
static constexpr int BUF_SIZE = 100;
char buf[BUF_SIZE];
-#if defined(__linux__)
if (GetOsThreadStat(tid, buf, BUF_SIZE) == 0) {
snprintf(buf, BUF_SIZE, "Unknown state: %d", tid);
}
+ return buf;
#else
UNUSED(tid);
- strcpy(buf, "Unknown state"); // snprintf may not be usable.
+ return "Unknown state";
#endif
- return buf;
}
std::string GetOtherThreadOsStats() {