Commit graph

1261 commits

Author SHA1 Message Date
Bruce Beare
0f2dc2b60c ptrace.c Fix source file format to unix from dos
Orig-Change-Id: Ia771b457eec7f9575d4631fb1c12a7062ebcc7de
Signed-off-by: Bruce Beare <bruce.j.beare@intel.com>
2011-07-07 22:46:15 +02:00
Jean-Baptiste Queru
681c4bd782 Merge b3773e9c
Change-Id: I5787d9ac5e745a08e1c891e9ce9efc4e7f97ace8
2011-07-06 13:00:05 -07:00
Jean-Baptiste Queru
cb5529efd8 Merge 784515ad
Change-Id: I3e5b691d008e9548f43339635bafdd95bc2f56fe
2011-07-06 12:59:55 -07:00
Jean-Baptiste Queru
c993768360 Revert "Revert "libc: Add logcat error message for memory corruption""
This reverts commit 368ee1e4d6.
2011-07-06 12:58:56 -07:00
David 'Digit' Turner
b3773e9cc8 am 9c95cbf7: Merge "Really fix the build."
* commit '9c95cbf75094c15d251bb3d57a55ce47d7c6c2c8':
  Really fix the build.
2011-07-06 10:27:49 -07:00
David 'Digit' Turner
c51871d4b2 Really fix the build.
libcutils/mspace.c includes libc/bionic/dlmalloc.c, we need to
take care of the fact that any internal C library function cannot
be used from it.

Change-Id: I0bc81ae090b7ac2d464f26b97fc6b94a08cdad9c
2011-07-06 19:02:15 +02:00
David 'Digit' Turner
784515ad93 am 01eb7f72: Merge "Fix broken build"
* commit '01eb7f72434830bb14cec906d885d2b7ee40d53b':
  Fix broken build
2011-07-06 09:08:47 -07:00
David 'Digit' Turner
a4824467c3 Fix broken build
Change-Id: Ia46b50aec51a55434c8828a73e07f4732f8f6c1c
2011-07-06 17:54:35 +02:00
Mathew Inwood
368ee1e4d6 Revert "libc: Add logcat error message for memory corruption"
This fixes the build.

This reverts commit 7708a89c60.
2011-07-06 16:51:54 +01:00
David 'Digit' Turner
877923d369 am d25ea49e: am b73b6783: Merge "libc: Add logcat error message for memory corruption"
* commit 'd25ea49e632c00d57d893563dac3f6dae5493b7e':
  libc: Add logcat error message for memory corruption
2011-07-06 07:53:10 -07:00
David 'Digit' Turner
d25ea49e63 am b73b6783: Merge "libc: Add logcat error message for memory corruption"
* commit 'b73b6783a595cf4b1cef6463c23317a8b417f1e9':
  libc: Add logcat error message for memory corruption
2011-07-06 07:46:40 -07:00
David 'Digit' Turner
7708a89c60 libc: Add logcat error message for memory corruption
Our dlmalloc implementation currently calls abort() when it detects
that the heap is corrupted, or that an invalid pointer is passed to
one of its functions.

The only way to detect this is because abort() will force-fully
crash the current program with a magic fault address of '0xdeadbaad'.

However, this is not really well documented, and a frequent topic
on the android-ndk forum (among others).

This change makes our dlmalloc code dump a simple message to the
log just before the abort() call (and hence before the stack trace)
to better help identify the problem.

Change-Id: Iebf7eb7fe26463ecadfaca8f247d237edb441e3c
2011-07-05 19:53:53 +02:00
Brian Carlstrom
1f8e2672a8 Implement getpwnam_r(3) and getpwuid_r(3).
These functions were already declared in <pwd.h>, but hadn't been implemented
yet.

git cherry-pick --no-commit 081504af74

Change-Id: I316acf4cffb9f2c6788e8e342aa620f9a00886d5
2011-05-27 00:52:21 -07:00
David Turner
54e494d909 am add0a45a: am e8f7e30b: Merge "bionic, libthread_db x86 fixes"
* commit 'add0a45a117f00553e79e7137d023416f9c0a54f':
  bionic, libthread_db x86 fixes
2011-05-11 13:11:56 -07:00
David Turner
add0a45a11 am e8f7e30b: Merge "bionic, libthread_db x86 fixes"
* commit 'e8f7e30b05c6ba103d64c1fb3cd5ef2b17be7aab':
  bionic, libthread_db x86 fixes
2011-05-10 17:19:13 -07:00
Bruce Beare
8e551a6319 bionic, libthread_db x86 fixes
Change-Id: I3be997f5f1f6a894a3c200d4f325cf3bfd428c66
Author: James Rose <james.rose@intel.com>
Signed-off-by: Bruce Beare <bruce.j.beare@intel.com>
2011-04-27 09:12:58 -07:00
David Turner
3be409a38c am 70245736: am aad685ce: am 4c090434: Merge "removing shadowing redeclaration of result"
* commit '702457363c2b1b01f0d9cb0093a48ce28753e275':
  removing shadowing redeclaration of result
2011-04-11 14:50:33 -07:00
David Turner
702457363c am aad685ce: am 4c090434: Merge "removing shadowing redeclaration of result"
* commit 'aad685ce001495260a3ce0c9d9284a6ee3ca09c0':
  removing shadowing redeclaration of result
2011-04-11 14:46:48 -07:00
Brad Fitzpatrick
5f133f3c4d am 31e2feee: am 2dc801f9: am 8da75ab8: Ignore property set timeouts.
* commit '31e2feeef3dffb49ce742a6ae1c9280c792c7c49':
  Ignore property set timeouts.
2011-04-01 12:27:07 -07:00
Brad Fitzpatrick
2dc801f9fc am 8da75ab8: Ignore property set timeouts.
* commit '8da75ab8936b0b7fcf8dd9a3befeb696ee6aa39d':
  Ignore property set timeouts.
2011-04-01 12:24:15 -07:00
Brad Fitzpatrick
8da75ab893 Ignore property set timeouts.
Change-Id: Ic3f6119398368ba047736370336d0260905abd40
2011-04-01 10:53:12 -07:00
Brad Fitzpatrick
099423ba1c am 23bc3ff7: Don\'t futex_wait spin when setting properties. Wait for socket close.
* commit '23bc3ff71dffdfec208aee05938e544c7cb3bc37':
  Don't futex_wait spin when setting properties. Wait for socket close.
