summaryrefslogtreecommitdiffstats
path: root/libc
Commit message (Collapse)AuthorAgeFilesLines
* Ensure we have the off64_t variant of every function that takes an off_t.Elliott Hughes2013-09-1914-12/+154
| | | | Change-Id: Ib2eee0cf13162be3b62559b84e90c6dcf5aab1c3
* Add mmap64()Daniel Leung2013-09-192-2/+7
| | | | | | | | | | | | This adds mmap64() to bionic so that it is possible to have large offset passed to kernel. However, the syscall mechanism only passes 32-bit number to kernel. So effectively, the largest offset that can be passed is about 43 bits (since offset is signed, and the number passed to kernel is number of pages (page size == 4K => 12 bits)). Change-Id: Ib54f4e9b54acb6ef8b0324f3b89c9bc810b07281 Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
* Declare __page_shift and __page_size with C linkage.Bernhard Rosenkraenzer2013-09-193-12/+13
| | | | | | | | | | | | | __page_shift and __page_size were accidentally declared in unistd.h with C linkage - their implementation needs to use the same linkage. Going forward, though, let's stop the inlining madness and let's kill the non-standard __getpageshift(). This patch takes getpagesize(3) out of line and removes __getpageshift but fixes __page_shift and __page_size for backwards binary compatibility. Change-Id: I35ed66a08989ced1db422eb03e4d154a5d6b5bda Signed-off-by: Bernhard Rosenkraenzer <Bernhard.Rosenkranzer@linaro.org>
* Merge "Fix mismatch between declaration and forward declaration"Elliott Hughes2013-09-192-2/+2
|\
| * Fix mismatch between declaration and forward declarationBernhard Rosenkraenzer2013-09-182-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | KernelArgumentBlock is defined as a class in KernelArgumentBlock.h, but forward declarations refer to it as a struct. While this is essentially the same, the mismatch causes a compiler warning in clang (and may cause warnings in future versions of gcc) in code that is supposed to be compiled with -Werror. Change-Id: I4ba49d364c44d0a42c276aff3a8098300dbdcdf0 Signed-off-by: Bernhard Rosenkraenzer <Bernhard.Rosenkranzer@linaro.org>
* | Merge "Use $ANDROID_DATA and $ANDROID_ROOT to find the tzdata."Elliott Hughes2013-09-191-4/+11
|\ \
| * | Use $ANDROID_DATA and $ANDROID_ROOT to find the tzdata.Elliott Hughes2013-09-191-4/+11
| |/ | | | | | | | | | | This lets us run binaries linked against bionic on an x86 host. Change-Id: Icd60cf99a90d747c77304c05b4f764e4d26af985
* | Update netlink.h from tip-of-tree external/kernel-headersNick Kralevich2013-09-181-26/+62
|/ | | | | | | | | This file was generated using bionic/libc/kernel/tools/update_all.py The only change is a new netlink.h file, from external/kernel-headers. Please see the commit message there for details. Change-Id: I83645b88f0baff838131197913ebd70be69abd3f
* Simplify main thread stack size initializationBrian Carlstrom2013-09-133-19/+18
| | | | Change-Id: Iec09433d9de501031cce09dc75848a5e8f3d96bf
* Use kernel default for initial thread sizeBrian Carlstrom2013-09-131-3/+20
| | | | | | Bug: 10697851 Change-Id: I8d980f5e0b584799536f6e6b891056c968d26cdf
* Add the dl_iterate_phdr function to libdl for arm.Christopher Ferris2013-09-062-4/+5
| | | | | | | | | | Bug: 8410085 Merge from internal master. (cherry-picked from cb491bc66dc0abc145930b09086eb9189a30f6c2) Change-Id: I94ed51bc5d4c626df7552c0e85c31ccee2d6568f
* Merge "Avoid segfaults if properties are not initialized"Elliott Hughes2013-09-031-0/+4
|\
| * Avoid segfaults if properties are not initializedPavel Chupin2013-09-031-0/+4
| | | | | | | | | | | | | | | | | | Null or constant dereferencing occurs if properties are not initialized. On Android devices it shouldn't happen but can be faced if testing bionic libc.so on Linux host. Change-Id: I8f047cbe17d0e7bcde40ace000a8aa53789c16cb Signed-off-by: Pavel Chupin <pavel.v.chupin@intel.com>
* | Fix strchr for basic non-sse case on x86Pavel Chupin2013-09-032-3/+3
|/ | | | | | | | | Fix source location. Move declaration of __strchr_chk out of ifdef __BIONIC_FORTIFY which should be available for strchr.cpp compilation when __BIONIC_FORTIFY is not defined. Change-Id: I552a6e16656e59b276b322886cfbf57bbfb2e6a7 Signed-off-by: Pavel Chupin <pavel.v.chupin@intel.com>
* cdefs.h: introduce __bos0Nick Kralevich2013-08-282-4/+13
| | | | | | | | | | | | | | Introduce __bos0 as a #define for __builtin_object_size((s), 0). This macro is intended to be used for places where the standard __bos macro isn't appropriate. memcpy, memmove, and memset deliberately use __bos0. This is done for two reasons: 1) I haven't yet tested to see if __bos is safe to use. 2) glibc uses __bos0 for these methods. Change-Id: Ifbe02efdb10a72fe3529dbcc47ff647bde6feeca
* FORTIFY_SOURCE: introduce __strncpy_chk2Nick Kralevich2013-08-282-8/+58
| | | | | | | This change detects programs reading beyond the end of "src" when calling strncpy. Change-Id: Ie1b42de923385d62552b22c27b2d4713ab77ee03
* Delete CAVEATS / fix spelling.Nick Kralevich2013-08-272-27/+1
| | | | Change-Id: I0ed504271b7c2e4434d0d5f53bc10335c8cf7b5b
* Merge "Add explicit -m32/-melf_i386 for x86 target"Elliott Hughes2013-08-261-3/+4
|\
| * Add explicit -m32/-melf_i386 for x86 targetPavel Chupin2013-08-231-3/+4
| | | | | | | | | | | | | | Required for x86 build with multilib compiler. Change-Id: Iac71cdc3461df6fb48cb2a7b713324ca368e6704 Signed-off-by: Pavel Chupin <pavel.v.chupin@intel.com>
* | Change how DNS resolver handle no default ifaceRobert Greenwalt2013-08-222-12/+10
|/ | | | | | | | | | | | | | | We used to just try any iface we'd been told about as a fallback, but that will end up mistakenly using a secondary network's dns when we really don't have a default connection. It also messed up our detection of whether we were doing the lookup on the default or not (we'd get back our secondary net iface as the default, do the compare and think we were on default). Remove the lies and let dns fail if we don't have an iface for it. bug:10132565 Change-Id: I5f0f2abacaaaaf23c5292b20fba9d8dcb6fb10c5
* Apply upstream commit 943a6621866e9d6e654f5cfe1494378c1fb8957a.Elliott Hughes2013-08-223-6/+14
| | | | | | | | | | | | | | Author: Paul Eggert <eggert@cs.ucla.edu> Date: Thu Aug 22 12:47:51 2013 -0700 * localtime.c: Fix another integer overflow bug in mktime. (time2sub): Avoid undefined behavior on time_t overflow. Reported by Elliott Hughes in <http://mm.icann.org/pipermail/tz/2013-August/019580.html>. Bug: 10310929 Change-Id: I3bf26f1f91371552e0a3828457d27e22af55acb2
* Work around tzcode's reliance on signed overflow.Elliott Hughes2013-08-221-0/+2
| | | | | | | | I've mailed the tz list about this, and will switch to whatever upstream fix comes along as soon as it's available. Bug: 10310929 Change-Id: I36bf3fcf11f5ac9b88137597bac3487a7bb81b0f
* Fix pthread_getcpuclockid.Jeff Hao2013-08-151-2/+8
| | | | | | | | clock_gettime was returning EINVAL for the values produced by pthread_getcpuclockid. Bug: 10346183 Change-Id: Iabe643d7d46110bb311a0367aa0fc737f653208e
* Create optimized __strcpy_chk/__strcat_chk.Christopher Ferris2013-08-1520-574/+1952
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This change pulls the memcpy code out into a new file so that the __strcpy_chk and __strcat_chk can use it with an include. The new versions of the two chk functions uses assembly versions of strlen and memcpy to implement this check. This allows near parity with the assembly versions of strcpy/strcat. It also means that as memcpy implementations get faster, so do the chk functions. Other included changes: - Change all of the assembly labels to local labels. The other labels confuse gdb and mess up backtracing. - Add .cfi_startproc and .cfi_endproc directives so that gdb is not confused when falling through from one function to another. - Change all functions to use cfi directives since they are more powerful. - Move the memcpy_chk fail code outside of the memcpy function definition so that backtraces work properly. - Preserve lr before the calls to __fortify_chk_fail so that the backtrace actually works. Testing: - Ran the bionic unit tests. Verified all error messages in logs are set correctly. - Ran libc_test, replacing strcpy with __strcpy_chk and replacing strcat with __strcat_chk. - Ran the debugger on nexus10, nexus4, and old nexus7. Verified that the backtrace is correct for all fortify check failures. Also verify that when falling through from __memcpy_chk to memcpy that the backtrace is still correct. Also verified the same for __memset_chk and bzero. Verified the two different paths in the cortex-a9 memset routine that save variables to the stack still show the backtrace properly. Bug: 9293744 (cherry-picked from 2be91915dcecc956d14ff281db0c7d216ca98af2) Change-Id: Ia407b74d3287d0b6af0139a90b6eb3bfaebf2155
* Optimize __memset_chk, __memcpy_chk. DO NOT MERGE.Christopher Ferris2013-08-1413-45/+285
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This change creates assembler versions of __memcpy_chk/__memset_chk that is implemented in the memcpy/memset assembler code. This change avoids an extra call to memcpy/memset, instead allowing a simple fall through to occur from the chk code into the body of the real implementation. Testing: - Ran the libc_test on __memcpy_chk/__memset_chk on all nexus devices. - Wrote a small test executable that has three calls to __memcpy_chk and three calls to __memset_chk. First call dest_len is length + 1. Second call dest_len is length. Third call dest_len is length - 1. Verified that the first two calls pass, and the third fails. Examined the logcat output on all nexus devices to verify that the fortify error message was sent properly. - I benchmarked the new __memcpy_chk and __memset_chk on all systems. For __memcpy_chk and large copies, the savings is relatively small (about 1%). For small copies, the savings is large on cortex-a15/krait devices (between 5% to 30%). For cortex-a9 and small copies, the speed up is present, but relatively small (about 3% to 5%). For __memset_chk and large copies, the savings is also small (about 1%). However, all processors show larger speed-ups on small copies (about 30% to 100%). Bug: 9293744 Merge from internal master. (cherry-picked from 7c860db0747f6276a6e43984d43f8fa5181ea936) Change-Id: I916ad305e4001269460ca6ebd38aaa0be8ac7f52
* Update kernel input headersMichael Wright2013-08-141-180/+188
| | | | | | To upstream SHA e1c85813f3832b909d1c4309b213bb0a52c79ba5 Change-Id: I72ee3d59c105bc0252b5ca0c49c569d12ec685d1
* Make ctype.h a little less unhygienic.Elliott Hughes2013-08-132-20/+30
| | | | | | This caused trouble for stlport. Change-Id: Id40787c5a2b7a3a4e12fb557efe549778a01cbbd
* Fix our missing abs/labs/llabs/imaxabs (and imaxdiv) symbols.Elliott Hughes2013-08-128-13/+216
| | | | Change-Id: I94c411c22634e43184445c82e7388e51fc46a8cc
* Add futimens.Elliott Hughes2013-08-083-1/+37
| | | | | Bug: 10239370 Change-Id: I518340084103dc339ef8a065d4837d6258a1381d
* Fix strcpy.c that should have been strcpy.S. DO NOT MERGEChristopher Ferris2013-08-081-1/+1
| | | | | | | | Merge from internal master. (cherry-picked from 1ce665416307628f4bcaced86faa64bdf9c489c3) Change-Id: I376b831df42248baadde7202a30a68112f752ff7
* Optimize strcat/strcpy, small tweaks to strlen. DO NOT MERGEChristopher Ferris2013-08-0813-38/+2247
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Create one version of strcat/strcpy/strlen for cortex-a15/krait and another version for cortex-a9. Tested with the libc_test strcat/strcpy/strlen tests. Including new tests that verify that the src for strcat/strcpy do not overread across page boundaries. NOTE: The handling of unaligned strcpy (same code in strcat) could probably be optimized further such that the src is read 64 bits at a time instead of the partial reads occurring now. strlen improves slightly since it was recently optimized. Performance improvements for strcpy and strcat (using an empty dest string): cortex-a9 - Small copies vary from about 5% to 20% as the size gets above 10 bytes. - Copies >= 1024, about a 60% improvement. - Unaligned copies, from about 40% improvement. cortex-a15 - Most small copies exhibit a 100% improvement, a few copies only improve by 20%. - Copies >= 1024, about 150% improvement. - Unaligned copies, about 100% improvement. krait - Most small copies vary widely, but on average 20% improvement, then the performance gets better, hitting about a 100% improvement when copies 64 bytes of data. - Copies >= 1024, about 100% improvement. - When coping MBs of data, about 50% improvement. - Unaligned copies, about 90% improvement. As strcat destination strings get larger in size: cortex-a9 - about 40% improvement for small dst strings (>= 32). - about 250% improvement for dst strings >= 1024. cortex-a15 - about 200% improvement for small dst strings (>=32). - about 250% improvement for dst strings >= 1024. krait - about 25% improvement for small dst strings (>=32). - about 100% improvement for dst strings >=1024. Merge from internal master. (cherry-picked from d119b7b6f48fe507088cfb98bcafa99b320fd884) Change-Id: I296463b251ef9fab004ee4dded2793feca5b547a
* Merge "Fix stdint.h intptr_t/uintptr_t for x86_64/x32"Elliott Hughes2013-08-051-0/+5
|\
| * Fix stdint.h intptr_t/uintptr_t for x86_64/x32Pavel Chupin2013-08-021-0/+5
| | | | | | | | | | | | | | | | | | Patch is required in NDK headers as well to be able to build multilib GCC with libgomp support. It's here: https://android-review.googlesource.com/#/c/62982 Change-Id: I2bec25d8cbca0e5ef1a0857008ececd92f4911be Signed-off-by: Pavel Chupin <pavel.v.chupin@intel.com>
* | Merge "syslog needs a valid socket path for _PATH_LOG"Elliott Hughes2013-08-051-1/+1
|\ \
| * | syslog needs a valid socket path for _PATH_LOGCédric Cabessa2012-05-131-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | /dev/kmsg is a character device already used for different purposes. Most distribution use /dev/log for _PATH_LOG but this path is already used by logcat. I suggest using /dev/syslog. This change was tested with busybox's syslogd. Change-Id: I75b428123c7a0b3ca4bea656ce06860f6f727dde
* | | Fix the detection of alt-network in dns resolver.Robert Greenwalt2013-08-051-9/+12
| | | | | | | | | | | | | | | | | | | | | Used to determine proper A/AAAA record request. bug:10132565 Change-Id: I7229f6672e879920a6fae58672cddd72db78546c
* | | Add ssse3 implementation of __memcmp16.Alexander Ivchenko2013-08-025-30/+402
| | | | | | | | | | | | | | | | | | | | | | | | __memcmp16 was missing in x86. Also added C-version for backward compatibility. Added bionic test for __memcmp16 and for wmemcmp. Change-Id: I33718441e7ee343cdb021d91dbeaf9ce2d4d7eb4 Signed-off-by: Alexander Ivchenko <alexander.ivchenko@intel.com>
* | | Update the comments to reflect the current status.Ben Cheng2013-08-021-6/+14
| | | | | | | | | | | | Change-Id: I3a6348b568230fe8b21d121e5b8d30561a9703c2
* | | Merge "libgcc_compat: Introduce __aeabi_lasr for cortex-a9 and higher"Elliott Hughes2013-08-021-1/+2
|\ \ \
| * | | libgcc_compat: Introduce __aeabi_lasr for cortex-a9 and highersynergydev2013-07-291-1/+2
| | |/ | |/| | | | | | | | | | | | | | | | This is needed when passing -mcpu=cortex-a9 or higher on a modern toolchain for prebuilt library compatibility Change-Id: I73eb2393377914ae26216a8c2828ad973d1c1225
* | | Tell the dns resolver about our domains.Robert Greenwalt2013-07-311-0/+6
|/ / | | | | | | | | | | | | | | A refactor caused us to not tell the resolver about search domains until after it had done the domain fanout. bug:6799630 Change-Id: Ibabd8fa5bcc69b1490fc5e329e62eb0f2d1a5e63
* | Define PTHREAD_KEYS_MAX and _POSIX_THREAD_KEYS_MAX in a POSIX-compliant way.Elliott Hughes2013-07-293-5/+10
| | | | | | | | | | | | | | | | Also make sysconf use PTHREAD_STACK_MIN rather than redefining its own, different, constant. Bug: 9997352 Change-Id: I9a8e7d2b18e691439abfb45533e82c36eee9e81d
* | Bump the number of TLS slots to 128.Elliott Hughes2013-07-251-1/+1
| | | | | | | | | | Bug: 9997352 Change-Id: I7bde7228d803e9d4bb83309c5891d54a07e3b025
* | Avoid sign extension of the mmap offset.Elliott Hughes2013-07-251-2/+3
| | | | | | | | | | | | | | off_t is signed to support seeking backwards, but that's a liability when using off_t to represent a subset of a file. Change-Id: I2a3615166eb16212347eb47f1242e3bfb93c2022
* | am a8d06766: Merge "[MIPS] __dso_handle.S and __dso_handle_so.S not needed."Elliott Hughes2013-07-232-78/+0
|\ \ | | | | | | | | | | | | * commit 'a8d06766c7674bbfde852e8bfee4200e75ad8f24': [MIPS] __dso_handle.S and __dso_handle_so.S not needed.
| * \ Merge "[MIPS] __dso_handle.S and __dso_handle_so.S not needed."Elliott Hughes2013-07-242-78/+0
| |\ \
| | * | [MIPS] __dso_handle.S and __dso_handle_so.S not needed.Pete Delaney2013-07-222-78/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Global hidden variable __dso_handle is now declared in: bionic/libc/private/__dso_handle.h Change-Id: I8e951a8d7c65877bafc1be23a7fff6d44d3a2846 Signed-off-by: Pete Delaney <piet.delaney@imgtec.com> Signed-off-by: Chao-Ying Fu <chao-ying.fu@imgtec.com>
* | | | am 061246b6: Merge "Restore dlmalloc mmap threshold to 64k"Rom Lemarchand2013-07-231-0/+1
|\ \ \ \ | |/ / / | | | | | | | | | | | | * commit '061246b600c16a80b246804221b9e3fa65e507d9': Restore dlmalloc mmap threshold to 64k
| * | | Restore dlmalloc mmap threshold to 64kRom Lemarchand2013-07-231-0/+1
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | Restoring DEFAULT_MMAP_THRESHOLD to 64k, the way it was before 999089181ef60bb67e1a49f2cf6f4ec608a7caf8. This forces allocations in the 64k-256k range to be mmaped. Change-Id: Iace55ed638edd272b3e94fa6cd2ddd349042be84 Signed-off-by: Rom Lemarchand <romlem@google.com>
* | | am 6fe4a58f: Merge "Move stuff only needed by pthread-timers.c into ↵Elliott Hughes2013-07-192-59/+49
|\ \ \ | |/ / | | | | | | | | | | | | | | | pthread-timers.c." * commit '6fe4a58f84954523f17114f1f7cf060a3573c073': Move stuff only needed by pthread-timers.c into pthread-timers.c.