Commit graph

16158 commits

Author SHA1 Message Date
Dimitry Ivanov
ffaa2169d7 Hide '__moddi3' symbol for x86 and mips
Bug: http://b/26805673
Change-Id: I7dc213e9f25510a2a74a30e8c43fd7a64cb3dbdb
2016-01-27 15:12:19 -08:00
Dimitry Ivanov
aa2fd0fece Hide '__isthreaded' for lp64 libc.so
Bug: http://b/26805673
Change-Id: I2928d68287894be9f9ae7ed1858af512d8c80a3b
2016-01-27 14:54:36 -08:00
Elliott Hughes
172420e6a2 Merge "Fix a sign extension bug in stdio." 2016-01-27 02:38:46 +00:00
Dimitry Ivanov
eecae0a359 Merge "Unify names for pages allocated for small objects" 2016-01-27 02:28:41 +00:00
Elliott Hughes
955426ef79 Fix a sign extension bug in stdio.
This also lets us test the EOVERFLOW behavior, which pointed out that the
fgetpos/fsetpos return on failure has always been wrong...

Bug: http://b/24807045
Change-Id: I35273eb07c8c9155af858adb27569983397580b6
2016-01-26 18:25:52 -08:00
Dimitry Ivanov
d9d6a84c01 Unify names for pages allocated for small objects
Bug: http://b/26776399
Change-Id: Id5b6f143a526cecca56de18ddad8857dfa1dd165
2016-01-26 17:54:13 -08:00
Tom Cherry
194860a9e6 Merge "Replace snprintf() with __libc_format_buffer()" 2016-01-27 00:09:52 +00:00
Tom Cherry
8352475c75 Replace snprintf() with __libc_format_buffer()
If snprintf() is called from the linker, it may erroneously return a
null string.  The libc internal __libc_format_buffer() does not have
this problem, so it is now used instead.

Bug: 26756577

Change-Id: I37a97e27f59b3c0a087f54a6603cc3aff7f07522
2016-01-26 23:51:01 +00:00
Elliott Hughes
896224aa7f Merge "Implement funopen64." 2016-01-26 23:26:43 +00:00
Elliott Hughes
a449fafc89 Merge "Fix lockf for LP32." 2016-01-26 22:56:36 +00:00
Dimitry Ivanov
3a33b52981 Merge "Move android_ network functions to LIBC_PRIVATE" 2016-01-26 22:47:56 +00:00
Elliott Hughes
03e65eb03b Implement funopen64.
Bug: http://b/24807045
Change-Id: I161920978161389be34b707cc6ce8e05f760d552
2016-01-26 14:45:13 -08:00
Dimitry Ivanov
97cb4fbed2 Move android_ network functions to LIBC_PRIVATE
Make following functions platform-private:
 android_getaddrinfofornet
 android_getaddrinfofornetcontext
 android_gethostbyaddrfornet
 android_gethostbynamefornet

Bug: http://b/26794226
Change-Id: I0855b0b82721e4d24e918508931b4d5587fcae7d
2016-01-26 14:44:00 -08:00
Elliott Hughes
d4ae54f668 Fix lockf for LP32.
Bug: http://b/13077650
Change-Id: Ibbe2d907d23791c908475e0875a5c745ac948813
2016-01-26 14:32:55 -08:00
Elliott Hughes
ced73ee45e Merge "Factor out the waiting for children in bionic tests." 2016-01-26 21:32:13 +00:00
Elliott Hughes
33697a0c43 Factor out the waiting for children in bionic tests.
Change-Id: I4a1e51b6920b33dc892d447f5bd6d10f1cb2704a
2016-01-26 13:13:52 -08:00
Elliott Hughes
94bb0fab93 Merge "Support _FILE_OFFSET_BITS=64 for most of <stdio.h>." 2016-01-26 20:51:59 +00:00
Elliott Hughes
d9bb708575 Merge "Implement POSIX lockf." 2016-01-26 20:45:32 +00:00
Elliott Hughes
5704c423c8 Implement POSIX lockf.
This has been requested a few times over the years. This is basically
a very late rebase of https://android-review.googlesource.com/45470
which was abandoned years ago. One addition is that this version has
_FILE_OFFSET_BITS=64 support.

POSIX puts this in <unistd.h>. glibc also has it in <fcntl.h>.

