bionic/libc
Elliott Hughes 7086ad6919 Cache getpid.
In practice, with this implementation we never need to make a system call.
We get the main thread's tid (which is the same as our pid) back from
the set_tid_address system call we have to make during initialization.
A new pthread will have the same pid as its parent, and a fork child's
main (and only) thread will have a pid equal to its tid, which we get for
free from the kernel before clone returns.

The only time we'd actually have to make a getpid system call now is if
we take a signal during fork and the signal handler calls getpid. (That,
or we call getpid in the dynamic linker while it's still dealing with its
own relocations and hasn't even set up the main thread yet.)

Bug: 15387103
Change-Id: I6d4718ed0a5c912fc75b5f738c49a023dbed5189
2014-06-20 09:06:57 -07:00
..
arch-arm Cache getpid. 2014-06-20 09:06:57 -07:00
arch-arm64 Cache getpid. 2014-06-20 09:06:57 -07:00
arch-common/bionic Fixes for __cxa_finalize 2014-05-05 11:36:57 -07:00
arch-mips Cache getpid. 2014-06-20 09:06:57 -07:00
arch-mips64 Cache getpid. 2014-06-20 09:06:57 -07:00
arch-x86 Cache getpid. 2014-06-20 09:06:57 -07:00
arch-x86_64 Cache getpid. 2014-06-20 09:06:57 -07:00
bionic Cache getpid. 2014-06-20 09:06:57 -07:00
dns Somewhere, the declaration of _resolv_delete_cache_for_net went missing. 2014-06-12 18:40:06 -07:00
include Build tzcode with hidden visibility. 2014-06-19 14:49:30 -07:00
kernel Remove unused scripts. 2014-06-06 15:28:42 -07:00
private Build tzcode with hidden visibility. 2014-06-19 14:49:30 -07:00
stdio Expose __srefill for LP64 until we can fix the NDK. 2014-05-27 21:23:36 -07:00
stdlib Hide __atexit and remove __atexit_invalid. 2014-06-18 13:19:22 -07:00
tools Bring our "libresolv" stuff in line with glibc. 2014-06-13 11:50:07 -07:00
tzcode Build tzcode with hidden visibility. 2014-06-19 14:49:30 -07:00
unistd Hide non-standard syslog API. 2014-06-09 17:42:14 -07:00
upstream-dlmalloc Put all allocation functions into dispatch table. 2014-06-12 15:08:18 -07:00
upstream-freebsd Register _cleanup function with atexit 2014-05-15 13:05:21 -07:00
upstream-netbsd Get the full set of PRNG functions in <stdlib.h> 2014-06-12 14:37:31 -07:00
upstream-openbsd Hide _tolower_tab_ and _toupper_tab_ on LP64. 2014-06-18 13:11:07 -07:00
zoneinfo Upgrade to tzdata2014e. 2014-06-13 10:55:19 -07:00
Android.mk Cache getpid. 2014-06-20 09:06:57 -07:00
crt.mk Reconfig libc's Android.mk to build for multilib 2014-02-12 13:58:34 -08:00
MODULE_LICENSE_BSD auto import from //depot/cupcake/@135843 2009-03-03 19:28:35 -08:00
NOTICE Update the NOTICE files and improve the script slightly. 2014-05-05 16:23:15 -07:00
SYSCALLS.TXT Cache getpid. 2014-06-20 09:06:57 -07:00