summaryrefslogtreecommitdiff
path: root/libc
AgeCommit message (Collapse)Author
2012-06-13Update C6X supportMark Salter
This patch updates the C6X support to work with latest uClibc code and uses reworked DSBT support to allow using kernel FDPIC loader. Signed-off-by: Mark Salter <msalter@redhat.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-10eventfd: Implement eventfd2 and fix eventfdKhem Raj
eventfd: evntfd assumes to take two arguments instead it should be one evntfd expects two therefore implement both syscalls with correct parameters Thanks Eugene Rudoy for reporting it and also providing the patch Signed-off-by: Khem Raj <raj.khem@gmail.com>
2012-06-06MIPS: Use $a0 instead of $v0 for __syscall_error() argumentKevin Cernekee
$a0 is saved across _dl_runtime_resolve(); $v0 is not. Unfortunately, __syscall_error() uses $v0 for its argument, not $a0 as is the MIPS ABI standard. This means that if lazy binding was used for __syscall_error(), the errno value in $v0 could get corrupted. The problem can be easily seen in testcases where syscalls in librt fail; when librt tries to call __syscall_error() in libc, the argument gets lost and errno gets set to a bogus value: # ./tst-mqueue1 ; echo $? mq_receive on O_WRONLY mqd_t did not fail with EBADF: Unknown error 2004684208 1 # ./tst-mqueue2 ; echo $? mq_timedreceive with too small msg_len did not fail with EMSGSIZE: Unknown error 1997360560 1 # ./tst-mqueue4 ; echo $? mq_timedsend did not fail with ETIMEDOUT: Unknown error 2008747440 1 When _dl_runtime_resolve() was taken out of the equation, the same test cases passed: # LD_BIND_NOW=y ./tst-mqueue1 ; echo $? 0 # LD_BIND_NOW=y ./tst-mqueue2 ; echo $? 0 # LD_BIND_NOW=y ./tst-mqueue4 ; echo $? 0 Changing __syscall_error() to look at $a0 instead of $v0 fixed the problem. (Note that there is also a "__syscall_error.c" file which presumably uses the standard C calling conventions, but I do not think it is used on MIPS.) Signed-off-by: Kevin Cernekee <cernekee@gmail.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-06MIPS: Convert __syscall_error() callers to use $a0 for argumentKevin Cernekee
Some callers passed the first argument in $v0, while others used $a0. Change the callers to use $a0 consistently. Signed-off-by: Kevin Cernekee <cernekee@gmail.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-05-30pread/pwrite: drop fallback funcsMike Frysinger
Linux has provided these functions since the 2.1.x era, so no need to keep these around. We'd rather find out when things are missing (and fix that) than fall back to the unsafe hacks. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2012-05-30pread/pwrite: handle renamed syscalls in common/ppc/xtensa codeMike Frysinger
Some arches got this fix, but many did not. So copy the ifdef logic to the ones that missed it to fix behavior in linux-2.6+. URL: https://bugs.busybox.net/show_bug.cgi?id=5258 Reported-by: David Laight <david.laight@aculab.com> Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2012-05-21mmap()->sys_mmap2: do unsigned shift of offsetJames Hogan
Fix the implementation of mmap based on the mmap2 system call, to construct pgoffset from offset with an unsigned shift rather than a signed (off_t) shift. The mmap2 test in the testsuite catches this case by mmap'ing with a large offset (with the sign bit set). The signed shift repeats the sign bit making the page shift way out of range. This is already fixed similarly in mmap64(). Signed-off-by: James Hogan <james.hogan@imgtec.com> Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2012-05-21stdio: implement assignment-allocation "m" characterMike Frysinger
The latest POSIX spec introduces a "m" character to allocate buffers for the user when using scanf type functions. This is like the old glibc "a" flag, but now standardized. With packages starting to use these, we need to implement it. for example: char *s; sscanf("foo", "%ms", &s); printf("%s\n", s); free(s); This will automatically allocate storage for "s", read in "foo" to it, and then display it. I'm not terribly familiar with the stdio layer, so this could be wrong. But it seems to work for me. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2012-05-18ldso: sh: handle _dl_skip_args in linker startup instead of __uClibc_mainFilippo Arcidiacono
Handle _dl_skip_args in the asm part of the dynamic linker startup, to skip the ldso arguments, so we can keep this symbol hidden as other archs do. Signed-off-by: Filippo Arcidiacono <filippo.arcidiacono@st.com> Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
2012-05-05drop support for old systems lacking vforkMark Salter
Only really old systems (<=linux-2.0) lack a dedicated vfork system call. The code that is in place to support them is causing issues with newer arches that also don't provide a vfork system call -- instead, they do vfork by calling clone in userspace. If anyone cares about these really old systems, they can submit a patch to make the system work with them while not breaking newer systems. Signed-off-by: Mark Salter <msalter@redhat.com> Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2012-05-03rpmatch: provide out-of-line implementationBernhard Reutner-Fischer
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-04-28epoll.h: sync with glibcMike Frysinger
Since glibc has split out arch-specific stuff to bits/epoll.h, we can pull that sanity back into our tree and drop the arch ifdefs. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2012-04-26llseek: support __NR_llseek syscallMark Salter
Older kernels use __NR__llseek for a 64-bit lseek syscall. Newer kernels use __NR_llseek. This patch fixes the implementation of lseek64 to use the __NR_llseek syscall if it exists. Signed-off-by: Mark Salter <msalter@redhat.com> Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2012-04-26getpgrp: fix fallback handlingMark Salter
The test for generating a stub for getpgrp was wrong and would result in duplicate symbols when building without __NR_getpgrp, but with __NR_getpgid and __NR_getpid. A closer look at the getpgrp implementation using getpgid showed that getpid was being called to pass the current pid to getpgid. This is unnecessary because passing 0 to getpgid returns the pgid of the current process. This patch cleans up the getpgrp implementation and the stub test. Signed-off-by: Mark Salter <msalter@redhat.com> Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2012-04-26arm: use PATH_MEM in ioperm()Bernhard Reutner-Fischer
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-04-26mmap64: Use correct type for offset parameterMike Frysinger
Some arches check the size in INLINE_SYSCALL() and barf if it's too big (i.e. a 64bit value getting truncated to 32bit). Satisfy error-check on ppc32. Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2012-04-25atomic.h: handle new mips R10K errataBernhard Reutner-Fischer
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-04-18sysconf: use getrlimit to determine ARG_MAXBernhard Reutner-Fischer
getrlimit previously was only called for NPTL (why?), fix that to be used everywhere. Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-04-17locale: avoid segfault freelocale()Bernhard Reutner-Fischer
PR 4964 Eric Nadler writes: It looks to me like the base structure is not fully initialized with 0 (only a subset of the structure is initialized). This later results in a free of base->collate.index2weight in _locale_set_l. This free tries to free uninitialized memory and segfaults. Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-04-17wchar: Fix BOM emitting in iconv_open()Ed W
Fix incorrect output of BOM when converting charactersets by name. Only affective when iconv/locale enabled. Signed-off-by: Ed Wildgoose <lists@wildgooses.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-04-17ipc: eventually use stat64 in ftok()Bernhard Reutner-Fischer
PR 4201 ftok() always used 32bit stat Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-04-17resolv: tiny shrinkage in /etc/hosts handlingBernhard Reutner-Fischer
-4b Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-04-17resolv: remove unused variablesBernhard Reutner-Fischer
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-04-17resolv: Fix /etc/hosts for more than MAXALIASES aliasesBernhard Reutner-Fischer
PR networking/4916 Reserve space for the terminating 0 alias and zero out the scratch-buffer so the last entry of the alias list is empty. Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-04-17parse_config: tweak indentationBernhard Reutner-Fischer
and shuffle tokens memsetting around. No obj-code changes. Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-04-17getaddrinfo(): avoid call to __check_pf() when not neededAlexander Komyagin
__check_pf() function is called from getaddrinfo() and it calls getifaddrs(), which is too much overhead especially if RSBAC-Net is enabled. So with this patch __check_pf() is being called only when AI_ADDRCONFIG hint flag is specified - just when we really need that check. Signed-off-by: Alexander Komyagin <komyagin@altell.ru> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-04-17inet: adjust handling of cacnonname in getaddrinfoEd W
Posix says that canonname should use the text representation of an IP address when a numerical nodename given See: http://pubs.opengroup.org/onlinepubs/9699919799/functions/getaddrinfo.html Signed-off-by: Ed Wildgoose <lists@wildgooses.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-04-11mmap64: use INLINE_SYSCALL() helperMike Frysinger
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2012-04-11mmap64: include stdint.h for uint64_tMike Frysinger
Some targets include this implicitly, but pull it in explicitly for those which don't to fix building for them. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2012-04-10mmap64: always use unsigned 64bit offsetsMike Frysinger
The current code will sometimes cast the offset to an unsigned long. On 32bit systems, that doesn't make much sense since we always know that the off64_t type is 64bits. So drop the ifdef logic, cast it to an unsigned 64bit value, and then do the shift. If the system is 32bits, and the address is still too large, then there's really nothing we could do about it anyways, so the extra ifdef logic wasn't helping. URL: https://bugs.busybox.net/show_bug.cgi?id=3853 Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2012-04-08alpha: trim crt code to fix build errorsMike Frysinger
Otherwise we get: /tmp/cc14nHjG.s: Assembler messages: /tmp/cc14nHjG.s: Error: .size expression for _init does not evaluate to a constant /tmp/cc14nHjG.s: Error: .size expression for _fini does not evaluate to a constant Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2012-04-08signalfd.h: Use new "bits/" scheme for arch-specific flagsKevin Cernekee
glibc has split off the arch-specific flag definitions (like SFD_NONBLOCK) into <arch>/bits/signalfd.h, so that there are no longer multiple redundant copies of the entire header file. We will adopt the same scheme in uClibc. Special cases are included for: alpha mips sparc hppa was omitted because it has not been updated in glibc. All others use the common definition. Signed-off-by: Kevin Cernekee <cernekee@gmail.com> Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2012-04-08timerfd.h: Use new "bits/" scheme for arch-specific flagsKevin Cernekee
glibc has split off the arch-specific flag definitions (like TFD_NONBLOCK) into <arch>/bits/timerfd.h, so that there are no longer multiple redundant copies of the entire header file. We will adopt the same scheme in uClibc. Special cases are included for: alpha mips sparc hppa was omitted because it has not been updated in glibc. All others use the common definition. Signed-off-by: Kevin Cernekee <cernekee@gmail.com> Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2012-04-08inotify.h: Use new "bits/" scheme for arch-specific flagsKevin Cernekee
glibc has split off the arch-specific flag definitions (like IN_NONBLOCK) into <arch>/bits/inotify.h, so that there are no longer multiple redundant copies of the entire header file. We will adopt the same scheme in uClibc. Special cases are included for: alpha mips sparc hppa was omitted because it has not been updated in glibc. All others use the common definition. Signed-off-by: Kevin Cernekee <cernekee@gmail.com> Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2012-04-08inotify_rm_watch: Change second argument to intKevin Cernekee
2009-01-30 Ulrich Drepper <drepper@redhat.com> [BZ #7040] * sysdeps/unix/sysv/linux/sys/inotify.h: Second parameter of inotify_rm_watch should have type int. This change allows us to copy inotify.h verbatim from glibc into uClibc. Signed-off-by: Kevin Cernekee <cernekee@gmail.com> Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2012-04-08regex: silence set-but-unused warningsMike Frysinger
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2012-04-08bfin: set an invalid insn for abortMike Frysinger
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2012-04-04stubs: Disregard LFSBernhard Reutner-Fischer
Fixes handling of e.g. splice Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-04-02fchmodat: fix handling of flagsMike Frysinger
The Linux syscall takes 3 args, not 4. We have to process flags in userspace ourselves. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2012-03-28stdio: Fix char signedness in _load_inttype()Bernhard Reutner-Fischer
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-03-26arm: disable ioperm/iopl stubsMike Frysinger
ARM always provides its own userspace funcs for ioperm/iopl. They've never had syscalls. So disable the stubs on ARM to avoid multiple definition errors. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2012-03-26Revert "Fix redefinition of ioperm and iopl in stubs.c and ↵Mike Frysinger
arm/{ioperm.c,iopl.c}" This reverts commit 3bcd031f97d61a8f732d865a0f4248aed2d191ab. The arm code is supposed to provide its own userspace ioperm/iopl functions. They've never had system calls for these funcs. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2012-03-26time.c: Readability improvements - no code changesDenys Vlasenko
Pulled assignments out of ifs, added whitespace around operation symbols. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2012-03-26stubs: unified from futureBernhard Reutner-Fischer
Future branch extends stubs with ret_enosys_stub. Resolve conflicts, and use superset of future and current master. Adjust posix_fadvise* accordingly. Upon future merge, pick this master version as the final state. Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-03-26Fix redefinition of ioperm and iopl in stubs.c and arm/{ioperm.c,iopl.c}Jason Woodward
This fixes the following link failure: LD libuClibc-0.9.33.so libc/libc_so.a(stubs.os): In function `sync_file_range': stubs.c:(.text+0x0): multiple definition of `ioperm' libc/libc_so.a(ioperm.os):ioperm.c:(.text+0x260): first defined here libc/libc_so.a(stubs.os): In function `sync_file_range': stubs.c:(.text+0x0): multiple definition of `iopl' libc/libc_so.a(iopl.os):iopl.c:(.text+0x0): first defined here collect2: ld returned 1 exit status make[1]: *** [lib/libc.so] Error 1 Signed-off-by: Jason Woodward <jason.woodward@timesys.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-03-26inet:rpc: fix build in !NPTL caseCarmelo Amoroso
__libc_once is not available / needed when multithreading support is not enabled, so authnone_create() calls authnone_create_once() directly. When LT.{old,new} is used instead of NPTL, it needs to explicitly include <bits/libc-lock.h> to get __libc_once to be visible. Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
2012-03-25stdio: prevent retries on fclose/fflush after write errorsDenys Vlasenko
Some test results: The longer patch posted at Sun 14:46:24 +0100 made my target system unbootable. I did not attempt to troubleshoot it, as we are focusing our efforts on the shorter patch now. The shorter patch posted at Mon 01:50:27 +0100 is a good start, but it didn't completely fix the problem for me. I am posting an updated version with a few changes at the end of this message; the patched uClibc 0.9.32.1 tree passes both of my test cases. My changes: 1) Need to break out of the loop on "hard" errors. Otherwise the library call never returns: open("/dev/null", O_RDONLY) = 4 dup2(4, 1) = 1 write(1, "hello world\n", 12) = -1 EBADF (Bad file descriptor) write(1, "hello world\n", 12) = -1 EBADF (Bad file descriptor) write(1, "hello world\n", 12) = -1 EBADF (Bad file descriptor) write(1, "hello world\n", 12) = -1 EBADF (Bad file descriptor) ... 2) Move all of the error handling logic back into the "else" clause. In particular, I believe we do not want to be checking errno unless __WRITE() had indicated a failure, since the value may be undefined: if (errno == EINTR || errno == EAGAIN /* do we have other "soft" errors? */ ) { 3) Whitespace/indentation consistency. -- 8< -- From: Denys Vlasenko <vda.linux@googlemail.com> Currently, uclibc retains buffered data on stdio write errors, and subsequent fclose and fflush will try to write it out again (in most cases, in vain). Which results in something like this: On Wednesday 26 January 2011 13:21, Baruch Siach wrote: > Hi busybox list, > > I'm running the following command under strace (thanks Rob): > > echo 56 > /sys/class/gpio/export > > and I see the following output: > > write(1, "56\n", 3) = -1 EBUSY (Device or resource busy) > write(1, "5", 1) = 1 > > The first EBUSY is OK, since GPIO 56 is already requested. But the second > write() attempt seems strange, and leads to an unwanted outcome. GPIO 5 gets > exported. This patch prevents that. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com> Signed-off-by: Kevin Cernekee <cernekee@gmail.com> Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2012-03-25microblaze: add sys/user.hSteve Bennett
A microblaze-specific sys/user.h is needed for (e.g.) strace, so use this version from glibc. Signed-off-by: Steve Bennett <steveb@workware.net.au> Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2012-03-11__stdio_WRITE: make code more readable. No code changesDenys Vlasenko
Pulled assignments out of ifs. do {...} while (1); is a weird method of writing "loop forever", thus rewrote it. No code changes: objdump output is the same. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2012-02-13arm: Do not use 'sed -r' to calculate IS_EABIKhem Raj
-r is not available on BSD sed so to keep compatibility avoid using it. Signed-off-by: Khem Raj <raj.khem@gmail.com>