summaryrefslogtreecommitdiff
path: root/libc
AgeCommit message (Collapse)Author
2010-11-28Merge commit 'origin/master' into prelinkCarmelo Amoroso
Conflicts: ldso/include/dl-hash.h Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
2010-11-28libc_utmp: Fix getutmp and getutmpx for x86_64Carmelo Amoroso
On x86_64, when WORDSIZE_COMPAT32 is enabled, the ut_tv field of 'struct utmp' and 'struct utmpx' are defined as two nested structs instead of being defined as 'struct timeval', so it is not possible to directly assign the two ut_tv values. This patch split the assignment by setting each fields (tv_sec, tv_usec) of the ut_tv filed separately It is als compatible with 'struct timeval' usage. Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.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-11-24wchar: bug #1471: fix cornercase in mbrtowcBernhard Reutner-Fischer
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2010-11-23resolv.c fails for /etc/hosts lookupsPhilip Nye
Patch attached: Fix a bug in offset calculations when parsing /etc/hosts in resolv.c. Formerly a miscalculation meant that having found the correct line, the code was trashing its own result data. Signed-off-by: Philip Nye <philipn@engarts.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2010-11-18Adding quad float gcc intrinsic implementation for SPARCAustin Foxley
Sparc-Gcc generates q_xxx intrinsic calls for quad float ("long double") code. The routines from glibc's glibc-2.9/sysdeps/sparc/sparc32/soft-fp/* where taken and ported to uclibc. Signed-off-by: Konrad Eisele <konrad@gaisler.com> Signed-off-by: Austin Foxley <austinf@cetoncorp.com>
2010-11-10microblaze: build infrastructureSteven J. Magnani
Fix Microblaze config and makefiles. Signed-off-by: Steven J. Magnani <steve@digidescorp.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2010-11-10microblaze: thread supportSteven J. Magnani
Header files needed to build linuxthreads.old for microblaze. Signed-off-by: Steven J. Magnani <steve@digidescorp.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2010-11-10microblaze: optimized memcpy/memmoveSteven J. Magnani
Port optimized memcpy/memmove from the kernel. Signed-off-by: Steven J. Magnani <steve@digidescorp.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2010-11-10microblaze: misc headersSteven J. Magnani
Other header files for uClibc compilation. Signed-off-by: Steven J. Magnani <steve@digidescorp.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2010-11-10microblaze: kernel headersSteven J. Magnani
Sync kernel header definitions with those used in recent mainline kernels. Signed-off-by: Steven J. Magnani <steve@digidescorp.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2010-11-10microblaze: Restore soft-floatSteven J. Magnani
Software floating point for microblaze. Signed-off-by: Steven J. Magnani <steve@digidescorp.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2010-11-10microblaze: vfork/clone interfaceSteven J. Magnani
Fix the microblaze vfork() and clone() implementations. Add support for clone2(). Signed-off-by: Steven J. Magnani <steve@digidescorp.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2010-11-10microblaze: syscall interfaceSteven J. Magnani
Fix the microblaze syscall interface. Recent mainline kernels no longer carry userland code to invoke syscalls and microblaze can use the uClibc generic code. Signed-off-by: Steven J. Magnani <steve@digidescorp.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2010-11-10microblaze: Fix crt bootstrapSteven J. Magnani
Rework crt bootstrap to work with the new __uClibc_main(), and hardwire crt init/fini code since the awk approach to generating it on the fly doesn't work for microblaze. The output from the gcc 4.1.2 compiler is scrambled so that the tags expected by the awk script to bracket the init/fini entry and exit code no longer do. Signed-off-by: Steven J. Magnani <steve@digidescorp.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2010-11-10microblaze: Fix setjmp/longjmpSteven J. Magnani
Some state and registers are missing from setjmp/longjmp handling. Signed-off-by: Steven J. Magnani <steve@digidescorp.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2010-10-31libm: improve readability of math.h; expand comments and docsDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-10-30sleep: include Linus' email in the commentDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-10-29sleep: document testing result on 2.4.x kernelsDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-10-29sleep: add comment with test program for SIG_IGNed SIGCHLDDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-10-27Fix msync() redefinition for noMMU buildBernhard Reutner-Fischer
An architecture that _may_ have a MMU (and thus implements the msync syscall), but for which the kernel and uClibc are built as noMMU, we have a stub for msync. Thanks to Steven J. Magnani for noticing. Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2010-10-27mips: fix errno setting after syscallAlexander Gordeev
If there was an error during syscall then after it's completion a3 register holds a non-zero value and v0 holds an actual error code which should be saved in errno. This can be achieved by calling __syscall_error with the value from v0 as a parameter. So this value should be stored in a0, but the appropriate assembly instructions are missing. Fixed this now by adding "move a0, v0". I think it was once fixed by 58c5f8ba4cdf62342d05a546d15404cbbb3c4e07 but then something went wrong. Again... Signed-off-by: Alexander Gordeev <lasaine@lvk.cs.msu.su> 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-10-22remove superfluous libc_hidden_proto(memcpy) and #includeDenys Vlasenko
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-10-22sleep: tiny code shrinkDenys Vlasenko
...or rather, it WILL BE code shrink when gcc become clever enough to not emit a second, useless XORing of ebx: 31 db xor %ebx,%ebx 85 c0 test %eax,%eax 74 11 je 73 <__GI_sleep+0x73> 31 db xor %ebx,%ebx <=== ?! Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-10-22sleep: employ __USE_EXTERN_INLINES (with necessary fixes)Denys Vlasenko
__USE_EXTERN_INLINES was unused and had bit-rotted, had to fix it when it didn't work as intended at first. text data bss dec hex filename - 168 0 0 168 a8 libc/unistd/sleep.o + 146 0 0 146 92 libc/unistd/sleep.o Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-10-22sleep: check "SIGCHLD is SIG_IGN'ed" first. Saves two syscalls in common caseDenys Vlasenko
text data bss dec hex filename - 197 0 0 197 c5 libc/unistd/sleep.o + 168 0 0 168 a8 libc/unistd/sleep.o Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-10-22sleep: remove commented-out code. no code changesDenys Vlasenko
It can be easily reconstructed, since it's obvious Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-10-21sleep: code shrinkDenys Vlasenko
Use less stack by using same "sigset_t set" object for new and saved signal set, remove redundant clearing of set, and do not save/restore errno around sigprocmask(SIG_SETMASK) - it never changes it. While at it, improve comments and make code style consistent across sleep.c file. text data bss dec hex filename - 242 0 0 242 f2 libc/unistd/sleep.o + 197 0 0 197 c5 libc/unistd/sleep.o Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-10-19vfprintf.c: reduce a chunk of #ifdef forest and remove one goto inside itDenys Vlasenko
No code changes according to objdump. Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-10-19_vfprintf.c: de-obfuscate badly twisted fragment. no code changes.Denys Vlasenko
objdump confirms that I did not mess it up. Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-10-19vfprintf.c: remove endif comments which clog up the source. no code changesDenys Vlasenko
Example: --ppfs->maxposarg; Verified with objdump that no code is changed Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-10-19vfprintf.c: de-obfuscate if(with nested assignments). no logic changesDenys Vlasenko
God knows this file is hard to read as-is, some readability improvement is in order. Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-10-14getproto: increase line buffer size, simlify and fix alias handlingNatanael Copa
We increase line buffer size, reduce MAXALIASES and make sure we don't segfault when there are too manuy aliases in /etc/protocols. Signed-off-by: Natanael Copa <natanael.copa@gmail.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2010-10-14getnet: simplify alias handling and reduce MAXALIASESNatanael Copa
Reduce MAXALIASES to something lower. There will probably never be need for more than 1 alias but we allow a few extra. While here we alos fix segfault when there are too many aliases. Signed-off-by: Natanael Copa <natanael.copa@gmail.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2010-10-14getservice: fix handling of long linesNatanael Copa
Don't try to be smart by dynamically realloc buffersize as it doesn't work. Instead, be simple and allocate a buffer big enough. This fixes a memory leak when calling getserv{ent,byname,byport} multiple times. To save memory we reduce number of max aliases. We seldomly will need more than 1 anyways. While here, fix segfault that happened if there were too many aliases. Signed-off-by: Natanael Copa <natanael.copa@gmail.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2010-10-14parse_config: discard rest of incomplete lineNatanael Copa
If line is longer then size of given buffer and buffer is not allocated by the config parser itself, then discard rest of line. Signed-off-by: Natanael Copa <natanael.copa@gmail.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2010-10-14config parser: always initialize line pointerNatanael Copa
We must always initialize line pointer since data pointer might have changed due to a realloc (in getserv.c for example). Signed-off-by: Natanael Copa <natanael.copa@gmail.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2010-10-14getservice: getservent_r must return ERANGE when buffer is too smallNatanael Copa
This fixes issue introduced by 72e1a1ce186c39f07282398e2af9eb0253e60f15 This should also fix the following testcase to exit with error rather than cause an endless loop. int main(void) { if (getservbyname("non-existing", "udp") == NULL) err(1, "getservbyname"); return 0; } Reported by Pirmin Walthert http://lists.uclibc.org/pipermail/uclibc/2010-August/044277.html Signed-off-by: Natanael Copa <natanael.copa@gmail.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2010-10-14config parser: do not assume that realloc return same pointerNatanael Copa
We need to update the parser->line pointer on realloc and do not initialize the token array til after the potensial realloc in bb_get_chunk_with_continuation(). While here, also replace a realloc() with malloc() where pointer always is NULL. Signed-off-by: Natanael Copa <natanael.copa@gmail.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2010-10-01sparc: pipe.SAustin Foxley
return value of pipe on success is supposed to be 0 Signed-off-by: Austin Foxley <austinf@cetoncorp.com>
2010-09-24Merge commit 'origin/master' into prelinkCarmelo Amoroso
Conflicts: ldso/ldso/sh/elfinterp.c Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
2010-09-20nptl: Fix libpthread build when UCLIBC_LINUX_SPECIFIC is disabledCarmelo Amoroso
NPTL library needs both madvise and statfs symbols, that are guarded by UCLIBC_LINUX_SPECIFIC option. This fix provides these symbols too when NPTL is used, indipendently by UCLIBC_LINUX_SPECIFIC choice. Otherwise libpthread link fails as below: LD libpthread-0.9.32-git.so libpthread/nptl/libpthread_so.a(pthread_create.oS): In function `__free_tcb': pthread_create.c:(.text+0x1184): undefined reference to `madvise' libpthread/nptl/libpthread_so.a(sem_open.oS): In function `__where_is_shmfs': sem_open.c:(.text+0x764): undefined reference to `statfs' collect2: ld returned 1 exit status make: *** [lib/libpthread.so] Error 1 Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
2010-09-17ldso: Add implementation of ld.so standalone executionFilippo Arcidiacono
The dynamic linker can be run either indirectly through running some dynamically linked program or library (in which case no command line options to the dynamic linker can be passed and, in the ELF case, the dynamic linker which is stored in the .interp section of the program is executed) or directly by running: /lib/ld-uClibc.so.* [OPTIONS] [PROGRAM [ARGUMENTS]] Stand-alone execution is a prerequisite for adding prelink capabilities to uClibc dynamic linker, as well useful for testing an updated version of the dynamic linker without breaking the whole system. Currently supported option: --library-path PATH use given PATH instead of content of the environment variable LD_LIBRARY_PATH (Mandatory for prelinking) Not supported options: --list list all dependencies and how they are resolved --verify verify that given object really is a dynamically linked object we can handle --inhibit-rpath LIST ignore RUNPATH and RPATH information in object names in LIST This feature can be enabled by setting LDSO_STANDALONE_SUPPORT=y Signed-off-by: Filippo Arcidiacono <filippo.arcidiacono@st.com> Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
2010-09-17libc: Handle cancellation in non multiplexed socket callsCarmelo Amoroso
For those archs that provide non multiplexed socket calls it possible to implement the lib C wrappers without calling the multi-purpose __socketcall. For a subset of these functions that are cancellation point, it needs to correctly handle cancellation. Signed-off-by: Francesco Rundo <francesco.rundo@st.com> Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
2010-09-16nptl_sh: Fix compiler warning due to shadowed variableCarmelo Amoroso
Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.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-09-15sh: update the memcpy adding a new loop with aggressive prefetchingSalvatore Cro
After exploring different prefetch distance-degree combinations in this new update of the memcpy function, a new loop has been added for moving many cache lines with an aggressive prefetching schema. Prefetch has been removed when move few cache line aligned blocks. As final result, this memcpy gives us the same performances for small sizes (we already had!) and better numbers for big copies. In case of SH4-300 CPU Series, benchmarks show a gain of ~20% for sizes from 4KiB to 256KiB. In case of the SH4-200, there is a gain of ~40% for sizes bigger than 32KiB. Signed-off-by: Giuseppe Cavallaro <peppe.cavallaro@st.com> Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
2010-09-15sh: move data without fetching cache block within the memsetSalvatore Cro
With this patch the movca.l instruction is used within the memset. The current memset implementation only uses the FPU and there is an real gain for all the sizes. Adding the movca.l instruction numbers always are better than the generic code. There is a big gain for size greater than 64 KiB but number are worst for 4-32KiB sizes compared with the implementation without movca.l. Time Memory Bandwidth (Mbytes) ------------------------------------------------- Generic SH4 SH4 (FPU) (FPU+movca.l) ------------------------------------------------- 512 1143 1998 1596 1 KiB 1273 2567 1915 2 KiB 1350 2993 2128 4-32KiB 1391 3262 2252 64KiB-16MiB 170 186 *830* Signed-off-by: Giuseppe Cavallaro <peppe.cavallaro@st.com> Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
2010-09-15libc: Fix cancellation handling in some C functionsSalvatore Cro
According to POSIX.1-2008 standard, the following syscalls shall be cancellation points : waitid, sleep, fdatasync, ppoll. Further, if generic syscall is not available and stubs are configured, provide the stub implementation for function. Signed-off-by: Salvatore Cro <salvatore.cro@st.com> Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>