Migrate gettid to GetThreadId

Bug: 289414897
Test: it builds
Change-Id: If1214a181d4e9a193adf1bac0d35e7e3ac6c27db
This commit is contained in:
Tomasz Wasilczyk 2023-06-29 15:05:44 -07:00
parent f43e20c9b4
commit 0de2195738
3 changed files with 9 additions and 5 deletions

View File

@ -26,7 +26,7 @@ package {
cc_defaults {
name: "libstatspush_compat_defaults",
srcs: [
"statsd_writer.c",
"statsd_writer.cpp",
"stats_event_list.c",
"StatsEventCompat.cpp"
],

View File

@ -15,9 +15,9 @@
*/
#include "statsd_writer.h"
#include <android-base/threads.h>
#include <cutils/fs.h>
#include <cutils/sockets.h>
#include <cutils/threads.h>
#include <errno.h>
#include <fcntl.h>
#include <inttypes.h>
@ -108,7 +108,7 @@ static int statsdOpen() {
case -ECONNREFUSED:
case -ENOENT:
i = atomic_exchange(&statsdLoggerWrite.sock, ret);
/* FALLTHRU */
break;
default:
break;
}
@ -188,7 +188,7 @@ static int statsdWrite(struct timespec* ts, struct iovec* vec, size_t nr) {
* };
*/
header.tid = gettid();
header.tid = android::base::GetThreadId();
header.realtime.tv_sec = ts->tv_sec;
header.realtime.tv_nsec = ts->tv_nsec;
@ -272,7 +272,7 @@ static int statsdWrite(struct timespec* ts, struct iovec* vec, size_t nr) {
if (ret < 0) {
ret = -errno;
}
/* FALLTHRU */
break;
default:
break;
}

View File

@ -21,6 +21,8 @@
#include <stdatomic.h>
#include <sys/socket.h>
__BEGIN_DECLS
/**
* Internal lock should not be exposed. This is bad design.
* TODO: rewrite it in c++ code and encapsulate the functionality in a
@ -42,4 +44,6 @@ struct android_log_transport_write {
void (*noteDrop)(int error, int tag);
};
__END_DECLS
#endif // ANDROID_STATS_LOG_STATS_WRITER_H