2011-03-30 15:48:11 -07:00
Brad Fitzpatrick
23bc3ff71d Don't futex_wait spin when setting properties. Wait for socket close.
Depends on init change I8dd685ea

Bug: 4185486
Change-Id: I5a2dbc3b7be1759212d4a3988d9033b9b947a1db
2011-03-30 15:28:11 -07:00
Brad Fitzpatrick
bf90b57b44 Don't futex_wait spin when setting properties. Wait for socket close.
Depends on init change I8dd685ea

Bug: 4185486
Change-Id: I3e80cecfad8e072973003ec6f93146c5cad369ac
2011-03-30 14:25:27 -07:00
Christopher Schwardt
0f5587097b removing shadowing redeclaration of result
Change-Id: Ic1f86962dfb8620cf5c63ff4913b2f0bf908abb5
2011-03-22 15:35:40 +01:00
Carl Shapiro
2cc2b2be69 Add some missing includes.
Change-Id: Ieec623c06bc32ec78334f628af25b00c2bccd2e7
2011-03-21 20:01:03 -07:00
satok
0b3c5c50f7 do not merge. Move property setting from libcutils to bionic.
Backport I110b653a58f3

All the other property stuff is already here.  Property setting was
only in libcutils previously to leverage a utility function / constant
or two.

Unfortunately in the process of fixing a race condition we would've
had to do break abstraction boundaries and put some libc-internal
details into libcutils so instead of that we'll just move this
into bionic.

Along with Iee1ca9b7, this now passes:

$ adb shell am instrument -w -e class android.os.SystemPropertiesTest \
  com.android.frameworks.coretests.systemproperties/android.test.InstrumentationTestRunner

  Bug: 3511230

Change-Id: I1b588db3344169621e1279ecc0b660cf4e1015d7
2011-03-15 23:06:58 -07:00
satok
ec7e8cc9dd do not merge. Move property setting from libcutils to bionic.
Backport I110b653a58f3

All the other property stuff is already here.  Property setting was
only in libcutils previously to leverage a utility function / constant
or two.

Unfortunately in the process of fixing a race condition we would've
had to do break abstraction boundaries and put some libc-internal
details into libcutils so instead of that we'll just move this
into bionic.

Along with Iee1ca9b7, this now passes:

$ adb shell am instrument -w -e class android.os.SystemPropertiesTest \
  com.android.frameworks.coretests.systemproperties/android.test.InstrumentationTestRunner

  Bug: 3511230

Change-Id: I1b588db3344169621e1279ecc0b660cf4e1015d7
2011-03-15 11:02:26 +09:00
Brad Fitzpatrick
4399df8f2e Move property setting from libcutils to bionic.
All the other property stuff is already here.  Property setting was
only in libcutils previously to leverage a utility function / constant
or two.

Unfortunately in the process of fixing a race condition we would've
had to do break abstraction boundaries and put some libc-internal
details into libcutils so instead of that we'll just move this
into bionic.

Along with Iee1ca9b7, this now passes:

$ adb shell am instrument -w -e class android.os.SystemPropertiesTest \
  com.android.frameworks.coretests.systemproperties/android.test.InstrumentationTestRunner

Bug: 3511230
Change-Id: I110b653a58f312fbe069dca59892a877ae9bc911
2011-03-14 16:53:18 -07:00
Brad Fitzpatrick
f9316d37b4 am 08a4ce98: am 0c398985: Merge "[ENDIAN] Build md5 code correctly for bigendian targets"
* commit '08a4ce983ba14cef394e5198c9561349ec7fef44':
  [ENDIAN] Build md5 code correctly for bigendian targets
2011-03-14 11:50:56 -07:00
Paul Lind
865e3789dd [ENDIAN] Build md5 code correctly for bigendian targets
Signed-off-by: Raghu Gandham <raghu@mips.com>
2011-03-10 11:13:50 -08:00
David 'Digit' Turner
81d79f9fb3 am 962dcb22: am fed58049: Merge "libc: Fix PTHREAD_RWLOCK_INITIALIZER"
* commit '962dcb22218a1a6d4ebd05e4fc4a69875d037234':
  libc: Fix PTHREAD_RWLOCK_INITIALIZER
  Proxy getnameinfo through netd
  Updated gcc 4.4.3 IA toolchain doesn't require the .ctors list
  Convert cname lenght before use
2011-03-10 01:55:35 -08:00
Bruce Beare
48e1feaa9d Updated gcc 4.4.3 IA toolchain doesn't require the .ctors list
Change-Id: Ia840a19a45257128eccdcf25d105f500f2d90741
Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Signed-off-by: Bruce Beare <bruce.j.beare@intel.com>
2011-02-16 17:50:23 -08:00
Andy McFadden
4ce737f5df Added _memmove_words
Added a memmove() variant for Dalvik's System.arraycopy()
implementation.  It guarantees 16-bit or 32-bit atomicity depending
on the alignment of the arguments.

Bug 3398352

Change-Id: Ie7bd246305ef0ff8290513663327c5b81680368d
2011-02-04 14:49:49 -08:00
Glenn Kasten
a37cf34ede Bug 3330205 Reentrant MD5
Change-Id: I4c8e4a8f3ef4cdaac50f32d9e55accb16133ab35
2011-01-09 12:37:26 -08:00
David 'Digit' Turner
5c8c00a95a libc: Fix the definition of SIGRTMAX
After this change, SIGRTMAX will be set to 64 (instead of 32 currently).
Note that this doesn't change the fact that our sigset_t is still defined
as a 32-bit unsigned integer, so most functions that deal with this type
won't support real-time signals though.

Change-Id: Ie1e2f97d646f1664f05a0ac9cac4a43278c3cfa8
2010-12-20 15:58:06 +01:00
David 'Digit' Turner
72e6fd4242 <sched.h>: Add sched_getcpu() and cpu_set_t
This adds the cpu_set_t type definition and related functions
and macros used to handle CPU thread affinity.

  sched_getcpu()
  sched_setaffinity()
  sched_getaffinity()