Bug: http://b/13077650
Change-Id: I5862b1dc326e326c01ad92438ecc1578d19ba739
2016-01-26 11:09:44 -08:00
Elliott Hughes
9677fab88c Support _FILE_OFFSET_BITS=64 for most of <stdio.h>.
This doesn't address funopen, but does add fgetpos/fsetpos/fseeko/ftello.

Bug: http://b/24807045
Change-Id: Ibff6f00df5fb699c8e8f13b91a75caf024540b73
2016-01-26 09:14:41 -08:00
Yabin Cui
e1497902c1 Merge "Revert "Revert "Make sem_wait able to return errno EINTR for sdk > 23.""" 2016-01-26 02:20:24 +00:00
Yabin Cui
ca48274298 Revert "Revert "Make sem_wait able to return errno EINTR for sdk > 23.""
This reverts commit 6d51085202.
And add missing bionic_sdk_version.h.

Change-Id: I24cc738b1fd1d26234c52afbc787f5b3c4a9c9cb
2016-01-25 17:39:18 -08:00
Christopher Ferris
126cf324a3 Merge "Fix gcc test issues." 2016-01-26 01:35:03 +00:00
Christopher Ferris
1e185a5056 Fix gcc test issues.
Change-Id: I2b26b779f5198c7c9362a452b971260a8852aa7b
2016-01-25 17:27:40 -08:00
Elliott Hughes
ac67b4eb7c Merge "Revert "Make sem_wait able to return errno EINTR for sdk > 23."" 2016-01-26 00:32:38 +00:00
Dan Albert
6d51085202 Revert "Make sem_wait able to return errno EINTR for sdk > 23."
Broke the build. There's no such file as bionic_sdk_version.h anywhere in the tree.

This reverts commit 892b61d340.

Change-Id: Iec3f4588edfb1d1524bb5f16451fd05dc6ebe44a
2016-01-26 00:20:06 +00:00
Yabin Cui
c96b6e1747 Merge "Make sem_wait able to return errno EINTR for sdk > 23." 2016-01-25 23:39:29 +00:00
Christopher Ferris
e40e429753 Merge "Fix build for gcc." 2016-01-25 22:44:56 +00:00
Christopher Ferris
f2b67b85f5 Fix build for gcc.
Gcc doesn't like the brace object initialization, so make all of
the Feature objects explicit.

Also, no arguments to the error_log macros make gcc unhappy, so add
an option to turn these into warnings. These will be fixed when we
add the explicit _error and _warn log functions.

Change-Id: I35af834dabb5548923e893dd980a751fdebfa13a
2016-01-25 14:36:34 -08:00
Yabin Cui
892b61d340 Make sem_wait able to return errno EINTR for sdk > 23.
Posix standards says sem_wait is interruptible by the delivery
of a signal. To keep compatiblity with old apps, only fix that
in newer sdk versions.

Bug: 26743454

Change-Id: I924cbb436658e3e0f397c922d866ece99b8241a3
2016-01-25 13:44:39 -08:00
Christopher Ferris
0f7631fd92 Merge "Malloc debug rewrite." 2016-01-25 20:48:29 +00:00
Elliott Hughes
7150e5a8ef Merge "Move internal FILE flags macros to "local.h" from <stdio.h>." 2016-01-25 19:35:36 +00:00
Chih-hung Hsieh
5491d489fe Merge "Include libz for new libelf." 2016-01-25 19:31:23 +00:00
Chih-Hung Hsieh
20322c25e7 Include libz for new libelf.
New external/elfutils needs libz.

Change-Id: Ib2f2d56d4831809509a0fb3a849656f68adece7f
2016-01-25 11:12:14 -08:00
Elliott Hughes
e70e0e9267 Move internal FILE flags macros to "local.h" from <stdio.h>.
Bug: http://b/24807045
Change-Id: Ia42ec1907370b4af957ece94a856f71c7ee27cb7
2016-01-25 11:10:47 -08:00
Christopher Ferris
63860cb8fd Malloc debug rewrite.
The major components of the rewrite:

- Completely remove the qemu shared library code. Nobody was using it
  and it appears to have broken at some point.
- Adds the ability to enable/disable different options independently.
- Adds a new option that can enable the backtrace on alloc/free when
  a process gets a specific signal.
- Adds a new way to enable malloc debug. If a special property is
  set, and the process has an environment variable set, then debug
  malloc will be enabled. This allows something that might be
  a derivative of app_process to be started with an environment variable
  being enabled.
- get_malloc_leak_info() used to return one element for each pointer that
  had the exact same backtrace. The new version returns information for
  every one of the pointers with same backtrace. It turns out ddms already
  automatically coalesces these, so the old method simply hid the fact
  that there where multiple pointers with the same amount of backtrace.
