summaryrefslogtreecommitdiff
path: root/libc
AgeCommit message (Collapse)Author
2013-06-14config: UCLIBC_HAS_OBSTACK to optionally enable obstack supportAnthony G. Basile
Signed-off-by: Anthony G. Basile <blueness@gentoo.org> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-06-07eventfd.h: Use new "bits/" scheme for arch-specific flagsHiroaki KAWAI
As in timerfd.h, eventfd.h needs arch-specific definition files. alpha, mips and sparc needs separate file, all the other arch will use common definition. This problem is already fixed in glibc. Also sanitize and provide bits for hppa. Make sure not to install the new bits/eventfd unless eventfd support is enabled. Signed-off-by: Hiroaki KAWAI <kawai@stratosphere.co.jp> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-05-28libc: elf: explicitly include uClibc_page.h to make PAGE_SIZE visibleCarmelo Amoroso
Signed-off-by: Filippo Arcidiacono <filippo.arcidiacono@st.com> Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
2013-05-13libc: deal with aux vect inside __uClibc_main only if !SHAREDFilippo ARCIDIACONO
It's not safe to use the aux vect inside __uClibc_main if we are running with shared libraries, because it could have been already modified. For example, if some constructor plays with environment variables by using unsetenv, the modifications done into the stack to unset an environment variable, have impacts on the aux vect due to the extra NULL entries added. Due to this, __uClibc_main is not able to detect where the aux vect starts, so all the entries that are used by __uClibc_main (AT_UID, AT_EUID, AT_GID, AT_EGID, AT_PAGESZ and possibly other arch specific) are impacted. Same side effect on the aux vect is caused by the ld.so when running a SUID program with some of the unsecure environment variables set, that will be unset by the ld.so itself. In order to fix this issue, it needs to handle aux vect entries into __uClibc_main only if SHARED is not defined. In SHARED case, libc refers to __dl_secure and _dl_pagesize as initialised by the ld.so where the aux vext is still untouched. Signed-off-by: Filippo Arcidiacono <filippo.arcidiacono@st.com> Reviewed-by: Carmelo Amoroso <carmelo.amoroso@st.com> Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
2013-04-07linux: pread/write: fix 64bit handlingMike Frysinger
The syscall on 64bit ports takes 4 args as there is no need to split up the value into two args. Add support for that to the common code. Once we fix that, the mips code can now leverage it for its 64bit and 32bit needs. However, we can't just drop it entirely yet because its n32 ABI needs special handling to treat it like a 64bit port. This does change the existing behavior which treats the n32 like a 32bit port, but we want to do this. In the future, we'll probably have to introduce a define for this as it currently affects x86_64/x32 and mips/n32. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2013-04-04add UCLIBC_SUSV2_LEGACY to hide vallocBernhard Reutner-Fischer
valloc was marked as LEGACY in SUSv2, removed from SUSv3 and later. TODO: Remove this (point people to memalign and it's successors?). Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-04-03stdlib: avoid relocationBernhard Reutner-Fischer
valloc uses memalign Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-04-01linux: pread/write: convert to SYSCALL_ALIGN_64BITMike Frysinger
The pread64/write64 syscalls have the 64bit register align issue for all arches. Use this new define so we can merge the powerc/xtensa versions back into the common code. SuperH is funky and also allows us to do this. We should be able to merge the mips version too, but that'll require someone to take a closer look as the current stuff doesn't look quite right. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2013-04-01linux: readahead: convert to SYSCALL_ALIGN_64BITMike Frysinger
The readahead syscall has the 64bit register align issue for all arches. Only mips was handling this though. Clean up the common readahead.c to use the SYSCALL_ALIGN_64BIT define so that we can throw away the mips version and make this work correctly on arm/ppc/xtensa. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2013-04-01linux: posix_fadvise: use new SYSCALL_ALIGN_64BITMike Frysinger
Now that we have a new SYSCALL_ALIGN_64BIT define for tracking the 64bit register shift behavior, use it. This allows us to delete duplicated arm/xtensa files, as well as drop a few arch ifdefs from common code. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2013-04-01linux: use OFF64_HI_LO rather than __LONG_LONG_PAIRMike Frysinger
This macro takes care of the shift/mask split for us, so no need to open code this ourselves and then use __LONG_LONG_PAIR. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2013-04-01mips: only define SYSCALL_ALIGN_64BIT for O32 ABIsMike Frysinger
The 64bit register alignment issue only affects the O32 ABI, so wrap the define accordingly. We don't want this being used for N32 ABIs. This doesn't directly affect the N64 ABI since these files wouldn't even be compiled for those targets (no need for the 32bit/64bit shim). Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2013-04-01libc: rename TRUNCATE64_HAS_4_ARGS to SYSCALL_ALIGN_64BITMike Frysinger
The reason truncate64 takes 4 args on some arches is that their ABI requires 64bit values to be aligned on register pair boundaries. Since this alignment affects more than just truncate64, rename the define to properly document its purpose. This also allows us to expand it to the other impacted syscalls (which will be done in a follow up commit). Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2013-03-29Revert "_scanf.c: Implement 'm' modifier for 'c' and '[' conversions."Bernhard Reutner-Fischer
This reverts commit e567c399ff86d007d8c4586f0dd5e0ca61e283ca. since it breaks badly (e.g. busybox netstat) Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-03-29_vfprintf.c: use 'fputws_unlocked(S, F)' instead of 'fputws(S, F)'Mirko Vogt
This eliminates a source of reproduceable freezes Signed-off-by: Mirko Vogt <dev@nanl.de> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-03-29inet: fix getting the nameserver from _res state after res_init.Felix Fietkau
Fixes displaying the nameserver in busybox nslookup. Signed-off-by: Felix Fietkau <nbd@openwrt.org> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-03-22libc: Fix common-generic stat.h for BEMischa Jonker
Signed-off-by: Mischa Jonker <mjonker@synopsys.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-03-22Fix a problem with scanning wide chars.Nathan Sidwell
We found that the testcase int main (void) { wchar_t s[10]; memset (s, 0, sizeof (s)); int r = sscanf ("s", "%ls", s); printf ("%d\n", r); printf ("%ls\n", s); return 0; } printed 0 <blankline> rather than the expected 1 s The problem was the enum in _scanf.c, which has had a 'CONV_m' value inserted. The attached patch fixes the problem in __psfs_parse_spec by not presuming a particular displacement between the two sets of char-like conversion values. With this patch the above program produces the expected output. Signed-off-by: Nathan Sidwell <nathan@codesourcery.com> Signed-off-by: Bernd Schmidt <bernds@codesourcery.com>
2013-03-20inet: do not filter responses in res_queryTimo Teräs
Fixes bug #5342 res_query was silently rejecting responses against T_ANY DNS questions. Remove the type-filtering from res_query altogether. __dns_lookup is supposed to return the proper stuff that you asked for (and only that). Signed-off-by: Timo Teräs <timo.teras@iki.fi> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-03-20inet: Fix LT{.old,} compilation due to res_icloseBernhard Reutner-Fischer
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-03-20rpc: silence warningBernhard Reutner-Fischer
Silence warning about shadowing wait Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-03-14libc: switch several users to unlikely()Bernhard Reutner-Fischer
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-03-14inet: res_nclose: free user-buffer, not global _resBernhard Reutner-Fischer
In res_iclose we were operating on the global _res even if called via res_nclose where we are supposed to operate on the user provided res_state. Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-03-14metag: Add NPTL supportMarkos Chandras
Signed-off-by: Markos Chandras <markos.chandras@imgtec.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-03-14libm: Add support for the Meta architectureMarkos Chandras
Signed-off-by: Markos Chandras <markos.chandras@imgtec.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-03-14Add support for the Meta architectureMarkos Chandras
Meta cores are 32-bit, hardware multithreaded, general purpose, embedded processors which also feature a DSP instruction set, and can be found in many digital radios. They are capable of running different operating systems on different hardware threads, for example a digital radio might run RTOSes for DAB decoding and audio decoding on 3 hardware threads, and run Linux on the 4th hardware thread to manage the user interface, networking etc. HTPs are also capable of running SMP Linux on multiple hardware threads. Signed-off-by: Markos Chandras <markos.chandras@imgtec.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-03-14libc/ipc: Make IPC_64 0 for common-generic ABIVineet Gupta
This avoids having to define __IPC_64 to 0 in each arch using the ABI Signed-off-by: Vineet Gupta <vgupta@synopsys.com> Cc: Markos Chandras <markos.chandras@imgtec.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-03-14fstat64: Fix Build warnings with common-generic ABI buildVineet Gupta
CC libc/sysdeps/linux/common/fstat64.os In file included from libc/sysdeps/linux/common/fstat64.c:16: libc/sysdeps/linux/common/xstatconv.h:28: warning: 'struct kernel_stat' declared inside parameter list libc/sysdeps/linux/common/xstatconv.h:28: warning: its scope is only this definition or declaration, which is probably not what you want libc/sysdeps/linux/common/fstat64.c: In function 'fstat64': libc/sysdeps/linux/common/fstat64.c:33: warning: passing argument 2 of '__syscall_fstat64' from incompatible pointer type libc/sysdeps/linux/common/fstat64.c:18: note: expected 'struct stat *' but argument is of type 'struct stat64 *' ------------------------------------------------------------------- Signed-off-by: Vineet Gupta <vgupta@synopsys.com> Cc: Markos Chandras <markos.chandras@imgtec.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-03-14leek: if lseek syscall is not available, use lseek64 even for !LFSVineet Gupta
With Busybox and uClibc - both built w/o LFS, this caused ash to be completely broken, as lseek was simply returning error. Signed-off-by: Vineet Gupta <vgupta@synopsys.com> Cc: Markos Chandras <markos.chandras@imgtec.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-03-14utimes: Export utimensat based utimesVineet Gupta
sys/time.h has libc_hidden_proto(utimes) which generates the hidden "__GI_utimes" symbol reference, and common/utimes.c has a libc_hidden_def(utimes) which generates the exported "utimes" alias. As part of no-legacy-syscall kernel ABI, Commit 80dc2ed05 "utimes: Use utimensat if arch does not have the utimes syscall" introduced a new wrapper, but missed the corresponding libc_hidden_def, causing Busybox (1.20.0) link to fail (for ARC). Also don't generate a STUB, in that case. ---------------->8------------------- .... touch.c:(.text.touch_main+0xdc): undefined reference to `utimes' touch.c:(.text.touch_main+0x114): undefined reference to `utimes' libbb/lib.a(copy_file.o): In function `copy_file': copy_file.c:(.text.copy_file+0x446): undefined reference to `utimes' collect2: ld returned 1 exit status ---------------->8------------------- Signed-off-by: Vineet Gupta <vgupta@synopsys.com> Cc: Markos Chandras <markos.chandras@imgtec.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-02-27libc/pause: Enable pause_nocancel for arches without __NR_pauseMarkos Chandras
Signed-off-by: Markos Chandras <markos.chandras@imgtec.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-02-20nice: fix overflow checking in int_add_no_wrap()Xi Wang
In C, signed integer overflow is undefined behavior. Many compilers optimize away checks like `a + b < a'. Use safe precondition testing instead. Signed-off-by: Xi Wang <xi@mit.edu> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-02-20inet: remove noreturn attribute from res_ncloseBernhard Reutner-Fischer
Partially revert e9af4dfbd328e9f3bba235fdb2d1027dd2dbbcde Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-02-20libc/ipc: Allow architectures to define their own __IPC_64 macroMarkos Chandras
New architectures don't define ARCH_WANT_IPC_PARSE_VERSION in their kernel. This means that every cmd passed to semctl,msgctl and shmctl is IPC_64 by default. For these architectures we need to define __IPC_64 as 0. Existing architectures are not affected by this change. Signed-off-by: Markos Chandras <markos.chandras@imgtec.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-02-20open: Use openat if arch does not have the open syscallMarkos Chandras
Signed-off-by: Markos Chandras <markos.chandras@imgtec.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-02-20not-cancel.h: Use openat if arch does not have the open syscallMarkos Chandras
Signed-off-by: Markos Chandras <markos.chandras@imgtec.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-02-20open64: Use openat if arch does not have the open syscallMarkos Chandras
Signed-off-by: Markos Chandras <markos.chandras@imgtec.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-02-20fcntl: Use fcntl64 is arch does not have the fcntl syscallMarkos Chandras
Signed-off-by: Markos Chandras <markos.chandras@imgtec.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-02-20fstatfs64: Prefer fstatfs64 system call instead of __libc_fstatfsMarkos Chandras
Using __libc_fstatfs for fstatfs64 adds a small delay as it needs to use a 32-bit data structure to get the file info and them pass them to the 64-bit data structure which was given as a fstatfs64 argument. Using the system call directly should make the entire process much faster. Also fix the arguments for fstatfs64. It takes three arguments (see fs/fstatfs.c in Linux kernel sources) so despite what the manpage says, the size of the buffer needs to be passed as the second argument Signed-off-by: Markos Chandras <markos.chandras@imgtec.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-02-20fstatfs: Add __libc_fstatfs wrapperMarkos Chandras
New architectures don't have fstatfs anymore, so we use a wrapper for __libc_fstatfs which will use fstatfs64 internally. The interface however needs to remain the same (i.e accepting a struct statfs as a second argument) for backwards compatibility Signed-off-by: Markos Chandras <markos.chandras@imgtec.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-02-20stat: Use fstatat64 if arch does not have the stat syscallMarkos Chandras
Signed-off-by: Markos Chandras <markos.chandras@imgtec.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-02-20ustat: Add ustat stub for arches that don't have the ustat system callMarkos Chandras
Signed-off-by: Markos Chandras <markos.chandras@imgtec.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-02-20lstat64: Use fstatat64 if arch does not have the lstat64 syscallMarkos Chandras
Signed-off-by: Markos Chandras <markos.chandras@imgtec.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-02-20lstat: Use fstatat64 if arch does not have the lstat syscallMarkos Chandras
Signed-off-by: Markos Chandras <markos.chandras@imgtec.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-02-20stat64: Use fstatat64 if arch does not have the stat64 syscallMarkos Chandras
Signed-off-by: Markos Chandras <markos.chandras@imgtec.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-02-20fstatat{64}: No conversion code is needed for new architecturesMarkos Chandras
Signed-off-by: Markos Chandras <markos.chandras@imgtec.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-02-20fstatat64: Use newfstatat only for 64-bit operationsMarkos Chandras
Signed-off-by: Markos Chandras <markos.chandras@imgtec.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-02-20fstatat: Use newfstatat only for 64-bit operationsMarkos Chandras
Signed-off-by: Markos Chandras <markos.chandras@imgtec.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-02-20fstat: Use fstat64 if arch does not have the fstat syscallMarkos Chandras
Signed-off-by: Markos Chandras <markos.chandras@imgtec.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-02-20libc/statfs64: Skip conversion code for new architecturesMarkos Chandras
Fixes the following tests in LTP statfs02_64 ( test case #5 ) The purpose of this test is to pass an invalid pointer to the statfs64 syscall and check if the kernel returns EFAULT or not. However, uClibc creates a new statfs struct which is then passed to the kernel. As a result of which, the kernel returns 0 because the newly created statfs structure is valid. But, when copying the contens of the new pointer to the old userspace one, the uClibc segfauls because the old pointer is invalid. Old architectures are doomed to suffer by this problem but new architectures can use the statfs64 syscall directly so that the userspace pointer is passed directly to the kernel and get the correct errno at the end. Signed-off-by: Markos Chandras <markos.chandras@imgtec.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>