Change-Id: If382ecafde8926341a88478062b275553645065b
2010-12-06 13:42:54 +01:00
David 'Digit' Turner
6481b91520 <time.h>: Add timegm(), timelocal() and others.
Add timegm(), timelocal(), time2posix() and posix2time() to the
C library.

Change-Id: I34d5771ed83dd994870a5ca58a511d01898b1ffb
2010-12-06 12:25:52 +01:00
Elliott Hughes
ff590cadc2 Use a modern chdir(2)-free realpath(3) implementation.
(This is the current OpenBSD implementation.)

Bug: 3055824, 2281992
Change-Id: Iafa8f78e8d6e44c036a547c7210a13d559b7483a
2010-11-04 17:53:06 -07:00
Jean-Baptiste Queru
fa8fef9506 am f2c05baa: am 96c03c7d: Merge "Remove duplicated _rand48 implementation. Use stdlib version instead"
Merge commit 'f2c05baac40bceb754ac69a38b83250c3a5aaddd'

* commit 'f2c05baac40bceb754ac69a38b83250c3a5aaddd':
  Remove duplicated _rand48 implementation. Use stdlib version instead
2010-10-25 18:00:00 -07:00
Jean-Baptiste Queru
f2c05baac4 am 96c03c7d: Merge "Remove duplicated _rand48 implementation. Use stdlib version instead"
Merge commit '96c03c7dcc8cad59f2b8f3e6fef6a77a43750756' into gingerbread-plus-aosp

* commit '96c03c7dcc8cad59f2b8f3e6fef6a77a43750756':
  Remove duplicated _rand48 implementation. Use stdlib version instead
2010-10-25 17:32:13 -07:00
Jim Huang
70478100d5 Remove duplicated _rand48 implementation. Use stdlib version instead
Originally, there are _rand48 (in libc/bionic/_rand48.c) and __rand48
(in libc/stdlib/_rand48.c) implemented in bionic.  Besides the naming,
the functionality is identical.  This patch removes the duplicated
_rand48.  Also, drand48 and erand48 are modified accordingly.

Change-Id: Ie5761a0a97f45df8538222a77edacb7c3e0125d7
2010-10-25 16:27:47 -07:00
David 'Digit' Turner
209cf82593 am f7ad13b0: am 1df986c2: libc: fix executable destruction support.
Merge commit 'f7ad13b0ce5ad2d2f0340c066b09eb8174877739'

* commit 'f7ad13b0ce5ad2d2f0340c066b09eb8174877739':
  libc: fix executable destruction support.
2010-10-21 13:50:42 -07:00
Jean-Baptiste Queru
51a4f7872a am 001a3218: am 4afe0f47: Merge "time64: make helper functions static"
Merge commit '001a321897d0f053b87799dafe17a39036b72470'

* commit '001a321897d0f053b87799dafe17a39036b72470':
  time64: make helper functions static
2010-10-21 13:48:17 -07:00
Jean-Baptiste Queru
f97ce8cb7b am 6ac5660e: am ade2a929: Merge "bionic: stubs: Make internal symbol static"
Merge commit '6ac5660e1c8fc9934d11ed675771063624ac1b4b'

* commit '6ac5660e1c8fc9934d11ed675771063624ac1b4b':
  bionic: stubs: Make internal symbol static
2010-10-21 13:48:14 -07:00
Jean-Baptiste Queru
d3ecb3cd05 am 1203671b: am 2215c113: Merge "pthread-timers: Hide internal symbol __timer_table_start_stop"
Merge commit '1203671b47246efd20279a39ab9bd7ea934ae8dc'

* commit '1203671b47246efd20279a39ab9bd7ea934ae8dc':
  pthread-timers: Hide internal symbol __timer_table_start_stop
2010-10-21 13:48:11 -07:00
Jean-Baptiste Queru
d445a2b275 am bcd94044: am 847223de: Merge "__set_errno: Hide internal symbol __set_syscall_errno"
Merge commit 'bcd940444513a24268d5f9c9a6186274cf09c8dd'

* commit 'bcd940444513a24268d5f9c9a6186274cf09c8dd':
  __set_errno: Hide internal symbol __set_syscall_errno
2010-10-21 09:54:38 -07:00
David 'Digit' Turner
f7ad13b0ce am 1df986c2: libc: fix executable destruction support.
Merge commit '1df986c21ee52c6756846b4a5e45cb316f772112' into gingerbread-plus-aosp

* commit '1df986c21ee52c6756846b4a5e45cb316f772112':
  libc: fix executable destruction support.
2010-10-21 09:43:19 -07:00
David 'Digit' Turner
1df986c21e libc: fix executable destruction support.
This change allows an executable to call its destructor functions
(declared with __attribute__((destructor))) to be properly called
when it normally exits.

Note that this is different from calling the destructors of a shared
library when it is unloaded with dlclose() or through program exit,
which are already supported.

Bug: 3106500
Change-Id: I1412ef5407f13b613fc6cb6103e0a691dbee4b1a
2010-10-21 04:16:50 +02:00
Jean-Baptiste Queru
001a321897 am 4afe0f47: Merge "time64: make helper functions static"
Merge commit '4afe0f4724b3d7180d67eae29bfdad5f815857cb' into gingerbread-plus-aosp

* commit '4afe0f4724b3d7180d67eae29bfdad5f815857cb':
  time64: make helper functions static
2010-10-20 18:57:55 -07:00
Jean-Baptiste Queru
6ac5660e1c am ade2a929: Merge "bionic: stubs: Make internal symbol static"
Merge commit 'ade2a92991d1c7edc32c4a300bd83d622fa1567d' into gingerbread-plus-aosp

* commit 'ade2a92991d1c7edc32c4a300bd83d622fa1567d':
  bionic: stubs: Make internal symbol static
2010-10-20 18:57:53 -07:00
Jean-Baptiste Queru
1203671b47 am 2215c113: Merge "pthread-timers: Hide internal symbol __timer_table_start_stop"
Merge commit '2215c11325d0af07cde67bfee7bafa09ee5556a7' into gingerbread-plus-aosp