- Moved all of the malloc debug specific code into the library.
  Nothing related to the malloc debug data structures remains in libc.
- Removed the calls to the debug malloc cleanup routine. Instead, I
  added an atexit call with the debug malloc cleanup routine. This gets
  around most problems related to the timing of doing the cleanup.

The new properties and environment variables:

libc.debug.malloc.options
  Set by option name (such as "backtrace"). Setting this to a bad value
  will cause a usage statement to be printed to the log.

libc.debug.malloc.program
  Same as before. If this is set, then only the program named will
  be launched with malloc debug enabled. This is not a complete match,
  but if any part of the property is in the program name, malloc debug is
  enabled.

libc.debug.malloc.env_enabled
  If set, then malloc debug is only enabled if the running process has the
  environment variable LIBC_DEBUG_MALLOC_ENABLE set.

Bug: 19145921

Change-Id: I7b0e58cc85cc6d4118173fe1f8627a391b64c0d7
2016-01-25 10:54:21 -08:00
Elliott Hughes
ad9c3f34f7 Merge "Add _seek64 to FILE." 2016-01-25 18:50:41 +00:00
Josh Gao
c650447239 Merge "Remove dlmalloc." 2016-01-25 18:42:55 +00:00
Elliott Hughes
05db62657b Merge "Add another stdio test." 2016-01-25 18:31:35 +00:00
Josh Gao
0ac0cee0d1 Remove dlmalloc.
Bug: http://b/17207577
Change-Id: Ie009badca6deb1f91b27a4340b70cdd6bedff893
2016-01-25 10:14:35 -08:00
Elliott Hughes
023c3071a0 Add _seek64 to FILE.
Move fdopen/fopen/freopen and change them to initialize _seek64 instead
of the legacy _seek. The in-memory streams can stick with _seek for now,
since you're not going to fit a > 4GiB in-memory stream on a 32-bit device
anyway.

Bug: http://b/24807045
Change-Id: I09dcb426817b571415ce24d4d15f364cdda395b3
2016-01-22 23:54:10 -08:00
Elliott Hughes
8fb40bad49 Merge "Put struct FILE back how NDK-built apps expect it." 2016-01-23 04:50:40 +00:00
Elliott Hughes
b877601bff Put struct FILE back how NDK-built apps expect it.
The first rule of stdio is you never change struct FILE. This broke all
NDK-built apps that used stdin/stdout/stderr. (Which is more than you
might think, given that those streams don't go anywhere useful. Svelte!)

I've added a big code comment because I knew when I removed the field that
doing so was a mistake, but I couldn't think why.

Bug: http://b/24807045
Bug: http://b/26747402
Change-Id: Ie1233586b223bb1cdf8e354c66d5ff23487a833a
2016-01-22 19:23:40 -08:00
Elliott Hughes
71288cbfdf Add another stdio test.
This test didn't catch anything, but it does ensure that we exercise
the "lots of files" case.

Bug: http://b/26747402
Change-Id: I6c51c6436029572a49190d509f131eb93b808652
2016-01-22 19:22:44 -08:00
Dimitry Ivanov
a42483baad Merge "Revert "Temporary apply LIBC version to __pthread_gettid"" 2016-01-22 18:38:08 +00:00
Elliott Hughes
8fd5bc0ccb Merge "Loosen up sys_time.gettimeofday." 2016-01-22 03:19:20 +00:00
Dimitry Ivanov
bba395492a Revert "Temporary apply LIBC version to __pthread_gettid"
This reverts commit 0ef1d121b5.

Bug: http://b/26392296
Bug: http://b/26391427
Change-Id: I7bbb555de3a43813e7623ff6ad4e17874d283eca
2016-01-22 01:43:04 +00:00
Dimitry Ivanov
05c2f6b3d3 Merge "libc: hide __signalfd4 symbol" 2016-01-22 01:41:27 +00:00
Dimitry Ivanov
40316a3748 Merge "libc: hide fake_gmtime_r and fake_localtime_r" 2016-01-22 01:40:45 +00:00
Elliott Hughes
7f54348f30 Loosen up sys_time.gettimeofday.
We've seen it take 1146us on Nexus 9 (which did have exceptionally slow
system calls).

Bug: http://b/26724042
Change-Id: I263b7e1267d58fe4a6528403d03e5b245fdcd528
2016-01-21 16:43:43 -08:00