Revert "Stop using the cached pid."
Revert submission 34620896-getpid-always-syscall
Reason for revert: Droidmonitor created revert due to b/432461376. Will be verifying through ABTD before submission.
Fix: 432461376
Reverted changes: /q/submissionid:34620896-getpid-always-syscall
Change-Id: I2b17ab1fe3b2611a7babc1d195c5a45b19cac57a
diff --git a/libc/bionic/__libc_init_main_thread.cpp b/libc/bionic/__libc_init_main_thread.cpp
index 41a9a5a..2824340 100644
--- a/libc/bionic/__libc_init_main_thread.cpp
+++ b/libc/bionic/__libc_init_main_thread.cpp
@@ -38,6 +38,7 @@
#include "private/bionic_ssp.h"
#include "pthread_internal.h"
+extern "C" pid_t __getpid();
extern "C" int __set_tid_address(int* tid_address);
// Declared in "private/bionic_ssp.h".
@@ -78,7 +79,7 @@
__init_tcb(temp_tcb, &main_thread);
__init_tcb_dtv(temp_tcb);
__set_tls(&temp_tcb->tls_slot(0));
- main_thread.tid = getpid();
+ main_thread.tid = __getpid();
main_thread.set_cached_pid(main_thread.tid);
main_thread.stack_top = reinterpret_cast<uintptr_t>(args.argv);
main_thread.stack_bottom = 0;