* commit '2215c11325d0af07cde67bfee7bafa09ee5556a7':
  pthread-timers: Hide internal symbol __timer_table_start_stop
2010-10-20 18:57:51 -07:00
Jean-Baptiste Queru
4afe0f4724 Merge "time64: make helper functions static" 2010-10-20 18:54:17 -07:00
Jean-Baptiste Queru
ade2a92991 Merge "bionic: stubs: Make internal symbol static" 2010-10-20 18:52:10 -07:00
Jean-Baptiste Queru
2215c11325 Merge "pthread-timers: Hide internal symbol __timer_table_start_stop" 2010-10-20 18:49:51 -07:00
Jean-Baptiste Queru
bcd9404445 am 847223de: Merge "__set_errno: Hide internal symbol __set_syscall_errno"
Merge commit '847223de9ceff6db468a8246792542517a12d39f' into gingerbread-plus-aosp

* commit '847223de9ceff6db468a8246792542517a12d39f':
  __set_errno: Hide internal symbol __set_syscall_errno
2010-10-19 15:22:17 -07:00
Jim Huang
cd9c98dfda __set_errno: Hide internal symbol __set_syscall_errno
Change-Id: I21e7ef6bf0bca288069275add43bd53294c0760d
2010-10-15 03:07:22 +08:00
Jim Huang
c9a41a6997 pthread-timers: Hide internal symbol __timer_table_start_stop
Change-Id: If99c5816fe6fa9107aa6bef4697048fabf92283f
2010-10-15 02:28:22 +08:00
Jim Huang
c940945155 bionic: stubs: Make internal symbol static
Thread-specific state for the stubs functions should not be exposed to
applications.

Change-Id: I4d35dab6009dab8db7781671ac5cc9b5f6904e84
2010-10-15 02:23:00 +08:00
Jim Huang
8b2707a6a0 time64: make helper functions static
Change-Id: I98d9a5f736482e52904228c171a1bdefd2f5b213
2010-10-15 02:16:16 +08:00
tedbo
9d8be5485c get_malloc_leak_info: Fix assumption that totalMemory out parameter was initialized to zero.
The get_malloc_leak_info() currently asssumes that the totalMemory out parameter
was pre-initialized to zero before the routine is called. If it is not then the
accumulated totalMemory value will be incorrect. It is likely that many callers
will simply allocate totalMemory on the stack with no initialization and assume
that get_malloc_leak_info will set the proper value.

As an example, the caller in frameworks/base/core/jni/android_os_Debug.cpp
calls get_malloc_leak_info() with the address uninitiazed stack variable
for totalMemory. It is probably best to fix this in get_malloc_leak_info.

Change-Id: I84c927c3781419585794726115b7d34d8fdd24ae
2010-10-05 13:23:28 -07:00
Andy McFadden
b1c9cc2f2d Add memory barriers to pthread_once.
The implementation was using a double-checked locking approach that
could break on SMP.

In addition to the barriers I also switched to a volatile pointer.  I
don't think this will matter unless gcc can conclude that _normal_lock
can't affect *once_control, but I figured it was better to be safe.
(It seems to have no impact whatsoever on the generated code.)

Bug 3022795.

Change-Id: Ib91da25d57ff5bee4288526e39d457153ef6aacd
2010-09-23 12:30:12 -07:00
Wink Saville
6dbfddfe4e am b9e49ad5: Use a recursive lock for pthread_once. DO NOT MERGE.
Merge commit 'b9e49ad56e5776ace7c6eab2e997d5b7acb16792' into gingerbread-plus-aosp

* commit 'b9e49ad56e5776ace7c6eab2e997d5b7acb16792':
  Use a recursive lock for pthread_once. DO NOT MERGE.
2010-09-23 01:43:43 -07:00
Wink Saville
b9e49ad56e Use a recursive lock for pthread_once. DO NOT MERGE.
Backport change I9fc8b790 from Master to Gingerbread

Change-Id: I5cf48fcd4efb7991ed82f87d9365c19655dc9b7f
2010-09-22 14:51:53 -07:00
Andy McFadden
e2ac89869f Add a memory barrier to cond var signaling.
This adds an explicit memory barrier to condition variable signaling.
It's a little murky as to whether it's strictly required, but it seems
like a wise thing to do.

Change-Id: Id0faa542d61e4b8ffa775e4adf68e4d7471f4fb7
2010-09-02 13:34:53 -07:00
Christopher Tate
caaf7ecd1c am 1ff91085: am 52e7d3d9: Bulletproof leak dump against null hash entries
Merge commit '1ff910858c8ae5863761101c673a196a6a16bca3'

* commit '1ff910858c8ae5863761101c673a196a6a16bca3':
  Bulletproof leak dump against null hash entries
2010-08-09 19:57:25 -07:00
Christopher Tate
1ff910858c am 52e7d3d9: Bulletproof leak dump against null hash entries
Merge commit '52e7d3d91ab6a5bab77c5dfb1ed47381fd52f9ba' into gingerbread-plus-aosp

* commit '52e7d3d91ab6a5bab77c5dfb1ed47381fd52f9ba':
  Bulletproof leak dump against null hash entries
2010-08-09 19:53:32 -07:00
Christopher Tate
52e7d3d91a Bulletproof leak dump against null hash entries
Previously, the malloc leak checking code would crash in qsort()
if null entries existed in its bookkeeping table.  This change
makes the comparison function detect null entries and sort them
to the end safely.

Change-Id: I88244a7df1e289dd9d7992ce29606d505bd63079
2010-08-09 13:43:46 -07:00
Jean-Baptiste Queru
6b9d2d6839 am 6d4d8cb7: resolved conflicts for merge of 4f086aeb to gingerbread-plus-aosp
Merge commit '6d4d8cb79c5578d33ab17806d67b1e53a730fbc3'

* commit '6d4d8cb79c5578d33ab17806d67b1e53a730fbc3':
  Implemented pthread_atfork()
