summaryrefslogtreecommitdiff
path: root/libc
AgeCommit message (Collapse)Author
2018-02-04mman: disable memfd_create declarationWaldemar Brodkorb
2018-02-03csky: bugfix ltp open12 failed.Guo Ren
Signed-off-by: Guo Ren <ren_guo@c-sky.com>
2018-02-03add libc version compatibilityWaldemar Brodkorb
2018-02-03bits/mman.h: consolidate header fileWaldemar Brodkorb
Sync with GNU C library and consolidate duplicate non architecture specific defines. MAP_UNINITIALIZED is only defined to 0x4000000 and used by the Linux kernel when CONFIG_MMAP_ALLOW_UNINITIALIZED is enabled. CONFIG_MMAP_ALLOW_UNINITIALIZED is only available for nommu. See Documentation/nommu-mmap.txt.
2018-01-31malloc: add glibc compat symbolsWaldemar Brodkorb
2018-01-31malloc: add malloc_usable_size()Waldemar Brodkorb
2018-01-31remove arc4random (rc4 based)Waldemar Brodkorb
OpenBSD arc4random is using chacha20 cipher algorithm for a long time. This copy is still based on deprecated rc4 cipher algorithm. We could either update the arc4random.c or drop it. Drop it. Users should better use libbsd when using arc4random interface. Musl/glibc does not have arc4random either.
2018-01-31aarch64/sys/ucontext.h: include bits/sigcontext.hBernd Kuhls
Fixes a buildroot build error with ffmpeg In file included from /home/bernd/buildroot/output/host/aarch64-buildroot-linux-uclibc/sysroot/usr/include/signal.h:329:0, from fftools/ffmpeg.h:26, from fftools/ffmpeg_opt.c:23: /home/bernd/buildroot/output/host/aarch64-buildroot-linux-uclibc/sysroot/usr/include/sys/ucontext.h:52:16: error: field 'uc_mcontext' has incomplete type mcontext_t uc_mcontext; ^~~~~~~~~~~ using this defconfig: BR2_aarch64=y BR2_PACKAGE_FFMPEG=y sys/ucontext.h for other archs already include bits/sigcontext.h, on aarch64 this is needed as well. Signed-off-by: Bernd Kuhls <bernd.kuhls@t-online.de>
2018-01-21simplify and fix getcwdWaldemar Brodkorb
The fallback code is not used as all supported kernels have the syscall. Check if a absolute path is returned from syscall.
2018-01-15xtensa: fix strcmpMax Filippov
Loops with 'loop forever' annotation inside strcmp are actually meant to loop forever. Falling through the end of the first loop may result in equal strings being compared unequal, e.g.: #include <string.h> int main(void) { char a[4096] __attribute__((aligned(4))); char b[4096] __attribute__((aligned(4))); memset(a, ' ', 258 * 8); memset(b, ' ', 258 * 8); a[255 * 8] = 0; a[256 * 8] = 'a'; b[255 * 8] = 0; b[256 * 8] = 'b'; return !(strcmp(a, b) == 0); } Falling through the end of the second loop may result in unequal strings being compared as equal, e.g.: #include <string.h> int main(void) { char a[4096] __attribute__((aligned(4))); char b[4096] __attribute__((aligned(4))); memset(a, ' ', 514 * 6); memset(b, ' ', 514 * 6); a[514 * 6 + 0] = 'a'; a[514 * 6 + 1] = 0; b[514 * 6 + 0] = 'b'; b[514 * 6 + 1] = 0; return !(strcmp(a, b) != 0); } Use 0 as a loop counter to make 2^32 - 1 iterations which is enough to cover all addressable memory. While at it drop useless nop at the end of the first loop and use a11 for all loop counters. Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
2018-01-15rt: cleanup and allow to build for linuxthreadsWaldemar Brodkorb
It seems there is no real dependency to NPTL for these clock_* functions when UCLIBC_ADVANCED_REALTIME is enabled. No regressions found. Reported-by: Baruch Siach <baruch@tkos.co.il>
2018-01-15nds32: Add syscall macros for 5 and 6 parametersStafford Horne
This is to fix an error after switching to use generic syscalls. libc/sysdeps/linux/common/syscall.c: In function 'syscall': libc/sysdeps/linux/common/syscall.c:27:2: warning: implicit declaration of function 'internal_syscall_ncs6' [-Wimplicit-function-declaration] return INLINE_SYSCALL_NCS(sysnum, 6, arg1, arg2, arg3, arg4, arg5, arg6); ^ Defining these functions as described by Vincent Ren-Wei Chen <vincentc@andestech.com> Signed-off-by: Stafford Horne <shorne@gmail.com>
2018-01-15nds32: Use new common syscall() implementationStafford Horne
Traditionally nds32 has had a generic syscall implementation supporting varargs. During an audit it was found that this implementation seems to duplicate the new common implementation and is no longer needed. Signed-off-by: Stafford Horne <shorne@gmail.com>
2018-01-15or1k: Use new common syscall() implementationStafford Horne
Now that the common syscall implementation supports vararg calling conventions we can safely use it on OpenRISC. This saves a bit of code in the openrisc implementation. Signed-off-by: Stafford Horne <shorne@gmail.com>
2018-01-15syscall: Make common implementation match unistd.hStafford Horne
The definition of syscall() in unistd.h is with varargs. Traditionally the common implementation in uclibc has been with regular arguments. This patch updates that by using varargs. This has caused issues on architectures like or1k which have different calling conventions for varargs and regular arg parameters. The implementation here is based on an implementation from Joel Stanley <joel@jms.id.au>. There is a difference that I do not initialize the stack args with 0 as they are immediately overwritten by va_args. Signed-off-by: Stafford Horne <shorne@gmail.com>
2018-01-08csky: bugfix libc sync_file_range.c for csky.Guo Ren
Use __NR_sync_file_range2 for csky sync_file_range function. Signed-off-by: Guo Ren <ren_guo@c-sky.com>
2018-01-02remove COMPAT_ATEXITWaldemar Brodkorb
2017-12-31m68k: add NPTL/TLS supportWaldemar Brodkorb
Port over NPTL/TLS support from GNU C Library. In the first step only the slower syscall is used for TLS access. The uClibc-ng testsuite shows 79 errors, so their is room for bugfixes and improvements.
2017-12-28csky: add Copyright.Guo Ren
Signed-off-by: Guo Ren <ren_guo@c-sky.com>
2017-12-10or1k: syscall: Pass arguments on the stackJoel Stanley
Busybox internally calls syscall(2). - in unistd.h defined something like int syscall(nr, ....) - in syscall.c (common) implemented as int syscall(nr, arg1, arg3, arg3, arg4, arg5, arg6) This will not work, busybox thinks syscall should have varargs calling conventions. But it doesnt in the uclibc implementation so no args go through. Most architectures this will work. But on openrisc varargs are all sent on the stack. Regular args are passed in registers. Commit message and idea from Stafford Horne <shorne@gmail.com>. Signed-off-by: Joel Stanley <joel@jms.id.au>
2017-12-03x86_64: add fenv support from glibcWaldemar Brodkorb
2017-11-25statfs.h: add f_flagsWaldemar Brodkorb
Add missing member in struct statfs. It is used by xfsprogs (f.e. 4.13.1). Reported-by: Joshua Kinard <kumba@gentoo.org>
2017-11-25setjmp/longjmp saves only non-call clobbered regsChristian Svensson
Previously we saved everything, but we only need to save the registers that are promised to be untouched by the setjmp call.
2017-11-25Update __longjmp.SChristian Svensson
2017-11-25Only emulate fstatfs64 if __NR_fstatfs64 is not definedEugene Rudoy
Follow-up of e3d6c8bffe79b2c070bc7a3aabc9d9c65f6b099e Signed-off-by: Eugene Rudoy <gene.devel@gmail.com> Signed-off-by: Ralf Friedl <Ralf.Friedl@online.de>
2017-11-25fix regression from a745c4bfc8a9b5db4e48387170da0dc1d39e3abeWaldemar Brodkorb
2017-11-22remove misleading comment about f_frsize fieldEugene Rudoy
It is supported both in the sense of being contained in mips version of statfs/statfs64 structs and also in the sense that it's filled by the corresponding kernel syscalls. It is UNsupported in that sense that it's value is the same as that of f_bsize (at least on older kernel versions, the oldest version tested is 2.6.13), s. [1] and [2] for details ([1] is the latest kernel version as of now, [2] is the oldest kernel version git history is available for). [1] https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git/tree/fs/statfs.c?h=v4.14-rc7#n64 [2] https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git/tree/fs/open.c?h=v2.6.12-rc2#n41 Follow-up of 68de9946e914d8c30dcc6667a059ea59e5b74cac Signed-off-by: Eugene Rudoy <gene.devel@gmail.com> Signed-off-by: Ralf Friedl <Ralf.Friedl@online.de>
2017-11-22librt: fix broken posix_spawnWaldemar Brodkorb
Fix iteration over signals, synced with GNU C library code and pending patches. Issues found when running dhcpcd with hook scripts. (exit status 127) Reported-By: kapeka <kapeka@bering-uclibc.de>
2017-11-19csky: port to uclibc-ngGuo Ren
Follow the steps to build c-sky uclibc linux system: 1. git clone https://github.com/c-sky/buildroot.git 2. cd buildroot 3. make qemu_csky_ck810_uclibc_defconfig 4. make Follow the buildroot/board/qemu/csky/readme.txt to run. This buildroot toolchain is pre-build, But you can rebuild the c-sky uclibc-ng alone and install it to the buildroot sysroot manually. We'll try our best to improve the uclibc-ng continuously. Signed-off-by: Guo Ren <ren_guo@c-sky.com>
2017-11-19remove unused FORTIFY code fragmentsWaldemar Brodkorb
2017-11-18use atomic instructions for atomicsStafford Horne
Signed-off-by: Stafford Horne <shorne@gmail.com>
2017-11-16or1k: remove unused fileWaldemar Brodkorb
2017-11-03math: add exception handling functionalitySergey Cherkashin
According to standards SVID and SYSV. Modified lgamma calling in case when 'signgam' variable should not be used. Signed-off-by: Waldemar Brodkorb <wbx@uclibc-ng.org>
2017-11-03Define _STATFS_F_FRSIZE for MIPSWaldemar Brodkorb
After discussion on the busybox mailinglist. Reported-by: Ralf Friedl <Ralf.Friedl@online.de> Signed-off-by: Waldemar Brodkorb <wbx@uclibc-ng.org>
2017-11-03Only emulate statfs64 if __NR_statfs64 is not definedWaldemar Brodkorb
After discussions on the busybox mailinglist. Reported-by: Ralf Friedl <Ralf.Friedl@online.de> Signed-off-by: Waldemar Brodkorb <wbx@uclibc-ng.org>
2017-11-03malloc-standard/malloc.h: use getpagesizeYitai Schwartz
sysconf creates a lot of code dependencies. getpagesize dosen't. staticly linked code that calls malloc is now much smaller. Signed-off-by: Waldemar Brodkorb <wbx@uclibc-ng.org>
2017-11-02convert accept4() to use cancel.h macrosWaldemar Brodkorb
2017-10-11h8300: remove dead codeWaldemar Brodkorb
As h8/300 architecture does not use deprecated syscalls after reintroduction into Linux upstream, this part of the code in vfork.S is always unused.
2017-10-08socketcall: fix compile issue with older Linux kernelWaldemar Brodkorb
2017-10-01recvmmsg/sendmmsg: add recvmmsg sendmmsg support.Guo Ren
The recvmmsg and sendmmsg is very important for UDP stream application. If we only use recvmsg for UDP stream, it will only copy one mtu size of data in a syscall. And recvmmsg copy as many as you want in a syscall. So recvmmsg is more efficient,and some applications will depends on the recvmmsg and sendmmsg, eg: UDP media stream player. Signed-off-by: Guo Ren <ren_guo@c-sky.com>
2017-10-01statfs: bugfix statfs02 fstatfs02 failed in ltp-testsuiteGuo Ren
In the test-case of statfs from ltp-testsuite, it pass -1 to 2th argument. eg: fstatfs(fd , -1) When uclibc-ng parse the buf32 to buf will cause illegal address access, the kernel will signal the process with SIGSEGV. If we pass the -1 directly to the syscall of statfs/fstatfs, kernel use copy_to_user() to prevent the signal of SIGSEGV and just return EINVAL. This is the ltp-testsuite expect. Signed-off-by: Guo Ren <ren_guo@c-sky.com>
2017-10-01preadv/pwritev: bugfix preadv/pwritev syscall should be 5 argsGuo Ren
The current uclibc-ng use 4 arguments, and this will cause ltp-testsuite's preadv/pwritev case failed. The syscall of preadv/pwritev in current linux-kernel is 5 arguments: linux/fs/read_write.c: SYSCALL_DEFINE5(preadv, unsigned long, fd, const struct iovec __user *, vec, unsigned long, vlen, unsigned long, pos_l, unsigned long, pos_h) SYSCALL_DEFINE5(pwritev, unsigned long, fd, const struct iovec __user *, vec, unsigned long, vlen, unsigned long, pos_l, unsigned long, pos_h) So just update to 5-args-syscall, and off_t could be 32bit or 64bit. Signed-off-by: Guo Ren <ren_guo@c-sky.com>
2017-09-14arc: Ensure that debugger can recognize sigrestorerAnton Kolesov
An issue has been found with current implementation of signal restorer function in uClibc and how GDB handles it. When debugger information is not present, everything worked fine, because GDB would use a built-in logic to determine if function is a signal restorer. However when debugging information is present, debugger would rely solely on it and wouldn't use ARC-specific functions to detect signal handler frames. Because debug information for signal restorer is generated completely by the compiler, it lacks a marker, that identifies this as a signal frame that requires special handling. While it is possible to insert that marker via inline assembly, that still doesn't solve the whole problem, because some other expectations are not met by the debug information - there is no "nop" in front of the function, needed to fool debugger into thinking that this was a function call, and references to previous frame information need to be described manually. The simplest way to fix the problem is just to make sure that signal restorer function will not have any debug function at all, which can be done by writing it in assembly. Alternative, more complex, solution, where debug information for signal frame is manually defined can be found in glibc/sysdeps/unix/sysv/linux/x86_64/sigaction.c [1]. [1] https://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/unix/sysv/linux/x86_64/sigaction.c;hb=HEAD Signed-off-by: Anton Kolesov <Anton.Kolesov@synopsys.com>
2017-08-20arc: Merge ARCv2 string routines in generic ARC .S filesAlexey Brodkin
In cde74b83f9b2 "ARC: remove special CFLAGS/LDFLAGS handling" we got rid of CONFIG_ARC_CPU_HS which was used to select ARCv2-specific implementation of optimized string routines. So now ARCv2-tuned memset/memcpy/strcmp are not used, instead those for ARC700 used for both ARC700 and ARCHS. Without uClibc config option we may only tell which CPU type we're targeting by built-in defines of GCC. I.e. no more conditional file inclusion in Makefiles. That leaves us only one option - merge both implementations in 1 file and use ifdefs. Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
2017-08-10sys/ptrace.h: remove obsolete Linux PTRACE_SEIZE_DEVEL constantWaldemar Brodkorb
Remove enum __ptrace_flags along with the only constant it contains, PTRACE_SEIZE_DEVEL, from Linux's sys/ptrace.h files. Following GNU C library commit: 60e2846e2633a990bdf474004a373bde54c0bc5f
2017-07-28aarch64: finetuning, sync with glibcWaldemar Brodkorb
2017-07-28fix tolower and localesEugene Yudin
The function towlower doesn't work with locales different from C. Issue was introduced in commit: 8cde3a9bf2856dcb9a759dec7ecb04a68e712254 Call to setlocale is needed for correct generation of the table uplow_diff. Otherwise you receive compile time error "range assumption error" after uncommenting the call. Similar problem described here: http://lists.uclibc.org/pipermail/uclibc/2015-March/048852.html This commit fix the problem by using int32_t values.
2017-07-28cleanup unused defines and includes from clone.SWaldemar Brodkorb
2017-06-23sparc64: add basic supportWaldemar Brodkorb
No NPTL, no LDSO support. Bootup with Busybox Ash in Qemu working. Testuite shows only two failures, but mksh continue/break support doesn't work.
2017-06-21remove editor hints for viWaldemar Brodkorb