summaryrefslogtreecommitdiff
path: root/libc/stdlib
AgeCommit message (Collapse)Author
2012-06-15arc4random.c: replace a commentPeter S. Mazinger
Remove pointer to a dead link. Signed-off-by: Peter S. Mazinger <ps.m@gmx.net> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15stdlib.h, arc4random.c: fix arc4random return type to u_int32_tPeter S. Mazinger
Change uint32_t to u_int32_t and uint8_t to u_int8_t, removing completely the dependency on stdint.h. Based on patch by Timo Teraes <timo.teras@iki.fi>. His comment: 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 Teraes <timo.teras@iki.fi> Signed-off-by: Peter S. Mazinger <ps.m@gmx.net> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15arc4random.c: use smallint for rs_initializedPeter S. Mazinger
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15arc4random.c: move arc4_getbyte upPeter S. Mazinger
no need for forward declarations Signed-off-by: Peter S. Mazinger <ps.m@gmx.net> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15stdlib.c: get rid of the compiler workarounds by using strong_alias_untypedPeter S. Mazinger
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15make __uClibc_fini() hiddenPeter S. Mazinger
No need for a visible version Signed-off-by: Peter S. Mazinger <ps.m@gmx.net> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15do not include xlocale.h, it is included by locale.h when neededPeter S. Mazinger
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15remove unneeded hiddens for rtime, basename, strtof* and wcstof*Peter S. Mazinger
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-05-05drop support for old systems lacking vforkMark Salter
Only really old systems (<=linux-2.0) lack a dedicated vfork system call. The code that is in place to support them is causing issues with newer arches that also don't provide a vfork system call -- instead, they do vfork by calling clone in userspace. If anyone cares about these really old systems, they can submit a patch to make the system work with them while not breaking newer systems. Signed-off-by: Mark Salter <msalter@redhat.com> Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2012-05-03rpmatch: provide out-of-line implementationBernhard Reutner-Fischer
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-01-23libc: fix signal handling in system()Richard Braun
When built without NPTL support (or for a sparc target), the system() function doesn't conform to its specification. Namely, it uses signal() to install/save/restore signal handlers, which may break applications using custom handlers installed with sigaction(). In addition, it resets the SIGCHLD handler to SIG_DFL instead of blocking the signal, which may result in "lost" signals if a custom handler was installed. Fix system() by replacing uses of signal() with appropriate calls to sigaction() and sigprocmask(). Signed-off-by: Richard Braun <rbraun@sceen.net> Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2012-01-15libc: build abort with unwind-info for backtraceBernhard Reutner-Fischer
If backtrace support is turned on, build raise() and abort() with unwind info (fixup 4c9b7f3c21ff21c199e54bfad2fdf3445fa4573d). Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-01-13libc: allow to backtrace out of abort callCarmelo Amoroso
Build raise and abort function with dwarf2 info by using -fasynchronous-unwind-tables to make backtrace() working across a call to abort. A scenario where it could be useful is within a signal handler that wants to dump a backtrace when catching some signal (i.e SIGABRT). Without having abort & raise built with DWARF2 information, it is not possible for the libgcc stack unwinder to walk through the call stack out of the abort/raise function. Impacts in terms of size are really limited Current text data bss dec hex filename 164 0 0 164 a4 ./libpthread/nptl/sysdeps/unix/sysv/linux/raise.os 164 0 0 164 a4 ./libpthread/nptl/sysdeps/unix/sysv/linux/raise.oS 220 24 4 248 f8 ./libc/stdlib/abort.os With (-fasynchronous-unwind-tables) text data bss dec hex filename 216 0 0 216 d8 ./libpthread/nptl/sysdeps/unix/sysv/linux/raise.os 216 0 0 216 d8 ./libpthread/nptl/sysdeps/unix/sysv/linux/raise.oS 280 24 4 308 134 ./libc/stdlib/abort.os Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com> Acked-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2011-11-07stdlib: add qsort_rBernhard Reutner-Fischer
GNU extension like qsort but takes a 3 parameter comparision function. Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2011-09-15Defeat compiler optimization which assumes function addresses are never NULLDenys Vlasenko
From email: A warning for people who can be hit by the same or similar issue: gcc 4.1.2 with -march=i486 here with -Os and even with -O2 or -O is "optimizing away" the check if (_stdio_term) in libc/stdlib/_atexit.c which results in a "call 0" and a segfault at exit if you do not happen to link in stdio. Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2011-05-10__uc_malloc: Fix memory-leak in error pathBernhard Reutner-Fischer
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2011-04-11Fix malloc alignmentBernd Schmidt
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>
2011-03-16memalign: include sys/param.h for MAXBernhard Reutner-Fischer
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>
2011-03-10really fix missing __libc_drand48_dataPeter S. Mazinger
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
2011-03-10Revert "missing prototype of __libc_drand48_data fixed"Peter S. Mazinger
This reverts commit e2cea9b9edabe885b9bf2586f9541ffb8fe93f3f. Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
2011-03-10missing prototype of __libc_drand48_data fixedPeter S. Mazinger
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
2011-03-09stdlib.c, _strtod.c, stdlib.h: remove unused hidden functionsPeter S. Mazinger
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
2011-03-09arc4random.c, stdlib.h: get rid of hidden arc4random_stirPeter S. Mazinger
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>
2011-03-09move prototype for __drand48_iterate and __libc_drand48_data to stdlib.hPeter S. Mazinger
Move them to a common header guarded by _LIBC Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
2011-03-09stdlib.c: remove duplicate libc_hidden_proto for strtoul/strtoul_lPeter S. Mazinger
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
2011-03-09_strtod.c: only strtod hidden version is neededPeter S. Mazinger
Do not provide hidden strtod_l, wcstod and wcstod_l Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
2011-03-03style updatePeter S. Mazinger
Style update avoiding compile warnings Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
2010-12-01libc: fix strtoqNatanael Copa
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>
2010-11-24libc: silence warningBernhard Reutner-Fischer
about implicit declaration of memset in system() Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2010-10-22*: inline constant __sig{add,del}set and __sigismemberDenys Vlasenko
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>
2010-09-16libc: Add canonicalize_file_name functionCarmelo Amoroso
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>
2010-07-27malloc: simplify MAP_UNINITIALIZE ifdef logicMike Frysinger
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2010-07-27malloc-simple: Make calloc() return zeroed memorySteven J. Magnani
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>
2010-06-11silence some warnings about missing prototypesBernhard Reutner-Fischer
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2010-04-22nptl: fix malloc library lockingTimo Teräs
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>
2010-04-02Merge commit 'origin/master' into nptlAustin Foxley
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>
2010-03-25prettify make cleanBernhard Reutner-Fischer
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2010-02-19sparc: disable cancellable system, as it fails in strange ways right nowAustin Foxley
Signed-off-by: Austin Foxley <austinf@cetoncorp.com>
2010-02-03libc: Fix l64a to return the correct buffer pointerFilippo Arcidiacono
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>
2010-02-03libc: Fix l64a to return the correct buffer pointerFilippo Arcidiacono
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>
2010-02-01Fix accidently dropped hunk during last merge from master.Khem Raj
Signed-off-by: Khem Raj <raj.khem@gmail.com>
2010-02-01Merge commit 'origin/master' into nptlKhem Raj
Conflicts: libc/stdlib/Makefile.in Signed-off-by: Khem Raj <raj.khem@gmail.com>
2010-01-26convert to foo-y kbuild styleBernhard Reutner-Fischer
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2009-12-19Merge commit 'origin/master' into nptlAustin Foxley
Conflicts: libc/signal/sigpause.c libc/string/x86_64/memset.S Signed-off-by: Austin Foxley <austinf@cetoncorp.com>
2009-12-19malloc: fix race condition and other bugs in the no-mmu mallocFreeman Wang
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>
2009-11-28Merge remote branch 'origin/master' into nptlAustin Foxley
Signed-off-by: Austin Foxley <austinf@cetoncorp.com>
2009-11-23nommu: use MAP_UNINITIALIZE for mallocsMike Frysinger
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>
2009-11-22Merge remote branch 'origin/master' into nptl_mergeAustin Foxley
Conflicts: Rules.mak libc/misc/sysvipc/msgq.c test/Rules.mak Signed-off-by: Austin Foxley <austinf@cetoncorp.com>
2009-11-14realpath: SUSv4 compliantBernhard Reutner-Fischer
Signed-off-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2009-11-09Extend __gen_tempname with mode argumentMikhail Gusarov
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>