2010-07-23 15:04:24 -07:00
Jean-Baptiste Queru
6d4d8cb79c resolved conflicts for merge of 4f086aeb to gingerbread-plus-aosp
Change-Id: Ice2a6d41a7e9d04eca02e15ed189d648d61b5801
2010-07-23 13:53:19 -07:00
Matt Fischer
4f086aeb4a Implemented pthread_atfork()
Change-Id: Ie6c0bf593315d3507b3c4a6c8903a74a1fa053db
2010-07-23 13:10:16 -07:00
The Android Open Source Project
fb6907d39c am 0e78f786: merge from open-source master
Merge commit '0e78f786777a04af498b43564a8d6ed8e15e8940'

* commit '0e78f786777a04af498b43564a8d6ed8e15e8940':
  Change-Id: I68cc462aeb2460345a53bdb9941ce4bfc10456fb
2010-07-09 10:54:06 -07:00
The Android Open Source Project
0e78f78677 merge from open-source master
Change-Id: Id84ff747889d6f2c15c0510263e32fdfdd18dbed
2010-07-09 10:48:45 -07:00
Jean-Baptiste Queru
fc6d95b10e Merge "Change-Id: I68cc462aeb2460345a53bdb9941ce4bfc10456fb bionic: fix clearenv() compiler warning and related comment typos" 2010-07-08 15:38:13 -07:00
David 'Digit' Turner
cf38531741 resolved conflicts for merge of 2576abf0 to master
Change-Id: Ibd3ed11f3cc27ff12c0464b0f56d7057be6a7b85
2010-07-02 15:22:19 -07:00
David 'Digit' Turner
519763265e libc: Fix sem_post() implementation to wake up all waiting threads.
This also allows us to optimize the case where we increment an
uncontended semaphore (no need to call futex_wake() then).

Change-Id: Iad48efe8551dc66dc89d3e3f18c001e5a6c1939f
2010-07-02 15:09:57 -07:00
David 'Digit' Turner
3b43f87d29 Allow dlclose() to properly call static C++ destructors.
With this patch _and_ an upcoming build/ patch, the destruction
of static C++ objects contained in shared libraries will happen
properly when dlclose() is called.

Note that this change introduces crtbegin_so.S and crtend_so.S which
are currently ignored by the build system.

+ move definition of __dso_handle to the right place
(before that, all shared libraries used the __dso_handle
global variable from the C library).

Note that we keep a 'weak' __dso_handle in aeabi.c to avoid
breaking the build until the next patch to build/core/combo/
appears. We will be able to remove that later.

+ move bionic/aeabi.c to arch-arm/bionic/ (its proper location)

NOTE: The NDK will need to be modified to enable this feature in
         the shared libraries that are generated through it.

Change-Id: I99cd801375bbaef0581175893d1aa0943211b9bc
2010-07-01 23:09:28 -07:00
David 'Digit' Turner
4e6043a355 am 7d1d98b9: am a02b93bd: libc: add sanity checks to pthread_mutex_destroy()
Merge commit '7d1d98b97e947de22aff4c0b67eec7ae68c822ee'

* commit '7d1d98b97e947de22aff4c0b67eec7ae68c822ee':
  libc: add sanity checks to pthread_mutex_destroy()
2010-06-29 12:55:34 -07:00
David 'Digit' Turner
a02b93bd75 libc: add sanity checks to pthread_mutex_destroy()
Change-Id: Iddb2204fa792fa9aca5f19838926dddbb09b74a2
2010-06-28 14:20:22 -07:00
Wink Saville
ccc3d1eea1 Use a recursive lock for pthread_once.
bug: 2292366
Change-Id: I9fc8b790dcfcb30ca94a0beb340d43fe5cd6c22e
2010-06-28 11:41:16 -07:00
Chris Peterson
2bf607d599 Change-Id: I68cc462aeb2460345a53bdb9941ce4bfc10456fb
bionic: fix clearenv() compiler warning and related comment typos
2010-06-27 20:53:04 -07:00
David 'Digit' Turner
50ace4fec5 Remove compiler warnings when building Bionic.
Also add missing declarations to misc. functions.
Fix clearerr() implementation (previous was broken).
Handle feature test macros like _POSIX_C_SOURCE properly.

Change-Id: Icdc973a6b9d550a166fc2545f727ea837fe800c4
2010-06-22 17:51:41 -07:00
David 'Digit' Turner
6a9b888d7c Allow static C++ destructors to be properly called on dlclose().
With this patch, _and_ an upcoming build/ patch, the destruction
of static C++ objects contained in shared libraries will happen
properly when dlclose() is called.

Note that this change introduces crtbegin_so.S and crtend_so.S which
are currently ignored by the build system.

+ move definition of __dso_handle to the right place
  (before that, all shared libraries used the __dso_handle
   global variable from the C library).

  Note that we keep a 'weak' __dso_handle in aeabi.c to avoid
  breaking the build until the next patch to build/core/combo/
  appears. We will be able to remove that later.

+ move bionic/aeabi.c to arch-arm/bionic/ (its proper location)

Change-Id: Ie771aa204e3acbdf02fd30ebd4150373a1398f39
NOTE: The NDK will need to be modified to enable this feature in
      the shared libraries that are generated through it.
2010-06-18 16:07:10 -07:00
David 'Digit' Turner
6c8a2f2a5b libc: remove cutils dependencies
We simply copy the stuff we need from cutils headers.

A future patch will change cutils to include the private <bionic_atomic_inline.h>

Change-Id: Ib6fd9a03bc9e337ce867bd606dc94c2b4438480a
2010-06-11 13:49:09 -07:00
David 'Digit' Turner
6304d8b218 Use private futexes for semaphores, unless they are initialized with pshared != 0.
Change-Id: I534e36a7171cd37037ae03b910ba71ea6968286d
Note: previously, sem_init() would return an error if pshared != 0.
2010-06-08 17:04:49 -07:00
Jean-Baptiste Queru
a8a2148863 resolved conflicts for merge of 7b6e6fa5 to kraken
Change-Id: I2b9b80a7fa32c56be2b85ff8be0d6e7ac1848afe
2010-06-03 15:05:04 -07:00
The Android Open Source Project
7b6e6fa572 merge from open-source master
Change-Id: Ib7fc9c6f79f9b13e2175da137005d8968ea85eaf
2010-06-03 14:39:20 -07:00
Andy McFadden
fcd00ebbdf Atomic/SMP update, part 3.
Update ARM atomic ops to use LDREX/STREX.  Stripped out #if 0 chunk.

