summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
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-22libm/x86: use call instead of jump for wrappersTimo Teräs
GCC can emit prologue/epilogue code for the functions in various different cases: - frame pointers - PIC build (to load ebx for indirect calls/jumps) - forced stack smashing protection If we used jump in such cases, we'd corrupt the call stack and crash. Signed-off-by: Timo Teräs <timo.teras@iki.fi> 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-24ldso_sh: add support for protected symbols to SHSalvatore Cro
Protected symbols should not be overridden by symbols from other modules. Such symbols are exported i.e. globally visible, but references from whithin defining modules are satisfied locally. Signed-off-by: Salvatore Cro <salvatore.cro@st.com> Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
2010-09-22libc: Sort HEADERS_RM alphabeticallyCarmelo Amoroso
No functional changes, just a code tidy-up. Please keep them sorted in future changes. Signed-off-by: Filippo Arcidiacono <filippo.arcidiacono@st.com> 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-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: Remove nptl/sysdeps/generic directory from include listCarmelo Amoroso
All archs have now moved their generic sysdep.h header from sysdeps/generic to sysdeps/common directory, so it is possible to remove the sysdeps/generic directory from the include list. 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-16test: Update gitignore to take into account new tests added.Carmelo Amoroso
Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
2010-09-15ldso: Do not adjust dynamic section entries unnecessarilyFilippo Arcidiacono
Signed-off-by: Filippo Arcidiacono <filippo.arcidiacono@st.com> Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
2010-09-15tests: Added new nptl testsSalvatore Cro
tests: Added several nptl tests from glibc 2.10.1 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>
2010-09-15libubacktrace: Provide uClibc with backtrace functionsSalvatore Cro
A new shared object, libubacktrace.so.0 is added to uClibc to provide backtrace functions to support application self-debugging. This set of functions requires to dynamically load libgcc_s.so so they need to call dlopen/dlsym that are provided by libdl. For this reason they cannot be included into libc.so.0 but are provided by a new library. User application that wants to use backtrace needs to be compiled with -fexceptions option and -rdynamic to get full symbols printed and must be linked against libubacktrace.so Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
2010-09-14misc: utmpx based logging supportSalvatore Cro
misc: Added support for accessing user accounting database based on utmpx structure. Signed-off-by: Salvatore Cro <salvatore.cro@st.com> Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
2010-09-09nptl: fix static linkingNatanael Copa
We need dl-tls.c for static libc or we will get missing symbols when linking thinkgs like openssl static. Signed-off-by: Natanael Copa <natanael.copa@gmail.com> Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
2010-09-09tests: nptl tests dependencies cleanupSalvatore Cro
tests: some cleanings on nptl tests' dependencies. Signed-off-by: Salvatore Cro <salvatore.cro@st.com> Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
2010-09-07ldso: Fix compilation for x86_64 without TLS support.Will Newton
Add an #ifdef to avoid using TLS structures when TLS is not enabled. Signed-off-by: Will Newton <will.newton@imgtec.com> Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
2010-09-06misc: Fix build error about missing PAGE_SIZEAbdoulaye Walsimou Gaye
This patch fixes the following build error: CC libc/misc/internals/__h_errno_location.os CC libc/misc/internals/parse_config.os libc/misc/internals/parse_config.c: In function 'bb_get_chunk_with_continuation': libc/misc/internals/parse_config.c:77: error: 'PAGE_SIZE' undeclared (first use in this function) libc/misc/internals/parse_config.c:77: error: (Each undeclared identifier is reported only once libc/misc/internals/parse_config.c:77: error: for each function it appears in.) make[2]: *** [libc/misc/internals/parse_config.os] Error 1 Signed-off-by: Abdoulaye Walsimou Gaye <awg@embtoolkit.org> Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
2010-08-31libc: Provide both getpgid and __getpgid symbolsCarmelo Amoroso
Indeed unistd.h header does export '__getpgid' by default, while uClibc provide only 'getpgid' implementation. The 'getpgid' symbol is exported by standard header if __USE_XOPEN_EXTENDED is defined. This patch alignes uClibc implementation with standard header (matching with glibc behaviour). Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
2010-08-28Fix resolver broken in NPTL buildTimo Teräs
The combination of commit aab4df0fb51660300559f5f29290709db2f7bfee resolv.c: add support for per thread res_state commit cca45baf8353d1e338d232f5bdb2d1d6b357f1da /etc/resolv.conf: support "timeout:n" and "attempts:n" options .. and NPTL results in broken resolver in very annoying ways. Now, it seems that most of the uclibc code does not work well if res_state is TLS variable. Technically, this is the correct thing to do since this gives proper per-thread resolving behavior, and it also makes the config options overridable per thread. This probably what apps expect as glibc does it too. But alas, most places use _res to sync up static global variables which results in breakage. It gets more or less randomly selected which threads options get applied. Also in case of multiple servers it looks like the retry logic is shared between all threads, e.g. two concurrent resolutions can make other resolvers skip nameservers due to shared "last_ns_num". And finally the timeout/attempts commit breaks the accumulated stuff horribly. What happens is: 1. multithreaded application startups, initializes resolver, resolves things just fine 2. resolv.conf gets changed, application calls res_init after res_init uclibc will call res_sync on all resolver functions to refresh globals from the TLS variable _res 3. res_init was called only in one thread, so other thread's _res contains all zeroes (yes, this is correct app usage: res_init should be called only from one thread) 4. threads not calling res_init get broken resolver due to timeout being set to zero Now, one proper solution would be to: 1. make __open_nameservers return the configuration options 2. pass the config options struct to res_sync_func so it can do the proper overrides from per-thread _res 3. remove the related globals and use locally config options from __open_nameservers But technically, the correct thing (as in glibc does this) is: - res_init increases global "res_init timestamp" - use _res (or pointer within there) for resolver retries etc. get proper per-thread behavior - resolvers functions call "maybe_init" which reinitialize the TLS'ed resolver state (e.g. reload resolv.conf) if their res_init timestamp is out dated As an immediate emergency kludge fix, the following might do: resolv: fix options handling for TLS _res If _res is in TLS (NPTL), it might not get initialized. Assume zeroes mean default values. Signed-off-by: Timo Teräs <timo.teras@iki.fi> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-08-26_uintmaxtostr: fix indentation (spaces->tabs), no code changesDenys Vlasenko
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-08-19resolv: simplify MAXALIAS handlingBernhard Reutner-Fischer
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2010-08-19getserv: fix reading services lines w > 80 charsBernhard Reutner-Fischer
e.g. getservbyname() Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2010-08-19add header guardBernhard Reutner-Fischer
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2010-08-19buildsys: Do not error on GNUHASH for clean targetsBernhard Reutner-Fischer
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2010-08-17testsuite: nptl/tst-basic5 depends on SUSV4_LEGACYBernhard Reutner-Fischer
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2010-08-17nptl: fix calling convention for __pthread_mutex_cond_lockTimo Teräs
The assembly versions of pthread_cond_wait calls __pthread_mutex_cond_lock and __pthread_mutex_cond_lock_adjust using internal calling convention (which differs from default calling convention at least on x86). Thus these two functions must be defined with internal_function or the call sequence goes wrong. __pthread_mutex_cond_lock resides in sysdeps/unix/sysv/linux/pthread_mutex_cond_lock.c, but it does evil macro definitions and includes pthread_mutex_lock.c, so we need to add some extra kludge to pthread_mutex_lock.c to get the prototypes correctly. Signed-off-by: Timo Teräs <timo.teras@iki.fi> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2010-08-06config parser: fix memory corruptionTimo Teräs
fgets will happily write over allocated area limits. Adjusted the buffer size according to how much is already read. Also increase the maximum default line length, as 80 is slightly small. It might be better if bb_get_chunk_with_continuation would reallocate the line buffer if it was not user given. Signed-off-by: Timo Teräs <timo.teras@iki.fi> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2010-08-06nptl i686: avoid cpp problems with thunk sectionBernhard Reutner-Fischer
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2010-08-05Revert "nptl i686: fix pthread_cond_wait.S compilation"Bernhard Reutner-Fischer
This reverts commit f71c0d8af11252f119fad04938ddd5501a7df21a.
2010-08-05resolver: switch to config parserBernhard Reutner-Fischer
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2010-08-05getnet: switch to config parserBernhard Reutner-Fischer
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>