summaryrefslogtreecommitdiff
path: root/libc/sysdeps
AgeCommit message (Collapse)Author
2015-03-17include: silence __leaf warningBernhard Reutner-Fischer
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2015-03-13unistd.h: put getppid under XOPEN2K8Bernhard Reutner-Fischer
Add __LEAF to all __THROW, introduce non-leaf __THROWNL Adjust affected spots accordingly. Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2015-03-03sparc/clone.S: guard tcb-offsets.h include with RESET_PIDGustavo Zacarias
Otherwise we have a broken scenario with non-threading builds. Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2015-02-27libc: silence warningBernhard Reutner-Fischer
include/bits/sigset.h:219:62: warning: right-hand operand of comma expression has no effect [-Wunused-value] include/bits/sigset.h:210:63: warning: right-hand operand of comma expression has no effect [-Wunused-value] Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2015-02-20sync_file_range: fix standard UCLIBC_SYSCALL_ALIGN_64BIT handlingVineet Gupta
Currently UCLIBC_SYSCALL_ALIGN_64BIT is not explicitly handled. Fix that and make sure the special handling is done for powerpc/xtensa which use UCLIBC_SYSCALL_ALIGN_64BIT but don't use hole punched syscall handler in kernel. Signed-off-by: Vineet Gupta <vgupta@synopsys.com> Cc: Baruch Siach <baruch@tkos.co.il> Cc: Max Filippov <jcmvbkbc@gmail.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2015-02-20posix_fadvise: handle 2 variants for SYSCALL_ALIGN_64BITVineet Gupta
arm/powerpc/xtensa pass @advice as 2nd arg to syscall (vs. canonical 4th) Current code however does this for UCLIBC_SYSCALL_ALIGN_64BIT which powerpc/xtensa also happen to define. This is not true for ARCv2 ISA and possibly other arch of future with 64-bit even register requirement, which uses the standard syscall handler in kernel. Fix that by providing 2 variants of SYSCALL_ALIGN_64BIT Signed-off-by: Vineet Gupta <vgupta@synopsys.com> Cc: Baruch Siach <baruch@tkos.co.il> Cc: Max Filippov <jcmvbkbc@gmail.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2015-02-20ARCv2 ISA supportVineet Gupta
This is next gen Instruction Set Architecture from Synopsys and basis for the ARC HS family of processors. http://www.synopsys.com/dw/ipdir.php?ds=arc-hs38-processor&elq_mid=5732&elq_cid=458802 http://www.synopsys.com/IP/ProcessorIP/ARCProcessors/arc-hs/Pages/default.aspx Signed-off-by: Vineet Gupta <vgupta@synopsys.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2015-02-17libc: add setns()Bernhard Reutner-Fischer
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2015-02-17Add eventfd_read() and eventfd_write()Khem Raj
Signed-off-by: Khem Raj <raj.khem@gmail.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2015-02-16ARC: sigaction: inline syscall trapVineet Gupta
Signed-off-by: Vineet Gupta <vgupta@synopsys.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2015-02-16ARC: sigaction: fold default sigrestorer into "C"Vineet Gupta
Signed-off-by: Vineet Gupta <vgupta@synopsys.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2015-02-16ARC: siagction: opencode memcpyVineet Gupta
Signed-off-by: Vineet Gupta <vgupta@synopsys.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2015-02-16ARC: remove stale TRUNCATE64_HAS_4_ARGSVineet Gupta
Not relevant anymore since commit e8cc14e59ed3f66b84e, "libc: rename TRUNCATE64_HAS_4_ARGS to SYSCALL_ALIGN_64BIT" Signed-off-by: Vineet Gupta <vgupta@synopsys.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2015-02-16ARC: add configuration option for MMU page sizeAlexey Brodkin
ARC CPU may have MMU page size of 4/8(default)/16k. uClibc needs to have page size configured accodring to HW it will be run on. Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com> Signed-off-by: Vineet Gupta <vgupta@synopsys.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2015-01-26libc: sync_file_range missing commaBernhard Reutner-Fischer
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2015-01-24libc: ppc64 etc: Fix sync_file_rangeBernhard Reutner-Fischer
Fix copy'n paste error for ppc64 and other sync_file_range2 arches Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2015-01-23add argument check in mknodWang Yufen
mknod() in glibc/eglibc will check the argument, like this, ... if (k_dev != dev) { __set_errno (EINVAL); return -1; } ... So add argument check in uclibc's mknod() too. Signed-off-by: Wang Yufen <wangyufen@huawei.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2014-12-12unistd: allow to turn off getopt_longBernhard Reutner-Fischer
The GNU variant of getopt() previously had no way to turn off getopt_long() support.
2014-12-03mips: rename siginfo _timer membersBernhard Reutner-Fischer
Rename _timer[12] to si_tid and si_overrun to fix compilation of strace-4.9+ Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2014-11-10statfs: fix compile error when UCLIBC_LINUX_SPECIFIC is not setAnthony G. Basile
statfs() is a Linux-specific function. When building without UCLIBC_LINUX_SPECIFIC set, libc_hidden_proto(statfs) in include/sys/statfs.h is unmatched with libc_hidden_def(statfs) in libc/sysdeps/linux/common/statfs.c, leading to a compile error. This patch fixes this, as well as adds statfs() to the list of Linux-specific functions in extra/Configs/Config.in. Signed-off-by: Anthony G. Basile <blueness@gentoo.org> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2014-09-17m68k: libc: add fmovem* mcffpu conditionBernhard Reutner-Fischer
add fmovem{x,.d,.*} ISA conditional Fixes assembler errors for 5206. isa_a, isa_b (or a+, don't remember) do not have emx, use em.d there. Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2014-09-16sparc: update ptrace.h to latest from glibcGustavo Zacarias
Update sys/ptrace.h to latest glibc release for a lot of missing definitions. Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2014-09-16powerpc: update ptrace.h to latest from glibcGustavo Zacarias
Update sys/ptrace.h to latest glibc release for a lot of missing definitions. Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2014-09-16buildsys: fix IS_IN_lib*Bernhard Reutner-Fischer
define NOT_IN_libc / IS_IN_libxxx appropriately to fix pthread_once Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2014-09-09libc: add fallocate() and fallocate64()Anthony G. Basile
We add the Linux-specific function fallocate() which allows the user to directly manipulate allocate space for a file. fallocate() can operate in different modes, but the default mode is equivalent to posix_fallocate() which is specified in POSIX.1. Recent releases of e2fsprogs 1.42.11 and above expect fallocate64() to be available. Signed-off-by: Anthony G. Basile <blueness@gentoo.org> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2014-09-05libc: split multi-source epoll.cBernhard Reutner-Fischer
We cannot override individual functions on a per-arch basis otherwise Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2014-09-04sparc: remove sparc64/sparcv9 codeWaldemar Brodkorb
The sparc64/sparcv9 code is incomplete. Furthermore there is no real embedded hardware for sparc64 available, so better remove it until someone comes up with a complete port. Signed-off-by: Waldemar Brodkorb <wbx@openadk.org> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2014-08-28m68k: fix typoWaldemar Brodkorb
otherwise you get compile warnings, when building for m68k. Signed-off-by: Waldemar Brodkorb <wbx@openadk.org> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2014-08-28Revert "sparc: use HIDDEN_JUMPTARGET for errno"Waldemar Brodkorb
This reverts commit f51fb26dbcceee9e48d10facc830bd4a549f6cc2. This fixes linking error for sparc build. While building a sparc system you get following linking error: libc/sysdeps/linux/sparc/pipe.S:54: undefined reference to `__GI___errno_location' Removing the HIDDEN_JUMPTARGET fixes the issue, while using gcc 4.8.3/binutils 2.24. The definition of __errno_location was changed recently here: http://git.uclibc.org/uClibc/commit/?id=8f550715c2b211036fc273add3cb5219397ed312 Signed-off-by: Waldemar Brodkorb <wbx@openadk.org> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2014-08-25microblaze: Remove duplicate F_{S,G}ETPIPE_SZBernhard Reutner-Fischer
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2014-08-25fcntl.h: Define F_SETPIPE_SZ and F_GETPIPE_SZKhem Raj
Signed-off-by: Khem Raj <raj.khem@gmail.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2014-08-25mathinline.h: Use __extern_inlineBernhard Reutner-Fischer
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2014-08-25Add clock_adjtime syscallKhem Raj
Signed-off-by: Khem Raj <raj.khem@gmail.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2014-08-20fix for pipe() on sparcWaldemar Brodkorb
When using something like this: $ echo foo|grep foo|wc -l with mksh shell, you get an runtime error. Glibc and klibc does not do these extra check. After removing this check using double pipes work fine. Tested with Qemu 2.1.0. Signed-off-by: Waldemar Brodkorb <wbx@openadk.org> Signed-off-by: Thorsten Glaser <tg@mirbsd.org> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2014-08-18lseek: Correct order of offset argumentsAnton Kolesov
There was a runtime error in systems without large file support. Call fseek(fd, 4096, SEEK_SET) has been failing with EINVAL, though it was succeeding for offset = 4092. This has been happening because llseek system call accepts 64-bit value as an offset argument and lseek function has been ordering 32-bits words that form this offset value, according to the endianness. However this ordering to match endianness is not required, because llseek doesn't accept one 64-bit offset argument, it accepts two 32-bit offset argument, then stitches them into one following its endianness. As a result on little endian system, order of words has been swapped two time: in libc and in kernel. Thus call to fseek with offset 4096 (0x1000) was doing a system call to llseek with offset 0x1000_0000_0000. I'm not entirely sure why then offset = 4092 hasn't been failing then. This patch removes malicious swap of words when calling llseek. Signed-off-by: Anton Kolesov <Anton.Kolesov@synopsys.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2014-08-18libc: posix_fadvise: Fix build breakage for !LFSVineet Gupta
commit 00571b43df2e "libc: posix_fadvise: restore implementation for xtensa" enabled posix_fadvise() for all arches (it was just not generated before). However this also unearthed an issue introduced by ee84b8b400 "linux: posix_fadvise: use new SYSCALL_ALIGN_64BIT" which is to referencing LFS'ish code (off64_t) w/o proper checks which causes build to break for !LFS. Fix this by calling posix_fadvise64() only for LFS case and open-code it's equivalent for !LFS. Signed-off-by: Vineet Gupta <vgupta@synopsys.com> Cc: Mike Frysinger <vapier@gentoo.org> Cc: Baruch Siach <baruch@tkos.co.il> Cc: Khem Raj <raj.khem@gmail.com> Cc: markos Chandras <markos.chandras@gmail.com> Cc: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2014-08-18ARC/NPTL: clone to set TP if CLONE_SETTLSVineet Gupta
Typically kernel would set the TP register of newly created thread in clone syscall with CLONE_SETTLS. However this implies that: * kernel knows of the exact TP register (which is already different for ARCompact and ARCv2) and is a detail which becomes part of the ABI * kernel also needs to handle the unlikely but possible case of !TLS userspace (e.g. Android libc) case where TP reg is not reserved and thus need not be mucked with (using ELF personality based detection) It is better to confine this detail to userspace runtime and set TP reg right after clone syscall returns. Signed-off-by: Vineet Gupta <vgupta@synopsys.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2014-08-18NPTL: ARC supportVineet Gupta
Signed-off-by: Vineet Gupta <vgupta@synopsys.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2014-08-01bits/time.h: sync with latest glibcMike Frysinger
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2014-07-22ARC: Implement native GDB requirements in procfs.hAnton Kolesov
Native GDB requires elf_fpregset_t to be defined, even if floating point registers are absent. In this case we use empty structure. Additionally we redefined prfpregset_t to use this new type. And there has been an error: it was defined that user_regs_struct has 20 registers, while it has 40. Signed-off-by: Anton Kolesov <Anton.Kolesov@synopsys.com> Signed-off-by: Vineet Gupta <vgupta@synopsys.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2014-07-22ARC: clone: Ensure that @fn returns back to cloneVineet Gupta
This showed up due to longstanding test/unistd/clone failure where post clone, the callback was not exiting and rather falling thru in into main program. Signed-off-by: Vineet Gupta <vgupta@synopsys.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2014-07-22ARC: make sigaction inline with other archesVineet Gupta
Signed-off-by: Vineet Gupta <vgupta@synopsys.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2014-07-22ARC: syscalls.h: code-reuse/fix-arg-annotationsVineet Gupta
- Use syscalls-common.h vers of INTERNAL_SYSCALL / INLINE_SYSCALL_NOERR - INLINE_SYSCALL takes syscall name (e.g. write) - {INLINE,INTERNAL}_SYSCALL_NCS macros take syscall num (__NR_write) Signed-off-by: Vineet Gupta <vgupta@synopsys.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2014-07-22syscalls-common.h: Rename some macro args for correct documentationVineet Gupta
Signed-off-by: Vineet Gupta <vgupta@synopsys.com> Cc: Mike Frysinger <vapier@gentoo.org> Cc: Denys Vlasenko <vda.linux@googlemail.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2014-06-24open64: ensure that openat check worksVineet Gupta
For ARC builds atleast, __NR_xxx was not trickling into in open64.c causing open64->openat a needless detour via open Signed-off-by: Vineet Gupta <vgupta@synopsys.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2014-06-12fix pthread_cancel lead to segmentation fault for x86_64.Zhang Pu
When x86_64 cpu contains 'cpu_has_xsave' flag(in kernel),call the pthread_cancel will have a segmentation fault. Because gcc could not find the end of stack in user signal stack. Signed-off-by: Zhang Pu <glen4linux@gmail.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2014-06-12arm: move check for BX to its own headerYann E. MORIN
As Will noticed, the header this check is currently done in is asm-only, and is not meant to be included from C code. This breaks compilation when compiled for a Thumb2-aware CPU. Move the BX check to its own header, and revert 7a246fd. Reported-by: Will Newton <will.newton@gmail.com> Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr> Cc: Will Newton <will.newton@gmail.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2014-06-12arm/clone.S: Add missing IT instruction for Thumb2.Will Newton
The conditional load needs to be made part of an IT block on Thumb2 cores. Signed-off-by: Will Newton <will.newton@linaro.org> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2014-04-23weak symbols need to be "defined" weak but "declared" strongVineet Gupta
Patch "LT.old: Make __errno_location/__h_errno_location thread safe" uncovered yet another bug with static linking and errno (hopefully this is last of them all). Currently, __errno_location is declared weak but is defined strong. While this provides with the desired weak semantics in dso, it is subtly broken in static links. Quoting Joern Rennecke (ARC gcc expert): | I think the issue is that you declare the function as weak in the | header file. That is a rare instance where you want the reference | use declaration that differs a bit from the definition. | If the reference uses a weakly declared function, that creates a | weakref, i.e. the linker won't bother to look for this symbol at | all - if it gets linked in for some other reason, fine, | otherwise, it stays zero. So the solution to declare strong, define weak. Supporting data ----------------- orig code: ARM mmap wrapper (LT.old build + my prev patch for errno) _mmap: @ args = 8, pretend = 0, frame = 0 @ frame_needed = 0, uses_anonymous_args = 0 stmfd sp!, {r4, r5, r7, lr} ldr r5, [sp, #20] movs ip, r5, asl #20 beq .L2 bl __errno_location(PLT) mov r3, #22 str r3, [r0, #0] mvn r0, #0 ... ... .weak __errno_location A statically linked hello world program which uses mmap too. As we can see__errno_location is completely gone - which is semantically wrong - we need functional errno. 00008274 <__GI_mmap>: 8274: e92d40b0 push {r4, r5, r7, lr} 8278: e59d5014 ldr r5, [sp, #20] 827c: e1b0ca05 lsls ip, r5, #20 8280: 0a000004 beq 8298 8284: e320f000 nop {0} ^^^^^^^^^^ 8288: e3a03016 mov r3, #22 828c: e5803000 str r3, [r0] 8290: e3e00000 mvn r0, #0 This in turn is due to a fixup in ARM ld which transforms branch-to-null into a nop. It is better than crashing but still wrong since errno handling is removed. With the patch, errno_location is restored back in test program. 00008274 <__GI_mmap>: 8274: e92d40b0 push {r4, r5, r7, lr} 8278: e59d5014 ldr r5, [sp, #20] 827c: e1b0ca05 lsls ip, r5, #20 8280: 0a000004 beq 8298 <__GI_mmap+0x24> 8284: eb000010 bl 82cc <__errno_location> 8288: e3a03016 mov r3, #22 828c: e5803000 str r3, [r0] Cc: Christian Ruppert <christian.ruppert@abilis.com> CC: Francois Bedard <Francois.Bedard@synopsys.com> Cc: Anton Kolesov <Anton.Kolesov@synopsys.com> Cc: Joern Rennecke <joern.rennecke@embecosm.com> Cc: Jeremy Bennett <jeremy.bennett@embecosm.com> Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> Cc: Peter Korsgaard <peter@korsgaard.com> Cc: Khem Raj <raj.khem@gmail.com> Signed-off-by: Vineet Gupta <vgupta@synopsys.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2014-04-23LT.old: Make __errno_location/__h_errno_location thread safeVineet Gupta
WHY: errno in uClibc is not thread safe HOW: __errno_location and it's sibling __h_errno_location need to be called via PLT - even from within libc. That way when linked with pthread, intra-uClibc callers will also use the thread safe version. This is achieved by removing the GI alias for these functions, ensuring that they get called normally (via PLT) Verified with ARC LT.old and ARM cubieboard2 buildroot (LT.old) NPTL is unaffected by this bug. ------------ History behind this patch --------------------- This is a long standing bug (https://bugs.busybox.net/show_bug.cgi?id=2089) Others have tried to fix it in past (alteast Peter Korsgaard's patch in 2010), but somehow failed to be merged (or were backed out afterwards). http://lists.uclibc.org/pipermail/uclibc/2010-July/044176.html One of the causes could be side effect of atleast one more bug related to pthreads and static link which has now been fixed. http://lists.uclibc.org/pipermail/uclibc/2013-October/047958.html I have solved this w/o looking at other pacthes but would like to give credit to Peter and others for confirming that it makes sense. Cc: Christian Ruppert <christian.ruppert@abilis.com> CC: Francois Bedard <Francois.Bedard@synopsys.com> Cc: Joern Rennecke <joern.rennecke@embecosm.com> Cc: Jeremy Bennett <jeremy.bennett@embecosm.com> Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> Cc: Peter Korsgaard <peter@korsgaard.com> Cc: Khem Raj <raj.khem@gmail.com> Cc: buildroot@busybox.net Signed-off-by: Vineet Gupta <vgupta@synopsys.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>