Insert explicit memory barriers in pthread and semaphore code.

For bug 2721865.

Change-Id: I0f153b797753a655702d8be41679273d1d5d6ae7
2010-05-28 16:12:01 -07:00
André Goddard Rosa
78c1c04ced pthread: introduce pthread_setname_np() as a mean to give names to threads
... so that each cloned process at the kernel level can be named
independently. Tools like 'top' can display the CPU/memory statistics
for each process's thread if "Show Threads" mode is on.

With this function in place, we can convert dalvik/Thread.c setThreadName()
function over this function. This feature ought to be provided by the
underlying C library and not coded directly in Dalvik.

Change-Id: Ifa997665dbaa114e0b126f8c667708be9a4137fd
Signed-off-by: André Goddard Rosa <andre.goddard@gmail.com>
2010-05-19 23:17:16 -03:00
David 'Digit' Turner
8a1d2cf142 Add pthread_rwlock_t implementation to the C library (DO NOT MERGE)
Change-Id: I756d8c26afc37cd7b71117ddbaa02a2cb40fdecb
2010-05-19 14:53:18 -07:00
The Android Open Source Project
f450fa5f99 merge from open-source master
Change-Id: If02d33af51017dbd85e91c79ac2e848eda6cf253
2010-05-03 15:33:05 -07:00
David Turner
0be7eda75a Merge "Fix log channel initialization at bionic/logd_write.c." 2010-05-01 15:31:39 -07:00
André Goddard Rosa
5751c54bf1 bionic: add missing NULL check from memory allocation on record_backtrace()
Signed-off-by: André Goddard Rosa <andre.goddard@gmail.com>

Change-Id: I739c63c5a7344fff1775580044dc647edf246ebf
2010-04-29 07:37:42 -07:00
The Android Open Source Project
95faecefde merge from open-source master
Change-Id: If77618a329fc7b497c44c2585e644bc50e7e1406
2010-04-08 11:11:53 -07:00
André Goddard Rosa
350bb359fa bionic: fix memory leak in get_malloc_leak_info() error path
Signed-off-by: André Goddard Rosa <andre.goddard@gmail.com>
2010-03-29 21:21:26 -03:00
André Goddard Rosa
3f61212781 bionic: clear only the part of the buffer which is not overwritten afterward
Change-Id: I5ddd93f0557e5a7401460dc9fc8a55b330a79c3a
Signed-off-by: André Goddard Rosa <andre.goddard@gmail.com>
2010-03-28 21:32:36 -03:00
David 'Digit' Turner
5207d78c32 Fix typo that broke recursive mutexes implementation.
Change-Id: I832901604b487c6a50304c311b5ba135e153530d
2010-03-23 05:30:55 -07:00
David 'Digit' Turner
b5e4a41606 pthread: Use private futexes by default in condition variables
Now that the system properly uses shared condvars when needed, we
can enable the use of private futexes for them too.

Change-Id: Icf8351fc0a2309f764cba45c65bc3af047720cdf
2010-03-22 17:31:50 -07:00
The Android Open Source Project
377d4c979d merge from open-source master
Change-Id: I70266ee8c520b216773f267e46c8273d2334c31d
2010-03-22 15:55:09 -07:00
David 'Digit' Turner
88f06cd84a Use private futexes for pthread_mutex_t.
This does not change the implementation of conditional variables
since we're waiting for other system components to properly use
pthread_condattr_init/setpshared before that.

Also remove an obsolete x86 source file.

Change-Id: Ia3e3fbac35b87a534fb04d4381c3c66b975bc8f7
2010-03-18 17:13:41 -07:00
David Turner
1825fb5d5f Merge "bionic: on pthread_join(), avoid extra check in case we find the thread" 2010-03-18 16:42:49 -07:00
David Turner
c0e464268d Merge "bionic: ftell() returns a long, not an int" 2010-03-18 16:35:42 -07:00
David 'Digit' Turner
ee7b077abf Add pthread_condattr_init/destroy/setpshared/getpshared
Note that this does not change the implementation of conditional variables
which still use shared futexes, independent on the flags being selected.

This will be fixed in a later patch, once our system is modified to use
pthread_condattr_setpshared(attr, PTHREAD_PROCESS_SHARED) properly.

Change-Id: I935de50964cd41f97a13dbfd6626d3407b0406c3
2010-03-18 14:07:42 -07:00
David 'Digit' Turner
40e6b82286 Fix indentation in pthread mutex implementation.
This is preliminary work to simplify later changes to support
private futexes.

Change-Id: I06750936a93747a5e3f5a10228cbdc29e39c528c
2010-03-17 11:25:46 -07:00
David Turner
a9c41a8e0a Merge "bionic: remove unneeded variable from chk_realloc()" 2010-03-16 17:26:44 -07:00
Fabrice Di Meglio
8641833b62 Revert "bionic: pthread: use private futexes by default for mutexes and condvars"
This reverts commit ba9c6f0989.
2010-03-11 14:47:47 -08:00
David 'Digit' Turner
ba9c6f0989 bionic: pthread: use private futexes by default for mutexes and condvars
Private futexes are a recent kernel addition: faster futexes that cannot be
shared between processes. This patch uses them by default, unless the PROCESS_SHARED
attribute flag is used when creating a mutex and/or conditional variable.

Also introduces pthread_condattr_init/destroy/setpshared/getpshared.

Change-Id: I3a0e2116f467072b046524cb5babc00e41057a53
2010-03-11 11:48:38 -08:00
Mike Chan
9f6915631b bonic: libc: cpuacct support for setuid functions
Any of the setuid functions now updates /acct/uid/ with its own tid
before changing users. This is so we can properly account for cpu time
per uid.

