aboutsummaryrefslogtreecommitdiffstats
path: root/libc
Commit message (Collapse)AuthorAgeFilesLines
* Merge "Completely disable assertions if NDEBUG is set." into gingerbreadgingerbreadJef Oliver2013-03-111-0/+4
|\
| * Completely disable assertions if NDEBUG is set.Danny Baumann2011-07-191-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | Normally, setting NDEBUG disables the assert function call in assert.h. This is sufficient if we build everything from source. However, as we're dealing with a number of precompiled binaries, we can also have binaries which were compiled with NDEBUG not being set. To achieve the same effect for those binaries (namely: don't make the program crash), disable the call to abort() inside the assert functions if NDEBUG is set. Change-Id: I545927757ae6e972f1567085715d9a6cb6c46107
* | Merge "Prevent deadlock when using fork" into gingerbreadJef Oliver2013-03-111-8/+16
|\ \
| * | Prevent deadlock when using forkRabin Vincent2012-03-141-8/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When forking of a new process in bionic, it is critical that it does not allocate any memory according to the comment in java_lang_ProcessManager.c: "Note: We cannot malloc() or free() after this point! A no-longer-running thread may be holding on to the heap lock, and an attempt to malloc() or free() would result in deadlock." However, as fork is using standard lib calls when tracing it a bit, they might allocate memory, and thus causing the deadlock. This is a rewrite so that the function cpuacct_add, that fork calls, will use system calls instead of standard lib calls. Signed-off-by: christian bejram <christian.bejram@stericsson.com> original identificator of the change is Iff22ea6b424ce9f9bf0ac8e9c76593f689e0cc86 picked from https://android-review.googlesource.com/#/c/21627/
* | | Merge "Fix possible file descriptor leaking" into gingerbreadDanny Baumann2012-09-182-0/+7
|\ \ \
| * | | Fix possible file descriptor leakingrobert_ch_chou2012-03-202-0/+7
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Original code returns w/o closing the file descriptor Close the descriptors and free the direct object before return to avoid leaking original id of the change I09204a8e989d041a12d6a6a00d1138b958f68a8f picked from: https://android-review.googlesource.com/#/c/23191/
* | | Merge "bionic: fixed the race condition in dlmalloc_usable_size()" into ↵Danny Baumann2012-09-181-25/+45
|\ \ \ | | | | | | | | | | | | gingerbread
| * | | bionic: fixed the race condition in dlmalloc_usable_size()Jack Ren2012-03-201-25/+45
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently there is a race condition in dlmalloc_usage_size(): if (cinuse(p)) return chunksize(p) - overhead_for(p); overhead_for(p) will return 2 bytes if p is mmaped, otherwise 1 byte. \#define is_mmapped(p)\ (!((p)->head & PINUSE_BIT) && ((p)->prev_foot & IS_MMAPPED_BIT)) If p is re-allocated by other thread and filled with data, then (p)->head and (p)->prev_foot could be arbitary value and overhead_for(p) could return a wrong value which leads to dlmalloc_usable_size() return a wrong value eventually. mspace_walk_heap() has the simliar issue. Fixed them by adding protection to prevent p from re-allocated when accessing (p)->head and (p)->prev_foot. original id of the change is I4e3ea5cb2938aad1eef353cf6b661555a4ced44e Signed-off-by: Fengwei Yin <fengwei.yin@intel.com> Signed-off-by: Jack Ren <jack.ren@intel.com> Signed-off-by: Bruce Beare <bruce.j.beare@intel.com>
* | | memcmp: prefetch optimizing for ARM Cortex-A8/A9Jim Huang2012-09-181-10/+71
| | | | | | | | | | | | | | | | | | Taken from ICS: http://review.cyanogenmod.com/#change,11309 Change-Id: If77b8cfdc0ab943db4534f060b82b05581ae071f
* | | Modify Android mem* routines with CodeAurora versions.Harshad Bhutada2012-06-104-4/+574
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Update the memcpy, memmove, and memset routines to use the versions from CodeAurora when specified in the bionic/Android.mk file (actually activated in the BoardConfig.mk file under device/<vendor>/<board>). With this change, the mem* routines are only used for the msm8660, while other platforms will use the current Android mem* routines. Future platforms can modify the makefile to use the CodeAurora-based mem* routines as desired. This has the benefit of making the CodeAurora- based routines opt-in instead of opt-out. Also, PLDSIZE and PLDOFFS can be specified in the BoardConfig.mk as well, so other platforms with different PLD tunings can use the same code without modifying the source file itself. Tests with FileCycler-0.3 showed a slight 1.1% improvement with these files on an 8660v2, based on the average of three FileCycler runs with and without the patch. Since the min/max values did not overlap, and the average score showed an improvement, we can consider upstreaming these modifications. Change-Id: I6946076bc6a88a2a2c8667b09494e1eb31e01ee0
* | Merge "Add ARMv7 optimized strlen() also update libc/Android.mk to actually ↵gb-release-7.2Ricardo Cerqueira2012-03-032-1/+116
|\ \ | | | | | | | | | use it Merge the ARM optimized strlen() routine from Linaro. Although it is optimized for ARM Cortex-A9, the performance is still reasonably faster than the original on Cortex-A8 machines." into gingerbread
| * | Add ARMv7 optimized strlen()Jim Huang2012-02-222-1/+116
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | also update libc/Android.mk to actually use it Merge the ARM optimized strlen() routine from Linaro. Although it is optimized for ARM Cortex-A9, the performance is still reasonably faster than the original on Cortex-A8 machines. Reference benchmark on Nexus S (ARM Cortex-A8; 1 GHz): [before] prc thr usecs/call samples errors cnt/samp size strlen_1k 1 1 1.31712 97 0 1000 1024 [after] prc thr usecs/call samples errors cnt/samp size strlen_1k 1 1 1.05855 96 0 1000 1024 Change-Id: I809928804726620f399510af1cd1c852ed754403
* | | memmove: Fix the abuse of memcpy() for overlapping regionsJim Huang2012-02-281-3/+3
|/ / | | | | | | | | | | | | memcpy is not defined for overlapping regions. Original author: Chris Dearman <chris@mips.com> remove the uneeded dependencies
* | Fix libc checksyscalls.py script to handle 'recent' kernelsTanguy Pruvot2011-11-241-5/+9
| | | | | | | | Signed-off-by: Tanguy Pruvot <tanguy.pruvot@gmail.com>
* | Merge "Add a static mutex for /dev/socket/dnsproxyd" into gingerbreadSteve Kondik2011-11-143-7/+45
|\ \
| * | Add a static mutex for /dev/socket/dnsproxydEvan McClain2011-11-113-7/+45
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This prevents several threads from trying to read and write to this socket at the same time. This fixes a race condition between these libc functions and netd which would cause data connections to get stuck in the TEMP_FAILURE_RETRY loops if these functions are called at the same time. Patch Set 2: Use pthread_mutex_lock instead of trylock to more closely match the TEMP_FAILURE_RETRY that was there originally. Patch Set 3: Move dnsproxyd_lock.h out of include/net since netd doesn't need it. Patch Set 4: A few fixes thanks to Yuliyan Lesev. Change-Id: I1531b0baf5688b1ef57b21e768bb9c74906f02c9 Signed-off-by: Evan McClain <aeroevan@gmail.com>
* | | Merge "bionic: remove V5 instruction for V6 targets (memcpy)" into gingerbreadSteve Kondik2011-11-141-0/+10
|\ \ \
| * | | bionic: remove V5 instruction for V6 targets (memcpy)Jim Huang2011-11-031-0/+10
| |/ / | | | | | | | | | | | | | | | | | | Instructions in memcpy that are only needed for ARMV5 targets are now conditionally compiled for those targets. Change-Id: I0c327f73dd8ed62ba2c7ce8ed49129bc39118380
* / / Update time zone data to the new version 2011nKir Kolyshkin2011-11-013-1/+1
|/ / | | | | | | | | | | | | | | | | | | | | | | | | Lots of users have suffered from the old tzdata because few countries (like Russia) have abandoned DST this year. New data is taken from ftp://munnari.oz.au/pub/tzdata2011n.tar.gz as per http://mm.icann.org/pipermail/tz/2011-October/007952.html v2: also update bionic/libc files Change-Id: I5cb28b083a6f64e8949be2c0a991943878f82171 Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
* | sha1: Use bswap* to optimize byte orderJim Huang2011-10-022-44/+66
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | bionic libc already makes use of ARMv6+ rev/rev16 instruction for endian conversion, and this patch rewrites some parts of SHA1 implementations with swap32 and swap64 routines, which is known to bring performance improvements. The reference sha1bench on Nexus S: [before] Rounds: 100000, size: 6250K, time: 1.183s, speed: 5.16 MB/s [after] Rounds: 100000, size: 6250K, time: 1.025s, speed: 5.957 MB/sB Change-Id: Iefd7054f9700fe4aa9a8fb3b4b047504abf2a8bd
* | sha1: code cleanup and use modern C syntaxJim Huang2011-10-022-97/+18
| | | | | | | | | | | | | | - Remove out-of-date workaround (SPARC64_GCC_WORKAROUND) - Use C99 prototype and stdint type Change-Id: Ic389eaf213b45b2ea922af03fdaf2004225df693
* | Merge branch 'gingerbread' of git://git.omapzoom.org/platform/bionic into 237cm-7.1.0gingerbread-releaseSteve Kondik2011-09-2939-361/+1194
|\ \ | | | | | | | | | | | | | | | | | | | | | Conflicts: libc/Android.mk libthread_db/Android.mk Change-Id: I4a730f70bf3b31331ab9cee5f1a098d4162ef4b7
| * | enable support for large files (> 2G)Dragos Tatulea2011-07-092-4/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | bionic has an i386 ifdef guard for the O_LARGEFILE flag. The reason for this is not traceable in the git history, but it's most likely due to some old toolchain or emulator problem. Bug Id: 10035 Change-Id: I742ee6e50220276c2cb268d66f89b5655ef689fc Signed-off-by: Dragos Tatulea <dragos.tatulea@intel.com>
| * | Enable functional DSO object destructionBruce Beare2011-07-0712-18/+227
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Unfortunately, legacy .so files for ARM don't have a correct crtbegin file. Consequently, we have to grandfather the old __dso_handle behaviour. Add some ifdefs for ARM to allow it to use the old code until we can work out a transition. Change-Id: I6a28f368267d792c94e1d985d8344023bc632f6f Author: H.J. Lu <hongjiu.lu@intel.com> Signed-off-by: Bruce Beare <bruce.j.beare@intel.com>
| * | x86: Enable -fstack-protectorBruce Beare2011-07-075-3/+63
| | | | | | | | | | | | | | | | | | Change-Id: Iff9e3a3ba0e2d0faa7c6d98154aa5be0cc8a6c50 Orig-Change-Id: Ib69514c3afcb4c1f5e5f3f8cd91acfd145a0866c Signed-off-by: Bruce Beare <bruce.j.beare@intel.com>
| * | Update X86 Bionic CRT files for unwind/exceptionsMark D Horn2011-07-075-9/+194
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Several updates to Bionic crt*.o files to implement Linux/x86 stack unwind/exception handling. Mark __dso_handle as hidden. Note: Requires complete rebuild due to CRT changes. Google will need to regenerate and check-in all the prebuilt x86 CRT object files and libraries which link to them. Change-Id: I01c14c19ef7569c9ffed89495cae2a459972c04b Orig-Change-Id: I191ce1afb0dee7bbc28dcd9694e5919226dbd070 Signed-off-by: Bruce J Beare <bruce.j.beare@intel.com> Signed-off-by: Mark D Horn <mark.d.horn@intel.com> Author: Lu, Hongjiu <hongjiu.lu@intel.com>
| * | bionic, libthread_db x86 fixesJames Rose2011-07-072-3/+14
| | | | | | | | | | | | | | | | | | Orig-Change-Id: I3be997f5f1f6a894a3c200d4f325cf3bfd428c66 Author: James Rose <james.rose@intel.com> Signed-off-by: Bruce Beare <bruce.j.beare@intel.com>
| * | Updated gcc 4.4.3 IA toolchain doesn't require the .ctors listBruce Beare2011-07-077-81/+5
| | | | | | | | | | | | | | | | | | Orig-Change-Id: Ia840a19a45257128eccdcf25d105f500f2d90741 Signed-off-by: H.J. Lu <hjl.tools@gmail.com> Signed-off-by: Bruce Beare <bruce.j.beare@intel.com>
| * | Remove an extra register move.Bruce Beare2011-07-071-2/+1
| | | | | | | | | | | | | | | | | | Orig-Change-Id: I63c217b73203b44b1a2e74950b58f2ec12989cab Author: H.J. Lu <hjl.tools@gmail.com> Signed-off-by: Bruce Beare <bruce.j.beare@intel.com>
| * | Replace __atomic_XXX with GCC __sync_XXX intrinsics.Bruce Beare2011-07-072-97/+65
| | | | | | | | | | | | | | | | | | Orig-Change-Id: I14f275392fcd70cc15e307470e0a099777c7c09e Author: H.J. Lu <hjl.tools@gmail.com> Signed-off-by: Bruce Beare <bruce.j.beare@intel.com>
| * | use consistent guards for off_t and size_t defines for IABruce Beare2011-07-071-5/+2
| | | | | | | | | | | | | | | Orig-Change-Id: I9347ab4407c48c71c99f42583523ebe31a5e67ae Signed-off-by: Bruce Beare <bruce.j.beare@intel.com>
| * | Simplify variable typing for IA buildsBruce Beare2011-07-071-6/+6
| | | | | | | | | | | | | | | Orig-Change-Id: I3f080b34360bfade0dbd5e2d8d0365e049162e4c Signed-off-by: Bruce Beare <bruce.j.beare@intel.com>
| * | sigsetmask.c was not processing the "mask" argument.Bruce Beare2011-07-071-0/+2
| | | | | | | | | | | | | | | | | | Orig-Change-Id: I79b898ea5b882e8c0564e25466e827a9bedda6e8 Author: yhe19 <yunan.he@intel.com> Signed-off-by: Bruce Beare <bruce.j.beare@intel.com>
| * | Add defines for CAIF supportBruce Beare2011-07-073-1/+6
| | | | | | | | | | | | | | | | | | Orig-Change-Id: I32d2e02814f1965ebdcecb804e947ff303dbe230 Author: Mark Gross <mark.gross@intel.com> Signed-off-by: Bruce Beare <brucex.j.beare@intel.com>
| * | Update ATOM string routines to latestBruce Beare2011-07-0710-92/+567
| | | | | | | | | | | | | | | | | | Orig-Change-Id: I22a600e7f172681cfd38ff73a64e3fd07b284959 Signed-off-by: Lu, Hongjiu <hongjiu.lu@intel.com> Signed-off-by: Bruce Beare <bruce.j.beare@intel.com>
| * | Fix undefined reference to dl_iterate_phdr for x86Bruce Beare2011-07-071-0/+1
| | | | | | | | | | | | | | | Orig-Change-Id: I22410b27939e8f54da932d7a1104102550c4685f Signed-off-by: Bruce Beare <brucex.j.beare@intel.com>
| * | Fix missing NLBruce Beare2011-07-071-1/+1
| | | | | | | | | | | | | | | Orig-Change-Id: Ic210fe9f740b9a8235a66d479ad4eddc869998bb Signed-off-by: Bruce Beare <brucex.j.beare@intel.com>
| * | ptrace.c Fix source file format to unix from dosBruce Beare2011-07-071-63/+63
| | | | | | | | | | | | | | | Orig-Change-Id: Ia771b457eec7f9575d4631fb1c12a7062ebcc7de Signed-off-by: Bruce Beare <bruce.j.beare@intel.com>
* | | Merge "res_send: Avoid spurious close()s and (rare) failure" into gingerbreadSteve Kondik2011-09-241-1/+1
|\ \ \
| * | | res_send: Avoid spurious close()s and (rare) failureJim Huang2011-09-201-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When looping over the current list of sockets we are connected to, use getpeername() not getsockname() to find out who the remote end is. This change avoids spurious close() and (rare) failure. ISC bug #18625 and fixed in libbind 6.0 Change-Id: Ic2b84301a6b850afff5e1588d9fdcca944eb2ae6
* | | | Merge "dlmalloc: Use more efficient ARMv7 implementation for macro ↵Steve Kondik2011-09-241-0/+15
|\ \ \ \ | | | | | | | | | | | | | | | compute_bit2idx" into gingerbread
| * | | | dlmalloc: Use more efficient ARMv7 implementation for macro compute_bit2idxJim Huang2011-09-181-0/+15
| |/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The macro compute_bit2idx(X, I) was definied as "I = ffs(X)-1". This equals to the operation __builtin_ctz(X), and using the new bit-reversal instruction would have been better for ARMv7: rbit r0, r0 clz r0, r0 This patch re-implements macro compute_bit2idx by using the above ARMv7 specific instructions to be more efficient. Reference: http://hardwarebug.org/2010/01/14/beware-the-builtins/ Change-Id: I7cd49da327329c5d75e5e75a557fd115a0c7c0e2
* / / / Use GCC's __attribute__((const)) to reduce code sizeJim Huang2011-09-203-1/+3
|/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | __attribute__((const)) is mainly intended for the compiler to optimize away repeated calls to a function that the compiler knows will return the same value repeatedly. By adding __attribute__((const)), the compiler can choose to call the function just once and cache the return value. Therefore, this yields code size reduction. Here are the reference results by arm-eabi-size on crespo device: [original] text data bss dec hex filename 257543 10040 45916 313499 4c89b [__attribute__ const] text data bss dec hex filename 257255 10040 45916 313211 4c77b Change-Id: I6936b21475d2c54ad02c954b41714f3911474559
* | | Don't call freeaddrinfo with a NULL ptr.Robert Greenwalt2011-09-171-2/+4
| | | | | | | | | | | | | | | bug:5067055 Change-Id: I863dc4760a0aa449ac6298397ed571d8d9287801
* | | Don't reset caches when dns props change.Mattias Falk2011-09-171-1/+0
| | | | | | | | | | | | | | | | | | | | | This happens too frequently. We should flush a per-interface cache when it's dns server addrs changes. Change-Id: I8a691c96ce9a775160ef55ddb8f755d649041583
* | | Add support for a dns cache per interfaceMattias Falk2011-09-173-20/+479
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Initial commit for dns cache per interface. Added a type that holds a reference to a cache and name of associated interface, address of interface, name server(s) associated with an interface etc. New functions to set default interface, address of name servers etc. Change-Id: Ie991bc5592fd998409853d8bf77d7fe69035dac5
* | | libc: Fix leak in the DNS thread-specific state.David 'Digit' Turner2011-09-172-32/+72
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | NOTE: This is a back-port from the internal HC branch. This patch fixes a leak that occurs when creating a new thread-specific DNS resolver state object. Essentially, each thread that calls gethostbyname() or getaddrinfo() at least once will leak a small memory block. Another leak happens anytime these functions are called after a change of the network settings. The leak is insignificant and hard to notice on typical programs. However, netd tends to create one new thread for each DNS request it processes, and quickly grows in size after a > 20 hours. The same problem is seen in other system processes that tend to create one thread per request too. The leak occured becasue res_ninit() was called twice when creating a new thread-specific DNS resolver state in _res_get_thread(). This function could not properly reset an existing thread and was leaking a memory block. The patch does two things: - First, it fixes res_ninit() to prevent any leakage when resetting the state of a given res_state instance. - Second, it modifies the _res_get_thread() implementation to make it more explicit, and avoid calling res_ninit() twice in a row on first-time creation. Fix for Bug 4089945, and Bug 4090857 Change-Id: Icde1d4d1dfb9383efdbf38d0658ba915be77942e
* | | Tracking change to dns proxy protocolBrian Carlstrom2011-09-171-3/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | The gethostbyaddr code in system/netd now expects a string address from inet_ntop, not raw bytes, in order to properly pass addresses containing null and probably spaces and newlines characeters as well. Bug: 4344448 Change-Id: I8ec0eab94d5b1d38e9269ba3afb2825e946f8df3
* | | Proxy getnameinfo through netdMattias Falk2011-09-171-0/+105
| | | | | | | | | | | | | | | | | | | | | Proxy the parts of getnameinfo that utilize the dns cache through netd. Change-Id: I1d57c451ea6b179c34828cf57a4182b262674003
* | | Convert cname lenght before useMattias Falk2011-09-171-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | The length of the cname is sent in big-endian order. Thus, it has to be converted before used in android_getaddrinfo_proxy Change-Id: I1a0cc12780c47f7493fcf06f690515829f88c01e