summaryrefslogtreecommitdiffstats
path: root/libc/stdlib
Commit message (Collapse)AuthorAgeFilesLines
* malloc-standard: synchronize on forkTimo Teräs2011-12-231-0/+17
| | | | | | | | Otherwise other threads can leave malloc state locked, and the child will hang indefinitely if it tries to malloc something. Signed-off-by: Timo Teräs <timo.teras@iki.fi> Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
* stdlib: fix arc4random return type to u_int32_tTimo Teräs2011-12-231-1/+2
| | | | | | | | | | | | | It's documented to be u_int32_t and not uint32_t: http://www.manpagez.com/man/3/arc4random/ This also fixes a major bug that stdlib.h includes stdint.h. Things might go very wrong because stdint.h has conditional defines and if stdlib.h is included before #define's for stdint.h we end up missing things and breaking builds (e.g. openjdk). Signed-off-by: Timo Teräs <timo.teras@iki.fi> Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
* __uc_malloc: Fix memory-leak in error pathBernhard Reutner-Fischer2011-05-101-0/+1
| | | | Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
* Fix malloc alignmentBernd Schmidt2011-04-112-3/+5
| | | | | | | | | | | | | In commit 3e0a1f388, Richard tried to fix malloc alignments by using alignof (double __attribute_aligned__(sizeof (size_t))). This doesn't work, since attribute_aligned overrides the alignment rather than providing a minimum. On C6X, malloc returns four-byte aligned values rather than the necessary eight-byte alignment. It's simpler to use a comparison and pick the bigger of the two values, so that's what I've done. Signed-off-by: Bernd Schmidt <bernds@codesourcery.com>
* memalign: include sys/param.h for MAXBernhard Reutner-Fischer2011-03-161-2/+1
| | | | | | | | | | | | | libc/stdlib/malloc/memalign.c:22:1: warning: "MAX" redefined In file included from ./libpthread/nptl/sysdeps/unix/sysv/linux/i386/lowlevellock.h:25, from ./include/bits/libc-lock.h:36, from ./include/bits/stdio-lock.h:23, from ./include/bits/uClibc_mutex.h:71, from libc/stdlib/malloc/malloc.h:135, from libc/stdlib/malloc/memalign.c:18: ./include/sys/param.h:75:1: warning: this is the location of the previous definition Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
* really fix missing __libc_drand48_dataPeter S. Mazinger2011-03-101-0/+4
| | | | Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
* Revert "missing prototype of __libc_drand48_data fixed"Peter S. Mazinger2011-03-101-1/+0
| | | | | | This reverts commit e2cea9b9edabe885b9bf2586f9541ffb8fe93f3f. Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
* missing prototype of __libc_drand48_data fixedPeter S. Mazinger2011-03-101-0/+1
| | | | Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
* stdlib.c, _strtod.c, stdlib.h: remove unused hidden functionsPeter S. Mazinger2011-03-092-23/+6
| | | | Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
* arc4random.c, stdlib.h: get rid of hidden arc4random_stirPeter S. Mazinger2011-03-091-5/+5
| | | | | | The function is used only in one file, make an internal static version for this Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
* move prototype for __drand48_iterate and __libc_drand48_data to stdlib.hPeter S. Mazinger2011-03-0912-45/+0
| | | | | | Move them to a common header guarded by _LIBC Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
* stdlib.c: remove duplicate libc_hidden_proto for strtoul/strtoul_lPeter S. Mazinger2011-03-091-1/+0
| | | | Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
* _strtod.c: only strtod hidden version is neededPeter S. Mazinger2011-03-091-2/+3
| | | | | | Do not provide hidden strtod_l, wcstod and wcstod_l Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
* style updatePeter S. Mazinger2011-03-031-12/+5
| | | | | | Style update avoiding compile warnings Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
* libc: fix strtoqNatanael Copa2010-12-011-0/+3
| | | | | | | | strtoq should always return a quad_t and be an alias of strtol on 64 bit and strtoll on 32 bit. Signed-off-by: Natanael Copa <natanael.copa@gmail.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
* libc: silence warningBernhard Reutner-Fischer2010-11-241-0/+1
| | | | | | about implicit declaration of memset in system() Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
* *: inline constant __sig{add,del}set and __sigismemberDenys Vlasenko2010-10-221-2/+3
| | | | | | | | | | | | text data bss dec hex filename - 318 4 0 322 142 libc/pwd_grp/lckpwdf.o + 312 4 0 316 13c libc/pwd_grp/lckpwdf.o - 166 0 1 167 a7 libc/stdlib/abort.o + 157 0 1 158 9e libc/stdlib/abort.o - 42 0 0 42 2a libc/sysdeps/linux/common/pause.o + 27 0 0 27 1b libc/sysdeps/linux/common/pause.o Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
* libc: Add canonicalize_file_name functionCarmelo Amoroso2010-09-163-1/+40
| | | | | | | | Add canonicalize_file_name function and its related tests. Required by elfutils and coreutils (readlink). Signed-off-by: Salvatore Cro <salvatore.cro@st.com> Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
* malloc: simplify MAP_UNINITIALIZE ifdef logicMike Frysinger2010-07-271-7/+4
| | | | Signed-off-by: Mike Frysinger <vapier@gentoo.org>
* malloc-simple: Make calloc() return zeroed memorySteven J. Magnani2010-07-271-5/+4
| | | | | | | | | | The 0.9.31 release included a change to malloc-simple to request uninitialized memory from noMMU kernels. Unfortunately, the corresponding calloc() code assumed that memory returned by malloc() was already zeroed, which leads to all kinds of nastiness. Signed-off-by: Steven J. Magnani <steve@digidescorp.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
* silence some warnings about missing prototypesBernhard Reutner-Fischer2010-06-111-1/+1
| | | | Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
* nptl: fix malloc library lockingTimo Teräs2010-04-222-10/+8
| | | | | | | | Update malloc library to use internal uclibc locking primitives to get the libpthread calls correct. Signed-off-by: Timo Teräs <timo.teras@iki.fi> Signed-off-by: Austin Foxley <austinf@cetoncorp.com>
* Merge commit 'origin/master' into nptlAustin Foxley2010-04-024-8/+8
|\ | | | | | | | | | | | | | | | | | | | | | | Conflicts: Makefile.in extra/Configs/Config.in libc/sysdeps/linux/common/bits/kernel-features.h libc/sysdeps/linux/common/poll.c libc/sysdeps/linux/common/sysdep.h libc/sysdeps/linux/sh/sysdep.h Signed-off-by: Austin Foxley <austinf@cetoncorp.com>
| * prettify make cleanBernhard Reutner-Fischer2010-03-254-8/+8
| | | | | | | | Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
| * libc: Fix l64a to return the correct buffer pointerFilippo Arcidiacono2010-02-031-1/+1
| | | | | | | | | | | | | | | | | | l64a was returning the pointer to the end of the internal buffer instead of the start. This caused an infinite loop in passwd application. Signed-off-by: Filippo Arcidiacono <filippo.arcidiacono@st.com> Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
* | sparc: disable cancellable system, as it fails in strange ways right nowAustin Foxley2010-02-191-1/+4
| | | | | | | | Signed-off-by: Austin Foxley <austinf@cetoncorp.com>
* | libc: Fix l64a to return the correct buffer pointerFilippo Arcidiacono2010-02-031-1/+1
| | | | | | | | | | | | | | | | | | l64a was returning the pointer to the end of the internal buffer instead of the start. This caused an infinite loop in passwd application. Signed-off-by: Filippo Arcidiacono <filippo.arcidiacono@st.com> Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
* | Fix accidently dropped hunk during last merge from master.Khem Raj2010-02-011-21/+8
| | | | | | | | Signed-off-by: Khem Raj <raj.khem@gmail.com>
* | Merge commit 'origin/master' into nptlKhem Raj2010-02-011-32/+19
|\| | | | | | | | | | | | | Conflicts: libc/stdlib/Makefile.in Signed-off-by: Khem Raj <raj.khem@gmail.com>
| * convert to foo-y kbuild styleBernhard Reutner-Fischer2010-01-261-54/+27
| | | | | | | | Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
* | Merge commit 'origin/master' into nptlAustin Foxley2009-12-192-6/+7
|\| | | | | | | | | | | | | | | Conflicts: libc/signal/sigpause.c libc/string/x86_64/memset.S Signed-off-by: Austin Foxley <austinf@cetoncorp.com>
| * malloc: fix race condition and other bugs in the no-mmu mallocFreeman Wang2009-12-192-6/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixes multiple race conditions on mmb list. This was done by making the mmb_heap_lock into a recursive lock and making the regular heap_lock extend to cover the mmb heap handling. Also move the new_mmb allocation up to before the mmb list is iterated through to find the insertion point. When the mmb_heap also runs out and needs to be extended when the regular heap is just extended, the mmb list could be messed up. Signed-off-by: Freeman Wang <xwang@ubicom.com> Signed-off-by: Austin Foxley <austinf@cetoncorp.com>
* | Merge remote branch 'origin/master' into nptlAustin Foxley2009-11-283-3/+3
|\| | | | | | | Signed-off-by: Austin Foxley <austinf@cetoncorp.com>
| * nommu: use MAP_UNINITIALIZE for mallocsMike Frysinger2009-11-233-3/+3
| | | | | | | | | | | | | | | | | | Now that the kernel supports MAP_UNINITIALIZE, have the malloc places use it to get real uninitialized memory on no-mmu systems. This avoids a lot of normally useless overhead involved in zeroing out all of the memory (sometimes multiple times). Signed-off-by: Mike Frysinger <vapier@gentoo.org>
* | Merge remote branch 'origin/master' into nptl_mergeAustin Foxley2009-11-221-14/+8
|\| | | | | | | | | | | | | | | | | Conflicts: Rules.mak libc/misc/sysvipc/msgq.c test/Rules.mak Signed-off-by: Austin Foxley <austinf@cetoncorp.com>
| * realpath: SUSv4 compliantBernhard Reutner-Fischer2009-11-141-14/+8
| | | | | | | | | | Signed-off-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
* | Extend __gen_tempname with mode argumentMikhail Gusarov2009-11-094-4/+7
| | | | | | | | | | | | | | | | | | | | sem_open(3) needs to create a temporary file in a way which can't be efficiently implemented in terms of POSIX API. Extend __gen_tempname with mode_t mode argument in order to ease sem_open implementation. Signed-off-by: Mikhail Gusarov <dottedmag@dottedmag.net> Signed-off-by: Austin Foxley <austinf@cetoncorp.com>
* | whitespace fixesAustin Foxley2009-10-171-1/+1
| | | | | | | | Signed-off-by: Austin Foxley <austinf@cetoncorp.com>
* | cancellation support for a large amount of the required syscallsAustin Foxley2009-10-171-0/+201
| | | | | | | | Signed-off-by: Austin Foxley <austinf@cetoncorp.com>
* | some tweaks under libc/ needed for nptlAustin Foxley2009-10-171-3/+4
|/ | | | | | | | | | * updated kernel-features.h * system is provided by pt-system with nptl * _exit should do exit_group with nptl * tsd tls ptr in libc * rt_sigwaitinfo impl added Signed-off-by: Austin Foxley <austinf@cetoncorp.com>
* mktemp does not depend on floatsAustin Foxley2009-10-171-1/+5
| | | | Signed-off-by: Austin Foxley <austinf@cetoncorp.com>
* malloc: handle size overflows in realloc()Mike Frysinger2009-10-151-0/+3
| | | | | | | | | The malloc() code checks the incoming size to make sure the header adjustment doesn't cause overflow in the size storage. Add the same check to realloc() to catch stupid stuff like realloc(..., -1). Reported-by: James Coleman <james.coleman@ubicom.com> Signed-off-by: Mike Frysinger <vapier@gentoo.org>
* remove a few more empty #if/#endif pairsDenys Vlasenko2009-09-191-2/+0
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* convert // comments to /**/; remove empty #if/#endif pairs. no code changesDenys Vlasenko2009-09-183-9/+0
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* trim Experimentally off and uncommented hiddenBernhard Reutner-Fischer2009-09-1848-153/+0
| | | | | | | | sed -i -e '/Experimentally off - /d' $(grep -rl "Experimentally off - " *) sed -i -e '/^\/\*[[:space:]]*libc_hidden_proto(/d' $(grep -rl "libc_hidden_proto" *) should be a nop Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
* support building out-of-treeBernhard Reutner-Fischer2009-08-174-0/+8
| | | | | | Handle O= Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
* - Add strtouq alias (to strtoul) for 64bitBernhard Reutner-Fischer2009-03-251-0/+3
| | | | | | | | The strtouq alias was only available on 32bit, breaking compilation of stuff using strtouq on 64bit machines. At the same time use the correct return type (u_quad_t). Signed-of-by: Peter Korsgaard <jacmet@sunsite.dk>
* *: remove __UCLIBC_CURLOCALE_DATA, __UCLIBC_CURLOCALE_DATA.xDenis Vlasenko2009-01-211-2/+2
| | | | | | | | | | | | | | | | | | | is always equivalent to __UCLIBC_CURLOCALE->x. remove typedef __uclibc_locale_t, it used only in a few places, it is lees confusing to use struct __uclibc_locale_struct everywhere. xlocale.h: hide __global_locale back under _LIBC, bug 53 is wrong in claiming it should be exported. Also hide under _LIBC: extern __locale_t __curlocale_var; extern __locale_t __curlocale(void); extern __locale_t __curlocale_set(__locale_t newloc); # define __UCLIBC_CURLOCALE # define __XL_NPP(N) # define __LOCALE_PARAM # define __LOCALE_ARG # define __LOCALE_PTR
* libc/stdlib/_strtod.c: add parens around a | bDenis Vlasenko2008-12-291-1/+1
|
* - expand SUSv3_LEGACYBernhard Reutner-Fischer2008-12-291-2/+2
| | | | - SUSv4_LEGACY part #1 (non-networking)