Change-Id: I34186cf4d5228cac8439e582a9e26c01ef3011e4
Signed-off-by: Mike Chan <mike@android.com>
2010-03-02 18:18:04 -08:00
David 'Digit' Turner
8f8b5310d2 Fix pthread_sigmask() to return correct error values.
Before that, it returned -1 on error and set errno (not Posix)
After the patch, it returns the error code and leaves errno untouched.
2010-03-01 11:30:40 -08:00
Vladimir Chtchetkine
b55462328f Merge "Merge memory checking functionality from sandbox" 2010-02-17 13:43:15 -08:00
Vladimir Chtchetkine
75fba6888a Merge memory checking functionality from sandbox
Change-Id: I304c789a752c9f4af4944ca14b9bf1e7644da15a
2010-02-16 11:43:18 -08:00
David 'Digit' Turner
4f920f685b Fix sem_post() behaviour to wake up multiple waiting threads. 2010-02-12 12:50:32 -08:00
David 'Digit' Turner
294dd0b86b Fix sem_trywait() implementation + update changelog. 2010-02-12 12:18:37 -08:00
David 'Digit' Turner
1dcf07a84c Fix android_id_from_name to accept "app_0" as a valid ID.
This fixes getpwnam and getpwgrp which returned NULL for "app_0".
"app_0" corresponds to uid/gid 10000 and is perfectly valid.
2010-02-12 11:35:38 -08:00
André Goddard Rosa
699237baf5 bionic: equalize the <unknown> program name between ssp.c and libc_init_common.c
... for the consistency sake.

Signed-off-by: André Goddard Rosa <andre.goddard@gmail.com>
2010-02-05 17:48:07 -02:00
André Goddard Rosa
291100c795 bionic: remove unneeded variable from chk_realloc()
... and simplify the generated code.

Signed-off-by: André Goddard Rosa <andre.goddard@gmail.com>
2010-02-05 16:32:56 -02:00
André Goddard Rosa
a28336c735 bionic: on pthread_join(), avoid extra check in case we find the thread
... by using similar logic as used in pthread_detach().

Signed-off-by: André Goddard Rosa <andre.goddard@gmail.com>
2010-02-05 16:21:07 -02:00
André Goddard Rosa
3b06c128cf bionic: ftell() returns a long, not an int
Signed-off-by: André Goddard Rosa <andre.goddard@gmail.com>
2010-02-05 16:05:52 -02:00
David 'Digit' Turner
97cf7f3394 Implement clone() C library function properly.
Only provide an implementation for ARM at the moment, since
it requires specific assembly fragments (the standard syscall
stubs cannot be used because the child returns in a different
stack).
2010-01-25 11:18:30 -08:00
Colin Cross
fc10b24acc Add implementation of fdprintf, clearenv, and stubs for ttyname_r, *usershell
Change-Id:	I5fe7e8b6ee5edbb49e707c3b6737a58563781fa3
2010-01-15 16:52:35 -08:00
Colin Cross
64ceac3f49 Add fts, err, and sys/queue for grep
Change-Id:	Id47514a1812d828e95efa2fab0e9c15c5b682b58
2010-01-15 15:57:02 -08:00
Alexey Tarasov
c22da7ed32 Fix log channel initialization at bionic/logd_write.c.
log_channel_t contains fd member, which is file descriptor for
exact logging channel. change cc05d12716
lacks initialization of this member in __write_to_log_init(), thus
logging code is not working, although not crashable.

Additional details may be found in comments here:
http://review.source.android.com/5617
2009-12-03 11:37:22 +10:00
Andy McFadden
5cdb2b73d2 Fix libc logging implementation.
The file descriptor wasn't getting set, so the writev() call was
silently failing.

There's a parallel implementation over in system/core/liblog, but it's
still using the old approach and didn't have this problem.
2009-11-30 17:09:45 -08:00
Vladimir Chtchetkine
fdfa16776c am 362b2aab: Merge change Ib4550a04 into eclair-mr2
Merge commit '362b2aabee2dd04e04a3ad9c09f0ad0212569be4' into eclair-mr2-plus-aosp

* commit '362b2aabee2dd04e04a3ad9c09f0ad0212569be4':
  Split libc_debug.so into two .so modules loaded on demand from libc.so
2009-11-19 11:28:22 -08:00
Vladimir Chtchetkine
b74ceb25aa Split libc_debug.so into two .so modules loaded on demand from libc.so
This change is intended to eliminate need to replace libc.so with libc_debug.so in order to enablememory allocation debugging.
This is also the first step towards implementing extended memoryallocation debugging using emulator's capabilities in monitoring memory access.
2009-11-18 10:36:25 -08:00
Jean-Baptiste Queru
95604529ec merge from eclair 2009-11-15 12:05:31 -08:00
Jean-Baptiste Queru
194d3fa048 eclair snapshot 2009-11-12 18:45:14 -08:00
David 'Digit' Turner
7e5e9f4270 am bc10cd29: Fix a typo that resulted in a crash in the boot sequence
Merge commit 'bc10cd2900cdb7fed077163b6a33e0f8572b2b19' into eclair-plus-aosp

* commit 'bc10cd2900cdb7fed077163b6a33e0f8572b2b19':
  Fix a typo that resulted in a crash in the boot sequence
2009-09-23 16:09:39 -07:00
David 'Digit' Turner
bc10cd2900 Fix a typo that resulted in a crash in the boot sequence 2009-09-23 15:56:50 -07:00
David 'Digit' Turner
9641805419 am d154954f: Merge change 26419 into eclair
Merge commit 'd154954f02691618fdf73a5a97336e64cad37af0' into eclair-plus-aosp

* commit 'd154954f02691618fdf73a5a97336e64cad37af0':
  Add pthread_mutex_lock_timeout_np
2009-09-23 12:20:52 -07:00
David 'Digit' Turner
3f56b7f65a Add pthread_mutex_lock_timeout_np
This is used to perform a mutex lock for a given amount of
milliseconds before giving up. Using the _np prefix since this
is absolutely not portable.

Also remove a compiler warning in pthread_attr_getstackaddr
2009-09-22 15:17:50 -07:00
Jean-Baptiste Queru
895244b2ab merge from open-source master 2009-09-16 16:21:35 -07:00
Matthieu CASTET
a4e67f4512 Remove code duplication for pthread_cond_timeout_np : use __pthread_cond_timedwait_relative helper 2009-09-14 09:19:42 -07:00
Jean-Baptiste Queru
00fb8b45d9 merge from open-source master 2009-09-01 08:27:42 -07:00
Alexey Tarasov
cc05d12716 Changed logging functions in bionic/logd_write.c.
Main differences from original code:
1. now log channel for LOG_ID_MAIN may exist even if LOG_ID_RADIO
   facility failed.
2. __write_to_log_null() now acts as always successful function.
3. it's more simplier to add new logging channels now

ammended commit fixes my typo on line 130
2009-08-25 10:27:26 -07:00
Jean-Baptiste Queru
44ac5d5d93 merge from open-source master 2009-08-07 17:04:35 -07:00
Android Code Review
bb08537104 Merge change 10057
* changes:
  Add mspace_merge_objects
2009-08-07 16:43:33 -07:00
Andy McFadden
e40fb3d68f am 39f3745c: Restore malloc debug.
Merge commit '39f3745cf30efe38482ffead1c32f4e62f6fe32e'

* commit '39f3745cf30efe38482ffead1c32f4e62f6fe32e':
  Restore malloc debug.
2009-07-21 16:40:00 -07:00
Andy McFadden
39f3745cf3 Restore malloc debug.
Some libc changes were preventing the initialization call from being made.
The basic problem appears to be that libc_init_common.c is only built once,
and it's only built for the non-debug libc.
2009-07-21 15:44:23 -07:00
David 'Digit' Turner
d5b3513cca am b56b5659: Fix the C library runtime initialization order.
Merge commit 'b56b5659b3996e98c2060f168d1cff1474e77d2a'

* commit 'b56b5659b3996e98c2060f168d1cff1474e77d2a':
  Fix the C library runtime initialization order.
2009-07-20 00:13:21 -07:00
David 'Digit' Turner
b56b5659b3 Fix the C library runtime initialization order.
This allows libc.so to run the C runtime initializer as soon as the
dynamic linker loads the shared library, i.e. before any other initializers
(e.g. static C++ constructors in other shared libraries the executable depends
on).

This also removes the bug where the initializers from the executable itself
were run twice: once by the dynamic linker, and another time by __libc_init
as defined by libc_init_dynamic.c
2009-07-18 01:11:10 +02:00
Mathias Agopian
b7681167cb allow pthread_mutexattr_setpshared to accept SHARED mutexes, since our current impl actually uses shared mutexes 2009-07-13 22:00:33 -07:00
Mathias Agopian
a2f5e21244 added pthread_cond_timedwait_relative_np() 2009-07-13 18:37:40 -07:00
David 'Digit' Turner
c4eee3765b Prevent a crash in the memory leak checker (which happened in chk_free())
Simplify the code a little, removing un-necessary mutex locks/unlocks.
Provide slightly better diagnostic message in case of corruption.
Use snprintf/strlcat instead of sprintf/strcat
2009-07-10 00:32:08 +02:00
David 'Digit' Turner
3a654b1e04 Revert "Fix the C library initialization to avoid calling static C++ constructors twice."
This reverts commit 03eabfe65e.
2009-06-03 19:32:37 +02:00
Barry Hayes
f30dae9cf4 Add mspace_merge_objects 2009-06-02 14:48:59 -07:00
David 'Digit' Turner
03eabfe65e Fix the C library initialization to avoid calling static C++ constructors twice.
The problem was due to the fact that, in the case of dynamic executables,
the dynamic linker calls the DT_PREINIT_ARRAY, DT_INIT and DT_INIT_ARRAY
constructors when loading shared libraries and dynamic executables,
*before* calling the executable's entry point (i.e. arch-$ARCH/bionic/crtbegin_dynamic.c)
which in turns call __libc_init() in libc.so, as defined by bionic/libc_init_dynamic.c

The latter did call these constructors array again, mistakenly.

The patch also updates the documentation of many related functions.

Also adds a new section to linker/README.TXT explaining restrictions on
C library usage.

The patch has been tested on a Dream for stability issues with
proprietary blobs:

- H264 decoding works
- Camera + Video recording works
- GPS works
- Sensors work

The tests in system/extra/tests/bionic/libc/common/test_static_cpp_mutex.cpp has been
run and shows the static C++ constructor being called only once.
2009-06-02 23:27:44 +02:00
David 'Digit' Turner
0ba91ed3ca Fix __eabi_atexit() implementation, as well as a bug in the BSD-originated __cxa_finalize() implementation
This patch uses "#if ANDROID" instead of "#if 1" in the __cxa_finalize() fix
2009-05-20 11:42:52 +02:00
David 'Digit' Turner
d386afcc41 revert to previous implementation of __aeabi_atexit() since the new one seems to crash a static ICU String destructor.
I don't have the time to investigate why right now, so a revert is preferred. Damn...
2009-05-15 02:11:12 +02:00
David 'Digit' Turner
3e16f84fca Fix __aeabi_atexit to call __cxa_atexit properly. This function is defined by the C++ ABI for ARM document. 2009-05-14 14:25:26 +02:00
The Android Open Source Project
1dc9e472e1 auto import from //depot/cupcake/@135843 2009-03-03 19:28:35 -08:00
The Android Open Source Project
1767f908af auto import from //depot/cupcake/@135843 2009-03-03 18:28:13 -08:00
The Android Open Source Project
a799b53f10 auto import from //depot/cupcake/@132589 2009-03-03 14:03:51 -08:00
The Android Open Source Project
fe5745033a auto import from //depot/cupcake/@137055 2009-03-02 22:54:14 -08:00
The Android Open Source Project
6f04a0f4c7 auto import from //branches/cupcake/...@132276 2009-02-19 10:57:29 -08:00
The Android Open Source Project
2489551343 auto import from //branches/cupcake/...@131421 2009-02-13 12:57:48 -08:00
The Android Open Source Project
9f65adf2ba auto import from //branches/cupcake/...@130745 2009-02-10 15:43:56 -08:00
The Android Open Source Project
d37527501c auto import from //branches/cupcake/...@127101 2009-01-20 14:03:55 -08:00
The Android Open Source Project
e5cc1f386b auto import from //branches/cupcake/...@126645 2009-01-15 16:12:07 -08:00
The Android Open Source Project
4e468ed2eb Code drop from //branches/cupcake/...@124589 2008-12-17 18:03:48 -08:00
The Android Open Source Project
a27d2baa0c Initial Contribution 2008-10-21 07:00:00 -07:00