From bugzilla at busybox.net Wed Apr 6 07:57:35 2011 From: bugzilla at busybox.net (bugzilla at busybox.net) Date: Wed, 6 Apr 2011 07:57:35 +0000 (UTC) Subject: [Bug 2227] ether_aton() accepts malformed input In-Reply-To: References: Message-ID: <20110406075735.73D29819BC@busybox.osuosl.org> https://bugs.busybox.net/show_bug.cgi?id=2227 --- Comment #1 from David Ramos --- *bump* this bug is still unassigned after 9 months... -- Configure bugmail: https://bugs.busybox.net/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug. From carmelo.amoroso at st.com Wed Apr 6 16:30:50 2011 From: carmelo.amoroso at st.com (Carmelo AMOROSO) Date: Wed, 06 Apr 2011 18:30:50 +0200 Subject: [git commit master 1/1] announce 0.9.32-rc2 In-Reply-To: <20110316193549.B40CA90982@busybox.osuosl.org> References: <20110316193549.B40CA90982@busybox.osuosl.org> Message-ID: <4D9C953A.1090308@st.com> On 3/16/2011 8:30 PM, Bernhard Reutner-Fischer wrote: > > commit: > http://git.uclibc.org/uClibc-website/commit/?id=b87a83ebc1e10b2e6ba8da3eb297d1c39945931c > branch: http://git.uclibc.org/uClibc-website/commit/?id=refs/heads/master > > Signed-off-by: Bernhard Reutner-Fischer > --- > news.html | 22 ++++++++++++++++++---- > 1 files changed, 18 insertions(+), 4 deletions(-) > > diff --git a/news.html b/news.html > index d63881a..06c1331 100644 > --- a/news.html > +++ b/news.html > @@ -1,13 +1,27 @@ > > >
    > +
  • 16 Mar 2011, uClibc 0.9.32-rc3 Release Candidate > +

    > + > + Release candidate 3 for 0.9.32 was released today. This release candidate > + contains the new C6X port and various fixes and enhancements for about > + all arches in several subsystems. > + The final release is planned for end of march 2011. > + Please test and report back! > +

    > + > + Go to the downloads page for the > + 0.9.32-rc2. > +

  • > + > + >
  • 20 Jan 2011, uClibc 0.9.32-rc2 Release Candidate >

    > > - Release candidate 2 for 0.9.32 was released today.This release contains > - the generic implementation of protected symbols for all archs with > respect > - to -rc1. The final release is planned for end of january 2011. > - Please test and report back. > + Release candidate 2 for 0.9.32 was released today. This release candidate > + contains the generic implementation of protected symbols for all archs > + with respect to -rc1. >

    > > Go to the downloads page for the > -- > 1.7.3.4 > Bernhard, have you forgotten to add the tag ? cheers, carmelo > _______________________________________________ > uClibc-cvs mailing list > uClibc-cvs at uclibc.org > http://lists.busybox.net/mailman/listinfo/uclibc-cvs > From bugzilla at busybox.net Mon Apr 11 02:10:06 2011 From: bugzilla at busybox.net (bugzilla at busybox.net) Date: Mon, 11 Apr 2011 02:10:06 +0000 (UTC) Subject: [Bug 3589] New: defconfig & option order in Makefile.in Message-ID: https://bugs.busybox.net/show_bug.cgi?id=3589 Summary: defconfig & option order in Makefile.in Product: uClibc Version: 0.9.31 Platform: PC OS/Version: Other Status: NEW Severity: minor Priority: P5 Component: Other AssignedTo: unassigned at uclibc.org ReportedBy: tsuckow at gmail.com CC: uclibc-cvs at uclibc.org Estimated Hours: 0.0 The modified kconfig defines -D to be the same function as -d. In addition -d does not take an argument and Config.in should be passed as a non-option argument. The existing argument order appears to work on distributions such as Fedora but chokes on Cygwin (newlib?). The following change worked for me: defconfig: $(top_builddir)extra/config/conf $(Q)$(top_builddir)extra/config/conf -d extra/Configs/Config.in \ -D extra/Configs/defconfigs/$(ARCH) should read: defconfig: $(top_builddir)extra/config/conf $(Q)$(top_builddir)extra/config/conf -D extra/Configs/defconfigs/$(ARCH) \ extra/Configs/Config.in -- Configure bugmail: https://bugs.busybox.net/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug. From ps.m at gmx.net Mon Apr 11 11:27:03 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Mon, 11 Apr 2011 13:27:03 +0200 Subject: [git commit future] _exit.c: include the proper headers Message-ID: <20110411142402.385CE8254F@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=15cef361ad2641ed365677c43e81d61edffd988f branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/future Signed-off-by: Peter S. Mazinger --- libc/sysdeps/linux/common/_exit.c | 14 +++----------- 1 files changed, 3 insertions(+), 11 deletions(-) diff --git a/libc/sysdeps/linux/common/_exit.c b/libc/sysdeps/linux/common/_exit.c index 51117d1..2196a98 100644 --- a/libc/sysdeps/linux/common/_exit.c +++ b/libc/sysdeps/linux/common/_exit.c @@ -7,25 +7,17 @@ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. */ -#include -#include #include -#include +#include #include -#ifdef __UCLIBC_HAS_THREADS_NATIVE__ -#include -#endif - -void attribute_noreturn _exit(int status) +void _exit(int status) { /* The loop is added only to keep gcc happy. */ while(1) { -#ifdef __UCLIBC_HAS_THREADS_NATIVE__ -# ifdef __NR_exit_group +#if defined __NR_exit_group && defined __UCLIBC_HAS_THREADS_NATIVE__ INLINE_SYSCALL(exit_group, 1, status); -# endif #endif INLINE_SYSCALL(exit, 1, status); } -- 1.7.3.4 From ps.m at gmx.net Mon Apr 11 11:27:03 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Mon, 11 Apr 2011 13:27:03 +0200 Subject: [git commit future] munmap.c: do not include unistd.h Message-ID: <20110411142402.1138C8254E@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=6cbc03c2e3a76a5990addeee5fb2a2da9dd6ca53 branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/future Signed-off-by: Peter S. Mazinger --- libc/sysdeps/linux/common/munmap.c | 2 -- 1 files changed, 0 insertions(+), 2 deletions(-) diff --git a/libc/sysdeps/linux/common/munmap.c b/libc/sysdeps/linux/common/munmap.c index 736bffe..22c393f 100644 --- a/libc/sysdeps/linux/common/munmap.c +++ b/libc/sysdeps/linux/common/munmap.c @@ -8,9 +8,7 @@ */ #include -#include #include - _syscall2(int, munmap, void *, start, size_t, length) libc_hidden_def(munmap) -- 1.7.3.4 From ps.m at gmx.net Mon Apr 11 11:27:03 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Mon, 11 Apr 2011 13:27:03 +0200 Subject: [git commit ldso-future] dl-syscall.h: use system headers as much as possible, cleanup a bit Message-ID: <20110411142450.C11B28254E@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=a698a25a8f0b0faad1117fc6f27bac463bda28d6 branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/ldso-future Signed-off-by: Peter S. Mazinger --- ldso/include/dl-syscall.h | 18 +++++------------- 1 files changed, 5 insertions(+), 13 deletions(-) diff --git a/ldso/include/dl-syscall.h b/ldso/include/dl-syscall.h index f002e8b..2cf58ff 100644 --- a/ldso/include/dl-syscall.h +++ b/ldso/include/dl-syscall.h @@ -15,8 +15,10 @@ #include #include /* MAP_ANONYMOUS -- differs between platforms */ -#define _FCNTL_H -#include +#define stat __hide_stat +#include +#include +#undef stat /* Pull in whatever this particular arch's kernel thinks the kernel version of * struct stat should look like. It turns out that each arch has a different @@ -29,10 +31,6 @@ #include #include -/* Protection bits. -- instead of including sys/stat.h */ -#define S_ISUID 04000 /* Set user ID on execution. */ -#define S_ISGID 02000 /* Set group ID on execution. */ - /* Pull in the arch specific syscall implementation */ #ifdef HAVE_DL_SYSCALLS_H # include @@ -114,12 +112,7 @@ static __always_inline _syscall3(int, _dl_readlink, const char *, path, char *, # include # define __NR__dl_gettimeofday __NR_gettimeofday static __always_inline _syscall2(int, _dl_gettimeofday, struct timeval *, tv, -# ifdef __USE_BSD - struct timezone * -# else - void * -# endif - , tz) + __timezone_ptr_t, tz) #endif /* Some architectures always use 12 as page shift for mmap2() eventhough the @@ -130,7 +123,6 @@ static __always_inline _syscall2(int, _dl_gettimeofday, struct timeval *, tv, # define MMAP2_PAGE_SHIFT 12 #endif -#define MAP_FAILED ((void *) -1) static __always_inline void *_dl_mmap(void *addr, unsigned long size, int prot, int flags, int fd, unsigned long offset) -- 1.7.3.4 From ps.m at gmx.net Mon Apr 11 11:27:03 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Mon, 11 Apr 2011 13:27:03 +0200 Subject: [git commit ldso-future] sh64: remove dl-syscalls.h Message-ID: <20110411142451.38A4E8254E@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=68b377cfe30056294d7c7d07977bdd186c141a78 branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/ldso-future The "special" __syscall_return was only added to handle errno, the general approach should handle this correctly Signed-off-by: Peter S. Mazinger --- ldso/ldso/sh64/dl-syscalls.h | 18 ------------------ ldso/ldso/sh64/dl-sysdep.h | 2 -- 2 files changed, 0 insertions(+), 20 deletions(-) delete mode 100644 ldso/ldso/sh64/dl-syscalls.h diff --git a/ldso/ldso/sh64/dl-syscalls.h b/ldso/ldso/sh64/dl-syscalls.h deleted file mode 100644 index 1de3899..0000000 --- a/ldso/ldso/sh64/dl-syscalls.h +++ /dev/null @@ -1,18 +0,0 @@ -#undef __syscall_return -#define __syscall_return(type, res) \ -do { \ - /* \ - * Note: when returning from kernel the return value is in r9 \ - * \ - * This prevents conflicts between return value and arg1 \ - * when dispatching signal handler, in other words makes \ - * life easier in the system call epilogue (see entry.S) \ - */ \ - register unsigned long __sr2 __asm__ ("r2") = res; \ - if ((unsigned long)(res) >= (unsigned long)(-125)) { \ - __set_errno(-(res)); \ - __sr2 = -1; \ - } \ - return (type)(__sr2); \ -} while (0) - diff --git a/ldso/ldso/sh64/dl-sysdep.h b/ldso/ldso/sh64/dl-sysdep.h index 3ad7efa..b60dcea 100644 --- a/ldso/ldso/sh64/dl-sysdep.h +++ b/ldso/ldso/sh64/dl-sysdep.h @@ -27,8 +27,6 @@ #define ELF_MACHINE_JMP_SLOT R_SH_JMP_SLOT -#define HAVE_DL_SYSCALLS_H - /* Need bootstrap relocations */ #define ARCH_NEEDS_BOOTSTRAP_RELOCS -- 1.7.3.4 From ps.m at gmx.net Mon Apr 11 11:27:03 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Mon, 11 Apr 2011 13:27:03 +0200 Subject: [git commit ldso-future] dl-sysdep.h: include on all archs elf.h and link.h Message-ID: <20110411142451.0092F8254E@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=0bcfb8636f878d1da000bc2d6d33e183774cfdb9 branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/ldso-future Signed-off-by: Peter S. Mazinger --- ldso/ldso/arm/dl-sysdep.h | 2 ++ ldso/ldso/avr32/dl-sysdep.h | 2 +- ldso/ldso/bfin/dl-sysdep.h | 13 ++----------- ldso/ldso/c6x/dl-sysdep.h | 13 ++----------- ldso/ldso/cris/dl-sysdep.h | 2 +- ldso/ldso/frv/dl-sysdep.h | 13 ++----------- ldso/ldso/i386/dl-sysdep.h | 2 ++ ldso/ldso/m68k/dl-sysdep.h | 2 ++ ldso/ldso/sh/dl-sysdep.h | 2 ++ ldso/ldso/sh64/dl-sysdep.h | 2 ++ ldso/ldso/sparc/dl-sysdep.h | 2 ++ ldso/ldso/x86_64/dl-sysdep.h | 1 + 12 files changed, 21 insertions(+), 35 deletions(-) diff --git a/ldso/ldso/arm/dl-sysdep.h b/ldso/ldso/arm/dl-sysdep.h index 5f17a77..0cc87b6 100644 --- a/ldso/ldso/arm/dl-sysdep.h +++ b/ldso/ldso/arm/dl-sysdep.h @@ -11,6 +11,8 @@ /* Define this if the system uses RELOCA. */ #undef ELF_USES_RELOCA #include +#include + /* Initialization sequence for the GOT. */ #define INIT_GOT(GOT_BASE,MODULE) \ { \ diff --git a/ldso/ldso/avr32/dl-sysdep.h b/ldso/ldso/avr32/dl-sysdep.h index 0b52a7a..311ec9a 100644 --- a/ldso/ldso/avr32/dl-sysdep.h +++ b/ldso/ldso/avr32/dl-sysdep.h @@ -9,8 +9,8 @@ /* Define this if the system uses RELOCA. */ #define ELF_USES_RELOCA - #include +#include #define ARCH_NUM 1 #define DT_AVR32_GOTSZ_IDX (DT_NUM + OS_NUM) diff --git a/ldso/ldso/bfin/dl-sysdep.h b/ldso/ldso/bfin/dl-sysdep.h index be705e0..4e3108e 100644 --- a/ldso/ldso/bfin/dl-sysdep.h +++ b/ldso/ldso/bfin/dl-sysdep.h @@ -28,6 +28,8 @@ USA. */ * Define this if the system uses RELOCA. */ #undef ELF_USES_RELOCA +#include +#include /* JMPREL relocs are inside the DT_RELA table. */ #define ELF_MACHINE_PLTREL_OVERLAP @@ -201,17 +203,6 @@ while (0) #define DL_GET_READY_TO_RUN_EXTRA_ARGS \ , dl_boot_progmap, dl_boot_got_pointer - -#ifdef __USE_GNU -# include -#else -# define __USE_GNU -# include -# undef __USE_GNU -#endif - -#include - static __always_inline Elf32_Addr elf_machine_load_address (void) { diff --git a/ldso/ldso/c6x/dl-sysdep.h b/ldso/ldso/c6x/dl-sysdep.h index e5ddb07..e1954c6 100644 --- a/ldso/ldso/c6x/dl-sysdep.h +++ b/ldso/ldso/c6x/dl-sysdep.h @@ -7,12 +7,12 @@ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. */ -#include - /* * Define this if the system uses RELOCA. */ #define ELF_USES_RELOCA +#include +#include /* JMPREL relocs are inside the DT_RELA table. */ /* Actually looks like a linker bug sets DT_JMPREL anyway */ @@ -167,15 +167,6 @@ while (0) #define DL_BOOT_COMPUTE_DYN(dpnt, got, load_addr) \ ((dpnt) = dl_boot_ldso_dyn_pointer) - -#ifdef __USE_GNU -# include -#else -# define __USE_GNU -# include -# undef __USE_GNU -#endif - static __always_inline Elf32_Addr elf_machine_load_address (void) { diff --git a/ldso/ldso/cris/dl-sysdep.h b/ldso/ldso/cris/dl-sysdep.h index be97ce7..900eda1 100644 --- a/ldso/ldso/cris/dl-sysdep.h +++ b/ldso/ldso/cris/dl-sysdep.h @@ -1,7 +1,7 @@ /* CRIS can never use Elf32_Rel relocations. */ #define ELF_USES_RELOCA - #include +#include /* Initialization sequence for the GOT. */ #define INIT_GOT(GOT_BASE,MODULE) \ diff --git a/ldso/ldso/frv/dl-sysdep.h b/ldso/ldso/frv/dl-sysdep.h index e33b399..7193c20 100644 --- a/ldso/ldso/frv/dl-sysdep.h +++ b/ldso/ldso/frv/dl-sysdep.h @@ -14,6 +14,8 @@ * Define this if the system uses RELOCA. */ #undef ELF_USES_RELOCA +#include +#include /* JMPREL relocs are inside the DT_RELA table. */ #define ELF_MACHINE_PLTREL_OVERLAP @@ -178,14 +180,3 @@ while (0) , struct elf32_fdpic_loadmap *dl_boot_progmap #define DL_GET_READY_TO_RUN_EXTRA_ARGS \ , dl_boot_progmap - - - - -#ifdef __USE_GNU -# include -#else -# define __USE_GNU -# include -# undef __USE_GNU -#endif diff --git a/ldso/ldso/i386/dl-sysdep.h b/ldso/ldso/i386/dl-sysdep.h index 535e8e3..b91bd61 100644 --- a/ldso/ldso/i386/dl-sysdep.h +++ b/ldso/ldso/i386/dl-sysdep.h @@ -8,6 +8,8 @@ /* Define this if the system uses RELOCA. */ #undef ELF_USES_RELOCA #include +#include + /* Initialization sequence for the GOT. */ #define INIT_GOT(GOT_BASE,MODULE) \ do { \ diff --git a/ldso/ldso/m68k/dl-sysdep.h b/ldso/ldso/m68k/dl-sysdep.h index 87b0245..5660571 100644 --- a/ldso/ldso/m68k/dl-sysdep.h +++ b/ldso/ldso/m68k/dl-sysdep.h @@ -8,6 +8,8 @@ /* Define this if the system uses RELOCA. */ #define ELF_USES_RELOCA #include +#include + /* Initialization sequence for a GOT. */ #define INIT_GOT(GOT_BASE,MODULE) \ do { \ diff --git a/ldso/ldso/sh/dl-sysdep.h b/ldso/ldso/sh/dl-sysdep.h index 650a8fd..a8a4dc7 100644 --- a/ldso/ldso/sh/dl-sysdep.h +++ b/ldso/ldso/sh/dl-sysdep.h @@ -6,6 +6,8 @@ /* Define this if the system uses RELOCA. */ #define ELF_USES_RELOCA #include +#include + /* * Initialization sequence for a GOT. */ diff --git a/ldso/ldso/sh64/dl-sysdep.h b/ldso/ldso/sh64/dl-sysdep.h index e413c59..3ad7efa 100644 --- a/ldso/ldso/sh64/dl-sysdep.h +++ b/ldso/ldso/sh64/dl-sysdep.h @@ -7,6 +7,8 @@ /* Define this if the system uses RELOCA. */ #define ELF_USES_RELOCA #include +#include + /* * Initialization sequence for a GOT. */ diff --git a/ldso/ldso/sparc/dl-sysdep.h b/ldso/ldso/sparc/dl-sysdep.h index bb2b1cd..f2cd46b 100644 --- a/ldso/ldso/sparc/dl-sysdep.h +++ b/ldso/ldso/sparc/dl-sysdep.h @@ -8,6 +8,8 @@ /* Define this if the system uses RELOCA. */ #define ELF_USES_RELOCA #include +#include + /* * Initialization sequence for a GOT. For the Sparc, this points to the * PLT, and we need to initialize a couple of the slots. The PLT should diff --git a/ldso/ldso/x86_64/dl-sysdep.h b/ldso/ldso/x86_64/dl-sysdep.h index 2c6c9e8..a64af00 100644 --- a/ldso/ldso/x86_64/dl-sysdep.h +++ b/ldso/ldso/x86_64/dl-sysdep.h @@ -24,6 +24,7 @@ #define ELF_USES_RELOCA #include #include + /* Initialization sequence for the GOT. */ #define INIT_GOT(GOT_BASE,MODULE) \ do { \ -- 1.7.3.4 From ps.m at gmx.net Mon Apr 11 11:27:03 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Mon, 11 Apr 2011 13:27:03 +0200 Subject: [git commit ldso-future] dl-syscall.h: remove inconsistent mmap implementation, use the common one Message-ID: <20110411142451.58DDD8254E@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=820bfb1fae5fb1d66f2bf5f8b989bac7bf3e4a93 branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/ldso-future Signed-off-by: Peter S. Mazinger --- ldso/include/dl-syscall.h | 42 +------------------------------------- libc/sysdeps/linux/common/mmap.c | 26 +++++++++++++---------- 2 files changed, 16 insertions(+), 52 deletions(-) diff --git a/ldso/include/dl-syscall.h b/ldso/include/dl-syscall.h index 2cf58ff..0b1c6c2 100644 --- a/ldso/include/dl-syscall.h +++ b/ldso/include/dl-syscall.h @@ -115,47 +115,7 @@ static __always_inline _syscall2(int, _dl_gettimeofday, struct timeval *, tv, __timezone_ptr_t, tz) #endif -/* Some architectures always use 12 as page shift for mmap2() eventhough the - * real PAGE_SHIFT != 12. Other architectures use the same value as - * PAGE_SHIFT... - */ -#ifndef MMAP2_PAGE_SHIFT -# define MMAP2_PAGE_SHIFT 12 -#endif - -static __always_inline -void *_dl_mmap(void *addr, unsigned long size, int prot, - int flags, int fd, unsigned long offset) -{ -#if defined(__UCLIBC_MMAP_HAS_6_ARGS__) && defined(__NR_mmap) - /* first try mmap(), syscall6() style */ - return (void *)INLINE_SYSCALL(mmap, 6, addr, size, prot, flags, fd, offset); - -#elif defined(__NR_mmap2) && !defined (__mcoldfire__) - /* then try mmap2() */ - unsigned long shifted; - - if (offset & ((1 << MMAP2_PAGE_SHIFT) - 1)) - return MAP_FAILED; - - /* gcc needs help with putting things onto the stack */ - shifted = offset >> MMAP2_PAGE_SHIFT; - return (void *)INLINE_SYSCALL(mmap2, 6, addr, size, prot, flags, fd, shifted); - -#elif defined(__NR_mmap) - /* finally, fall back to mmap(), syscall1() style */ - unsigned long buffer[6]; - buffer[0] = (unsigned long) addr; - buffer[1] = (unsigned long) size; - buffer[2] = (unsigned long) prot; - buffer[3] = (unsigned long) flags; - buffer[4] = (unsigned long) fd; - buffer[5] = (unsigned long) offset; - return (void *)INLINE_SYSCALL(mmap, 1, buffer); -#else -# error "Your architecture doesn't seem to provide mmap() !?" -#endif -} +#include "../../libc/sysdeps/linux/common/mmap.c" #else /* IS_IN_rtld */ diff --git a/libc/sysdeps/linux/common/mmap.c b/libc/sysdeps/linux/common/mmap.c index dbc66c2..4446a02 100644 --- a/libc/sysdeps/linux/common/mmap.c +++ b/libc/sysdeps/linux/common/mmap.c @@ -16,9 +16,9 @@ # error disable __UCLIBC_MMAP_HAS_6_ARGS__ for this arch # endif -# define __NR__mmap __NR_mmap -static _syscall6(void *, _mmap, void *, addr, size_t, len, - int, prot, int, flags, int, fd, __off_t, offset) +# define __NR__dl_mmap __NR_mmap +static __always_inline _syscall6(void *, _dl_mmap, void *, addr, size_t, len, + int, prot, int, flags, int, fd, __off_t, offset) #elif defined __NR_mmap2 && defined _syscall6 @@ -29,17 +29,19 @@ static _syscall6(void *, _mmap, void *, addr, size_t, len, # endif # define __NR___syscall_mmap2 __NR_mmap2 -static __inline__ _syscall6(void *, __syscall_mmap2, void *, addr, size_t, len, - int, prot, int, flags, int, fd, __off_t, offset) +static __always_inline _syscall6(void *, __syscall_mmap2, void *, addr, size_t, len, + int, prot, int, flags, int, fd, __off_t, offset) -static void *_mmap(void *addr, size_t len, int prot, int flags, - int fd, __off_t offset) +static __always_inline void *_dl_mmap(void *addr, size_t len, int prot, int flags, + int fd, __off_t offset) { const int mmap2_shift = MMAP2_PAGE_SHIFT; const __off_t mmap2_mask = ((__off_t) 1 << MMAP2_PAGE_SHIFT) - 1; /* check if offset is page aligned */ if (offset & mmap2_mask) { +# ifndef IS_IN_rtld __set_errno(EINVAL); +# endif return MAP_FAILED; } # ifdef __USE_FILE_OFFSET64 @@ -54,10 +56,10 @@ static void *_mmap(void *addr, size_t len, int prot, int flags, #elif defined __NR_mmap # define __NR___syscall_mmap __NR_mmap -static __inline__ _syscall1(void *, __syscall_mmap, unsigned long *, buffer) +static __always_inline _syscall1(void *, __syscall_mmap, unsigned long *, buffer) -static void *_mmap(void *addr, size_t len, int prot, int flags, - int fd, __off_t offset) +static __always_inline void *_dl_mmap(void *addr, size_t len, int prot, int flags, + int fd, __off_t offset) { unsigned long buffer[6]; @@ -76,5 +78,7 @@ static void *_mmap(void *addr, size_t len, int prot, int flags, #endif -strong_alias(_mmap,mmap) +#ifndef IS_IN_rtld +strong_alias(_dl_mmap,mmap) +#endif libc_hidden_def(mmap) -- 1.7.3.4 From ps.m at gmx.net Mon Apr 11 11:27:03 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Mon, 11 Apr 2011 13:27:03 +0200 Subject: [git commit ldso-future] dl-syscall.h: use newer common get[e]uid, get[e]gid and getpid Message-ID: <20110411142451.8705D8254F@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=d21f59a4a02f3d274d6eb0cbba46409d3ab0ef71 branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/ldso-future Signed-off-by: Peter S. Mazinger --- ldso/include/dl-syscall.h | 34 +++++----------------------------- libc/sysdeps/linux/common/getegid.c | 5 +++++ libc/sysdeps/linux/common/geteuid.c | 5 +++++ libc/sysdeps/linux/common/getgid.c | 9 +++++++++ libc/sysdeps/linux/common/getpid.c | 7 ++++++- libc/sysdeps/linux/common/getuid.c | 9 +++++++++ 6 files changed, 39 insertions(+), 30 deletions(-) diff --git a/ldso/include/dl-syscall.h b/ldso/include/dl-syscall.h index 0b1c6c2..9f4ac05 100644 --- a/ldso/include/dl-syscall.h +++ b/ldso/include/dl-syscall.h @@ -74,35 +74,11 @@ static __always_inline _syscall2(int, _dl_fstat, int, fd, struct stat *, buf) #define __NR__dl_munmap __NR_munmap static __always_inline _syscall2(int, _dl_munmap, void *, start, unsigned long, length) -#ifdef __NR_getxuid -# define __NR_getuid __NR_getxuid -#endif -#define __NR__dl_getuid __NR_getuid -static __always_inline _syscall0(uid_t, _dl_getuid) - -#ifndef __NR_geteuid -# define __NR_geteuid __NR_getuid -#endif -#define __NR__dl_geteuid __NR_geteuid -static __always_inline _syscall0(uid_t, _dl_geteuid) - -#ifdef __NR_getxgid -# define __NR_getgid __NR_getxgid -#endif -#define __NR__dl_getgid __NR_getgid -static __always_inline _syscall0(gid_t, _dl_getgid) - -#ifndef __NR_getegid -# define __NR_getegid __NR_getgid -#endif -#define __NR__dl_getegid __NR_getegid -static __always_inline _syscall0(gid_t, _dl_getegid) - -#ifdef __NR_getxpid -# define __NR_getpid __NR_getxpid -#endif -#define __NR__dl_getpid __NR_getpid -static __always_inline _syscall0(gid_t, _dl_getpid) +#include "../../libc/sysdeps/linux/common/getuid.c" +#include "../../libc/sysdeps/linux/common/geteuid.c" +#include "../../libc/sysdeps/linux/common/getgid.c" +#include "../../libc/sysdeps/linux/common/getegid.c" +#include "../../libc/sysdeps/linux/common/getpid.c" #define __NR__dl_readlink __NR_readlink static __always_inline _syscall3(int, _dl_readlink, const char *, path, char *, buf, diff --git a/libc/sysdeps/linux/common/getegid.c b/libc/sysdeps/linux/common/getegid.c index 80a8ac9..9e2998b 100644 --- a/libc/sysdeps/linux/common/getegid.c +++ b/libc/sysdeps/linux/common/getegid.c @@ -16,6 +16,11 @@ #endif #ifdef __NR_getegid +# ifdef IS_IN_rtld +# define __NR__dl_getegid __NR_getegid +# define getegid _dl_getegid +static __always_inline +# endif _syscall_noerr0(gid_t, getegid) libc_hidden_def(getegid) #endif diff --git a/libc/sysdeps/linux/common/geteuid.c b/libc/sysdeps/linux/common/geteuid.c index 610fbc1..4830c57 100644 --- a/libc/sysdeps/linux/common/geteuid.c +++ b/libc/sysdeps/linux/common/geteuid.c @@ -16,6 +16,11 @@ #endif #ifdef __NR_geteuid +# ifdef IS_IN_rtld +# define __NR__dl_geteuid __NR_geteuid +# define geteuid _dl_geteuid +static __always_inline +# endif _syscall_noerr0(uid_t, geteuid) libc_hidden_def(geteuid) #endif diff --git a/libc/sysdeps/linux/common/getgid.c b/libc/sysdeps/linux/common/getgid.c index ccfbfc0..868c9e1 100644 --- a/libc/sysdeps/linux/common/getgid.c +++ b/libc/sysdeps/linux/common/getgid.c @@ -19,9 +19,18 @@ # define __NR_getgid __NR_getgid32 #endif +#ifdef IS_IN_rtld +# define __NR__dl_getgid __NR_getgid +# define getgid _dl_getgid +static __always_inline +#endif _syscall_noerr0(gid_t, getgid) libc_hidden_def(getgid) #if !defined __NR_getegid32 && !defined __NR_getegid +# ifdef IS_IN_rtld +# define getegid _dl_getegid +static __always_inline +# endif strong_alias(getgid,getegid) libc_hidden_def(getegid) #endif diff --git a/libc/sysdeps/linux/common/getpid.c b/libc/sysdeps/linux/common/getpid.c index d9a6908..88ba680 100644 --- a/libc/sysdeps/linux/common/getpid.c +++ b/libc/sysdeps/linux/common/getpid.c @@ -15,8 +15,13 @@ # define __NR_getpid __NR_getxpid #endif +#ifdef IS_IN_rtld +# define __NR__dl_getpid __NR_getpid +# define getpid _dl_getpid +static __always_inline +#endif _syscall_noerr0(pid_t, getpid) libc_hidden_weak(getpid) -#ifndef __NR_getppid +#if !defined __NR_getppid && !defined IS_IN_rtld strong_alias(getpid,getppid) #endif diff --git a/libc/sysdeps/linux/common/getuid.c b/libc/sysdeps/linux/common/getuid.c index f921acb..b59bfac 100644 --- a/libc/sysdeps/linux/common/getuid.c +++ b/libc/sysdeps/linux/common/getuid.c @@ -19,9 +19,18 @@ # define __NR_getuid __NR_getuid32 #endif +#ifdef IS_IN_rtld +# define __NR__dl_getuid __NR_getuid +# define getuid _dl_getuid +static __always_inline +#endif _syscall_noerr0(uid_t, getuid) libc_hidden_def(getuid) #if !defined __NR_geteuid32 && !defined __NR_geteuid +# ifdef IS_IN_rtld +# define geteuid _dl_geteuid +static __always_inline +# endif strong_alias(getuid,geteuid) libc_hidden_def(geteuid) #endif -- 1.7.3.4 From ps.m at gmx.net Mon Apr 11 11:27:03 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Mon, 11 Apr 2011 13:27:03 +0200 Subject: [git commit ldso-future] dl-syscall.h: mark _dl_exit with attribute_noreturn Message-ID: <20110411142452.4111D8254E@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=486f3d1b16ec46abb6b21e9161940e6f40250213 branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/ldso-future Signed-off-by: Peter S. Mazinger Patch is too large, so refusing to show it From ps.m at gmx.net Mon Apr 11 11:27:03 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Mon, 11 Apr 2011 13:27:03 +0200 Subject: [git commit ldso-future] _exit.c: include the proper headers Message-ID: <20110411142452.A9B868254E@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=15cef361ad2641ed365677c43e81d61edffd988f branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/ldso-future Signed-off-by: Peter S. Mazinger Patch is too large, so refusing to show it From ps.m at gmx.net Mon Apr 11 11:27:03 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Mon, 11 Apr 2011 13:27:03 +0200 Subject: [git commit ldso-future] dl-syscall.h: change _dl_close to void, return value is nowhere checked Message-ID: <20110411142452.F272F8254E@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=3ef57d53be081aeffe331478763434a3045c6493 branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/ldso-future Signed-off-by: Peter S. Mazinger Patch is too large, so refusing to show it From ps.m at gmx.net Mon Apr 11 11:27:03 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Mon, 11 Apr 2011 13:27:03 +0200 Subject: [git commit ldso-future] munmap.c: do not include unistd.h Message-ID: <20110411142451.CDECA8254E@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=6cbc03c2e3a76a5990addeee5fb2a2da9dd6ca53 branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/ldso-future Signed-off-by: Peter S. Mazinger Patch is too large, so refusing to show it From ps.m at gmx.net Mon Apr 11 11:27:03 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Mon, 11 Apr 2011 13:27:03 +0200 Subject: [git commit ldso-future] dl-inlines.h: remove useless prototypes for _dl_debug and _dl_debug_file Message-ID: <20110411142453.214778254E@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=4901b37adda08e89bb871e1206040f419ddca1f9 branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/ldso-future Signed-off-by: Peter S. Mazinger --- ldso/ldso/bfin/dl-inlines.h | 2 -- ldso/ldso/frv/dl-inlines.h | 2 -- 2 files changed, 0 insertions(+), 4 deletions(-) diff --git a/ldso/ldso/bfin/dl-inlines.h b/ldso/ldso/bfin/dl-inlines.h index 66c6dd6..1b284d9 100644 --- a/ldso/ldso/bfin/dl-inlines.h +++ b/ldso/ldso/bfin/dl-inlines.h @@ -85,8 +85,6 @@ __dl_init_loadaddr_hdr (struct elf32_fdpic_loadaddr loadaddr, void *addr, #if defined (__SUPPORT_LD_DEBUG__) { - extern char *_dl_debug; - extern int _dl_debug_file; if (_dl_debug) _dl_dprintf(_dl_debug_file, "%i: mapped %x at %x, size %x\n", loadaddr.map->nsegs-1, diff --git a/ldso/ldso/frv/dl-inlines.h b/ldso/ldso/frv/dl-inlines.h index 8f4c13a..c07e5aa 100644 --- a/ldso/ldso/frv/dl-inlines.h +++ b/ldso/ldso/frv/dl-inlines.h @@ -69,8 +69,6 @@ __dl_init_loadaddr_hdr (struct elf32_fdpic_loadaddr loadaddr, void *addr, #if defined (__SUPPORT_LD_DEBUG__) { - extern char *_dl_debug; - extern int _dl_debug_file; if (_dl_debug) _dl_dprintf(_dl_debug_file, "%i: mapped %x at %x, size %x\n", loadaddr.map->nsegs-1, -- 1.7.3.4 From ps.m at gmx.net Mon Apr 11 11:27:03 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Mon, 11 Apr 2011 13:27:03 +0200 Subject: [git commit ldso-future] ldsodefs.h: add prototypes for functions used in libdl and libc Message-ID: <20110411142453.4B3C18254E@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=7d7ff83fc7a8bb5ab15b757552a72d7af84fb8a8 branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/ldso-future Signed-off-by: Peter S. Mazinger --- ldso/include/ldsodefs.h | 7 ++++++- ldso/ldso/dl-array.c | 16 +++++----------- libc/misc/internals/__uClibc_main.c | 5 +---- 3 files changed, 12 insertions(+), 16 deletions(-) diff --git a/ldso/include/ldsodefs.h b/ldso/include/ldsodefs.h index 7eb4c8f..ebfee72 100644 --- a/ldso/include/ldsodefs.h +++ b/ldso/include/ldsodefs.h @@ -50,9 +50,14 @@ extern struct r_debug *_dl_debug_addr; extern void *(*_dl_malloc_function)(size_t); extern void (*_dl_free_function) (void *p); struct elf_resolve; +# ifdef __UCLIBC_CTOR_DTOR__ +extern void _dl_app_init_array(void); +extern void _dl_app_fini_array(void); +# endif +#endif +struct elf_resolve; extern void _dl_run_init_array(struct elf_resolve *); extern void _dl_run_fini_array(struct elf_resolve *); -#endif #ifdef __UCLIBC_HAS_TLS__ /* Determine next available module ID. */ diff --git a/ldso/ldso/dl-array.c b/ldso/ldso/dl-array.c index 8e2ea00..cc5e197 100644 --- a/ldso/ldso/dl-array.c +++ b/ldso/ldso/dl-array.c @@ -47,7 +47,6 @@ static void _dl_run_array_forward(unsigned long array, unsigned long size, } } -void _dl_run_init_array(struct elf_resolve *tpnt); void _dl_run_init_array(struct elf_resolve *tpnt) { _dl_run_array_forward(tpnt->dynamic_info[DT_INIT_ARRAY], @@ -55,15 +54,6 @@ void _dl_run_init_array(struct elf_resolve *tpnt) tpnt->loadaddr); } -#if defined IS_IN_rtld && defined __UCLIBC_CTOR_DTOR__ -void _dl_app_init_array(void); -void _dl_app_init_array(void) -{ - _dl_run_init_array(_dl_loaded_modules); -} -#endif - -void _dl_run_fini_array(struct elf_resolve *tpnt); void _dl_run_fini_array(struct elf_resolve *tpnt) { if (tpnt->dynamic_info[DT_FINI_ARRAY]) { @@ -78,7 +68,11 @@ void _dl_run_fini_array(struct elf_resolve *tpnt) } #if defined IS_IN_rtld && defined __UCLIBC_CTOR_DTOR__ -void _dl_app_fini_array(void); +void _dl_app_init_array(void) +{ + _dl_run_init_array(_dl_loaded_modules); +} + void _dl_app_fini_array(void) { _dl_run_fini_array(_dl_loaded_modules); diff --git a/libc/misc/internals/__uClibc_main.c b/libc/misc/internals/__uClibc_main.c index 68b020f..7462241 100644 --- a/libc/misc/internals/__uClibc_main.c +++ b/libc/misc/internals/__uClibc_main.c @@ -128,10 +128,7 @@ extern void __pthread_initialize_minimal(void); /* If __UCLIBC_FORMAT_SHARED_FLAT__, all array initialisation and finalisation * is handled by the routines passed to __uClibc_main(). */ #if defined (__UCLIBC_CTOR_DTOR__) && !defined (__UCLIBC_FORMAT_SHARED_FLAT__) -# ifdef SHARED -extern void _dl_app_init_array(void); -extern void _dl_app_fini_array(void); -# else +# ifndef SHARED /* These magic symbols are provided by the linker. */ extern void (*__preinit_array_start []) (void) attribute_hidden; extern void (*__preinit_array_end []) (void) attribute_hidden; -- 1.7.3.4 From ps.m at gmx.net Mon Apr 11 11:27:03 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Mon, 11 Apr 2011 13:27:03 +0200 Subject: [git commit ldso-future] arm/dl-startup.h: guard a bx instruction with __USE_BX__ Message-ID: <20110411142453.80DC48254E@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=fc103eef1a09e54b6fc4ec9c09078c4e7fde8d66 branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/ldso-future Signed-off-by: Peter S. Mazinger --- ldso/ldso/arm/dl-startup.h | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-) diff --git a/ldso/ldso/arm/dl-startup.h b/ldso/ldso/arm/dl-startup.h index f170dbd..f89f70c 100644 --- a/ldso/ldso/arm/dl-startup.h +++ b/ldso/ldso/arm/dl-startup.h @@ -73,7 +73,11 @@ __asm__( " @ odd, so use an arm function and change to thumb (_dl_start\n" " @ is thumb)\n" " adr r0, __dl_thumb_start+1\n" +#if defined(__USE_BX__) " bx r0\n" +#else + " mov pc, r0\n" +#endif "\n\n" " .thumb\n" " .globl __dl_thumb_start\n" -- 1.7.3.4 From ps.m at gmx.net Mon Apr 11 11:27:03 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Mon, 11 Apr 2011 13:27:03 +0200 Subject: [git commit ldso-future] ldso: make a bunch of functions static Message-ID: <20110411142453.E192C8254E@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=44627e878e11cda2b766293c322e5a95b5722b4f branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/ldso-future They all go into the same file, no need to handle them as hidden Signed-off-by: Peter S. Mazinger --- ldso/include/dl-elf.h | 6 ------ ldso/include/dl-hash.h | 4 ---- ldso/ldso/dl-elf.c | 5 ++++- ldso/ldso/dl-hash.c | 2 +- ldso/ldso/elfinterp_common.c | 10 ++++------ ldso/ldso/ldso.c | 17 ++++++++++------- ldso/ldso/mips/elfinterp.c | 10 ++++------ ldso/ldso/powerpc/elfinterp.c | 5 ++--- 8 files changed, 25 insertions(+), 34 deletions(-) diff --git a/ldso/include/dl-elf.h b/ldso/include/dl-elf.h index addf23a..0103d3d 100644 --- a/ldso/include/dl-elf.h +++ b/ldso/include/dl-elf.h @@ -28,15 +28,9 @@ static __inline__ void _dl_unmap_cache(void) { } #endif /* Function prototypes for non-static stuff in dl-elf.c and elfinterp.c */ -extern void _dl_parse_lazy_relocation_information(struct dyn_elf *rpnt, - ElfW(Addr) rel_addr, ElfW(Word) rel_size); -extern int _dl_parse_relocation_information(struct dyn_elf *rpnt, - ElfW(Addr) rel_addr, ElfW(Word) rel_size); extern struct elf_resolve * _dl_load_shared_library(int secure, struct dyn_elf **rpnt, struct elf_resolve *tpnt, char *full_libname, int trace_loaded_objects); -extern struct elf_resolve * _dl_load_elf_shared_library(int secure, - struct dyn_elf **rpnt, char *libname) attribute_hidden; extern int _dl_fixup(struct dyn_elf *rpnt, int flag); extern void _dl_protect_relro (struct elf_resolve *l) internal_function; diff --git a/ldso/include/dl-hash.h b/ldso/include/dl-hash.h index b3f811b..3e25692 100644 --- a/ldso/include/dl-hash.h +++ b/ldso/include/dl-hash.h @@ -151,10 +151,6 @@ struct elf_resolve { extern struct dyn_elf * _dl_symbol_tables; extern struct elf_resolve * _dl_loaded_modules; -extern struct elf_resolve * _dl_add_elf_hash_table(const char * libname, - DL_LOADADDR_TYPE loadaddr, ElfW(Word) * dynamic_info, - ElfW(Addr) dynamic_addr, unsigned long dynamic_size); - extern char *_dl_find_hash(const char *name, struct dyn_elf *rpnt, struct elf_resolve *mytpnt, int type_class, struct symbol_ref *symbol); diff --git a/ldso/ldso/dl-elf.c b/ldso/ldso/dl-elf.c index 0d3640d..8832c1a 100644 --- a/ldso/ldso/dl-elf.c +++ b/ldso/ldso/dl-elf.c @@ -31,6 +31,9 @@ #include +static struct elf_resolve * _dl_load_elf_shared_library(int secure, + struct dyn_elf **rpnt, char *libname); + #ifdef __LDSO_CACHE_SUPPORT__ static caddr_t _dl_cache_addr = NULL; @@ -320,7 +323,7 @@ goof: * are required. */ -struct elf_resolve *_dl_load_elf_shared_library(int secure, +static struct elf_resolve *_dl_load_elf_shared_library(int secure, struct dyn_elf **rpnt, char *libname) { ElfW(Ehdr) *epnt; diff --git a/ldso/ldso/dl-hash.c b/ldso/ldso/dl-hash.c index fa6b316..1232c0d 100644 --- a/ldso/ldso/dl-hash.c +++ b/ldso/ldso/dl-hash.c @@ -82,7 +82,7 @@ static __inline__ Elf_Symndx _dl_elf_hash(const unsigned char *name) * We add the relevant info to the symbol chain, so that we can resolve all * externals properly. */ -struct elf_resolve *_dl_add_elf_hash_table(const char *libname, +static struct elf_resolve *_dl_add_elf_hash_table(const char *libname, DL_LOADADDR_TYPE loadaddr, ElfW(Word) *dynamic_info, ElfW(Addr) dynamic_addr, attribute_unused unsigned long dynamic_size) { diff --git a/ldso/ldso/elfinterp_common.c b/ldso/ldso/elfinterp_common.c index c89ffda..a9f4092 100644 --- a/ldso/ldso/elfinterp_common.c +++ b/ldso/ldso/elfinterp_common.c @@ -186,9 +186,8 @@ static int _dl_parse(struct elf_resolve *tpnt, struct dyn_elf *scope, return 0; } -int _dl_parse_relocation_information(struct dyn_elf *rpnt, - ElfW(Addr) rel_addr, - ElfW(Word) rel_size) +static int _dl_parse_relocation_information(struct dyn_elf *rpnt, + ElfW(Addr) rel_addr, ElfW(Word) rel_size) { return _dl_parse(rpnt->dyn, rpnt->dyn->symbol_scope, rel_addr, rel_size, _dl_do_reloc); } @@ -245,9 +244,8 @@ static __always_inline int _dl_do_lazy_reloc(struct elf_resolve *tpnt, struct dy #endif #ifndef ARCH_HAS_LAZY -void _dl_parse_lazy_relocation_information(struct dyn_elf *rpnt, - ElfW(Addr) rel_addr, - ElfW(Word) rel_size) +static void _dl_parse_lazy_relocation_information(struct dyn_elf *rpnt, + ElfW(Addr) rel_addr, ElfW(Word) rel_size) { # if defined ELF_MACHINE_NONE && defined ELF_MACHINE_JMP_SLOT (void)_dl_parse(rpnt->dyn, NULL, rel_addr, rel_size, _dl_do_lazy_reloc); diff --git a/ldso/ldso/ldso.c b/ldso/ldso/ldso.c index f2ea13b..b7c2a8a 100644 --- a/ldso/ldso/ldso.c +++ b/ldso/ldso/ldso.c @@ -64,9 +64,9 @@ void (*_dl_free_function) (void *p) = NULL; static int _dl_secure = 1; /* Are we dealing with setuid stuff? */ -void _dl_get_ready_to_run(struct elf_resolve *tpnt, DL_LOADADDR_TYPE load_addr, - ElfW(auxv_t) auxvt[AT_EGID + 1], char **envp, char **argv - DL_GET_READY_TO_RUN_EXTRA_PARMS) attribute_hidden; +static __always_inline void _dl_get_ready_to_run(struct elf_resolve *tpnt, DL_LOADADDR_TYPE load_addr, + ElfW(auxv_t) auxvt[AT_EGID + 1], char **envp, char **argv + DL_GET_READY_TO_RUN_EXTRA_PARMS); #include "dl-startup.c" #include "dl-symbols.c" @@ -267,10 +267,13 @@ static void __attribute__ ((destructor)) __attribute_used__ _dl_fini(void) } } -void _dl_get_ready_to_run(struct elf_resolve *tpnt, DL_LOADADDR_TYPE load_addr, - ElfW(auxv_t) auxvt[AT_EGID + 1], char **envp, - char **argv - DL_GET_READY_TO_RUN_EXTRA_PARMS) +static struct elf_resolve * _dl_add_elf_hash_table(const char * libname, + DL_LOADADDR_TYPE loadaddr, ElfW(Word) * dynamic_info, + ElfW(Addr) dynamic_addr, unsigned long dynamic_size); + +static __always_inline void _dl_get_ready_to_run(struct elf_resolve *tpnt, DL_LOADADDR_TYPE load_addr, + ElfW(auxv_t) auxvt[AT_EGID + 1], char **envp, + char **argv DL_GET_READY_TO_RUN_EXTRA_PARMS) { ElfW(Addr) app_mapaddr = 0; ElfW(Phdr) *ppnt; diff --git a/ldso/ldso/mips/elfinterp.c b/ldso/ldso/mips/elfinterp.c index 10e752d..fd41c44 100644 --- a/ldso/ldso/mips/elfinterp.c +++ b/ldso/ldso/mips/elfinterp.c @@ -81,17 +81,15 @@ unsigned long __dl_runtime_resolve(unsigned long sym_index, return new_addr; } -void _dl_parse_lazy_relocation_information(struct dyn_elf *rpnt, - ElfW(Addr) rel_addr, - ElfW(Word) rel_size) +static void _dl_parse_lazy_relocation_information(struct dyn_elf *rpnt, + ElfW(Addr) rel_addr, ElfW(Word) rel_size) { /* Nothing to do */ return; } -int _dl_parse_relocation_information(struct dyn_elf *xpnt, - ElfW(Addr) rel_addr, - ElfW(Word) rel_size) +static int _dl_parse_relocation_information(struct dyn_elf *xpnt, + ElfW(Addr) rel_addr, ElfW(Word) rel_size) { ElfW(Addr) *reloc_addr = NULL; struct elf_resolve *tpnt = xpnt->dyn; diff --git a/ldso/ldso/powerpc/elfinterp.c b/ldso/ldso/powerpc/elfinterp.c index 21b5869..b96ce36 100644 --- a/ldso/ldso/powerpc/elfinterp.c +++ b/ldso/ldso/powerpc/elfinterp.c @@ -358,9 +358,8 @@ _dl_do_reloc(struct elf_resolve *tpnt,struct dyn_elf *scope, return 0; } -void _dl_parse_lazy_relocation_information(struct dyn_elf *rpnt, - ElfW(Addr) rel_addr, - ElfW(Word) rel_size) +static void _dl_parse_lazy_relocation_information(struct dyn_elf *rpnt, + ElfW(Addr) rel_addr, ElfW(Word) rel_size) { struct elf_resolve *tpnt = rpnt->dyn; ElfW(Word) *plt, offset, i, num_plt_entries, rel_offset_words; -- 1.7.3.4 From ps.m at gmx.net Mon Apr 11 11:27:03 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Mon, 11 Apr 2011 13:27:03 +0200 Subject: [git commit ldso-future] dl-hash.c: disable the use of weak_result Message-ID: <20110411142454.2E7CB8254E@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=4314dc306516c0671732555a895b8d894d1267c5 branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/ldso-future Leave the code in for the case, that someone wants to enable support for old style weak symbols like glibc, when LD_DYNAMIC_WEAK is exported. Signed-off-by: Peter S. Mazinger --- ldso/ldso/dl-hash.c | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-) diff --git a/ldso/ldso/dl-hash.c b/ldso/ldso/dl-hash.c index 1232c0d..a86bd63 100644 --- a/ldso/ldso/dl-hash.c +++ b/ldso/ldso/dl-hash.c @@ -272,7 +272,9 @@ char *_dl_find_hash(const char *name, struct dyn_elf *rpnt, struct elf_resolve * unsigned long elf_hash_number = 0xffffffff; const ElfW(Sym) *sym = NULL; +#if 0 char *weak_result = NULL; +#endif #ifdef __LDSO_GNU_HASH_SUPPORT__ unsigned long gnu_hash_number = _dl_gnu_hash((const unsigned char *)name); @@ -366,5 +368,9 @@ char *_dl_find_hash(const char *name, struct dyn_elf *rpnt, struct elf_resolve * if (sym_ref) sym_ref->tpnt = tpnt; #endif +#if 0 return weak_result; +#else + return NULL; +#endif } -- 1.7.3.4 From ps.m at gmx.net Mon Apr 11 11:27:03 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Mon, 11 Apr 2011 13:27:03 +0200 Subject: [git commit ldso-future] ldso: make _dl_strdup static Message-ID: <20110411142455.085B38254E@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=e820363b0f4cf837e79f2ad7587fe295f1eb2052 branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/ldso-future Signed-off-by: Peter S. Mazinger --- ldso/include/ldso.h | 1 - ldso/ldso/dl-elf.c | 2 +- ldso/ldso/ldso.c | 2 ++ 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/ldso/include/ldso.h b/ldso/include/ldso.h index e84e64d..61e8846 100644 --- a/ldso/include/ldso.h +++ b/ldso/include/ldso.h @@ -108,7 +108,6 @@ extern void *_dl_malloc(size_t size); extern void *_dl_calloc(size_t __nmemb, size_t __size); extern void *_dl_realloc(void *__ptr, size_t __size); extern void _dl_free(void *); -extern char *_dl_strdup(const char *string) attribute_hidden; extern void _dl_dprintf(int, const char *__restrict, ...) attribute_hidden; #else # include diff --git a/ldso/ldso/dl-elf.c b/ldso/ldso/dl-elf.c index 8832c1a..39c5044 100644 --- a/ldso/ldso/dl-elf.c +++ b/ldso/ldso/dl-elf.c @@ -1032,7 +1032,7 @@ void _dl_dprintf(int fd, const char *__restrict fmt, ...) return; } -char *_dl_strdup(const char *string) +static char *_dl_strdup(const char *string) { char *retval; int len; diff --git a/ldso/ldso/ldso.c b/ldso/ldso/ldso.c index b7c2a8a..eb439ef 100644 --- a/ldso/ldso/ldso.c +++ b/ldso/ldso/ldso.c @@ -108,6 +108,8 @@ uintptr_t __guard attribute_relro; # endif #endif +static __attribute_noinline__ char *_dl_strdup(const char *); + static char *_dl_getenv(const char *symbol, char **envp) { char *pnt; -- 1.7.3.4 From ps.m at gmx.net Mon Apr 11 11:27:03 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Mon, 11 Apr 2011 13:27:03 +0200 Subject: [git commit ldso-future] dl-syscall.h: _dl_getpid is needed only if SUPPORT_LD_DEBUG is defined Message-ID: <20110411142454.9CE238254E@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=893a79d30f6ee7f1c954c32e1c8af181f666f7f1 branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/ldso-future Signed-off-by: Peter S. Mazinger --- ldso/include/dl-syscall.h | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/ldso/include/dl-syscall.h b/ldso/include/dl-syscall.h index 1bef111..3888be0 100644 --- a/ldso/include/dl-syscall.h +++ b/ldso/include/dl-syscall.h @@ -89,7 +89,9 @@ static __always_inline _syscall2(int, _dl_munmap, void *, start, unsigned long, #include "../../libc/sysdeps/linux/common/geteuid.c" #include "../../libc/sysdeps/linux/common/getgid.c" #include "../../libc/sysdeps/linux/common/getegid.c" +#ifdef __SUPPORT_LD_DEBUG__ #include "../../libc/sysdeps/linux/common/getpid.c" +#endif #define __NR__dl_readlink __NR_readlink static __always_inline _syscall3(int, _dl_readlink, const char *, path, char *, buf, -- 1.7.3.4 From ps.m at gmx.net Mon Apr 11 11:27:03 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Mon, 11 Apr 2011 13:27:03 +0200 Subject: [git commit ldso-future] dl-syscall.h: remove unused _dl_readlink Message-ID: <20110411142454.CC8358254E@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=ff4036f9b34be03b3ebda1a14d2b1eea7a6cabdd branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/ldso-future Signed-off-by: Peter S. Mazinger --- ldso/include/dl-syscall.h | 4 ---- 1 files changed, 0 insertions(+), 4 deletions(-) diff --git a/ldso/include/dl-syscall.h b/ldso/include/dl-syscall.h index 3888be0..91c723d 100644 --- a/ldso/include/dl-syscall.h +++ b/ldso/include/dl-syscall.h @@ -93,10 +93,6 @@ static __always_inline _syscall2(int, _dl_munmap, void *, start, unsigned long, #include "../../libc/sysdeps/linux/common/getpid.c" #endif -#define __NR__dl_readlink __NR_readlink -static __always_inline _syscall3(int, _dl_readlink, const char *, path, char *, buf, - size_t, bufsiz) - #ifdef __UCLIBC_HAS_SSP__ # include # define __NR__dl_gettimeofday __NR_gettimeofday -- 1.7.3.4 From ps.m at gmx.net Mon Apr 11 11:27:03 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Mon, 11 Apr 2011 13:27:03 +0200 Subject: [git commit ldso-future] ldso.c: mark _dl_getenv noinline, size shrink Message-ID: <20110411142455.372C78254E@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=0a0361104efeca0332b1da8d5ac5678fa0dbc0ab branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/ldso-future Signed-off-by: Peter S. Mazinger --- ldso/ldso/ldso.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/ldso/ldso/ldso.c b/ldso/ldso/ldso.c index eb439ef..83902ff 100644 --- a/ldso/ldso/ldso.c +++ b/ldso/ldso/ldso.c @@ -110,7 +110,7 @@ uintptr_t __guard attribute_relro; static __attribute_noinline__ char *_dl_strdup(const char *); -static char *_dl_getenv(const char *symbol, char **envp) +static __attribute_noinline__ char *_dl_getenv(const char *symbol, char **envp) { char *pnt; const char *pnt1; -- 1.7.3.4 From ps.m at gmx.net Mon Apr 11 11:27:03 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Mon, 11 Apr 2011 13:27:03 +0200 Subject: [git commit ldso-future] ldso.c: move _dl_strdup and _dl_dprintf from dl-elf.c Message-ID: <20110411142455.97AB98254E@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=abd8ac564fb6ab661c91232388b54c2e518bd12d branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/ldso-future Signed-off-by: Peter S. Mazinger --- ldso/ldso/dl-elf.c | 105 ---------------------------------------------------- ldso/ldso/ldso.c | 105 ++++++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 102 insertions(+), 108 deletions(-) diff --git a/ldso/ldso/dl-elf.c b/ldso/ldso/dl-elf.c index 97fa9a3..8c0a954 100644 --- a/ldso/ldso/dl-elf.c +++ b/ldso/ldso/dl-elf.c @@ -939,111 +939,6 @@ int _dl_fixup(struct dyn_elf *rpnt, int now_flag) return goof; } -#ifdef IS_IN_rtld -/* Minimal printf which handles only %s, %d, and %x */ -static void _dl_dprintf(int fd, const char *__restrict fmt, ...) -{ -#if __WORDSIZE > 32 - long int num; -#else - int num; -#endif - va_list args; - char *start, *ptr, *string; - char *buf; - - if (!fmt) - return; - - buf = _dl_mmap((void *) 0, _dl_pagesize, PROT_READ | PROT_WRITE, - MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); - if (_dl_mmap_check_error(buf)) { - _dl_write(fd, "mmap of a spare page failed!\n", 29); - _dl_exit(20); - } - - start = ptr = buf; - - if (_dl_strlen(fmt) >= (_dl_pagesize - 1)) { - _dl_write(fd, "overflow\n", 11); - _dl_exit(20); - } - - _dl_strcpy(buf, fmt); - va_start(args, fmt); - - while (start) { - while (*ptr != '%' && *ptr) { - ptr++; - } - - if (*ptr == '%') { - *ptr++ = '\0'; - _dl_write(fd, start, _dl_strlen(start)); - - switch (*ptr++) { - case 's': - string = va_arg(args, char *); - - if (!string) - _dl_write(fd, "(null)", 6); - else - _dl_write(fd, string, _dl_strlen(string)); - break; - - case 'i': - case 'd': - { - char tmp[22]; -#if __WORDSIZE > 32 - num = va_arg(args, long int); -#else - num = va_arg(args, int); -#endif - string = _dl_simple_ltoa(tmp, num); - _dl_write(fd, string, _dl_strlen(string)); - break; - } - case 'x': - case 'p': - { - char tmp[22]; -#if __WORDSIZE > 32 - num = va_arg(args, long int); -#else - num = va_arg(args, int); -#endif - string = _dl_simple_ltoahex(tmp, num); - _dl_write(fd, string, _dl_strlen(string)); - break; - } - default: - _dl_write(fd, "(bad format)", 12); - break; - } - - start = ptr; - } else { - _dl_write(fd, start, _dl_strlen(start)); - start = NULL; - } - } - _dl_munmap(buf, _dl_pagesize); - return; -} - -static char *_dl_strdup(const char *string) -{ - char *retval; - int len; - - len = _dl_strlen(string); - retval = _dl_malloc(len + 1); - _dl_strcpy(retval, string); - return retval; -} -#endif - unsigned int _dl_parse_dynamic_info(ElfW(Dyn) *dpnt, ElfW(Word) dynamic_info[], void *debug_addr, DL_LOADADDR_TYPE load_off) { diff --git a/ldso/ldso/ldso.c b/ldso/ldso/ldso.c index dbade03..823e529 100644 --- a/ldso/ldso/ldso.c +++ b/ldso/ldso/ldso.c @@ -34,7 +34,108 @@ #include -static void _dl_dprintf(int, const char *__restrict, ...); +/* Minimal printf which handles only %s, %d, %x and %p */ +static void _dl_dprintf(int fd, const char *__restrict fmt, ...) +{ +#if __WORDSIZE > 32 + long int num; +#else + int num; +#endif + va_list args; + char *start, *ptr, *string; + char *buf; + + if (!fmt) + return; + + buf = _dl_mmap((void *) 0, _dl_pagesize, PROT_READ | PROT_WRITE, + MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); + if (_dl_mmap_check_error(buf)) { + _dl_write(fd, "mmap of a spare page failed!\n", 29); + _dl_exit(20); + } + + start = ptr = buf; + + if (_dl_strlen(fmt) >= (_dl_pagesize - 1)) { + _dl_write(fd, "overflow\n", 11); + _dl_exit(20); + } + + _dl_strcpy(buf, fmt); + va_start(args, fmt); + + while (start) { + while (*ptr != '%' && *ptr) { + ptr++; + } + + if (*ptr == '%') { + *ptr++ = '\0'; + _dl_write(fd, start, _dl_strlen(start)); + + switch (*ptr++) { + case 's': + string = va_arg(args, char *); + + if (!string) + _dl_write(fd, "(null)", 6); + else + _dl_write(fd, string, _dl_strlen(string)); + break; + + case 'i': + case 'd': + { + char tmp[22]; +#if __WORDSIZE > 32 + num = va_arg(args, long int); +#else + num = va_arg(args, int); +#endif + string = _dl_simple_ltoa(tmp, num); + _dl_write(fd, string, _dl_strlen(string)); + break; + } + case 'x': + case 'p': + { + char tmp[22]; +#if __WORDSIZE > 32 + num = va_arg(args, long int); +#else + num = va_arg(args, int); +#endif + string = _dl_simple_ltoahex(tmp, num); + _dl_write(fd, string, _dl_strlen(string)); + break; + } + default: + _dl_write(fd, "(bad format)", 12); + break; + } + + start = ptr; + } else { + _dl_write(fd, start, _dl_strlen(start)); + start = NULL; + } + } + _dl_munmap(buf, _dl_pagesize); + return; +} + +static __attribute_noinline__ char *_dl_strdup(const char *string) +{ + char *retval; + int len; + + len = _dl_strlen(string); + retval = _dl_malloc(len + 1); + _dl_strcpy(retval, string); + return retval; +} /* Pull in common debug code */ #include "dl-debug.c" @@ -110,8 +211,6 @@ uintptr_t __guard attribute_relro; # endif #endif -static __attribute_noinline__ char *_dl_strdup(const char *); - static __attribute_noinline__ char *_dl_getenv(const char *symbol, char **envp) { char *pnt; -- 1.7.3.4 From ps.m at gmx.net Mon Apr 11 11:27:03 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Mon, 11 Apr 2011 13:27:03 +0200 Subject: [git commit ldso-future] i386/dl-sysdep.h: remove unneeded prototypes Message-ID: <20110411142455.CBA388254E@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=67a803cddd0f1c6b4f05a9dc2b61102517978608 branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/ldso-future Signed-off-by: Peter S. Mazinger --- ldso/ldso/i386/dl-sysdep.h | 6 ++---- 1 files changed, 2 insertions(+), 4 deletions(-) diff --git a/ldso/ldso/i386/dl-sysdep.h b/ldso/ldso/i386/dl-sysdep.h index b91bd61..a38760c 100644 --- a/ldso/ldso/i386/dl-sysdep.h +++ b/ldso/ldso/i386/dl-sysdep.h @@ -41,8 +41,7 @@ do { \ /* Return the link-time address of _DYNAMIC. Conveniently, this is the first element of the GOT. This must be inlined in a function which uses global data. */ -static __always_inline Elf32_Addr elf_machine_dynamic (void) attribute_unused; -static __always_inline Elf32_Addr +static __always_inline Elf32_Addr attribute_unused elf_machine_dynamic (void) { register Elf32_Addr *got __asm__ ("%ebx"); @@ -51,8 +50,7 @@ elf_machine_dynamic (void) /* Return the run-time load address of the shared object. */ -static __always_inline Elf32_Addr elf_machine_load_address (void) attribute_unused; -static __always_inline Elf32_Addr +static __always_inline Elf32_Addr attribute_unused elf_machine_load_address (void) { /* It doesn't matter what variable this is, the reference never makes -- 1.7.3.4 From ps.m at gmx.net Mon Apr 11 11:27:03 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Mon, 11 Apr 2011 13:27:03 +0200 Subject: [git commit ldso-future] libdl.c: do not read LD_LIBRARY_PATH unconditionally Message-ID: <20110411142456.023958254E@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=0ededcae1c3c793e07e5aa61160963cac37cdd55 branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/ldso-future Signed-off-by: Peter S. Mazinger --- ldso/libdl/libdl.c | 18 +++++++++++++----- 1 files changed, 13 insertions(+), 5 deletions(-) diff --git a/ldso/libdl/libdl.c b/ldso/libdl/libdl.c index 4a74f07..6a58ce8 100644 --- a/ldso/libdl/libdl.c +++ b/ldso/libdl/libdl.c @@ -36,6 +36,7 @@ #include #ifndef SHARED +#include /* When libdl is linked as a static library, we need to replace all * the symbols that otherwise would have been loaded in from ldso... */ @@ -273,6 +274,18 @@ void *dlopen(const char *libname, int flag) _dl_map_cache(); +#ifndef SHARED + /* When statically linked, the _dl_library_path is not yet initialized */ + { + static smallint _dl_library_path_set = 0; + if (!_dl_library_path_set) { + _dl_library_path_set = 1; + if (getuid() == geteuid() && getgid() == getegid()) + _dl_library_path = getenv("LD_LIBRARY_PATH"); + } + } +#endif + /* * Try and locate the module we were called from - we * need this so that we get the correct RPATH/RUNPATH. Note that @@ -298,11 +311,6 @@ void *dlopen(const char *libname, int flag) if (getenv("LD_BIND_NOW")) now_flag = RTLD_NOW; -#ifndef SHARED - /* When statically linked, the _dl_library_path is not yet initialized */ - _dl_library_path = getenv("LD_LIBRARY_PATH"); -#endif - /* Try to load the specified library */ _dl_if_debug_print("Trying to dlopen '%s', RTLD_GLOBAL:%d RTLD_NOW:%d\n", (char*)libname, (flag & RTLD_GLOBAL ? 1:0), (now_flag & RTLD_NOW ? 1:0)); -- 1.7.3.4 From ps.m at gmx.net Mon Apr 11 11:27:03 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Mon, 11 Apr 2011 13:27:03 +0200 Subject: [git commit ldso-future] i386/dl-sysdep.h: add newer code from glibc, requires hidden support Message-ID: <20110411142456.6103F8254E@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=7de778389d0040be4a21ffc326310e0eb361570a branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/ldso-future Signed-off-by: Peter S. Mazinger --- ldso/ldso/i386/dl-sysdep.h | 26 ++++++++++++++++++++++++++ 1 files changed, 26 insertions(+), 0 deletions(-) diff --git a/ldso/ldso/i386/dl-sysdep.h b/ldso/ldso/i386/dl-sysdep.h index a38760c..f52d813 100644 --- a/ldso/ldso/i386/dl-sysdep.h +++ b/ldso/ldso/i386/dl-sysdep.h @@ -38,6 +38,31 @@ do { \ || (type) == R_386_TLS_TPOFF) * ELF_RTYPE_CLASS_PLT) \ | (((type) == R_386_COPY) * ELF_RTYPE_CLASS_COPY)) +#if 1 /* this code needs .hidden support */ +/* Return the link-time address of _DYNAMIC. Conveniently, this is the + first element of the GOT, a special entry that is never relocated. */ +extern const Elf32_Addr _GLOBAL_OFFSET_TABLE_[] attribute_hidden; +static __always_inline Elf32_Addr __attribute__ ((unused, const)) +elf_machine_dynamic (void) +{ + /* This produces a GOTOFF reloc that resolves to zero at link time, so in + fact just loads from the GOT register directly. By doing it without + an asm we can let the compiler choose any register. */ + return _GLOBAL_OFFSET_TABLE_[0]; +} + + +extern Elf32_Dyn bygotoff[] __asm__ ("_DYNAMIC") attribute_hidden; +/* Return the run-time load address of the shared object. */ +static __always_inline Elf32_Addr attribute_unused +elf_machine_load_address (void) +{ + /* Compute the difference between the runtime address of _DYNAMIC as seen + by a GOTOFF reference, and the link-time address found in the special + unrelocated first GOT entry. */ + return (Elf32_Addr) &bygotoff - elf_machine_dynamic (); +} +#else /* Return the link-time address of _DYNAMIC. Conveniently, this is the first element of the GOT. This must be inlined in a function which uses global data. */ @@ -63,6 +88,7 @@ elf_machine_load_address (void) : "=r" (addr) : "m" (tmp) : "cc"); return addr; } +#endif static __always_inline void elf_machine_relative (Elf32_Addr load_off, const Elf32_Addr rel_addr, -- 1.7.3.4 From ps.m at gmx.net Mon Apr 11 11:27:03 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Mon, 11 Apr 2011 13:27:03 +0200 Subject: [git commit ldso-future] no need to SSP compile libresolv/libnsl dummies Message-ID: <20110411142456.2D6038254E@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=55061e87b7e016a0d00da11bf655021eba4e4377 branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/ldso-future Fails to compile if binutils is patched to default to as_needed, since libc.so will be eliminated and __stack_chk_guard() will be missing. Signed-off-by: Peter S. Mazinger --- libnsl/Makefile.in | 2 +- libresolv/Makefile.in | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/libnsl/Makefile.in b/libnsl/Makefile.in index 333c490..760be96 100644 --- a/libnsl/Makefile.in +++ b/libnsl/Makefile.in @@ -7,7 +7,7 @@ subdirs += libnsl -CFLAGS-libnsl := -DNOT_IN_libc -DIS_IN_libnsl $(SSP_ALL_CFLAGS) +CFLAGS-libnsl := -DNOT_IN_libc -DIS_IN_libnsl #$(SSP_ALL_CFLAGS) LDFLAGS-$(UCLIBC_FORMAT_DSBT_ELF)-libnsl.so := -Wl,--dsbt-index=6 LDFLAGS-libnsl.so := $(LDFLAGS) $(call link.asneeded,-lc) diff --git a/libresolv/Makefile.in b/libresolv/Makefile.in index fa3c341..c0f1a6d 100644 --- a/libresolv/Makefile.in +++ b/libresolv/Makefile.in @@ -7,7 +7,7 @@ subdirs += libresolv -CFLAGS-libresolv := -DNOT_IN_libc -DIS_IN_libresolv $(SSP_ALL_CFLAGS) +CFLAGS-libresolv := -DNOT_IN_libc -DIS_IN_libresolv #$(SSP_ALL_CFLAGS) LDFLAGS-$(UCLIBC_FORMAT_DSBT_ELF)-libresolv.so := -Wl,--dsbt-index=7 LDFLAGS-libresolv.so := $(LDFLAGS) $(call link.asneeded,-lc) -- 1.7.3.4 From ps.m at gmx.net Mon Apr 11 11:27:03 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Mon, 11 Apr 2011 13:27:03 +0200 Subject: [git commit ldso-future] ldso/libdl: include ldso.h only in ldso.c and libdl.c Message-ID: <20110411142456.C8D7A8254E@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=4e6699981c75b58297216cbfad65843f1f0daa3f branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/ldso-future Replace ldso.h everywhere else with ldsodefs.h Signed-off-by: Peter S. Mazinger --- ldso/include/ldso.h | 9 +-------- ldso/include/ldsodefs.h | 1 + ldso/ldso/arm/elfinterp.c | 2 +- ldso/ldso/cris/elfinterp.c | 2 +- ldso/ldso/dl-debug.c | 3 ++- ldso/ldso/dl-elf.c | 2 +- ldso/ldso/dl-hash.c | 2 +- ldso/ldso/dl-startup.c | 2 +- ldso/ldso/dl-tls.c | 2 +- ldso/ldso/elfinterp_common.c | 2 +- ldso/ldso/i386/elfinterp.c | 2 +- ldso/ldso/ldso.c | 1 + ldso/ldso/m68k/elfinterp.c | 2 +- ldso/ldso/mips/elfinterp.c | 2 +- ldso/ldso/powerpc/elfinterp.c | 2 +- ldso/ldso/sh/elfinterp.c | 2 +- ldso/ldso/sh64/elfinterp.c | 2 +- ldso/ldso/x86_64/elfinterp.c | 2 +- ldso/ldso/xtensa/elfinterp.c | 2 +- ldso/libdl/libdl.c | 4 ++-- 20 files changed, 22 insertions(+), 26 deletions(-) diff --git a/ldso/include/ldso.h b/ldso/include/ldso.h index 201db68..077ca2d 100644 --- a/ldso/include/ldso.h +++ b/ldso/include/ldso.h @@ -21,18 +21,16 @@ /* Pull in the arch specific page size */ #include -#include - #ifndef __ARCH_HAS_NO_SHARED__ #include +#include #include #include #include #include #ifdef __UCLIBC_HAS_TLS__ # include -# include #endif /* common align masks, if not specified by dl-sysdep.h */ @@ -59,7 +57,6 @@ extern void ** __attribute__ ((const)) _dl_initial_error_catch_tsd (void); #endif #ifdef __SUPPORT_LD_DEBUG__ -extern char *_dl_debug; # define __dl_debug_dprint(fmt, args...) \ _dl_dprintf(_dl_debug_file, "%s:%i: " fmt, __FUNCTION__, __LINE__, ## args); # define _dl_if_debug_dprint(fmt, args...) \ @@ -98,10 +95,6 @@ extern char *_dl_debug; # define _dl_debug_early(fmt, args...) do {} while (0) #endif /* __SUPPORT_LD_DEBUG_EARLY__ */ -#ifndef NULL -#define NULL ((void *) 0) -#endif - #ifdef IS_IN_rtld extern void *_dl_malloc(size_t size); extern void *_dl_calloc(size_t __nmemb, size_t __size); diff --git a/ldso/include/ldsodefs.h b/ldso/include/ldsodefs.h index 6454dd4..e2b517c 100644 --- a/ldso/include/ldsodefs.h +++ b/ldso/include/ldsodefs.h @@ -186,6 +186,7 @@ extern void *__libc_stack_end attribute_relro; #ifdef SHARED extern unsigned long _dl_error_number; +extern char *_dl_debug; extern struct r_debug *_dl_debug_addr; extern void *(*_dl_malloc_function)(size_t); extern void (*_dl_free_function) (void *p); diff --git a/ldso/ldso/arm/elfinterp.c b/ldso/ldso/arm/elfinterp.c index 630ecbe..9d04798 100644 --- a/ldso/ldso/arm/elfinterp.c +++ b/ldso/ldso/arm/elfinterp.c @@ -38,7 +38,7 @@ a more than adequate job of explaining everything required to get this working. */ -#include +#include #if 0 static unsigned long diff --git a/ldso/ldso/cris/elfinterp.c b/ldso/ldso/cris/elfinterp.c index a616273..3b87cb2 100644 --- a/ldso/ldso/cris/elfinterp.c +++ b/ldso/ldso/cris/elfinterp.c @@ -33,7 +33,7 @@ * SUCH DAMAGE. */ -#include +#include static int _dl_do_reloc(struct elf_resolve *tpnt, struct dyn_elf *scope, diff --git a/ldso/ldso/dl-debug.c b/ldso/ldso/dl-debug.c index 19f3eef..95ab90e 100644 --- a/ldso/ldso/dl-debug.c +++ b/ldso/ldso/dl-debug.c @@ -37,10 +37,11 @@ * SUCH DAMAGE. */ -#include +#include #ifdef __SUPPORT_LD_DEBUG__ +#include /* include the arch-specific _dl_reltypes_tab */ #include diff --git a/ldso/ldso/dl-elf.c b/ldso/ldso/dl-elf.c index 8c0a954..c48632d 100644 --- a/ldso/ldso/dl-elf.c +++ b/ldso/ldso/dl-elf.c @@ -29,7 +29,7 @@ * SUCH DAMAGE. */ -#include +#include static struct elf_resolve * _dl_load_elf_shared_library(int secure, struct dyn_elf **rpnt, char *libname); diff --git a/ldso/ldso/dl-hash.c b/ldso/ldso/dl-hash.c index a86bd63..8a31eb8 100644 --- a/ldso/ldso/dl-hash.c +++ b/ldso/ldso/dl-hash.c @@ -30,7 +30,7 @@ * SUCH DAMAGE. */ -#include +#include /* Various symbol table handling functions, including symbol lookup */ /* diff --git a/ldso/ldso/dl-startup.c b/ldso/ldso/dl-startup.c index 17629b5..d012716 100644 --- a/ldso/ldso/dl-startup.c +++ b/ldso/ldso/dl-startup.c @@ -89,7 +89,7 @@ * the user's application. */ -#include +#include /* Needed for standalone execution */ static __attribute_used__ unsigned long _dl_skip_args = 0; diff --git a/ldso/ldso/dl-tls.c b/ldso/ldso/dl-tls.c index b4a466d..2917702 100644 --- a/ldso/ldso/dl-tls.c +++ b/ldso/ldso/dl-tls.c @@ -28,7 +28,7 @@ #include #include -#include +#include void *(*_dl_calloc_function) (size_t __nmemb, size_t __size) = NULL; void *(*_dl_realloc_function) (void *__ptr, size_t __size) = NULL; diff --git a/ldso/ldso/elfinterp_common.c b/ldso/ldso/elfinterp_common.c index a9f4092..5720a90 100644 --- a/ldso/ldso/elfinterp_common.c +++ b/ldso/ldso/elfinterp_common.c @@ -1,7 +1,7 @@ /* vi: set sw=4 ts=4: */ /* Licensed under the LGPL v2.1, see the file LICENSE in this tarball. */ -#include +#include /* * dynamic_info is of type ElfW(Word) diff --git a/ldso/ldso/i386/elfinterp.c b/ldso/ldso/i386/elfinterp.c index b1667f1..1e73707 100644 --- a/ldso/ldso/i386/elfinterp.c +++ b/ldso/ldso/i386/elfinterp.c @@ -40,7 +40,7 @@ a more than adequate job of explaining everything required to get this working. */ -#include +#include static int _dl_do_reloc(struct elf_resolve *tpnt, struct dyn_elf *scope, diff --git a/ldso/ldso/ldso.c b/ldso/ldso/ldso.c index 823e529..6a6e78a 100644 --- a/ldso/ldso/ldso.c +++ b/ldso/ldso/ldso.c @@ -30,6 +30,7 @@ * SUCH DAMAGE. */ +#include #include #include diff --git a/ldso/ldso/m68k/elfinterp.c b/ldso/ldso/m68k/elfinterp.c index 3295fd0..42b04ff 100644 --- a/ldso/ldso/m68k/elfinterp.c +++ b/ldso/ldso/m68k/elfinterp.c @@ -40,7 +40,7 @@ a more than adequate job of explaining everything required to get this working. */ -#include +#include static int _dl_do_reloc(struct elf_resolve *tpnt, struct dyn_elf *scope, ELF_RELOC *rpnt, const ElfW(Sym) *const symtab, const char *strtab) diff --git a/ldso/ldso/mips/elfinterp.c b/ldso/ldso/mips/elfinterp.c index fd41c44..3459703 100644 --- a/ldso/ldso/mips/elfinterp.c +++ b/ldso/ldso/mips/elfinterp.c @@ -27,7 +27,7 @@ * SUCH DAMAGE. */ -#include +#include #define OFFSET_GP_GOT 0x7ff0 diff --git a/ldso/ldso/powerpc/elfinterp.c b/ldso/ldso/powerpc/elfinterp.c index b96ce36..05258b3 100644 --- a/ldso/ldso/powerpc/elfinterp.c +++ b/ldso/ldso/powerpc/elfinterp.c @@ -29,7 +29,7 @@ * SUCH DAMAGE. */ -#include +#include #define TLS_DTV_OFFSET 0x8000 #define TLS_TP_OFFSET 0x7000 diff --git a/ldso/ldso/sh/elfinterp.c b/ldso/ldso/sh/elfinterp.c index 0c57bde..d7ee12b 100644 --- a/ldso/ldso/sh/elfinterp.c +++ b/ldso/ldso/sh/elfinterp.c @@ -39,7 +39,7 @@ a more than adequate job of explaining everything required to get this working. */ -#include +#include static int _dl_do_reloc(struct elf_resolve *tpnt, struct dyn_elf *scope, diff --git a/ldso/ldso/sh64/elfinterp.c b/ldso/ldso/sh64/elfinterp.c index fe7b3c4..d3c475c 100644 --- a/ldso/ldso/sh64/elfinterp.c +++ b/ldso/ldso/sh64/elfinterp.c @@ -41,7 +41,7 @@ a more than adequate job of explaining everything required to get this working. */ -#include +#include static int _dl_do_reloc(struct elf_resolve *tpnt, struct dyn_elf *scope, ELF_RELOC *rpnt, const ElfW(Sym) *const symtab, const char *strtab) diff --git a/ldso/ldso/x86_64/elfinterp.c b/ldso/ldso/x86_64/elfinterp.c index 13357bb..c95c6f6 100644 --- a/ldso/ldso/x86_64/elfinterp.c +++ b/ldso/ldso/x86_64/elfinterp.c @@ -40,7 +40,7 @@ a more than adequate job of explaining everything required to get this working. */ -#include +#include static int _dl_do_reloc(struct elf_resolve *tpnt, struct dyn_elf *scope, diff --git a/ldso/ldso/xtensa/elfinterp.c b/ldso/ldso/xtensa/elfinterp.c index 27b259c..d3183ee 100644 --- a/ldso/ldso/xtensa/elfinterp.c +++ b/ldso/ldso/xtensa/elfinterp.c @@ -30,7 +30,7 @@ * SUCH DAMAGE. */ -#include +#include static int _dl_do_reloc(struct elf_resolve *tpnt, struct dyn_elf *scope, diff --git a/ldso/libdl/libdl.c b/ldso/libdl/libdl.c index 6a58ce8..d7a969a 100644 --- a/ldso/libdl/libdl.c +++ b/ldso/libdl/libdl.c @@ -29,11 +29,11 @@ * SUCH DAMAGE. */ - -#include #include #include #include +#include +#include #ifndef SHARED #include -- 1.7.3.4 From ps.m at gmx.net Mon Apr 11 11:27:03 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Mon, 11 Apr 2011 13:27:03 +0200 Subject: [git commit ldso-future] dl-debug.h: guard TLS relocations Message-ID: <20110411142453.AC98B8254E@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=ad688a0be9360850b5c1552fb135a4d335e2655c branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/ldso-future Signed-off-by: Peter S. Mazinger --- ldso/ldso/arm/dl-debug.h | 4 ++++ ldso/ldso/sh/dl-debug.h | 4 ++++ ldso/ldso/x86_64/dl-debug.h | 4 ++++ 3 files changed, 12 insertions(+), 0 deletions(-) diff --git a/ldso/ldso/arm/dl-debug.h b/ldso/ldso/arm/dl-debug.h index 1bca6ff..48aa6fc 100644 --- a/ldso/ldso/arm/dl-debug.h +++ b/ldso/ldso/arm/dl-debug.h @@ -27,6 +27,8 @@ * SUCH DAMAGE. */ +#include + static const char *_dl_reltypes_tab[] = { [0] "R_ARM_NONE", "R_ARM_PC24", "R_ARM_ABS32", "R_ARM_REL32", @@ -39,8 +41,10 @@ static const char *_dl_reltypes_tab[] = [32] "R_ARM_ALU_PCREL_7_0","R_ARM_ALU_PCREL_15_8","R_ARM_ALU_PCREL_23_15","R_ARM_LDR_SBREL_11_0", [36] "R_ARM_ALU_SBREL_19_12","R_ARM_ALU_SBREL_27_20", [100] "R_ARM_GNU_VTENTRY","R_ARM_GNU_VTINHERIT","R_ARM_THM_PC11","R_ARM_THM_PC9", +#ifdef __UCLIBC_HAS_TLS__ [104] "R_ARM_TLS_GD32","R_ARM_TLS_LDM32","R_ARM_TLS_LDO32","R_ARM_TLS_IE32", [108] "R_ARM_TLS_LE32","R_ARM_TLS_LDO12","R_ARM_TLS_LE12","R_ARM_TLS_IE12GP", +#endif [249] "R_ARM_RXPC25", "R_ARM_RSBREL32", "R_ARM_THM_RPC22", "R_ARM_RREL32", [253] "R_ARM_RABS22", "R_ARM_RPC24", "R_ARM_RBASE", }; diff --git a/ldso/ldso/sh/dl-debug.h b/ldso/ldso/sh/dl-debug.h index e2e74f8..f6e2191 100644 --- a/ldso/ldso/sh/dl-debug.h +++ b/ldso/ldso/sh/dl-debug.h @@ -28,6 +28,8 @@ * SUCH DAMAGE. */ +#include + static const char *_dl_reltypes_tab[] = { [0] "R_SH_NONE", "R_SH_DIR32", "R_SH_REL32", "R_SH_DIR8WPN", @@ -36,8 +38,10 @@ static const char *_dl_reltypes_tab[] = [25] "R_SH_SWITCH16","R_SH_SWITCH32","R_SH_USES", [28] "R_SH_COUNT", "R_SH_ALIGN", "R_SH_CODE", "R_SH_DATA", [32] "R_SH_LABEL", "R_SH_SWITCH8", "R_SH_GNU_VTINHERIT","R_SH_GNU_VTENTRY", +#ifdef __UCLIBC_HAS_TLS__ [144] "R_SH_TLS_GD_32","R_SH_TLS_LD_32", "R_SH_TLS_LDO_32", "R_SH_TLS_IE_32", [148] "R_SH_TLS_LE_32","R_SH_TLS_DTPMOD32", "R_SH_TLS_DTPOFF32", "R_SH_TLS_TPOFF32", +#endif [160] "R_SH_GOT32", "R_SH_PLT32", "R_SH_COPY", "R_SH_GLOB_DAT", [164] "R_SH_JMP_SLOT","R_SH_RELATIVE","R_SH_GOTOFF", "R_SH_GOTPC", }; diff --git a/ldso/ldso/x86_64/dl-debug.h b/ldso/ldso/x86_64/dl-debug.h index d605a03..2cadc47 100644 --- a/ldso/ldso/x86_64/dl-debug.h +++ b/ldso/ldso/x86_64/dl-debug.h @@ -29,11 +29,15 @@ * SUCH DAMAGE. */ +#include + static const char *_dl_reltypes_tab[] = { [ 0] "R_X86_64_NONE", "R_X86_64_64", "R_X86_64_PC32", "R_X86_64_GOT32", [ 4] "R_X86_64_PLT32", "R_X86_64_COPY", "R_X86_64_GLOB_DAT", "R_X86_64_JUMP_SLOT", [ 8] "R_X86_64_RELATIVE", "R_X86_64_GOTPCREL", "R_X86_64_32", "R_X86_64_32S", [12] "R_X86_64_16", "R_X86_64_PC16", "R_X86_64_8", "R_X86_64_PC8", +#ifdef __UCLIBC_HAS_TLS__ [16] "R_X86_64_DTPMOD64", "R_X86_64_DTPOFF64", "R_X86_64_TPOFF64", "R_X86_64_TLSGD", [20] "R_X86_64_TLSLD", "R_X86_64_DTPOFF32", "R_X86_64_GOTTPOFF", "R_X86_64_TPOFF32" +#endif }; -- 1.7.3.4 From ps.m at gmx.net Mon Apr 11 11:27:03 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Mon, 11 Apr 2011 13:27:03 +0200 Subject: [git commit ldso-future] ldsodefs.h: move all structure and function prototypes from dl-elf.h and dl-hash.h Message-ID: <20110411142456.92D4F8254E@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=aa10066065d79aff4a364be8df0a7a79008ca650 branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/ldso-future non-ldso files should include only this file. Signed-off-by: Peter S. Mazinger --- ldso/include/dl-elf.h | 34 +-------- ldso/include/dl-hash.h | 136 ------------------------------- ldso/include/ldso.h | 3 +- ldso/include/ldsodefs.h | 170 ++++++++++++++++++++++++++++++++++++++- ldso/ldso/dl-array.c | 2 +- ldso/ldso/dl-symbols.c | 4 +- libc/misc/elf/dl-iterate-phdr.c | 8 +- 7 files changed, 177 insertions(+), 180 deletions(-) diff --git a/ldso/include/dl-elf.h b/ldso/include/dl-elf.h index 0103d3d..41a5997 100644 --- a/ldso/include/dl-elf.h +++ b/ldso/include/dl-elf.h @@ -13,26 +13,7 @@ #include #include -#include - -/* Forward declarations for stuff defined in dl-hash.h */ -struct dyn_elf; -struct elf_resolve; - -#ifdef __LDSO_CACHE_SUPPORT__ -extern int _dl_map_cache(void); -extern int _dl_unmap_cache(void); -#else -static __inline__ void _dl_map_cache(void) { } -static __inline__ void _dl_unmap_cache(void) { } -#endif - -/* Function prototypes for non-static stuff in dl-elf.c and elfinterp.c */ -extern struct elf_resolve * _dl_load_shared_library(int secure, - struct dyn_elf **rpnt, struct elf_resolve *tpnt, char *full_libname, - int trace_loaded_objects); -extern int _dl_fixup(struct dyn_elf *rpnt, int flag); -extern void _dl_protect_relro (struct elf_resolve *l) internal_function; +#include /* * Bitsize related settings for things ElfW() @@ -75,19 +56,6 @@ extern void _dl_protect_relro (struct elf_resolve *l) internal_function; # define UNSUPPORTED_RELOC_STR "RELA" #endif -/* OS and/or GNU dynamic extensions */ -#ifdef __LDSO_GNU_HASH_SUPPORT__ -# define OS_NUM 2 /* for DT_RELOCCOUNT and DT_GNU_HASH entries */ -#else -# define OS_NUM 1 /* for DT_RELOCCOUNT entry */ -#endif - -#ifndef ARCH_DYNAMIC_INFO - /* define in arch specific code, if needed */ -# define ARCH_NUM 0 -#endif - -#define DYNAMIC_SIZE (DT_NUM+OS_NUM+ARCH_NUM) /* Keep ARCH specific entries into dynamic section at the end of the array */ #define DT_RELCONT_IDX (DYNAMIC_SIZE - OS_NUM - ARCH_NUM) diff --git a/ldso/include/dl-hash.h b/ldso/include/dl-hash.h index 3e25692..c2cc50e 100644 --- a/ldso/include/dl-hash.h +++ b/ldso/include/dl-hash.h @@ -8,153 +8,17 @@ #ifndef _DL_HASH_H #define _DL_HASH_H -#include - -#include -#include - #include #ifndef RTLD_NEXT #define RTLD_NEXT ((void*)-1) #endif -#include /* DYNAMIC_SIZE */ - -struct init_fini { - struct elf_resolve **init_fini; - unsigned long nlist; /* Number of entries in init_fini */ -}; - -/* For INIT/FINI dependency sorting. */ -struct init_fini_list { - struct init_fini_list *next; - struct elf_resolve *tpnt; -}; - -struct dyn_elf { - struct elf_resolve * dyn; - struct dyn_elf * next_handle; /* Used by dlopen et al. */ - struct init_fini init_fini; - struct dyn_elf * next; - struct dyn_elf * prev; -}; - -struct symbol_ref { - const ElfW(Sym) *sym; - struct elf_resolve *tpnt; -}; - -struct elf_resolve { - /* These entries must be in this order to be compatible with the interface used - by gdb to obtain the list of symbols. */ - DL_LOADADDR_TYPE loadaddr; /* Base address shared object is loaded at. */ - char *libname; /* Absolute file name object was found in. */ - ElfW(Dyn) *dynamic_addr; /* Dynamic section of the shared object. */ - struct elf_resolve * next; - struct elf_resolve * prev; - /* Nothing after this address is used by gdb. */ - -#ifdef __UCLIBC_HAS_TLS__ - /* Thread-local storage related info. */ - - /* Start of the initialization image. */ - void *l_tls_initimage; - /* Size of the initialization image. */ - size_t l_tls_initimage_size; - /* Size of the TLS block. */ - size_t l_tls_blocksize; - /* Alignment requirement of the TLS block. */ - size_t l_tls_align; - /* Offset of first byte module alignment. */ - size_t l_tls_firstbyte_offset; -# ifndef NO_TLS_OFFSET -# define NO_TLS_OFFSET 0 -# endif - /* For objects present at startup time: offset in the static TLS block. */ - ptrdiff_t l_tls_offset; - /* Index of the module in the dtv array. */ - size_t l_tls_modid; - /* Nonzero if _dl_init_static_tls should be called for this module */ - unsigned int l_need_tls_init:1; -#endif - - ElfW(Addr) mapaddr; - enum {elf_lib, elf_executable,program_interpreter, loaded_file} libtype; - struct dyn_elf * symbol_scope; - unsigned short usage_count; - unsigned short int init_flag; - unsigned long rtld_flags; /* RTLD_GLOBAL, RTLD_NOW etc. */ - Elf_Symndx nbucket; - -#ifdef __LDSO_GNU_HASH_SUPPORT__ - /* Data needed to support GNU hash style */ - Elf32_Word l_gnu_bitmask_idxbits; - Elf32_Word l_gnu_shift; - const ElfW(Addr) *l_gnu_bitmask; - - union - { - const Elf32_Word *l_gnu_chain_zero; - const Elf_Symndx *elf_buckets; - }; -#else - Elf_Symndx *elf_buckets; -#endif - - struct init_fini_list *init_fini; - struct init_fini_list *rtld_local; /* keep tack of RTLD_LOCAL libs in same group */ - /* - * These are only used with ELF style shared libraries - */ - Elf_Symndx nchain; - -#ifdef __LDSO_GNU_HASH_SUPPORT__ - union - { - const Elf32_Word *l_gnu_buckets; - const Elf_Symndx *chains; - }; -#else - Elf_Symndx *chains; -#endif - ElfW(Word) dynamic_info[DYNAMIC_SIZE]; - - unsigned long n_phent; - ElfW(Phdr) * ppnt; - - ElfW(Addr) relro_addr; - size_t relro_size; - - dev_t st_dev; /* device */ - ino_t st_ino; /* inode */ - -#ifdef __powerpc__ - /* this is used to store the address of relocation data words, so - * we don't have to calculate it every time, which requires a divide */ - unsigned long data_words; -#endif - -#ifdef __FDPIC__ - /* Every loaded module holds a hashtable of function descriptors of - functions defined in it, such that it's easy to release the - memory when the module is dlclose()d. */ - struct funcdesc_ht *funcdesc_ht; -#endif -}; - #define RELOCS_DONE 0x000001 #define JMP_RELOCS_DONE 0x000002 #define INIT_FUNCS_CALLED 0x000004 #define FINI_FUNCS_CALLED 0x000008 #define DL_OPENED 0x000010 -extern struct dyn_elf * _dl_symbol_tables; -extern struct elf_resolve * _dl_loaded_modules; - -extern char *_dl_find_hash(const char *name, struct dyn_elf *rpnt, - struct elf_resolve *mytpnt, int type_class, - struct symbol_ref *symbol); - #define LD_ERROR_NOFILE 1 #define LD_ERROR_NOZERO 2 #define LD_ERROR_NOTELF 3 diff --git a/ldso/include/ldso.h b/ldso/include/ldso.h index 9a2fc74..201db68 100644 --- a/ldso/include/ldso.h +++ b/ldso/include/ldso.h @@ -21,7 +21,7 @@ /* Pull in the arch specific page size */ #include -#include +#include #ifndef __ARCH_HAS_NO_SHARED__ #include @@ -34,7 +34,6 @@ # include # include #endif -#include /* common align masks, if not specified by dl-sysdep.h */ #ifndef ADDR_ALIGN diff --git a/ldso/include/ldsodefs.h b/ldso/include/ldsodefs.h index ebfee72..6454dd4 100644 --- a/ldso/include/ldsodefs.h +++ b/ldso/include/ldsodefs.h @@ -1,14 +1,154 @@ #ifndef _LDSODEFS_H -#define _LDSODEFS_H 1 - -#include +#define _LDSODEFS_H #include #include +#include +#include +#include + +#include #ifdef __UCLIBC_HAS_TLS__ -#include +# include +#endif + +/* OS and/or GNU dynamic extensions */ +#ifdef __LDSO_GNU_HASH_SUPPORT__ +# define OS_NUM 2 /* for DT_RELOCCOUNT and DT_GNU_HASH entries */ +#else +# define OS_NUM 1 /* for DT_RELOCCOUNT entry */ +#endif + +#ifndef ARCH_DYNAMIC_INFO + /* define in arch specific code, if needed */ +# define ARCH_NUM 0 #endif +#define DYNAMIC_SIZE (DT_NUM+OS_NUM+ARCH_NUM) + +struct elf_resolve; +struct init_fini { + struct elf_resolve **init_fini; + unsigned long nlist; /* Number of entries in init_fini */ +}; + +/* For INIT/FINI dependency sorting. */ +struct init_fini_list { + struct init_fini_list *next; + struct elf_resolve *tpnt; +}; + +struct dyn_elf { + struct elf_resolve * dyn; + struct dyn_elf * next_handle; /* Used by dlopen et al. */ + struct init_fini init_fini; + struct dyn_elf * next; + struct dyn_elf * prev; +}; + +struct symbol_ref { + const ElfW(Sym) *sym; + struct elf_resolve *tpnt; +}; + +struct elf_resolve { + /* These entries must be in this order to be compatible with the interface used + by gdb to obtain the list of symbols. */ + DL_LOADADDR_TYPE loadaddr; /* Base address shared object is loaded at. */ + char *libname; /* Absolute file name object was found in. */ + ElfW(Dyn) *dynamic_addr; /* Dynamic section of the shared object. */ + struct elf_resolve * next; + struct elf_resolve * prev; + /* Nothing after this address is used by gdb. */ + +#ifdef __UCLIBC_HAS_TLS__ + /* Thread-local storage related info. */ + + /* Start of the initialization image. */ + void *l_tls_initimage; + /* Size of the initialization image. */ + size_t l_tls_initimage_size; + /* Size of the TLS block. */ + size_t l_tls_blocksize; + /* Alignment requirement of the TLS block. */ + size_t l_tls_align; + /* Offset of first byte module alignment. */ + size_t l_tls_firstbyte_offset; +# ifndef NO_TLS_OFFSET +# define NO_TLS_OFFSET 0 +# endif + /* For objects present at startup time: offset in the static TLS block. */ + ptrdiff_t l_tls_offset; + /* Index of the module in the dtv array. */ + size_t l_tls_modid; + /* Nonzero if _dl_init_static_tls should be called for this module */ + unsigned int l_need_tls_init:1; +#endif + + ElfW(Addr) mapaddr; + enum {elf_lib, elf_executable,program_interpreter, loaded_file} libtype; + struct dyn_elf * symbol_scope; + unsigned short usage_count; + unsigned short int init_flag; + unsigned long rtld_flags; /* RTLD_GLOBAL, RTLD_NOW etc. */ + Elf_Symndx nbucket; + +#ifdef __LDSO_GNU_HASH_SUPPORT__ + /* Data needed to support GNU hash style */ + Elf32_Word l_gnu_bitmask_idxbits; + Elf32_Word l_gnu_shift; + const ElfW(Addr) *l_gnu_bitmask; + + union + { + const Elf32_Word *l_gnu_chain_zero; + const Elf_Symndx *elf_buckets; + }; +#else + Elf_Symndx *elf_buckets; +#endif + + struct init_fini_list *init_fini; + struct init_fini_list *rtld_local; /* keep tack of RTLD_LOCAL libs in same group */ + /* + * These are only used with ELF style shared libraries + */ + Elf_Symndx nchain; + +#ifdef __LDSO_GNU_HASH_SUPPORT__ + union + { + const Elf32_Word *l_gnu_buckets; + const Elf_Symndx *chains; + }; +#else + Elf_Symndx *chains; +#endif + ElfW(Word) dynamic_info[DYNAMIC_SIZE]; + + unsigned long n_phent; + ElfW(Phdr) * ppnt; + + ElfW(Addr) relro_addr; + size_t relro_size; + + dev_t st_dev; /* device */ + ino_t st_ino; /* inode */ + +#ifdef __powerpc__ + /* this is used to store the address of relocation data words, so + * we don't have to calculate it every time, which requires a divide */ + unsigned long data_words; +#endif + +#ifdef __FDPIC__ + /* Every loaded module holds a hashtable of function descriptors of + functions defined in it, such that it's easy to release the + memory when the module is dlclose()d. */ + struct funcdesc_ht *funcdesc_ht; +#endif +}; + #ifdef __mips__ /* The MIPS ABI specifies that the dynamic section has to be read-only. */ @@ -59,6 +199,28 @@ struct elf_resolve; extern void _dl_run_init_array(struct elf_resolve *); extern void _dl_run_fini_array(struct elf_resolve *); +extern struct dyn_elf * _dl_symbol_tables; +extern struct elf_resolve * _dl_loaded_modules; + +extern char *_dl_find_hash(const char *name, struct dyn_elf *rpnt, + struct elf_resolve *mytpnt, int type_class, + struct symbol_ref *symbol); + +#ifdef __LDSO_CACHE_SUPPORT__ +extern int _dl_map_cache(void); +extern int _dl_unmap_cache(void); +#else +static __inline__ void _dl_map_cache(void) { } +static __inline__ void _dl_unmap_cache(void) { } +#endif + +/* Function prototypes for non-static stuff in dl-elf.c and elfinterp.c */ +extern struct elf_resolve * _dl_load_shared_library(int secure, + struct dyn_elf **rpnt, struct elf_resolve *tpnt, char *full_libname, + int trace_loaded_objects); +extern int _dl_fixup(struct dyn_elf *rpnt, int flag); +extern void _dl_protect_relro (struct elf_resolve *l) internal_function; + #ifdef __UCLIBC_HAS_TLS__ /* Determine next available module ID. */ extern size_t _dl_next_tls_modid (void) internal_function attribute_hidden; diff --git a/ldso/ldso/dl-array.c b/ldso/ldso/dl-array.c index cc5e197..edbf59d 100644 --- a/ldso/ldso/dl-array.c +++ b/ldso/ldso/dl-array.c @@ -28,7 +28,7 @@ * SUCH DAMAGE. */ -#include +#include static void _dl_run_array_forward(unsigned long array, unsigned long size, DL_LOADADDR_TYPE loadaddr) diff --git a/ldso/ldso/dl-symbols.c b/ldso/ldso/dl-symbols.c index 0997536..b03d516 100644 --- a/ldso/ldso/dl-symbols.c +++ b/ldso/ldso/dl-symbols.c @@ -16,7 +16,9 @@ * as well as all of the other good stuff in the binary. */ -#include +#define __need_NULL +#include +#include struct elf_resolve *_dl_loaded_modules = NULL; diff --git a/libc/misc/elf/dl-iterate-phdr.c b/libc/misc/elf/dl-iterate-phdr.c index 5b86db0..188ab1e 100644 --- a/libc/misc/elf/dl-iterate-phdr.c +++ b/libc/misc/elf/dl-iterate-phdr.c @@ -11,12 +11,14 @@ Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. */ - -#include -#include +#include /* we want this in libc but nowhere else */ #ifdef __USE_GNU +# define __need_NULL +# include +# include +# include static int __dl_iterate_phdr (int (*callback) (struct dl_phdr_info *info, size_t size, void *data), void *data) -- 1.7.3.4 From ps.m at gmx.net Mon Apr 11 11:27:03 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Mon, 11 Apr 2011 13:27:03 +0200 Subject: [git commit ldso-future] ldso: make _dl_dprintf static Message-ID: <20110411142455.6A39C8254E@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=a0902992926f78d2e1efc5ec25387bd69098eff5 branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/ldso-future Signed-off-by: Peter S. Mazinger --- ldso/include/ldso.h | 1 - ldso/ldso/dl-elf.c | 2 +- ldso/ldso/ldso.c | 2 ++ 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/ldso/include/ldso.h b/ldso/include/ldso.h index 61e8846..9a2fc74 100644 --- a/ldso/include/ldso.h +++ b/ldso/include/ldso.h @@ -108,7 +108,6 @@ extern void *_dl_malloc(size_t size); extern void *_dl_calloc(size_t __nmemb, size_t __size); extern void *_dl_realloc(void *__ptr, size_t __size); extern void _dl_free(void *); -extern void _dl_dprintf(int, const char *__restrict, ...) attribute_hidden; #else # include # define _dl_malloc malloc diff --git a/ldso/ldso/dl-elf.c b/ldso/ldso/dl-elf.c index 39c5044..97fa9a3 100644 --- a/ldso/ldso/dl-elf.c +++ b/ldso/ldso/dl-elf.c @@ -941,7 +941,7 @@ int _dl_fixup(struct dyn_elf *rpnt, int now_flag) #ifdef IS_IN_rtld /* Minimal printf which handles only %s, %d, and %x */ -void _dl_dprintf(int fd, const char *__restrict fmt, ...) +static void _dl_dprintf(int fd, const char *__restrict fmt, ...) { #if __WORDSIZE > 32 long int num; diff --git a/ldso/ldso/ldso.c b/ldso/ldso/ldso.c index 83902ff..dbade03 100644 --- a/ldso/ldso/ldso.c +++ b/ldso/ldso/ldso.c @@ -34,6 +34,8 @@ #include +static void _dl_dprintf(int, const char *__restrict, ...); + /* Pull in common debug code */ #include "dl-debug.c" -- 1.7.3.4 From ps.m at gmx.net Mon Apr 11 11:27:03 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Mon, 11 Apr 2011 13:27:03 +0200 Subject: [git commit ldso-future] ldso: introduce _rtld_global[_ro] and _rtld_local[_ro] structures Message-ID: <20110411142457.476328254E@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=6409a0c7a5c1ad4693e078a60d2f531dd40d0a69 branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/ldso-future With these structures the functions and global data provided by ldso can be hidden, The other libs (libdl/libc/libpthread) can access these by pointers. Same applies to global data, pagesize, clock ... can be reused. text data bss dec hex filename ldso-future 25497 312 224 26033 65b1 lib/ld-uClibc-0.9.32-rc3-git.so 6679 316 8 7003 1b5b lib/libdl-0.9.32-rc3-git.so future 28908 384 236 29528 7358 lib/ld-uClibc-0.9.32-rc3-git.so 7686 396 4 8086 1f96 lib/libdl-0.9.32-rc3-git.so master 28956 384 236 29576 7388 lib/ld-uClibc-0.9.32-rc3-git.so 8214 396 4 8614 21a6 lib/libdl-0.9.32-rc3-git.so Signed-off-by: Peter S. Mazinger Patch is too large, so refusing to show it From ps.m at gmx.net Mon Apr 11 11:27:03 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Mon, 11 Apr 2011 13:27:03 +0200 Subject: [git commit ldso-future] ldsodefs.h: removed unused code Message-ID: <20110411142456.F0DF38254E@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=da58a257d94eb339bfe088e549308111193b2778 branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/ldso-future Signed-off-by: Peter S. Mazinger --- ldso/include/ldsodefs.h | 30 ------------------------------ 1 files changed, 0 insertions(+), 30 deletions(-) diff --git a/ldso/include/ldsodefs.h b/ldso/include/ldsodefs.h index e2b517c..548a404 100644 --- a/ldso/include/ldsodefs.h +++ b/ldso/include/ldsodefs.h @@ -5,7 +5,6 @@ #include #include #include -#include #include #ifdef __UCLIBC_HAS_TLS__ @@ -149,14 +148,6 @@ struct elf_resolve { #endif }; -#ifdef __mips__ -/* The MIPS ABI specifies that the dynamic section has to be read-only. */ - -#define DL_RO_DYN_SECTION 1 - -/* TODO: Import in 64-bit relocations from glibc. */ -#endif - #ifndef SHARED # define EXTERN extern #else @@ -306,25 +297,4 @@ EXTERN size_t _dl_tls_generation; EXTERN void (*_dl_init_static_tls) (struct link_map *); #endif -/* We have the auxiliary vector. */ -#define HAVE_AUX_VECTOR - -/* We can assume that the kernel always provides the AT_UID, AT_EUID, - AT_GID, and AT_EGID values in the auxiliary vector from 2.4.0 or so on. */ -#if __ASSUME_AT_XID -# define HAVE_AUX_XID -#endif - -/* We can assume that the kernel always provides the AT_SECURE value - in the auxiliary vector from 2.5.74 or so on. */ -#if __ASSUME_AT_SECURE -# define HAVE_AUX_SECURE -#endif - -/* Starting with one of the 2.4.0 pre-releases the Linux kernel passes - up the page size information. */ -#if __ASSUME_AT_PAGESIZE -# define HAVE_AUX_PAGESIZE -#endif - #endif -- 1.7.3.4 From ps.m at gmx.net Mon Apr 11 11:27:03 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Mon, 11 Apr 2011 13:27:03 +0200 Subject: [git commit ldso-future] dl-inlines.h: fix the use of _dl_if_debug_dprint Message-ID: <20110411210337.7DC5F82550@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=15de054b119bf6f9b907ef2d269a66e55dc51601 branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/ldso-future Signed-off-by: Peter S. Mazinger --- ldso/ldso/bfin/dl-inlines.h | 2 +- ldso/ldso/c6x/dl-inlines.h | 2 +- ldso/ldso/frv/dl-inlines.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ldso/ldso/bfin/dl-inlines.h b/ldso/ldso/bfin/dl-inlines.h index b3eea8b..d79f898 100644 --- a/ldso/ldso/bfin/dl-inlines.h +++ b/ldso/ldso/bfin/dl-inlines.h @@ -83,7 +83,7 @@ __dl_init_loadaddr_hdr (struct elf32_fdpic_loadaddr loadaddr, void *addr, segdata->p_vaddr = phdr->p_vaddr; segdata->p_memsz = phdr->p_memsz; - _dl_if_debug_dprint(_dl_debug_file, "%i: mapped %x at %x, size %x\n", + _dl_if_debug_dprint("%i: mapped %x at %x, size %x\n", loadaddr.map->nsegs-1, segdata->p_vaddr, segdata->addr, segdata->p_memsz); } diff --git a/ldso/ldso/c6x/dl-inlines.h b/ldso/ldso/c6x/dl-inlines.h index 03b60c2..cf493df 100644 --- a/ldso/ldso/c6x/dl-inlines.h +++ b/ldso/ldso/c6x/dl-inlines.h @@ -64,7 +64,7 @@ __dl_init_loadaddr_hdr (struct elf32_dsbt_loadaddr loadaddr, void *addr, segdata->p_vaddr = phdr->p_vaddr; segdata->p_memsz = phdr->p_memsz; - _dl_if_debug_dprint(_dl_debug_file, "%i: mapped %x at %x, size %x\n", + _dl_if_debug_dprint("%i: mapped %x at %x, size %x\n", loadaddr.map->nsegs-1, segdata->p_vaddr, segdata->addr, segdata->p_memsz); } diff --git a/ldso/ldso/frv/dl-inlines.h b/ldso/ldso/frv/dl-inlines.h index 2249eae..22b42a8 100644 --- a/ldso/ldso/frv/dl-inlines.h +++ b/ldso/ldso/frv/dl-inlines.h @@ -67,7 +67,7 @@ __dl_init_loadaddr_hdr (struct elf32_fdpic_loadaddr loadaddr, void *addr, segdata->p_vaddr = phdr->p_vaddr; segdata->p_memsz = phdr->p_memsz; - _dl_if_debug_dprint(_dl_debug_file, "%i: mapped %x at %x, size %x\n", + _dl_if_debug_dprint("%i: mapped %x at %x, size %x\n", loadaddr.map->nsegs-1, segdata->p_vaddr, segdata->addr, segdata->p_memsz); } -- 1.7.3.4 From ps.m at gmx.net Mon Apr 11 11:27:03 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Mon, 11 Apr 2011 13:27:03 +0200 Subject: [git commit ldso-future] ldso/libdl: hide _dl_malloc and friends, add _dl_malloc_function to _rtld_global structure Message-ID: <20110411221925.413FB8231F@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=4f9fe3f11077989064ef448a28c9a235dc7744f0 branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/ldso-future Signed-off-by: Peter S. Mazinger --- ldso/include/ldso.h | 12 +++++++----- ldso/include/ldsodefs.h | 15 ++++++++------- ldso/ldso/dl-tls.c | 14 +++++++------- ldso/ldso/ldso.c | 41 ++++++++++++++++++++--------------------- ldso/libdl/libdl.c | 12 +++++++++--- 5 files changed, 51 insertions(+), 43 deletions(-) diff --git a/ldso/include/ldso.h b/ldso/include/ldso.h index 18156dd..8f7db6c 100644 --- a/ldso/include/ldso.h +++ b/ldso/include/ldso.h @@ -95,11 +95,13 @@ extern void **_dl_initial_error_catch_tsd(void) __attribute__((const)) #endif /* __SUPPORT_LD_DEBUG_EARLY__ */ #ifdef IS_IN_rtld -extern void *_dl_malloc(size_t size); -extern void *_dl_calloc(size_t __nmemb, size_t __size); -extern void *_dl_realloc(void *__ptr, size_t __size); -extern void *_dl_memalign(size_t __boundary, size_t __size); -extern void _dl_free(void *); +extern void *_dl_malloc(size_t size) attribute_hidden; +extern void _dl_free(void *) attribute_hidden; +# ifdef __UCLIBC_HAS_TLS__ +extern void *_dl_calloc(size_t __nmemb, size_t __size) attribute_hidden; +extern void *_dl_realloc(void *__ptr, size_t __size) attribute_hidden; +extern void *_dl_memalign(size_t __boundary, size_t __size) attribute_hidden; +# endif #else # include # define _dl_malloc malloc diff --git a/ldso/include/ldsodefs.h b/ldso/include/ldsodefs.h index 90dee51..bf6f3b1 100644 --- a/ldso/include/ldsodefs.h +++ b/ldso/include/ldsodefs.h @@ -196,6 +196,9 @@ struct rtld_global /* Used to communicate with the gdb debugger */ EXTERN struct r_debug *_dl_debug_addr; + EXTERN void *(*_dl_malloc_function) (size_t); + EXTERN void (*_dl_free_function) (void *); + #ifdef __UCLIBC_HAS_THREADS__ /* Function pointer for catching TLS errors. */ EXTERN void **(*_dl_error_catch_tsd) (void) __attribute__ ((const)); @@ -238,6 +241,11 @@ struct rtld_global EXTERN size_t _dl_tls_generation; EXTERN void (*_dl_init_static_tls) (struct link_map *); + + /* uClibc-specific */ + EXTERN void *(*_dl_calloc_function) (size_t, size_t); + EXTERN void *(*_dl_realloc_function) (void *, size_t); + EXTERN void *(*_dl_memalign_function) (size_t, size_t); #endif #ifdef __SUPPORT_LD_DEBUG__ @@ -269,10 +277,6 @@ struct rtld_global_ro int (*_dl_fixup) (struct dyn_elf *, int); void (internal_function *_dl_protect_relro) (struct elf_resolve *); char *(*_dl_find_hash) (const char *, struct dyn_elf *, struct elf_resolve *, int, struct symbol_ref *); -# if 0 /* psm: ask Bernd Schmid */ - void *(*_dl_malloc_function) (size_t); - void (*_dl_free_function) (void *); -# endif # ifdef __LDSO_CACHE_SUPPORT__ int (*_dl_map_cache) (void); int (*_dl_unmap_cache) (void); @@ -327,9 +331,6 @@ extern char *_dl_find_hash(const char *name, struct dyn_elf *rpnt, struct elf_re extern void _dl_protect_relro (struct elf_resolve *map) internal_function attribute_shared_hidden; -extern void *(*_dl_malloc_function) (size_t) /*attribute_shared_hidden*/; -extern void (*_dl_free_function) (void *) /*attribute_shared_hidden*/; - #ifdef __LDSO_CACHE_SUPPORT__ extern int _dl_map_cache(void) attribute_shared_hidden; extern int _dl_unmap_cache(void) attribute_shared_hidden; diff --git a/ldso/ldso/dl-tls.c b/ldso/ldso/dl-tls.c index fa304c6..189bf33 100644 --- a/ldso/ldso/dl-tls.c +++ b/ldso/ldso/dl-tls.c @@ -30,11 +30,11 @@ #include #include +#ifndef SHARED void *(*_dl_calloc_function) (size_t __nmemb, size_t __size) = NULL; void *(*_dl_realloc_function) (void *__ptr, size_t __size) = NULL; void *(*_dl_memalign_function) (size_t __boundary, size_t __size) = NULL; - -void (*_dl_free_function) (void *__ptr); +#endif /* Round up N to the nearest multiple of P, where P is a power of 2 --- without using libgcc division routines. */ @@ -46,8 +46,8 @@ _dl_calloc (size_t __nmemb, size_t __size) void *result; size_t size = (__size * __nmemb); - if (_dl_calloc_function) - return (*_dl_calloc_function) (__nmemb, __size); + if (GL(dl_calloc_function)) + return (*GL(dl_calloc_function)) (__nmemb, __size); if ((result = _dl_malloc(size)) != NULL) { _dl_memset(result, 0, size); @@ -59,8 +59,8 @@ _dl_calloc (size_t __nmemb, size_t __size) void * _dl_realloc (void * __ptr, size_t __size) { - if (_dl_realloc_function) - return (*_dl_realloc_function) (__ptr, __size); + if (GL(dl_realloc_function)) + return (*GL(dl_realloc_function)) (__ptr, __size); _dl_debug_early("NOT IMPLEMENTED PROPERLY!!!\n"); return NULL; @@ -202,7 +202,7 @@ _dl_nothread_init_static_tls (struct link_map *map) #endif /* Taken from glibc/sysdeps/generic/dl-tls.c */ -static void +static attribute_noreturn void oom (void) { _dl_debug_early("cannot allocate thread-local memory: ABORT\n"); diff --git a/ldso/ldso/ldso.c b/ldso/ldso/ldso.c index d96396c..49c14a1 100644 --- a/ldso/ldso/ldso.c +++ b/ldso/ldso/ldso.c @@ -39,7 +39,14 @@ struct rtld_global _rtld_global = { ._dl_loaded_modules = NULL, ._dl_symbol_tables = NULL, - ._dl_debug_addr = NULL + ._dl_debug_addr = NULL, + ._dl_malloc_function = NULL, + ._dl_free_function = NULL +#ifdef __UCLIBC_HAS_TLS__ +, ._dl_calloc_function = NULL, + ._dl_realloc_function = NULL, + ._dl_memalign_function = NULL +#endif #ifdef __SUPPORT_LD_DEBUG__ , ._dl_debug = NULL #endif @@ -55,10 +62,6 @@ struct rtld_global_ro _rtld_global_ro attribute_relro = ._dl_fixup = _dl_fixup, ._dl_protect_relro = _dl_protect_relro, ._dl_find_hash = _dl_find_hash -# if 0 /* psm: ask Bernd Schmid */ -, ._dl_malloc_function = _dl_malloc_function, - ._dl_free_function = _dl_free_function -# endif # ifdef __LDSO_CACHE_SUPPORT__ , ._dl_map_cache = _dl_map_cache, ._dl_unmap_cache = _dl_unmap_cache @@ -66,7 +69,7 @@ struct rtld_global_ro _rtld_global_ro attribute_relro = # ifdef __mips__ , ._dl_perform_mips_global_got_relocations = _dl_perform_mips_global_got_relocations # endif -# ifdef USE_TLS +# ifdef __UCLIBC_HAS_TLS__ # if 0 # ifdef __i386__ , ._tls_get_addr = ___tls_get_addr_internal @@ -215,9 +218,6 @@ static char *_dl_preload = NULL; /* Things to be loaded before the libs */ char *_dl_ldsopath = NULL; /* Location of the shared lib loader */ int _dl_errno = 0; /* We can't use the real errno in ldso */ -void *(*_dl_malloc_function) (size_t size) = NULL; -void (*_dl_free_function) (void *p) = NULL; - static int _dl_secure = 1; /* Are we dealing with setuid stuff? */ @@ -321,8 +321,8 @@ void *_dl_malloc(size_t size) _dl_debug_early("request for %d bytes\n", size); #endif - if (_dl_malloc_function) - return (*_dl_malloc_function) (size); + if (GL(dl_malloc_function)) + return (*GL(dl_malloc_function)) (size); if (_dl_malloc_addr - _dl_mmap_zero + size > GLRO(dl_pagesize)) { size_t rounded_size; @@ -372,8 +372,8 @@ static void *_dl_zalloc(size_t size) void _dl_free(void *p) { - if (_dl_free_function) - (*_dl_free_function) (p); + if (GL(dl_free_function)) + (*GL(dl_free_function)) (p); } #ifdef __UCLIBC_HAS_TLS__ @@ -384,8 +384,8 @@ void *_dl_memalign(size_t __boundary, size_t __size) size_t delta; size_t rounded = 0; - if (_dl_memalign_function) - return (*_dl_memalign_function) (__boundary, __size); + if (GL(dl_memalign_function)) + return (*GL(dl_memalign_function)) (__boundary, __size); while (rounded < __boundary) { rounded = (1 << i++); @@ -1223,23 +1223,22 @@ static __always_inline void _dl_get_ready_to_run(struct elf_resolve *tpnt, DL_LO } /* Find the real malloc function and make ldso functions use that from now on */ - _dl_malloc_function = (void* (*)(size_t)) (intptr_t) _dl_find_hash(__C_SYMBOL_PREFIX__ "malloc", + GL(dl_malloc_function) = (void* (*)(size_t)) (intptr_t) _dl_find_hash(__C_SYMBOL_PREFIX__ "malloc", GL(dl_symbol_tables), NULL, ELF_RTYPE_CLASS_PLT, NULL); - _dl_free_function = (void (*)(void *)) (intptr_t) + GL(dl_free_function) = (void (*)(void *)) (intptr_t) _dl_find_hash(__C_SYMBOL_PREFIX__ "free", GL(dl_symbol_tables), NULL, ELF_RTYPE_CLASS_PLT, NULL); #ifdef __UCLIBC_HAS_TLS__ /* Find the real functions and make ldso functions use them from now on */ - _dl_calloc_function = (void* (*)(size_t, size_t)) (intptr_t) + GL(dl_calloc_function) = (void* (*)(size_t, size_t)) (intptr_t) _dl_find_hash(__C_SYMBOL_PREFIX__ "calloc", GL(dl_symbol_tables), NULL, ELF_RTYPE_CLASS_PLT, NULL); - _dl_realloc_function = (void* (*)(void *, size_t)) (intptr_t) + GL(dl_realloc_function) = (void* (*)(void *, size_t)) (intptr_t) _dl_find_hash(__C_SYMBOL_PREFIX__ "realloc", GL(dl_symbol_tables), NULL, ELF_RTYPE_CLASS_PLT, NULL); - _dl_memalign_function = (void* (*)(size_t, size_t)) (intptr_t) + GL(dl_memalign_function) = (void* (*)(size_t, size_t)) (intptr_t) _dl_find_hash(__C_SYMBOL_PREFIX__ "memalign", GL(dl_symbol_tables), NULL, ELF_RTYPE_CLASS_PLT, NULL); - #endif /* Notify the debugger that all objects are now mapped in. */ diff --git a/ldso/libdl/libdl.c b/ldso/libdl/libdl.c index 20c827a..7fb33ef 100644 --- a/ldso/libdl/libdl.c +++ b/ldso/libdl/libdl.c @@ -32,6 +32,7 @@ #include #include #include +#include #include #include #ifdef __UCLIBC_HAS_TLS__ @@ -46,7 +47,7 @@ static const char *_dl_progname= ""; /* Program name */ void *(*_dl_malloc_function)(size_t) = NULL; -void (*_dl_free_function) (void *p); +void (*_dl_free_function) (void *p) = NULL; char *_dl_library_path = NULL; /* Where we look for libraries */ char *_dl_ldsopath = NULL; /* Location of the shared lib loader */ size_t _dl_pagesize = PAGE_SIZE; /* Store the page size for later use */ @@ -252,8 +253,13 @@ void *dlopen(const char *libname, int flag) if (!_dl_init) { _dl_init = true; - _dl_malloc_function = malloc; - _dl_free_function = free; + GL(dl_malloc_function) = malloc; + GL(dl_free_function) = free; +#ifdef __UCLIBC_HAS_TLS__ + GL(dl_calloc_function) = calloc; + GL(dl_realloc_function) = realloc; + GL(dl_memalign_function) = memalign; +#endif } /* Cover the trivial case first */ if (!libname) -- 1.7.3.4 From bugzilla at busybox.net Tue Apr 12 06:02:38 2011 From: bugzilla at busybox.net (bugzilla at busybox.net) Date: Tue, 12 Apr 2011 06:02:38 +0000 (UTC) Subject: [Bug 2089] errno not threadsafe In-Reply-To: References: Message-ID: <20110412060238.63C2A8259A@busybox.osuosl.org> https://bugs.busybox.net/show_bug.cgi?id=2089 Daniel Ng changed: What |Removed |Added ---------------------------------------------------------------------------- Priority|P5 |P2 Severity|minor |critical --- Comment #13 from Daniel Ng --- Without this patch, my system would be broken. I am using uClibc-0.9.31 with a PowerPC-based arch (Linux 2.6.30). Without this patch, I would get errno==0 when read() returned -1. The code doesn't handle such a case (and it shouldn't need to!) and so results in the system locking up. I've upped the Priority to P2 Critical. The patch makes the system behave correctly. -- Configure bugmail: https://bugs.busybox.net/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug. From ps.m at gmx.net Mon Apr 11 11:27:03 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Mon, 11 Apr 2011 13:27:03 +0200 Subject: [git commit future] hppa/bits/atomic.h: include errno.h to get EFAULT/ENOSYS Message-ID: <20110412203910.EE4CB825A1@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=09ccda6c11a2a424abe1f1488667a76392ee557e branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/future Signed-off-by: Peter S. Mazinger --- libc/sysdeps/linux/hppa/bits/atomic.h | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/libc/sysdeps/linux/hppa/bits/atomic.h b/libc/sysdeps/linux/hppa/bits/atomic.h index 87aeb84..08a7c3e 100644 --- a/libc/sysdeps/linux/hppa/bits/atomic.h +++ b/libc/sysdeps/linux/hppa/bits/atomic.h @@ -18,6 +18,7 @@ 02111-1307 USA. */ #include +#include #include #define ABORT_INSTRUCTION __asm__(__UCLIBC_ABORT_INSTRUCTION__) -- 1.7.3.4 From ps.m at gmx.net Mon Apr 11 11:27:03 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Mon, 11 Apr 2011 13:27:03 +0200 Subject: [git commit future] getpt.c: no need for hidden posix_openpt Message-ID: <20110412203910.A5514825A1@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=3981a59eb3efd3af78f4bc7379aec80e0d0275bd branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/future Prefer static inline instead of hidden (__bsd_getpt) Signed-off-by: Peter S. Mazinger --- include/stdlib.h | 1 - libc/stdlib/bsd_getpt.c | 2 +- libc/stdlib/getpt.c | 10 +++++----- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/include/stdlib.h b/include/stdlib.h index 7b35840..b2e51f5 100644 --- a/include/stdlib.h +++ b/include/stdlib.h @@ -856,7 +856,6 @@ extern void setkey (__const char *__key) __THROW __nonnull ((1)); #ifdef __USE_XOPEN2K /* Return a master pseudo-terminal handle. */ extern int posix_openpt (int __oflag) __wur; -libc_hidden_proto(posix_openpt) #endif #ifdef __USE_XOPEN diff --git a/libc/stdlib/bsd_getpt.c b/libc/stdlib/bsd_getpt.c index e704e23..d8c46f5 100644 --- a/libc/stdlib/bsd_getpt.c +++ b/libc/stdlib/bsd_getpt.c @@ -40,7 +40,7 @@ const char __libc_ptyname1[] attribute_hidden = PTYNAME1; const char __libc_ptyname2[] attribute_hidden = PTYNAME2; /* Open a master pseudo terminal and return its file descriptor. */ -int +static __inline__ int __getpt (void) { char buf[sizeof (_PATH_PTY) + 2]; diff --git a/libc/stdlib/getpt.c b/libc/stdlib/getpt.c index 2d8b207..adebec7 100644 --- a/libc/stdlib/getpt.c +++ b/libc/stdlib/getpt.c @@ -43,12 +43,12 @@ extern __typeof(statfs) __libc_statfs; #if !defined __UNIX98PTY_ONLY__ && defined __UCLIBC_HAS_GETPT__ /* Prototype for function that opens BSD-style master pseudo-terminals. */ -extern int __bsd_getpt (void) attribute_hidden; +static __inline__ int __bsd_getpt (void); #endif /* Open a master pseudo terminal and return its file descriptor. */ -int -posix_openpt (int flags) +static int +__posix_openpt (int flags) { #define have_no_dev_ptmx (1<<0) #define devpts_mounted (1<<1) @@ -112,14 +112,14 @@ posix_openpt (int flags) #endif return -1; } -libc_hidden_def(posix_openpt) +strong_alias(__posix_openpt,posix_openpt) #undef have_no_dev_ptmx #undef devpts_mounted #if defined __USE_GNU && defined __UCLIBC_HAS_GETPT__ int getpt (void) { - return posix_openpt(O_RDWR); + return __posix_openpt(O_RDWR); } #if !defined __UNIX98PTY_ONLY__ && defined __UCLIBC_HAS_GETPT__ -- 1.7.3.4 From ps.m at gmx.net Mon Apr 11 11:27:03 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Mon, 11 Apr 2011 13:27:03 +0200 Subject: [git commit future] add lcong48[_r] Message-ID: <20110412203910.CF5ED825A1@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=46374dd9effb20c13e26f70e23f269c14e551cee branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/future Signed-off-by: Peter S. Mazinger --- libc/stdlib/Makefile.in | 2 +- libc/stdlib/lcong48.c | 29 +++++++++++++++++++++++++++++ 2 files changed, 30 insertions(+), 1 deletions(-) create mode 100644 libc/stdlib/lcong48.c diff --git a/libc/stdlib/Makefile.in b/libc/stdlib/Makefile.in index 760ccf7..4407d63 100644 --- a/libc/stdlib/Makefile.in +++ b/libc/stdlib/Makefile.in @@ -15,7 +15,7 @@ CSRC-y := \ abort.c getenv.c mkdtemp.c realpath.c canonicalize.c mkstemp.c \ rand.c random.c random_r.c setenv.c div.c ldiv.c lldiv.c \ getpt.c drand48-iter.c jrand48.c \ - jrand48_r.c lrand48.c lrand48_r.c mrand48.c mrand48_r.c nrand48.c \ + jrand48_r.c lcong48.c lrand48.c lrand48_r.c mrand48.c mrand48_r.c nrand48.c \ nrand48_r.c rand_r.c srand48.c srand48_r.c seed48.c seed48_r.c \ valloc.c a64l.c l64a.c __uc_malloc.c CSRC-$(UCLIBC_HAS_ADVANCED_REALTIME) += posix_memalign.c diff --git a/libc/stdlib/lcong48.c b/libc/stdlib/lcong48.c new file mode 100644 index 0000000..06cab66 --- /dev/null +++ b/libc/stdlib/lcong48.c @@ -0,0 +1,29 @@ +/* vi: set sw=4 ts=4: */ +/* Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. */ + +#include + +#if defined __USE_SVID || defined __USE_XOPEN +#include +#include +#include + +static int __lcong48_r (unsigned short int param[7], struct drand48_data *buffer) +{ + /* Store the given values. */ + memcpy (buffer->__x, ¶m[0], sizeof (buffer->__x)); + buffer->__a = ((uint64_t) param[5] << 32 | (uint32_t) param[4] << 16 | param[3]); + buffer->__c = param[6]; + buffer->__init = 1; + + return 0; +} +# ifdef __USE_MISC +strong_alias(__lcong48_r,lcong48_r) +# endif + +void lcong48 (unsigned short int param[7]) +{ + (void) __lcong48_r (param, &__libc_drand48_data); +} +#endif -- 1.7.3.4 From ps.m at gmx.net Mon Apr 11 11:27:03 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Mon, 11 Apr 2011 13:27:03 +0200 Subject: [git commit future] stdlib.c: remove comment about _Exit, it is provided in _exit.c Message-ID: <20110412203911.1DE7B825A1@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=11e8ad9c4d2242631ff7694b290b9e3951403305 branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/future Signed-off-by: Peter S. Mazinger --- libc/stdlib/stdlib.c | 11 +---------- 1 files changed, 1 insertions(+), 10 deletions(-) diff --git a/libc/stdlib/stdlib.c b/libc/stdlib/stdlib.c index 6ce04e1..98c202e 100644 --- a/libc/stdlib/stdlib.c +++ b/libc/stdlib/stdlib.c @@ -659,16 +659,7 @@ unsigned long long attribute_hidden __XL_NPP(_stdlib_strto_ll)(register const Wc #endif /* defined(ULLONG_MAX) && (LLONG_MAX > LONG_MAX) */ #endif -/**********************************************************************/ -/* Made _Exit() an alias for _exit(), as per C99. */ -/* #ifdef L__Exit */ -/* void _Exit(int status) */ -/* { */ -/* _exit(status); */ -/* } */ - -/* #endif */ -/**********************************************************************/ + #ifdef L_bsearch void *bsearch(const void *key, const void *base, size_t /* nmemb */ high, -- 1.7.3.4 From ps.m at gmx.net Mon Apr 11 11:27:03 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Mon, 11 Apr 2011 13:27:03 +0200 Subject: [git commit ldso-future] use _dl_pagesize and _dl_stack_end from ldso in other libs Message-ID: <20110412203911.BD155825A1@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=c360cf016f11484f85f21f9ef40979ab1f30ea34 branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/ldso-future Export __libc_stack_end only on ppc (see ldsodefs.h for details) Signed-off-by: Peter S. Mazinger --- ldso/include/ldsodefs.h | 12 ++++++------ ldso/ldso/dl-startup.c | 8 ++------ ldso/ldso/ldso.c | 3 ++- libc/misc/internals/__uClibc_main.c | 14 ++++++++++++-- libpthread/linuxthreads/attr.c | 4 ++-- libpthread/nptl/init.c | 2 +- libpthread/nptl/pthread_getattr_np.c | 4 ++-- 7 files changed, 27 insertions(+), 20 deletions(-) diff --git a/ldso/include/ldsodefs.h b/ldso/include/ldsodefs.h index bf6f3b1..8afddc0 100644 --- a/ldso/include/ldsodefs.h +++ b/ldso/include/ldsodefs.h @@ -257,15 +257,15 @@ struct rtld_global struct rtld_global_ro { #endif -#ifdef SHARED /* Store the page size for later use */ - size_t _dl_pagesize; + EXTERN size_t _dl_pagesize; /* Variable pointing to the end of the stack (or close to it). This value must be constant over the runtime of the application. Some programs might use the variable which results in copy relocations on some platforms. But this does not matter, ld.so can always use the local copy. */ - void *_dl_stack_end; + EXTERN void *_dl_stack_end; +#ifdef SHARED /* We add a function table to _rtld_global_ro which is then used to call the function instead of going through the PLT. The result is that we can avoid exporting the functions and we do not jump @@ -373,10 +373,10 @@ extern void _dl_deallocate_tls (void *tcb, bool dealloc_tcb) internal_function a might use the variable which results in copy relocations on some platforms. But this does not matter, ld.so can always use the local copy. */ -/* gcc uses it in rs6000/linux-unwind.c, could be patched to use - * _dl_stack_end from the structure */ +/* gcc uses it in rs6000/linux-unwind.h, ckecked up to 4.5.2 + * could be patched to use _dl_stack_end from the structure */ /* gcc's boehm-gc has fallback if not found */ -#if 1 /*!defined SHARED || (defined IS_IN_rtld && defined __powerpc__)*/ +#if defined IS_IN_rtld && defined __powerpc__ extern void *__libc_stack_end attribute_relro; #endif diff --git a/ldso/ldso/dl-startup.c b/ldso/ldso/dl-startup.c index 76826ed..78bed69 100644 --- a/ldso/ldso/dl-startup.c +++ b/ldso/ldso/dl-startup.c @@ -100,11 +100,6 @@ static __attribute_used__ unsigned long _dl_skip_args = 0; /* Static declarations */ static int (*_dl_elf_main) (int, char **, char **); -#if 1 /*def __powerpc__*/ -/* see ldsodefs.h why only for ppc */ -void * __libc_stack_end attribute_relro = NULL; /* Points to argc on stack, e.g. *((long *)__libc_stack_end) == argc */ -#endif - /* When we enter this piece of code, the program stack looks like this: argc argument counter (integer) argv[0] program name (pointer) @@ -325,7 +320,8 @@ DL_START(unsigned long args) since the dynamic resolver is not yet ready. */ GLRO(dl_stack_end) = (void *)(argv - 1); -#if 1 /*def __powerpc__*/ +#ifdef __powerpc__ + /* see ldsodefs.h why only for ppc */ __libc_stack_end = GLRO(dl_stack_end); #endif diff --git a/ldso/ldso/ldso.c b/ldso/ldso/ldso.c index 49c14a1..142de79 100644 --- a/ldso/ldso/ldso.c +++ b/ldso/ldso/ldso.c @@ -54,7 +54,8 @@ struct rtld_global _rtld_global = struct rtld_global_ro _rtld_global_ro attribute_relro = { - ._dl_pagesize = 0 + ._dl_pagesize = 0, + ._dl_stack_end = NULL #ifdef SHARED , ._dl_run_init_array = _dl_run_init_array, ._dl_run_fini_array = _dl_run_fini_array, diff --git a/libc/misc/internals/__uClibc_main.c b/libc/misc/internals/__uClibc_main.c index 0783c26..4bdc9ea 100644 --- a/libc/misc/internals/__uClibc_main.c +++ b/libc/misc/internals/__uClibc_main.c @@ -42,7 +42,7 @@ #include #ifndef SHARED -void *__libc_stack_end attribute_relro = NULL; +void *_dl_stack_end attribute_relro = NULL; # ifdef __UCLIBC_HAS_SSP__ # include @@ -217,9 +217,13 @@ void __uClibc_init(void) if (__pagesize) return; +#ifdef SHARED + __pagesize = GLRO(dl_pagesize); +#else /* Setup an initial value. This may not be perfect, but is * better than malloc using __pagesize=0 for atexit, ctors, etc. */ __pagesize = PAGE_SIZE; +#endif #ifdef __UCLIBC_HAS_THREADS__ /* Before we start initializing uClibc we have to call @@ -318,7 +322,10 @@ void __uClibc_main(int (*main)(int, char **, char **), int argc, #endif #ifndef SHARED - __libc_stack_end = stack_end; + GLRO(dl_stack_end) = stack_end; +# ifdef __powerpc__ + __libc_stack_end = GLRO(dl_stack_end); +# endif #endif __rtld_fini = rtld_fini; @@ -363,7 +370,10 @@ void __uClibc_main(int (*main)(int, char **, char **), int argc, #ifndef __ARCH_HAS_NO_LDSO__ /* Make certain getpagesize() gives the correct answer */ +# ifndef SHARED + /* for SHARED this was already set in __uClibc_init() */ __pagesize = (auxvt[AT_PAGESZ].a_un.a_val)? auxvt[AT_PAGESZ].a_un.a_val : PAGE_SIZE; +# endif /* Prevent starting SUID binaries where the stdin. stdout, and * stderr file descriptors are not already opened. */ diff --git a/libpthread/linuxthreads/attr.c b/libpthread/linuxthreads/attr.c index 313d850..f142675 100644 --- a/libpthread/linuxthreads/attr.c +++ b/libpthread/linuxthreads/attr.c @@ -435,8 +435,8 @@ int pthread_getattr_np (pthread_t thread, pthread_attr_t *attr) uintptr_t to; if (sscanf (line, "%" SCNxPTR "-%" SCNxPTR, &from, &to) != 2) continue; - if (from <= (uintptr_t) __libc_stack_end - && (uintptr_t) __libc_stack_end < to) + if (from <= (uintptr_t) GLRO(dl_stack_end) + && (uintptr_t) GLRO(dl_stack_end) < to) { /* Found the entry. Now we have the info we need. */ attr->__stacksize = rl.rlim_cur; diff --git a/libpthread/nptl/init.c b/libpthread/nptl/init.c index 379c4bb..6dbe975 100644 --- a/libpthread/nptl/init.c +++ b/libpthread/nptl/init.c @@ -342,7 +342,7 @@ __pthread_initialize_minimal_internal (void) /* Set initial thread's stack block from 0 up to __libc_stack_end. It will be bigger than it actually is, but for unwind.c/pt-longjmp.c purposes this is good enough. */ - THREAD_SETMEM (pd, stackblock_size, (size_t) __libc_stack_end); + THREAD_SETMEM (pd, stackblock_size, (size_t) GLRO(dl_stack_end)); /* Initialize the list of all running threads with the main thread. */ INIT_LIST_HEAD (&__stack_user); diff --git a/libpthread/nptl/pthread_getattr_np.c b/libpthread/nptl/pthread_getattr_np.c index 86a4385..3635aef 100644 --- a/libpthread/nptl/pthread_getattr_np.c +++ b/libpthread/nptl/pthread_getattr_np.c @@ -105,8 +105,8 @@ pthread_getattr_np ( uintptr_t to; if (sscanf (line, "%" SCNxPTR "-%" SCNxPTR, &from, &to) != 2) continue; - if (from <= (uintptr_t) __libc_stack_end - && (uintptr_t) __libc_stack_end < to) + if (from <= (uintptr_t) GLRO(dl_stack_end) + && (uintptr_t) GLRO(dl_stack_end) < to) { /* Found the entry. Now we have the info we need. */ iattr->stacksize = rl.rlim_cur; -- 1.7.3.4 From ps.m at gmx.net Mon Apr 11 11:27:03 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Mon, 11 Apr 2011 13:27:03 +0200 Subject: [git commit future] _exit.c: add ABORT_INSTRUCTION Message-ID: <20110412203911.47B51825A1@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=3c84dc1ede65aaca391a229b96693526bc748aba branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/future Warn if the arch has no __UCLIBC_ABORT_INSTRUCTION__. Run only one syscall, exit_group is not an exclusivity, use it if THREADS are enabled. Guard according header. Signed-off-by: Peter S. Mazinger --- libc/sysdeps/linux/common/_exit.c | 22 +++++++++++++++++++--- 1 files changed, 19 insertions(+), 3 deletions(-) diff --git a/libc/sysdeps/linux/common/_exit.c b/libc/sysdeps/linux/common/_exit.c index 2196a98..c9e73c5 100644 --- a/libc/sysdeps/linux/common/_exit.c +++ b/libc/sysdeps/linux/common/_exit.c @@ -10,17 +10,33 @@ #include #include #include +#include + +#ifdef __UCLIBC_ABORT_INSTRUCTION__ +# define ABORT_INSTRUCTION __asm__(__UCLIBC_ABORT_INSTRUCTION__) +#else +# warning "no abort instruction defined for this arch" +#endif + +/* have to check for kernel 2.5.35 too, since NR was earlier present */ +#if defined __NR_exit_group && __LINUX_KERNEL_VERSION >= 0x020600 \ + && defined __UCLIBC_HAS_THREADS__ +# undef __NR_exit +# define __NR_exit __NR_exit_group +#endif void _exit(int status) { /* The loop is added only to keep gcc happy. */ while(1) { -#if defined __NR_exit_group && defined __UCLIBC_HAS_THREADS_NATIVE__ - INLINE_SYSCALL(exit_group, 1, status); -#endif INLINE_SYSCALL(exit, 1, status); +#ifdef ABORT_INSTRUCTION + ABORT_INSTRUCTION; +#endif } } libc_hidden_def(_exit) +#ifdef __USE_ISOC99 weak_alias(_exit,_Exit) +#endif -- 1.7.3.4 From ps.m at gmx.net Mon Apr 11 11:27:03 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Mon, 11 Apr 2011 13:27:03 +0200 Subject: [git commit ldso-future] getpt.c: no need for hidden posix_openpt Message-ID: <20110412204019.45AA5825A1@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=3981a59eb3efd3af78f4bc7379aec80e0d0275bd branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/ldso-future Prefer static inline instead of hidden (__bsd_getpt) Signed-off-by: Peter S. Mazinger Patch is too large, so refusing to show it From ps.m at gmx.net Mon Apr 11 11:27:03 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Mon, 11 Apr 2011 13:27:03 +0200 Subject: [git commit ldso-future] stdlib.c: remove comment about _Exit, it is provided in _exit.c Message-ID: <20110412204020.22277825A1@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=11e8ad9c4d2242631ff7694b290b9e3951403305 branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/ldso-future Signed-off-by: Peter S. Mazinger --- libc/stdlib/stdlib.c | 11 +---------- 1 files changed, 1 insertions(+), 10 deletions(-) diff --git a/libc/stdlib/stdlib.c b/libc/stdlib/stdlib.c index 6ce04e1..98c202e 100644 --- a/libc/stdlib/stdlib.c +++ b/libc/stdlib/stdlib.c @@ -659,16 +659,7 @@ unsigned long long attribute_hidden __XL_NPP(_stdlib_strto_ll)(register const Wc #endif /* defined(ULLONG_MAX) && (LLONG_MAX > LONG_MAX) */ #endif -/**********************************************************************/ -/* Made _Exit() an alias for _exit(), as per C99. */ -/* #ifdef L__Exit */ -/* void _Exit(int status) */ -/* { */ -/* _exit(status); */ -/* } */ - -/* #endif */ -/**********************************************************************/ + #ifdef L_bsearch void *bsearch(const void *key, const void *base, size_t /* nmemb */ high, -- 1.7.3.4 From ps.m at gmx.net Mon Apr 11 11:27:03 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Mon, 11 Apr 2011 13:27:03 +0200 Subject: [git commit ldso-future] add lcong48[_r] Message-ID: <20110412204019.9A262825A1@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=46374dd9effb20c13e26f70e23f269c14e551cee branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/ldso-future Signed-off-by: Peter S. Mazinger --- libc/stdlib/Makefile.in | 2 +- libc/stdlib/lcong48.c | 29 +++++++++++++++++++++++++++++ 2 files changed, 30 insertions(+), 1 deletions(-) create mode 100644 libc/stdlib/lcong48.c diff --git a/libc/stdlib/Makefile.in b/libc/stdlib/Makefile.in index 760ccf7..4407d63 100644 --- a/libc/stdlib/Makefile.in +++ b/libc/stdlib/Makefile.in @@ -15,7 +15,7 @@ CSRC-y := \ abort.c getenv.c mkdtemp.c realpath.c canonicalize.c mkstemp.c \ rand.c random.c random_r.c setenv.c div.c ldiv.c lldiv.c \ getpt.c drand48-iter.c jrand48.c \ - jrand48_r.c lrand48.c lrand48_r.c mrand48.c mrand48_r.c nrand48.c \ + jrand48_r.c lcong48.c lrand48.c lrand48_r.c mrand48.c mrand48_r.c nrand48.c \ nrand48_r.c rand_r.c srand48.c srand48_r.c seed48.c seed48_r.c \ valloc.c a64l.c l64a.c __uc_malloc.c CSRC-$(UCLIBC_HAS_ADVANCED_REALTIME) += posix_memalign.c diff --git a/libc/stdlib/lcong48.c b/libc/stdlib/lcong48.c new file mode 100644 index 0000000..06cab66 --- /dev/null +++ b/libc/stdlib/lcong48.c @@ -0,0 +1,29 @@ +/* vi: set sw=4 ts=4: */ +/* Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. */ + +#include + +#if defined __USE_SVID || defined __USE_XOPEN +#include +#include +#include + +static int __lcong48_r (unsigned short int param[7], struct drand48_data *buffer) +{ + /* Store the given values. */ + memcpy (buffer->__x, ¶m[0], sizeof (buffer->__x)); + buffer->__a = ((uint64_t) param[5] << 32 | (uint32_t) param[4] << 16 | param[3]); + buffer->__c = param[6]; + buffer->__init = 1; + + return 0; +} +# ifdef __USE_MISC +strong_alias(__lcong48_r,lcong48_r) +# endif + +void lcong48 (unsigned short int param[7]) +{ + (void) __lcong48_r (param, &__libc_drand48_data); +} +#endif -- 1.7.3.4 From ps.m at gmx.net Mon Apr 11 11:27:03 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Mon, 11 Apr 2011 13:27:03 +0200 Subject: [git commit ldso-future] hppa/bits/atomic.h: include errno.h to get EFAULT/ENOSYS Message-ID: <20110412204019.E0A2F825A1@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=09ccda6c11a2a424abe1f1488667a76392ee557e branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/ldso-future Signed-off-by: Peter S. Mazinger --- libc/sysdeps/linux/hppa/bits/atomic.h | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/libc/sysdeps/linux/hppa/bits/atomic.h b/libc/sysdeps/linux/hppa/bits/atomic.h index 87aeb84..08a7c3e 100644 --- a/libc/sysdeps/linux/hppa/bits/atomic.h +++ b/libc/sysdeps/linux/hppa/bits/atomic.h @@ -18,6 +18,7 @@ 02111-1307 USA. */ #include +#include #include #define ABORT_INSTRUCTION __asm__(__UCLIBC_ABORT_INSTRUCTION__) -- 1.7.3.4 From ps.m at gmx.net Mon Apr 11 11:27:03 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Mon, 11 Apr 2011 13:27:03 +0200 Subject: [git commit ldso-future] _exit.c: add ABORT_INSTRUCTION Message-ID: <20110412204020.7092E825A1@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=3c84dc1ede65aaca391a229b96693526bc748aba branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/ldso-future Warn if the arch has no __UCLIBC_ABORT_INSTRUCTION__. Run only one syscall, exit_group is not an exclusivity, use it if THREADS are enabled. Guard according header. Signed-off-by: Peter S. Mazinger --- libc/sysdeps/linux/common/_exit.c | 22 +++++++++++++++++++--- 1 files changed, 19 insertions(+), 3 deletions(-) diff --git a/libc/sysdeps/linux/common/_exit.c b/libc/sysdeps/linux/common/_exit.c index 2196a98..c9e73c5 100644 --- a/libc/sysdeps/linux/common/_exit.c +++ b/libc/sysdeps/linux/common/_exit.c @@ -10,17 +10,33 @@ #include #include #include +#include + +#ifdef __UCLIBC_ABORT_INSTRUCTION__ +# define ABORT_INSTRUCTION __asm__(__UCLIBC_ABORT_INSTRUCTION__) +#else +# warning "no abort instruction defined for this arch" +#endif + +/* have to check for kernel 2.5.35 too, since NR was earlier present */ +#if defined __NR_exit_group && __LINUX_KERNEL_VERSION >= 0x020600 \ + && defined __UCLIBC_HAS_THREADS__ +# undef __NR_exit +# define __NR_exit __NR_exit_group +#endif void _exit(int status) { /* The loop is added only to keep gcc happy. */ while(1) { -#if defined __NR_exit_group && defined __UCLIBC_HAS_THREADS_NATIVE__ - INLINE_SYSCALL(exit_group, 1, status); -#endif INLINE_SYSCALL(exit, 1, status); +#ifdef ABORT_INSTRUCTION + ABORT_INSTRUCTION; +#endif } } libc_hidden_def(_exit) +#ifdef __USE_ISOC99 weak_alias(_exit,_Exit) +#endif -- 1.7.3.4 From rep.dot.nop at gmail.com Wed Apr 13 08:26:38 2011 From: rep.dot.nop at gmail.com (Bernhard Reutner-Fischer) Date: Wed, 13 Apr 2011 10:26:38 +0200 Subject: [git commit] resolv: fix res_close not to hang with ipv6 Message-ID: <20110413082920.3D09B825CB@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=c277cc3c99a2499183fed84cdeb25c45a06f141d branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/master Timo Ter?s writes: The memory release loop is missing an obvious counter increment. Signed-off-by: Bernhard Reutner-Fischer --- libc/inet/resolv.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/libc/inet/resolv.c b/libc/inet/resolv.c index 47bab75..05a1335 100644 --- a/libc/inet/resolv.c +++ b/libc/inet/resolv.c @@ -3008,7 +3008,7 @@ void res_close(void) char *p1 = (char*) &(_res.nsaddr_list[0]); int m = 0; /* free nsaddrs[m] if they do not point to nsaddr_list[x] */ - while (m < ARRAY_SIZE(_res._u._ext.nsaddrs)) { + while (m++ < ARRAY_SIZE(_res._u._ext.nsaddrs)) { char *p2 = (char*)(_res._u._ext.nsaddrs[m]); if (p2 < p1 || (p2 - p1) > sizeof(_res.nsaddr_list)) free(p2); -- 1.7.3.4 From rep.dot.nop at gmail.com Wed Apr 13 08:26:38 2011 From: rep.dot.nop at gmail.com (Bernhard Reutner-Fischer) Date: Wed, 13 Apr 2011 10:26:38 +0200 Subject: [git commit] buildsys: do not use $(and) Message-ID: <20110413082920.A4F2C825CB@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=7da4d1e7553a766f2ddc6a9a7d36423c1cf68a80 branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/master make-3.80 does not have $(and) and $(or), so workaround for now. Signed-off-by: Bernhard Reutner-Fischer --- Rules.mak | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Rules.mak b/Rules.mak index 0aa6843..49ca207 100644 --- a/Rules.mak +++ b/Rules.mak @@ -531,7 +531,7 @@ ifdef LD_FLAG_NO_ASNEEDED export CC_FLAG_NO_ASNEEDED:=-Wl,$(LD_FLAG_NO_ASNEEDED) endif endif -link.asneeded = $(if $(and $(CC_FLAG_ASNEEDED),$(CC_FLAG_NO_ASNEEDED)),$(CC_FLAG_ASNEEDED) $(1) $(CC_FLAG_NO_ASNEEDED)) +link.asneeded = $(if $(findstring yy,$(CC_FLAG_ASNEEDED)$(CC_FLAG_NO_ASNEEDED)),$(CC_FLAG_ASNEEDED) $(1) $(CC_FLAG_NO_ASNEEDED)) # Check for AS_NEEDED support in linker script (binutils>=2.16.1 has it) ifndef ASNEEDED -- 1.7.3.4 From carmelo73 at gmail.com Wed Apr 13 12:44:27 2011 From: carmelo73 at gmail.com (Carmelo Amoroso) Date: Wed, 13 Apr 2011 14:44:27 +0200 Subject: [git commit] resolv: fix res_close not to hang with ipv6 In-Reply-To: <20110413082920.3D09B825CB@busybox.osuosl.org> References: <20110413082920.3D09B825CB@busybox.osuosl.org> Message-ID: <4DA59AAB.2030400@gmail.com> On 13/04/11 10:26, Bernhard Reutner-Fischer wrote: > > commit: http://git.uclibc.org/uClibc/commit/?id=c277cc3c99a2499183fed84cdeb25c45a06f141d > branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/master > > Timo Ter?s writes: > The memory release loop is missing an obvious counter increment. > > Signed-off-by: Bernhard Reutner-Fischer > --- > libc/inet/resolv.c | 2 +- > 1 files changed, 1 insertions(+), 1 deletions(-) > > diff --git a/libc/inet/resolv.c b/libc/inet/resolv.c > index 47bab75..05a1335 100644 > --- a/libc/inet/resolv.c > +++ b/libc/inet/resolv.c > @@ -3008,7 +3008,7 @@ void res_close(void) > char *p1 = (char*) &(_res.nsaddr_list[0]); > int m = 0; > /* free nsaddrs[m] if they do not point to nsaddr_list[x] */ > - while (m < ARRAY_SIZE(_res._u._ext.nsaddrs)) { > + while (m++ < ARRAY_SIZE(_res._u._ext.nsaddrs)) { > char *p2 = (char*)(_res._u._ext.nsaddrs[m]); > if (p2 < p1 || (p2 - p1) > sizeof(_res.nsaddr_list)) > free(p2); Just noted that the git commit subject does not specifies he head (master,prelink, future etc) as before. It was a nice feature. Carmelo From rep.dot.nop at gmail.com Wed Apr 13 17:38:40 2011 From: rep.dot.nop at gmail.com (Bernhard Reutner-Fischer) Date: Wed, 13 Apr 2011 19:38:40 +0200 Subject: [git commit] resolv: really fix res_close not to hang with ipv6 Message-ID: <20110413173905.A34B08255C@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=d37cda884e573638aa3fafcb7505d733cf8d9eae branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/master Fix goof in previous commit. Signed-off-by: Bernhard Reutner-Fischer --- libc/inet/resolv.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/libc/inet/resolv.c b/libc/inet/resolv.c index 05a1335..021d5bf 100644 --- a/libc/inet/resolv.c +++ b/libc/inet/resolv.c @@ -3008,8 +3008,8 @@ void res_close(void) char *p1 = (char*) &(_res.nsaddr_list[0]); int m = 0; /* free nsaddrs[m] if they do not point to nsaddr_list[x] */ - while (m++ < ARRAY_SIZE(_res._u._ext.nsaddrs)) { - char *p2 = (char*)(_res._u._ext.nsaddrs[m]); + while (m < ARRAY_SIZE(_res._u._ext.nsaddrs)) { + char *p2 = (char*)(_res._u._ext.nsaddrs[m++]); if (p2 < p1 || (p2 - p1) > sizeof(_res.nsaddr_list)) free(p2); } -- 1.7.3.4 From rep.dot.nop at gmail.com Thu Apr 14 16:05:17 2011 From: rep.dot.nop at gmail.com (Bernhard Reutner-Fischer) Date: Thu, 14 Apr 2011 18:05:17 +0200 Subject: [git commit] resolv: fix res_close not to hang with ipv6 In-Reply-To: <4DA59AAB.2030400@gmail.com> References: <20110413082920.3D09B825CB@busybox.osuosl.org> <4DA59AAB.2030400@gmail.com> Message-ID: Carmelo Amoroso wrote: >On 13/04/11 10:26, Bernhard Reutner-Fischer wrote: >> >Just noted that the git commit subject does not specifies he head >(master,prelink, future etc) as before. >It was a nice feature. Hm, master was never prefixed as opposed to branches. Are you sure that this does not work for branches anymore? > >Carmelo > >_______________________________________________ >uClibc-cvs mailing list >uClibc-cvs at uclibc.org >http://lists.busybox.net/mailman/listinfo/uclibc-cvs From ps.m at gmx.net Wed Apr 13 17:38:40 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Wed, 13 Apr 2011 19:38:40 +0200 Subject: [git commit future] getgroups.c: reorganize, include param.h instead of defining MIN Message-ID: <20110414223530.3958982631@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=804c1b0a31b2763d001841205dd6bac534201c76 branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/future Include only what is necessary. Mark __syscall_getgroups __always_inline. Signed-off-by: Peter S. Mazinger --- libc/sysdeps/linux/common/getgroups.c | 16 +++++++--------- 1 files changed, 7 insertions(+), 9 deletions(-) diff --git a/libc/sysdeps/linux/common/getgroups.c b/libc/sysdeps/linux/common/getgroups.c index ddc2cae..87fecce 100644 --- a/libc/sysdeps/linux/common/getgroups.c +++ b/libc/sysdeps/linux/common/getgroups.c @@ -8,10 +8,7 @@ */ #include -#include #include -#include - #if defined(__NR_getgroups32) # undef __NR_getgroups @@ -22,12 +19,14 @@ _syscall2(int, getgroups, int, size, gid_t *, list) _syscall2(int, getgroups, int, size, gid_t *, list) #else +# include +# include +# include +# include -#define MIN(a,b) (((a)<(b))?(a):(b)) - -#define __NR___syscall_getgroups __NR_getgroups -static __inline__ _syscall2(int, __syscall_getgroups, - int, size, __kernel_gid_t *, list) +# define __NR___syscall_getgroups __NR_getgroups +static __always_inline +_syscall2(int, __syscall_getgroups, int, size, __kernel_gid_t *, list) int getgroups(int size, gid_t groups[]) { @@ -56,5 +55,4 @@ ret_error: } } #endif - libc_hidden_def(getgroups) -- 1.7.3.4 From ps.m at gmx.net Wed Apr 13 17:38:40 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Wed, 13 Apr 2011 19:38:40 +0200 Subject: [git commit future] add LDSO_SAFE_RUNPATH config option Message-ID: <20110414223530.A0DEE801A3@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=97318fee8957fad2dec853fe57c054b6111daa48 branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/future Signed-off-by: Peter S. Mazinger --- extra/Configs/Config.in | 7 +++++++ ldso/ldso/dl-elf.c | 7 +++++-- test/Rules.mak | 27 ++++++++++++++++++--------- 3 files changed, 30 insertions(+), 11 deletions(-) diff --git a/extra/Configs/Config.in b/extra/Configs/Config.in index ac9fd13..bb1ec8b 100644 --- a/extra/Configs/Config.in +++ b/extra/Configs/Config.in @@ -375,6 +375,13 @@ config LDSO_RUNPATH Usage of RUNPATH tags is not too common, so disabling this feature should be safe for most people. +config LDSO_SAFE_RUNPATH + bool "Allow only RUNPATH beginning with /" + depends on LDSO_RUNPATH + default y + help + Allow only absolute path in RPATH/RUNPATH. + config LDSO_SEARCH_INTERP_PATH bool "Add ldso path to lib search path" depends on HAVE_SHARED diff --git a/ldso/ldso/dl-elf.c b/ldso/ldso/dl-elf.c index 7b715ee..ec4f1a5 100644 --- a/ldso/ldso/dl-elf.c +++ b/ldso/ldso/dl-elf.c @@ -174,8 +174,11 @@ search_for_named_library(const char *name, int secure, const char *path_list, _dl_strcpy(mylibname, "."); /* Assume current dir if empty path */ _dl_strcat(mylibname, "/"); _dl_strcat(mylibname, name); - if ((tpnt = _dl_load_elf_shared_library(secure, rpnt, mylibname)) != NULL) - return tpnt; +#ifdef __LDSO_SAFE_RUNPATH__ + if (*mylibname == '/') +#endif + if ((tpnt = _dl_load_elf_shared_library(secure, rpnt, mylibname)) != NULL) + return tpnt; path_n = path+1; } path++; diff --git a/test/Rules.mak b/test/Rules.mak index 2131a7b..6536a92 100644 --- a/test/Rules.mak +++ b/test/Rules.mak @@ -8,18 +8,28 @@ .SUFFIXES: top_builddir ?= ../ +abs_top_builddir ?= $(shell cd $(top_builddir); pwd)/ TESTDIR=$(top_builddir)test/ include $(top_builddir)/Rules.mak -ifndef TEST_INSTALLED_UCLIBC ifdef UCLIBC_LDSO ifeq (,$(findstring /,$(UCLIBC_LDSO))) -UCLIBC_LDSO := $(top_builddir)lib/$(UCLIBC_LDSO) +UCLIBC_LDSO := $(UCLIBC_LDSO) +else +UCLIBC_LDSO := $(notdir $(UCLIBC_LDSO)) +endif +else +UCLIBC_LDSO := $(notdir $(firstword $(wildcard $(top_builddir)lib/ld*))) endif +ifndef TEST_INSTALLED_UCLIBC +ifeq ($(LDSO_SAFE_RUNPATH),y) +UCLIBC_PATH := $(abs_top_builddir)lib else -UCLIBC_LDSO := $(firstword $(wildcard $(top_builddir)lib/ld*)) +UCLIBC_PATH := $(top_builddir)lib endif +else +UCLIBC_PATH := $(RUNTIME_PREFIX)$(MULTILIB_DIR) endif #-------------------------------------------------------- # Ensure consistent sort order, 'gcc -print-search-dirs' behavior, etc. @@ -81,15 +91,14 @@ ifneq ($(HAVE_SHARED),y) LDFLAGS += -Wl,-static -static-libgcc endif -LDFLAGS += -B$(top_builddir)lib -Wl,-rpath,$(top_builddir)lib -Wl,-rpath-link,$(top_builddir)lib -UCLIBC_LDSO_ABSPATH=$(shell pwd) -ifdef TEST_INSTALLED_UCLIBC -LDFLAGS += -Wl,-rpath,./ -UCLIBC_LDSO_ABSPATH=$(RUNTIME_PREFIX)$(MULTILIB_DIR) +ifndef TEST_INSTALLED_UCLIBC +LDFLAGS += -B$(UCLIBC_PATH) -Wl,-rpath,$(UCLIBC_PATH):$(shell pwd) -Wl,-rpath-link,$(UCLIBC_PATH):$(shell pwd) +else +LDFLAGS += -Wl,-rpath,$(shell pwd) endif ifeq ($(findstring -static,$(LDFLAGS)),) -LDFLAGS += -Wl,--dynamic-linker,$(UCLIBC_LDSO_ABSPATH)/$(UCLIBC_LDSO) +LDFLAGS += -Wl,--dynamic-linker,$(UCLIBC_PATH)/$(UCLIBC_LDSO) endif ifeq ($(LDSO_GNU_HASH_SUPPORT),y) -- 1.7.3.4 From ps.m at gmx.net Wed Apr 13 17:38:40 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Wed, 13 Apr 2011 19:38:40 +0200 Subject: [git commit future] get_kernel_syms.c: reorganize, no need for attribute_unused in prototype Message-ID: <20110414223530.6623B82631@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=8a329cfed233ee20a39f3bc5b0385d8921ea9a65 branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/future Signed-off-by: Peter S. Mazinger --- libc/sysdeps/linux/common/get_kernel_syms.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/libc/sysdeps/linux/common/get_kernel_syms.c b/libc/sysdeps/linux/common/get_kernel_syms.c index 6124a81..740b8d3 100644 --- a/libc/sysdeps/linux/common/get_kernel_syms.c +++ b/libc/sysdeps/linux/common/get_kernel_syms.c @@ -9,8 +9,8 @@ #include -struct kernel_sym; -int get_kernel_syms(struct kernel_sym *table attribute_unused); #ifdef __NR_get_kernel_syms +struct kernel_sym; +int get_kernel_syms(struct kernel_sym *table); _syscall1(int, get_kernel_syms, struct kernel_sym *, table) #endif -- 1.7.3.4 From ps.m at gmx.net Wed Apr 13 17:38:40 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Wed, 13 Apr 2011 19:38:40 +0200 Subject: [git commit future] tempname.c: remove unneeded attribute_hidden, change type to unsigned Message-ID: <20110414223531.2293B81D3A@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=31b3d08defe4b76946aa966de443321326b019c7 branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/future Signed-off-by: Peter S. Mazinger --- libc/misc/internals/tempname.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/libc/misc/internals/tempname.c b/libc/misc/internals/tempname.c index 59e4e7c..536bc83 100644 --- a/libc/misc/internals/tempname.c +++ b/libc/misc/internals/tempname.c @@ -58,7 +58,7 @@ static int direxists (const char *dir) for use with mk[s]temp. Will fail (-1) if DIR is non-null and doesn't exist, none of the searched dirs exists, or there's not enough space in TMPL. */ -int attribute_hidden ___path_search (char *tmpl, size_t tmpl_len, const char *dir, +int ___path_search (char *tmpl, size_t tmpl_len, const char *dir, const char *pfx /*, int try_tmpdir*/) { /*const char *d; */ @@ -196,7 +196,7 @@ int __gen_tempname (char *tmpl, int kind, mode_t mode) } for (i = 0; i < TMP_MAX; ++i) { - int j; + unsigned int j; /* Get some random data. */ if (fillrand(randomness, sizeof(randomness)) != sizeof(randomness)) { /* if random device nodes failed us, lets use the braindamaged ver */ -- 1.7.3.4 From ps.m at gmx.net Wed Apr 13 17:38:40 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Wed, 13 Apr 2011 19:38:40 +0200 Subject: [git commit future] wordexp.c: use vfork instead of fork on non-MMU archs Message-ID: <20110414223530.D93A081D3A@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=24cb8a9f360c5c4e552909f9304826b9a14b91b2 branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/future Signed-off-by: Peter S. Mazinger --- libc/misc/wordexp/wordexp.c | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-) diff --git a/libc/misc/wordexp/wordexp.c b/libc/misc/wordexp/wordexp.c index d063469..e1385be 100644 --- a/libc/misc/wordexp/wordexp.c +++ b/libc/misc/wordexp/wordexp.c @@ -36,6 +36,10 @@ #include #include +#ifndef __ARCH_USE_MMU__ +# define fork vfork +#endif + #define __WORDEXP_FULL /* -- 1.7.3.4 From ps.m at gmx.net Wed Apr 13 17:38:40 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Wed, 13 Apr 2011 19:38:40 +0200 Subject: [git commit future] make UCLIBC_HAS_PROGRAM_INVOCATION_NAME and UCLIBC_HAS___PROGNAME independent options Message-ID: <20110414223531.8C6ED81D3A@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=14858e1fba60c0f46c0807d89cf5fad54035e3a2 branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/future Signed-off-by: Peter S. Mazinger --- extra/Configs/Config.in | 1 - include/errno.h | 3 +++ libc/misc/internals/__uClibc_main.c | 31 ++++++++++++++++++------------- utils/getconf.c | 6 ++---- 4 files changed, 23 insertions(+), 18 deletions(-) diff --git a/extra/Configs/Config.in b/extra/Configs/Config.in index bb1ec8b..5184fe4 100644 --- a/extra/Configs/Config.in +++ b/extra/Configs/Config.in @@ -715,7 +715,6 @@ config UCLIBC_HAS_PROGRAM_INVOCATION_NAME config UCLIBC_HAS___PROGNAME bool "Support for __progname" default y - depends on UCLIBC_HAS_PROGRAM_INVOCATION_NAME help Some packages (like openssh) like to peek into internal libc symbols to make their output a bit more user friendly. diff --git a/include/errno.h b/include/errno.h index 7e1f583..5340601 100644 --- a/include/errno.h +++ b/include/errno.h @@ -47,6 +47,9 @@ __BEGIN_DECLS extern int errno; #endif +#ifdef _LIBC +extern const char *__progname, __progname_full; +#endif #if defined __USE_GNU && defined __UCLIBC_HAS_PROGRAM_INVOCATION_NAME__ /* The full and simple forms of the name with which the program was diff --git a/libc/misc/internals/__uClibc_main.c b/libc/misc/internals/__uClibc_main.c index 0716dff..fbb25ab 100644 --- a/libc/misc/internals/__uClibc_main.c +++ b/libc/misc/internals/__uClibc_main.c @@ -140,14 +140,19 @@ extern void (*__fini_array_end []) (void) attribute_hidden; # endif #endif -attribute_hidden const char *__uclibc_progname = ""; -#ifdef __UCLIBC_HAS_PROGRAM_INVOCATION_NAME__ -const char *program_invocation_short_name = ""; -const char *program_invocation_name = ""; +const char *__uclibc_progname = ""; +#if !defined __UCLIBC_HAS___PROGNAME__ && defined __USE_GNU && defined __UCLIBC_HAS_PROGRAM_INVOCATION_NAME__ +# define __progname program_invocation_short_name +# define __progname_full program_invocation_name #endif -#ifdef __UCLIBC_HAS___PROGNAME__ -weak_alias (program_invocation_short_name, __progname) -weak_alias (program_invocation_name, __progname_full) +#if defined __UCLIBC_HAS___PROGNAME__ || (defined __USE_GNU && defined __UCLIBC_HAS_PROGRAM_INVOCATION_NAME__) +const char *__progname = ""; +/* psm: why have a visible __progname_full? */ +const char *__progname_full = ""; +# if defined __UCLIBC_HAS___PROGNAME__ && defined __USE_GNU && defined __UCLIBC_HAS_PROGRAM_INVOCATION_NAME__ +weak_alias (__progname, program_invocation_short_name) +weak_alias (__progname_full, program_invocation_name) +# endif #endif /* @@ -380,14 +385,14 @@ void __uClibc_main(int (*main)(int, char **, char **), int argc, #endif __uclibc_progname = *argv; -#ifdef __UCLIBC_HAS_PROGRAM_INVOCATION_NAME__ +#if defined __UCLIBC_HAS___PROGNAME__ || (defined __USE_GNU && defined __UCLIBC_HAS_PROGRAM_INVOCATION_NAME__) if (*argv != NULL) { - program_invocation_name = *argv; - program_invocation_short_name = strrchr(*argv, '/'); - if (program_invocation_short_name != NULL) - ++program_invocation_short_name; + __progname_full = *argv; + __progname = strrchr(*argv, '/'); + if (__progname != NULL) + ++__progname; else - program_invocation_short_name = program_invocation_name; + __progname = *argv; } #endif diff --git a/utils/getconf.c b/utils/getconf.c index 8addf31..90fcb67 100644 --- a/utils/getconf.c +++ b/utils/getconf.c @@ -1055,10 +1055,8 @@ static const struct { const char *name; int num; } specs[] = }; static const int nspecs = sizeof (specs) / sizeof (specs[0]); -#ifdef __UCLIBC_HAS___PROGNAME__ -extern const char *__progname; -#else -#define __progname "foo" +#ifndef __UCLIBC_HAS___PROGNAME__ +static const char *__progname = "getconf" #endif static attribute_noreturn void -- 1.7.3.4 From ps.m at gmx.net Wed Apr 13 17:38:40 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Wed, 13 Apr 2011 19:38:40 +0200 Subject: [git commit future] syslog.c: disable locking in setlogmask Message-ID: <20110414223532.3DFAB81D3A@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=ff7e8674a985002ce9693b64f900dedbb4581aed branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/future Signed-off-by: Peter S. Mazinger --- libc/misc/syslog/syslog.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/libc/misc/syslog/syslog.c b/libc/misc/syslog/syslog.c index f79b92f..ce4c44a 100644 --- a/libc/misc/syslog/syslog.c +++ b/libc/misc/syslog/syslog.c @@ -339,9 +339,9 @@ int setlogmask(int pmask) omask = LogMask; if (pmask != 0) { - __UCLIBC_MUTEX_LOCK(mylock); +/* __UCLIBC_MUTEX_LOCK(mylock);*/ LogMask = pmask; - __UCLIBC_MUTEX_UNLOCK(mylock); +/* __UCLIBC_MUTEX_UNLOCK(mylock);*/ } return omask; } -- 1.7.3.4 From ps.m at gmx.net Wed Apr 13 17:38:40 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Wed, 13 Apr 2011 19:38:40 +0200 Subject: [git commit future] syslog.c: no need for hidden vsyslog, use a static __vsyslog instead Message-ID: <20110414223531.B585781D3A@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=f0b612388c97db865dd82a274b43b2753a5e5084 branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/future It is only used within the same file. Guard the visible version according to header. Signed-off-by: Peter S. Mazinger --- include/sys/syslog.h | 1 - libc/misc/syslog/syslog.c | 12 +++++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/include/sys/syslog.h b/include/sys/syslog.h index 8fc7688..29a1233 100644 --- a/include/sys/syslog.h +++ b/include/sys/syslog.h @@ -208,7 +208,6 @@ libc_hidden_proto(syslog) therefore not marked with __THROW. */ extern void vsyslog (int __pri, __const char *__fmt, __gnuc_va_list __ap) __attribute__ ((__format__ (__printf__, 2, 0))); -libc_hidden_proto(vsyslog) #endif __END_DECLS diff --git a/libc/misc/syslog/syslog.c b/libc/misc/syslog/syslog.c index 1b109e5..f79b92f 100644 --- a/libc/misc/syslog/syslog.c +++ b/libc/misc/syslog/syslog.c @@ -181,8 +181,12 @@ libc_hidden_def(openlog) * syslog, vsyslog -- * print message on log file; output is intended for syslogd(8). */ +static +#ifndef __USE_BSD +__always_inline +#endif void -vsyslog(int pri, const char *fmt, va_list ap) +__vsyslog(int pri, const char *fmt, va_list ap) { register char *p; char *last_chr, *head_end, *end, *stdp; @@ -301,7 +305,9 @@ vsyslog(int pri, const char *fmt, va_list ap) getout: __UCLIBC_MUTEX_UNLOCK(mylock); } -libc_hidden_def(vsyslog) +#ifdef __USE_BSD +strong_alias(__vsyslog,vsyslog) +#endif void syslog(int pri, const char *fmt, ...) @@ -309,7 +315,7 @@ syslog(int pri, const char *fmt, ...) va_list ap; va_start(ap, fmt); - vsyslog(pri, fmt, ap); + __vsyslog(pri, fmt, ap); va_end(ap); } libc_hidden_def(syslog) -- 1.7.3.4 From ps.m at gmx.net Wed Apr 13 17:38:40 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Wed, 13 Apr 2011 19:38:40 +0200 Subject: [git commit future] ssp-local.c: make sure that -fstack-protector is not enabled when compiling file Message-ID: <20110414223532.0609681D3A@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=f09787cc860748b24aa76b8b743b3de42e60d522 branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/future Signed-off-by: Peter S. Mazinger --- libc/sysdeps/linux/common/ssp-local.c | 6 +++++- 1 files changed, 5 insertions(+), 1 deletions(-) diff --git a/libc/sysdeps/linux/common/ssp-local.c b/libc/sysdeps/linux/common/ssp-local.c index 6b1809a..bea11a8 100644 --- a/libc/sysdeps/linux/common/ssp-local.c +++ b/libc/sysdeps/linux/common/ssp-local.c @@ -21,6 +21,10 @@ * copied stack_chk_fail_local.c from glibc and adapted for uClibc */ +#if defined __SSP__ || defined __SSP_ALL__ +# error "file must not be compiled with stack protection enabled on it. Use -fno-stack-protector" +#endif + #include /* On some architectures, this helps needless PIC pointer setup @@ -29,5 +33,5 @@ void __stack_chk_fail_local (void) attribute_noreturn attribute_hidden; void __stack_chk_fail_local (void) { - __stack_chk_fail (); + __stack_chk_fail (); } -- 1.7.3.4 From ps.m at gmx.net Wed Apr 13 17:38:40 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Wed, 13 Apr 2011 19:38:40 +0200 Subject: [git commit future] ssp: rework, sync messages with the ones in glibc Message-ID: <20110414223532.75C9C81D3A@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=d19a7de0b1b3069061a32908e35e566fb1a0b48d branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/future Touch signals only if DODEBUG is enabled. Make the signal selection dependent on DODEBUG, as last resort use SIGKILL. Use internal functions with less arguments, some savings. Fix a warning about unused argument. Do not use openlog/closelog, while there remove their hidden versions. Signed-off-by: Peter S. Mazinger --- extra/Configs/Config.in | 4 +- include/sys/syslog.h | 2 - libc/misc/syslog/syslog.c | 2 - libc/sysdeps/linux/common/ssp.c | 121 +++++++++++++++++++++------------------ 4 files changed, 68 insertions(+), 61 deletions(-) diff --git a/extra/Configs/Config.in b/extra/Configs/Config.in index 5184fe4..a0d2c7d 100644 --- a/extra/Configs/Config.in +++ b/extra/Configs/Config.in @@ -2107,8 +2107,8 @@ config SSP_QUICK_CANARY choice prompt "Propolice protection blocking signal" depends on UCLIBC_HAS_SSP - default PROPOLICE_BLOCK_ABRT if ! DODEBUG - default PROPOLICE_BLOCK_SEGV if DODEBUG + depends on DODEBUG + default PROPOLICE_BLOCK_SEGV help "abort" use SIGABRT to block offending programs. This is the default implementation. diff --git a/include/sys/syslog.h b/include/sys/syslog.h index 29a1233..fb8c500 100644 --- a/include/sys/syslog.h +++ b/include/sys/syslog.h @@ -179,14 +179,12 @@ __BEGIN_DECLS This function is a possible cancellation point and therefore not marked with __THROW. */ extern void closelog (void); -libc_hidden_proto(closelog) /* Open connection to system logger. This function is a possible cancellation point and therefore not marked with __THROW. */ extern void openlog (__const char *__ident, int __option, int __facility); -libc_hidden_proto(openlog) /* Set the log mask level. */ extern int setlogmask (int __mask) __THROW; diff --git a/libc/misc/syslog/syslog.c b/libc/misc/syslog/syslog.c index ce4c44a..1ab4707 100644 --- a/libc/misc/syslog/syslog.c +++ b/libc/misc/syslog/syslog.c @@ -175,7 +175,6 @@ openlog(const char *ident, int logstat, int logfac) openlog_intern(ident, logstat, logfac); __UCLIBC_MUTEX_UNLOCK(mylock); } -libc_hidden_def(openlog) /* * syslog, vsyslog -- @@ -330,7 +329,6 @@ closelog(void) closelog_intern(0); /* 0: reset LogXXX globals to default */ __UCLIBC_MUTEX_UNLOCK(mylock); } -libc_hidden_def(closelog) /* setlogmask -- set the log mask level */ int setlogmask(int pmask) diff --git a/libc/sysdeps/linux/common/ssp.c b/libc/sysdeps/linux/common/ssp.c index 07513e7..8dcc3dc 100644 --- a/libc/sysdeps/linux/common/ssp.c +++ b/libc/sysdeps/linux/common/ssp.c @@ -20,102 +20,113 @@ #error "file must not be compiled with stack protection enabled on it. Use -fno-stack-protector" #endif +#include +#include +#include +#ifdef __UCLIBC_HAS_SYSLOG__ +#include +#endif + #ifdef __PROPOLICE_BLOCK_SEGV__ # define SSP_SIGTYPE SIGSEGV #else # define SSP_SIGTYPE SIGABRT #endif -#include -#include -#include -#if defined __UCLIBC_HAS_SYSLOG__ -#include +static void do_write(const char *msg) +{ + /* could use inlined syscall here to be sure ... */ + return (void) write(STDERR_FILENO, msg, strlen(msg)); +} +static void __cold do_msg(const char *msg1, const char *msg2, const char *msg3) +{ + do_write(msg1); + do_write(msg2); + do_write(msg3); + do_write("\n"); +#ifdef __UCLIBC_HAS_SYSLOG__ + syslog(LOG_INFO, "%s%s%s()", msg1, msg2, msg3); #endif +} - -static void block_signals(void) +static void __cold attribute_noreturn +#ifdef __UCLIBC_HAS_SSP_COMPAT__ +ssp_handler(char func[]) +#else +ssp_handler(void) +#endif { + pid_t pid; + static const char msg_ssd[] = "*** stack smashing detected ***: "; + static const char msg_terminated[] = " terminated"; +#ifdef __UCLIBC_HAS_SSP_COMPAT__ + static const char msg_ssa[] = ": stack smashing attack in function "; +#endif + +#ifdef __DODEBUG__ struct sigaction sa; sigset_t mask; __sigfillset(&mask); __sigdelset(&mask, SSP_SIGTYPE); /* Block all signal handlers */ sigprocmask(SIG_BLOCK, &mask, NULL); /* except SSP_SIGTYPE */ +#endif + +#ifdef __UCLIBC_HAS_SSP_COMPAT__ + if (func != NULL) + do_msg(__uclibc_progname, msg_ssa, func); + else +#endif + do_msg(msg_ssd, __uclibc_progname, msg_terminated); + pid = getpid(); +#ifdef __DODEBUG__ /* Make the default handler associated with the signal handler */ memset(&sa, 0, sizeof(sa)); __sigfillset(&sa.sa_mask); /* Block all signals */ if (SIG_DFL) /* if it's constant zero, it's already done */ sa.sa_handler = SIG_DFL; - sigaction(SSP_SIGTYPE, &sa, NULL); -} - -static void __cold ssp_write(int fd, const char *msg1, const char *msg2, const char *msg3) -{ - write(fd, msg1, strlen(msg1)); - write(fd, msg2, strlen(msg2)); - write(fd, msg3, strlen(msg3)); - write(fd, "()\n", 3); -#if defined __UCLIBC_HAS_SYSLOG__ - openlog("ssp", LOG_CONS | LOG_PID, LOG_USER); - syslog(LOG_INFO, "%s%s%s()", msg1, msg2, msg3); - closelog(); + if (sigaction(SSP_SIGTYPE, &sa, NULL) == 0) + (void)kill(pid, SSP_SIGTYPE); #endif -} - -static attribute_noreturn void terminate(void) -{ - (void) kill(getpid(), SSP_SIGTYPE); - _exit(127); + (void)kill(pid, SIGKILL); + /* The loop is added only to keep gcc happy. */ + while(1) + _exit(127); } #ifdef __UCLIBC_HAS_SSP_COMPAT__ -void __stack_smash_handler(char func[], int damaged __attribute__ ((unused))) attribute_noreturn __cold; -void __stack_smash_handler(char func[], int damaged) +void __stack_smash_handler(char func[], int damaged) attribute_noreturn __cold; +void __stack_smash_handler(char func[], int damaged attribute_unused) { - static const char message[] = ": stack smashing attack in function "; - - block_signals(); - - ssp_write(STDERR_FILENO, __uclibc_progname, message, func); - - /* The loop is added only to keep gcc happy. */ - while(1) - terminate(); + ssp_handler(func); } -#endif -#ifdef __UCLIBC_HAS_SSP__ void __stack_chk_fail(void) { - static const char msg1[] = "stack smashing detected: "; - static const char msg3[] = " terminated"; - - block_signals(); - - ssp_write(STDERR_FILENO, msg1, __uclibc_progname, msg3); - - /* The loop is added only to keep gcc happy. */ - while(1) - terminate(); + ssp_handler(NULL); } +#else +strong_alias(ssp_handler,__stack_chk_fail) #endif #ifdef __UCLIBC_HAS_FORTIFY__ +/* should be redone when activated to use common code above. + * for now, it works without debugging support */ void __chk_fail(void) { - static const char msg1[] = "buffer overflow detected: "; - static const char msg3[] = " terminated"; - - block_signals(); + static const char msg_fail[] = "*** buffer overflow detected ***: "; + static const char msg_terminated[] = " terminated"; + pid_t pid; - ssp_write(STDERR_FILENO, msg1, __uclibc_progname, msg3); + do_msg(msg_fail, __uclibc_progname, msg_terminated); + pid = getpid(); + (void)kill(pid, SIGKILL); /* The loop is added only to keep gcc happy. */ while(1) - terminate(); + _exit(127); } libc_hidden_def(__chk_fail) #endif -- 1.7.3.4 From ps.m at gmx.net Wed Apr 13 17:38:40 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Wed, 13 Apr 2011 19:38:40 +0200 Subject: [git commit future] types.h: both icc and tendra support long long Message-ID: <20110414223532.A565181D3A@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=b789960767f17a858e957129926274dc02983d95 branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/future Signed-off-by: Peter S. Mazinger --- include/sys/types.h | 4 ++-- libc/sysdeps/linux/common/bits/types.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/include/sys/types.h b/include/sys/types.h index 7e29dc8..2d5eabc 100644 --- a/include/sys/types.h +++ b/include/sys/types.h @@ -165,7 +165,7 @@ typedef short int int16_t; typedef int int32_t; # if __WORDSIZE == 64 typedef long int int64_t; -# elif defined __GNUC__ || defined __ICC +# elif defined __GNUC__ || defined __ICC || defined __TenDRA__ __extension__ typedef long long int int64_t; # endif # endif @@ -176,7 +176,7 @@ typedef unsigned short int u_int16_t; typedef unsigned int u_int32_t; # if __WORDSIZE == 64 typedef unsigned long int u_int64_t; -# elif defined __GNUC__ || defined __ICC +# elif defined __GNUC__ || defined __ICC || defined __TenDRA__ __extension__ typedef unsigned long long int u_int64_t; # endif diff --git a/libc/sysdeps/linux/common/bits/types.h b/libc/sysdeps/linux/common/bits/types.h index c4c10e2..b50e090 100644 --- a/libc/sysdeps/linux/common/bits/types.h +++ b/libc/sysdeps/linux/common/bits/types.h @@ -49,7 +49,7 @@ typedef unsigned int __uint32_t; #if __WORDSIZE == 64 typedef signed long int __int64_t; typedef unsigned long int __uint64_t; -#elif defined(__GNUC__) +#elif defined(__GNUC__) || defined __ICC || defined __TenDRA__ __extension__ typedef signed long long int __int64_t; __extension__ typedef unsigned long long int __uint64_t; #endif @@ -58,7 +58,7 @@ __extension__ typedef unsigned long long int __uint64_t; #if __WORDSIZE == 64 typedef long int __quad_t; typedef unsigned long int __u_quad_t; -#elif defined(__GNUC__) +#elif defined(__GNUC__) || defined __ICC || defined __TenDRA__ __extension__ typedef long long int __quad_t; __extension__ typedef unsigned long long int __u_quad_t; #else -- 1.7.3.4 From rep.dot.nop at gmail.com Wed Apr 13 17:38:40 2011 From: rep.dot.nop at gmail.com (Bernhard Reutner-Fischer) Date: Wed, 13 Apr 2011 19:38:40 +0200 Subject: [git commit future] resolv: fix res_close not to hang with ipv6 Message-ID: <20110414224208.079FA825B6@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=c277cc3c99a2499183fed84cdeb25c45a06f141d branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/future Timo Ter?s writes: The memory release loop is missing an obvious counter increment. Signed-off-by: Bernhard Reutner-Fischer Patch is too large, so refusing to show it From rep.dot.nop at gmail.com Wed Apr 13 17:38:40 2011 From: rep.dot.nop at gmail.com (Bernhard Reutner-Fischer) Date: Wed, 13 Apr 2011 19:38:40 +0200 Subject: [git commit future] buildsys: do not use $(and) Message-ID: <20110414224208.503F6825B6@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=7da4d1e7553a766f2ddc6a9a7d36423c1cf68a80 branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/future make-3.80 does not have $(and) and $(or), so workaround for now. Signed-off-by: Bernhard Reutner-Fischer --- Rules.mak | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Rules.mak b/Rules.mak index 0aa6843..49ca207 100644 --- a/Rules.mak +++ b/Rules.mak @@ -531,7 +531,7 @@ ifdef LD_FLAG_NO_ASNEEDED export CC_FLAG_NO_ASNEEDED:=-Wl,$(LD_FLAG_NO_ASNEEDED) endif endif -link.asneeded = $(if $(and $(CC_FLAG_ASNEEDED),$(CC_FLAG_NO_ASNEEDED)),$(CC_FLAG_ASNEEDED) $(1) $(CC_FLAG_NO_ASNEEDED)) +link.asneeded = $(if $(findstring yy,$(CC_FLAG_ASNEEDED)$(CC_FLAG_NO_ASNEEDED)),$(CC_FLAG_ASNEEDED) $(1) $(CC_FLAG_NO_ASNEEDED)) # Check for AS_NEEDED support in linker script (binutils>=2.16.1 has it) ifndef ASNEEDED -- 1.7.3.4 From rep.dot.nop at gmail.com Wed Apr 13 17:38:40 2011 From: rep.dot.nop at gmail.com (Bernhard Reutner-Fischer) Date: Wed, 13 Apr 2011 19:38:40 +0200 Subject: [git commit future] resolv: really fix res_close not to hang with ipv6 Message-ID: <20110414224208.8303A825B6@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=d37cda884e573638aa3fafcb7505d733cf8d9eae branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/future Fix goof in previous commit. Signed-off-by: Bernhard Reutner-Fischer --- libc/inet/resolv.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/libc/inet/resolv.c b/libc/inet/resolv.c index 05a1335..021d5bf 100644 --- a/libc/inet/resolv.c +++ b/libc/inet/resolv.c @@ -3008,8 +3008,8 @@ void res_close(void) char *p1 = (char*) &(_res.nsaddr_list[0]); int m = 0; /* free nsaddrs[m] if they do not point to nsaddr_list[x] */ - while (m++ < ARRAY_SIZE(_res._u._ext.nsaddrs)) { - char *p2 = (char*)(_res._u._ext.nsaddrs[m]); + while (m < ARRAY_SIZE(_res._u._ext.nsaddrs)) { + char *p2 = (char*)(_res._u._ext.nsaddrs[m++]); if (p2 < p1 || (p2 - p1) > sizeof(_res.nsaddr_list)) free(p2); } -- 1.7.3.4 From ps.m at gmx.net Wed Apr 13 17:38:40 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Wed, 13 Apr 2011 19:38:40 +0200 Subject: [git commit ldso-future] getgroups.c: reorganize, include param.h instead of defining MIN Message-ID: <20110414224222.45027825B6@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=804c1b0a31b2763d001841205dd6bac534201c76 branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/ldso-future Include only what is necessary. Mark __syscall_getgroups __always_inline. Signed-off-by: Peter S. Mazinger Patch is too large, so refusing to show it From ps.m at gmx.net Wed Apr 13 17:38:40 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Wed, 13 Apr 2011 19:38:40 +0200 Subject: [git commit ldso-future] get_kernel_syms.c: reorganize, no need for attribute_unused in prototype Message-ID: <20110414224222.77D25825B6@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=8a329cfed233ee20a39f3bc5b0385d8921ea9a65 branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/ldso-future Signed-off-by: Peter S. Mazinger --- libc/sysdeps/linux/common/get_kernel_syms.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/libc/sysdeps/linux/common/get_kernel_syms.c b/libc/sysdeps/linux/common/get_kernel_syms.c index 6124a81..740b8d3 100644 --- a/libc/sysdeps/linux/common/get_kernel_syms.c +++ b/libc/sysdeps/linux/common/get_kernel_syms.c @@ -9,8 +9,8 @@ #include -struct kernel_sym; -int get_kernel_syms(struct kernel_sym *table attribute_unused); #ifdef __NR_get_kernel_syms +struct kernel_sym; +int get_kernel_syms(struct kernel_sym *table); _syscall1(int, get_kernel_syms, struct kernel_sym *, table) #endif -- 1.7.3.4 From ps.m at gmx.net Wed Apr 13 17:38:40 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Wed, 13 Apr 2011 19:38:40 +0200 Subject: [git commit ldso-future] add LDSO_SAFE_RUNPATH config option Message-ID: <20110414224222.A8BCE82631@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=97318fee8957fad2dec853fe57c054b6111daa48 branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/ldso-future Signed-off-by: Peter S. Mazinger --- extra/Configs/Config.in | 7 +++++++ ldso/ldso/dl-elf.c | 7 +++++-- test/Rules.mak | 27 ++++++++++++++++++--------- 3 files changed, 30 insertions(+), 11 deletions(-) diff --git a/extra/Configs/Config.in b/extra/Configs/Config.in index ac9fd13..bb1ec8b 100644 --- a/extra/Configs/Config.in +++ b/extra/Configs/Config.in @@ -375,6 +375,13 @@ config LDSO_RUNPATH Usage of RUNPATH tags is not too common, so disabling this feature should be safe for most people. +config LDSO_SAFE_RUNPATH + bool "Allow only RUNPATH beginning with /" + depends on LDSO_RUNPATH + default y + help + Allow only absolute path in RPATH/RUNPATH. + config LDSO_SEARCH_INTERP_PATH bool "Add ldso path to lib search path" depends on HAVE_SHARED diff --git a/ldso/ldso/dl-elf.c b/ldso/ldso/dl-elf.c index 7b715ee..ec4f1a5 100644 --- a/ldso/ldso/dl-elf.c +++ b/ldso/ldso/dl-elf.c @@ -174,8 +174,11 @@ search_for_named_library(const char *name, int secure, const char *path_list, _dl_strcpy(mylibname, "."); /* Assume current dir if empty path */ _dl_strcat(mylibname, "/"); _dl_strcat(mylibname, name); - if ((tpnt = _dl_load_elf_shared_library(secure, rpnt, mylibname)) != NULL) - return tpnt; +#ifdef __LDSO_SAFE_RUNPATH__ + if (*mylibname == '/') +#endif + if ((tpnt = _dl_load_elf_shared_library(secure, rpnt, mylibname)) != NULL) + return tpnt; path_n = path+1; } path++; diff --git a/test/Rules.mak b/test/Rules.mak index 2131a7b..6536a92 100644 --- a/test/Rules.mak +++ b/test/Rules.mak @@ -8,18 +8,28 @@ .SUFFIXES: top_builddir ?= ../ +abs_top_builddir ?= $(shell cd $(top_builddir); pwd)/ TESTDIR=$(top_builddir)test/ include $(top_builddir)/Rules.mak -ifndef TEST_INSTALLED_UCLIBC ifdef UCLIBC_LDSO ifeq (,$(findstring /,$(UCLIBC_LDSO))) -UCLIBC_LDSO := $(top_builddir)lib/$(UCLIBC_LDSO) +UCLIBC_LDSO := $(UCLIBC_LDSO) +else +UCLIBC_LDSO := $(notdir $(UCLIBC_LDSO)) +endif +else +UCLIBC_LDSO := $(notdir $(firstword $(wildcard $(top_builddir)lib/ld*))) endif +ifndef TEST_INSTALLED_UCLIBC +ifeq ($(LDSO_SAFE_RUNPATH),y) +UCLIBC_PATH := $(abs_top_builddir)lib else -UCLIBC_LDSO := $(firstword $(wildcard $(top_builddir)lib/ld*)) +UCLIBC_PATH := $(top_builddir)lib endif +else +UCLIBC_PATH := $(RUNTIME_PREFIX)$(MULTILIB_DIR) endif #-------------------------------------------------------- # Ensure consistent sort order, 'gcc -print-search-dirs' behavior, etc. @@ -81,15 +91,14 @@ ifneq ($(HAVE_SHARED),y) LDFLAGS += -Wl,-static -static-libgcc endif -LDFLAGS += -B$(top_builddir)lib -Wl,-rpath,$(top_builddir)lib -Wl,-rpath-link,$(top_builddir)lib -UCLIBC_LDSO_ABSPATH=$(shell pwd) -ifdef TEST_INSTALLED_UCLIBC -LDFLAGS += -Wl,-rpath,./ -UCLIBC_LDSO_ABSPATH=$(RUNTIME_PREFIX)$(MULTILIB_DIR) +ifndef TEST_INSTALLED_UCLIBC +LDFLAGS += -B$(UCLIBC_PATH) -Wl,-rpath,$(UCLIBC_PATH):$(shell pwd) -Wl,-rpath-link,$(UCLIBC_PATH):$(shell pwd) +else +LDFLAGS += -Wl,-rpath,$(shell pwd) endif ifeq ($(findstring -static,$(LDFLAGS)),) -LDFLAGS += -Wl,--dynamic-linker,$(UCLIBC_LDSO_ABSPATH)/$(UCLIBC_LDSO) +LDFLAGS += -Wl,--dynamic-linker,$(UCLIBC_PATH)/$(UCLIBC_LDSO) endif ifeq ($(LDSO_GNU_HASH_SUPPORT),y) -- 1.7.3.4 From ps.m at gmx.net Wed Apr 13 17:38:40 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Wed, 13 Apr 2011 19:38:40 +0200 Subject: [git commit ldso-future] wordexp.c: use vfork instead of fork on non-MMU archs Message-ID: <20110414224222.D18C9825B6@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=24cb8a9f360c5c4e552909f9304826b9a14b91b2 branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/ldso-future Signed-off-by: Peter S. Mazinger --- libc/misc/wordexp/wordexp.c | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-) diff --git a/libc/misc/wordexp/wordexp.c b/libc/misc/wordexp/wordexp.c index d063469..e1385be 100644 --- a/libc/misc/wordexp/wordexp.c +++ b/libc/misc/wordexp/wordexp.c @@ -36,6 +36,10 @@ #include #include +#ifndef __ARCH_USE_MMU__ +# define fork vfork +#endif + #define __WORDEXP_FULL /* -- 1.7.3.4 From ps.m at gmx.net Wed Apr 13 17:38:40 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Wed, 13 Apr 2011 19:38:40 +0200 Subject: [git commit ldso-future] tempname.c: remove unneeded attribute_hidden, change type to unsigned Message-ID: <20110414224223.0ADE3825B6@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=31b3d08defe4b76946aa966de443321326b019c7 branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/ldso-future Signed-off-by: Peter S. Mazinger --- libc/misc/internals/tempname.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/libc/misc/internals/tempname.c b/libc/misc/internals/tempname.c index 59e4e7c..536bc83 100644 --- a/libc/misc/internals/tempname.c +++ b/libc/misc/internals/tempname.c @@ -58,7 +58,7 @@ static int direxists (const char *dir) for use with mk[s]temp. Will fail (-1) if DIR is non-null and doesn't exist, none of the searched dirs exists, or there's not enough space in TMPL. */ -int attribute_hidden ___path_search (char *tmpl, size_t tmpl_len, const char *dir, +int ___path_search (char *tmpl, size_t tmpl_len, const char *dir, const char *pfx /*, int try_tmpdir*/) { /*const char *d; */ @@ -196,7 +196,7 @@ int __gen_tempname (char *tmpl, int kind, mode_t mode) } for (i = 0; i < TMP_MAX; ++i) { - int j; + unsigned int j; /* Get some random data. */ if (fillrand(randomness, sizeof(randomness)) != sizeof(randomness)) { /* if random device nodes failed us, lets use the braindamaged ver */ -- 1.7.3.4 From ps.m at gmx.net Wed Apr 13 17:38:40 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Wed, 13 Apr 2011 19:38:40 +0200 Subject: [git commit ldso-future] syslog.c: no need for hidden vsyslog, use a static __vsyslog instead Message-ID: <20110414224223.82484825B6@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=f0b612388c97db865dd82a274b43b2753a5e5084 branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/ldso-future It is only used within the same file. Guard the visible version according to header. Signed-off-by: Peter S. Mazinger --- include/sys/syslog.h | 1 - libc/misc/syslog/syslog.c | 12 +++++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/include/sys/syslog.h b/include/sys/syslog.h index 8fc7688..29a1233 100644 --- a/include/sys/syslog.h +++ b/include/sys/syslog.h @@ -208,7 +208,6 @@ libc_hidden_proto(syslog) therefore not marked with __THROW. */ extern void vsyslog (int __pri, __const char *__fmt, __gnuc_va_list __ap) __attribute__ ((__format__ (__printf__, 2, 0))); -libc_hidden_proto(vsyslog) #endif __END_DECLS diff --git a/libc/misc/syslog/syslog.c b/libc/misc/syslog/syslog.c index 1b109e5..f79b92f 100644 --- a/libc/misc/syslog/syslog.c +++ b/libc/misc/syslog/syslog.c @@ -181,8 +181,12 @@ libc_hidden_def(openlog) * syslog, vsyslog -- * print message on log file; output is intended for syslogd(8). */ +static +#ifndef __USE_BSD +__always_inline +#endif void -vsyslog(int pri, const char *fmt, va_list ap) +__vsyslog(int pri, const char *fmt, va_list ap) { register char *p; char *last_chr, *head_end, *end, *stdp; @@ -301,7 +305,9 @@ vsyslog(int pri, const char *fmt, va_list ap) getout: __UCLIBC_MUTEX_UNLOCK(mylock); } -libc_hidden_def(vsyslog) +#ifdef __USE_BSD +strong_alias(__vsyslog,vsyslog) +#endif void syslog(int pri, const char *fmt, ...) @@ -309,7 +315,7 @@ syslog(int pri, const char *fmt, ...) va_list ap; va_start(ap, fmt); - vsyslog(pri, fmt, ap); + __vsyslog(pri, fmt, ap); va_end(ap); } libc_hidden_def(syslog) -- 1.7.3.4 From ps.m at gmx.net Wed Apr 13 17:38:40 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Wed, 13 Apr 2011 19:38:40 +0200 Subject: [git commit ldso-future] make UCLIBC_HAS_PROGRAM_INVOCATION_NAME and UCLIBC_HAS___PROGNAME independent options Message-ID: <20110414224223.5237D825B6@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=14858e1fba60c0f46c0807d89cf5fad54035e3a2 branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/ldso-future Signed-off-by: Peter S. Mazinger --- extra/Configs/Config.in | 1 - include/errno.h | 3 +++ libc/misc/internals/__uClibc_main.c | 31 ++++++++++++++++++------------- utils/getconf.c | 6 ++---- 4 files changed, 23 insertions(+), 18 deletions(-) diff --git a/extra/Configs/Config.in b/extra/Configs/Config.in index bb1ec8b..5184fe4 100644 --- a/extra/Configs/Config.in +++ b/extra/Configs/Config.in @@ -715,7 +715,6 @@ config UCLIBC_HAS_PROGRAM_INVOCATION_NAME config UCLIBC_HAS___PROGNAME bool "Support for __progname" default y - depends on UCLIBC_HAS_PROGRAM_INVOCATION_NAME help Some packages (like openssh) like to peek into internal libc symbols to make their output a bit more user friendly. diff --git a/include/errno.h b/include/errno.h index 7e1f583..5340601 100644 --- a/include/errno.h +++ b/include/errno.h @@ -47,6 +47,9 @@ __BEGIN_DECLS extern int errno; #endif +#ifdef _LIBC +extern const char *__progname, __progname_full; +#endif #if defined __USE_GNU && defined __UCLIBC_HAS_PROGRAM_INVOCATION_NAME__ /* The full and simple forms of the name with which the program was diff --git a/libc/misc/internals/__uClibc_main.c b/libc/misc/internals/__uClibc_main.c index 0716dff..fbb25ab 100644 --- a/libc/misc/internals/__uClibc_main.c +++ b/libc/misc/internals/__uClibc_main.c @@ -140,14 +140,19 @@ extern void (*__fini_array_end []) (void) attribute_hidden; # endif #endif -attribute_hidden const char *__uclibc_progname = ""; -#ifdef __UCLIBC_HAS_PROGRAM_INVOCATION_NAME__ -const char *program_invocation_short_name = ""; -const char *program_invocation_name = ""; +const char *__uclibc_progname = ""; +#if !defined __UCLIBC_HAS___PROGNAME__ && defined __USE_GNU && defined __UCLIBC_HAS_PROGRAM_INVOCATION_NAME__ +# define __progname program_invocation_short_name +# define __progname_full program_invocation_name #endif -#ifdef __UCLIBC_HAS___PROGNAME__ -weak_alias (program_invocation_short_name, __progname) -weak_alias (program_invocation_name, __progname_full) +#if defined __UCLIBC_HAS___PROGNAME__ || (defined __USE_GNU && defined __UCLIBC_HAS_PROGRAM_INVOCATION_NAME__) +const char *__progname = ""; +/* psm: why have a visible __progname_full? */ +const char *__progname_full = ""; +# if defined __UCLIBC_HAS___PROGNAME__ && defined __USE_GNU && defined __UCLIBC_HAS_PROGRAM_INVOCATION_NAME__ +weak_alias (__progname, program_invocation_short_name) +weak_alias (__progname_full, program_invocation_name) +# endif #endif /* @@ -380,14 +385,14 @@ void __uClibc_main(int (*main)(int, char **, char **), int argc, #endif __uclibc_progname = *argv; -#ifdef __UCLIBC_HAS_PROGRAM_INVOCATION_NAME__ +#if defined __UCLIBC_HAS___PROGNAME__ || (defined __USE_GNU && defined __UCLIBC_HAS_PROGRAM_INVOCATION_NAME__) if (*argv != NULL) { - program_invocation_name = *argv; - program_invocation_short_name = strrchr(*argv, '/'); - if (program_invocation_short_name != NULL) - ++program_invocation_short_name; + __progname_full = *argv; + __progname = strrchr(*argv, '/'); + if (__progname != NULL) + ++__progname; else - program_invocation_short_name = program_invocation_name; + __progname = *argv; } #endif diff --git a/utils/getconf.c b/utils/getconf.c index 8addf31..90fcb67 100644 --- a/utils/getconf.c +++ b/utils/getconf.c @@ -1055,10 +1055,8 @@ static const struct { const char *name; int num; } specs[] = }; static const int nspecs = sizeof (specs) / sizeof (specs[0]); -#ifdef __UCLIBC_HAS___PROGNAME__ -extern const char *__progname; -#else -#define __progname "foo" +#ifndef __UCLIBC_HAS___PROGNAME__ +static const char *__progname = "getconf" #endif static attribute_noreturn void -- 1.7.3.4 From ps.m at gmx.net Wed Apr 13 17:38:40 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Wed, 13 Apr 2011 19:38:40 +0200 Subject: [git commit ldso-future] types.h: both icc and tendra support long long Message-ID: <20110414224224.5CDEB825B6@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=b789960767f17a858e957129926274dc02983d95 branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/ldso-future Signed-off-by: Peter S. Mazinger --- include/sys/types.h | 4 ++-- libc/sysdeps/linux/common/bits/types.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/include/sys/types.h b/include/sys/types.h index 7e29dc8..2d5eabc 100644 --- a/include/sys/types.h +++ b/include/sys/types.h @@ -165,7 +165,7 @@ typedef short int int16_t; typedef int int32_t; # if __WORDSIZE == 64 typedef long int int64_t; -# elif defined __GNUC__ || defined __ICC +# elif defined __GNUC__ || defined __ICC || defined __TenDRA__ __extension__ typedef long long int int64_t; # endif # endif @@ -176,7 +176,7 @@ typedef unsigned short int u_int16_t; typedef unsigned int u_int32_t; # if __WORDSIZE == 64 typedef unsigned long int u_int64_t; -# elif defined __GNUC__ || defined __ICC +# elif defined __GNUC__ || defined __ICC || defined __TenDRA__ __extension__ typedef unsigned long long int u_int64_t; # endif diff --git a/libc/sysdeps/linux/common/bits/types.h b/libc/sysdeps/linux/common/bits/types.h index c4c10e2..b50e090 100644 --- a/libc/sysdeps/linux/common/bits/types.h +++ b/libc/sysdeps/linux/common/bits/types.h @@ -49,7 +49,7 @@ typedef unsigned int __uint32_t; #if __WORDSIZE == 64 typedef signed long int __int64_t; typedef unsigned long int __uint64_t; -#elif defined(__GNUC__) +#elif defined(__GNUC__) || defined __ICC || defined __TenDRA__ __extension__ typedef signed long long int __int64_t; __extension__ typedef unsigned long long int __uint64_t; #endif @@ -58,7 +58,7 @@ __extension__ typedef unsigned long long int __uint64_t; #if __WORDSIZE == 64 typedef long int __quad_t; typedef unsigned long int __u_quad_t; -#elif defined(__GNUC__) +#elif defined(__GNUC__) || defined __ICC || defined __TenDRA__ __extension__ typedef long long int __quad_t; __extension__ typedef unsigned long long int __u_quad_t; #else -- 1.7.3.4 From ps.m at gmx.net Wed Apr 13 17:38:40 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Wed, 13 Apr 2011 19:38:40 +0200 Subject: [git commit ldso-future] ssp-local.c: make sure that -fstack-protector is not enabled when compiling file Message-ID: <20110414224223.A6DAD825B6@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=f09787cc860748b24aa76b8b743b3de42e60d522 branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/ldso-future Signed-off-by: Peter S. Mazinger --- libc/sysdeps/linux/common/ssp-local.c | 6 +++++- 1 files changed, 5 insertions(+), 1 deletions(-) diff --git a/libc/sysdeps/linux/common/ssp-local.c b/libc/sysdeps/linux/common/ssp-local.c index 6b1809a..bea11a8 100644 --- a/libc/sysdeps/linux/common/ssp-local.c +++ b/libc/sysdeps/linux/common/ssp-local.c @@ -21,6 +21,10 @@ * copied stack_chk_fail_local.c from glibc and adapted for uClibc */ +#if defined __SSP__ || defined __SSP_ALL__ +# error "file must not be compiled with stack protection enabled on it. Use -fno-stack-protector" +#endif + #include /* On some architectures, this helps needless PIC pointer setup @@ -29,5 +33,5 @@ void __stack_chk_fail_local (void) attribute_noreturn attribute_hidden; void __stack_chk_fail_local (void) { - __stack_chk_fail (); + __stack_chk_fail (); } -- 1.7.3.4 From ps.m at gmx.net Wed Apr 13 17:38:40 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Wed, 13 Apr 2011 19:38:40 +0200 Subject: [git commit ldso-future] syslog.c: disable locking in setlogmask Message-ID: <20110414224223.E3EC3825B6@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=ff7e8674a985002ce9693b64f900dedbb4581aed branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/ldso-future Signed-off-by: Peter S. Mazinger --- libc/misc/syslog/syslog.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/libc/misc/syslog/syslog.c b/libc/misc/syslog/syslog.c index f79b92f..ce4c44a 100644 --- a/libc/misc/syslog/syslog.c +++ b/libc/misc/syslog/syslog.c @@ -339,9 +339,9 @@ int setlogmask(int pmask) omask = LogMask; if (pmask != 0) { - __UCLIBC_MUTEX_LOCK(mylock); +/* __UCLIBC_MUTEX_LOCK(mylock);*/ LogMask = pmask; - __UCLIBC_MUTEX_UNLOCK(mylock); +/* __UCLIBC_MUTEX_UNLOCK(mylock);*/ } return omask; } -- 1.7.3.4 From ps.m at gmx.net Wed Apr 13 17:38:40 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Wed, 13 Apr 2011 19:38:40 +0200 Subject: [git commit ldso-future] ssp: rework, sync messages with the ones in glibc Message-ID: <20110414224224.27A8D82631@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=d19a7de0b1b3069061a32908e35e566fb1a0b48d branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/ldso-future Touch signals only if DODEBUG is enabled. Make the signal selection dependent on DODEBUG, as last resort use SIGKILL. Use internal functions with less arguments, some savings. Fix a warning about unused argument. Do not use openlog/closelog, while there remove their hidden versions. Signed-off-by: Peter S. Mazinger --- extra/Configs/Config.in | 4 +- include/sys/syslog.h | 2 - libc/misc/syslog/syslog.c | 2 - libc/sysdeps/linux/common/ssp.c | 121 +++++++++++++++++++++------------------ 4 files changed, 68 insertions(+), 61 deletions(-) diff --git a/extra/Configs/Config.in b/extra/Configs/Config.in index 5184fe4..a0d2c7d 100644 --- a/extra/Configs/Config.in +++ b/extra/Configs/Config.in @@ -2107,8 +2107,8 @@ config SSP_QUICK_CANARY choice prompt "Propolice protection blocking signal" depends on UCLIBC_HAS_SSP - default PROPOLICE_BLOCK_ABRT if ! DODEBUG - default PROPOLICE_BLOCK_SEGV if DODEBUG + depends on DODEBUG + default PROPOLICE_BLOCK_SEGV help "abort" use SIGABRT to block offending programs. This is the default implementation. diff --git a/include/sys/syslog.h b/include/sys/syslog.h index 29a1233..fb8c500 100644 --- a/include/sys/syslog.h +++ b/include/sys/syslog.h @@ -179,14 +179,12 @@ __BEGIN_DECLS This function is a possible cancellation point and therefore not marked with __THROW. */ extern void closelog (void); -libc_hidden_proto(closelog) /* Open connection to system logger. This function is a possible cancellation point and therefore not marked with __THROW. */ extern void openlog (__const char *__ident, int __option, int __facility); -libc_hidden_proto(openlog) /* Set the log mask level. */ extern int setlogmask (int __mask) __THROW; diff --git a/libc/misc/syslog/syslog.c b/libc/misc/syslog/syslog.c index ce4c44a..1ab4707 100644 --- a/libc/misc/syslog/syslog.c +++ b/libc/misc/syslog/syslog.c @@ -175,7 +175,6 @@ openlog(const char *ident, int logstat, int logfac) openlog_intern(ident, logstat, logfac); __UCLIBC_MUTEX_UNLOCK(mylock); } -libc_hidden_def(openlog) /* * syslog, vsyslog -- @@ -330,7 +329,6 @@ closelog(void) closelog_intern(0); /* 0: reset LogXXX globals to default */ __UCLIBC_MUTEX_UNLOCK(mylock); } -libc_hidden_def(closelog) /* setlogmask -- set the log mask level */ int setlogmask(int pmask) diff --git a/libc/sysdeps/linux/common/ssp.c b/libc/sysdeps/linux/common/ssp.c index 07513e7..8dcc3dc 100644 --- a/libc/sysdeps/linux/common/ssp.c +++ b/libc/sysdeps/linux/common/ssp.c @@ -20,102 +20,113 @@ #error "file must not be compiled with stack protection enabled on it. Use -fno-stack-protector" #endif +#include +#include +#include +#ifdef __UCLIBC_HAS_SYSLOG__ +#include +#endif + #ifdef __PROPOLICE_BLOCK_SEGV__ # define SSP_SIGTYPE SIGSEGV #else # define SSP_SIGTYPE SIGABRT #endif -#include -#include -#include -#if defined __UCLIBC_HAS_SYSLOG__ -#include +static void do_write(const char *msg) +{ + /* could use inlined syscall here to be sure ... */ + return (void) write(STDERR_FILENO, msg, strlen(msg)); +} +static void __cold do_msg(const char *msg1, const char *msg2, const char *msg3) +{ + do_write(msg1); + do_write(msg2); + do_write(msg3); + do_write("\n"); +#ifdef __UCLIBC_HAS_SYSLOG__ + syslog(LOG_INFO, "%s%s%s()", msg1, msg2, msg3); #endif +} - -static void block_signals(void) +static void __cold attribute_noreturn +#ifdef __UCLIBC_HAS_SSP_COMPAT__ +ssp_handler(char func[]) +#else +ssp_handler(void) +#endif { + pid_t pid; + static const char msg_ssd[] = "*** stack smashing detected ***: "; + static const char msg_terminated[] = " terminated"; +#ifdef __UCLIBC_HAS_SSP_COMPAT__ + static const char msg_ssa[] = ": stack smashing attack in function "; +#endif + +#ifdef __DODEBUG__ struct sigaction sa; sigset_t mask; __sigfillset(&mask); __sigdelset(&mask, SSP_SIGTYPE); /* Block all signal handlers */ sigprocmask(SIG_BLOCK, &mask, NULL); /* except SSP_SIGTYPE */ +#endif + +#ifdef __UCLIBC_HAS_SSP_COMPAT__ + if (func != NULL) + do_msg(__uclibc_progname, msg_ssa, func); + else +#endif + do_msg(msg_ssd, __uclibc_progname, msg_terminated); + pid = getpid(); +#ifdef __DODEBUG__ /* Make the default handler associated with the signal handler */ memset(&sa, 0, sizeof(sa)); __sigfillset(&sa.sa_mask); /* Block all signals */ if (SIG_DFL) /* if it's constant zero, it's already done */ sa.sa_handler = SIG_DFL; - sigaction(SSP_SIGTYPE, &sa, NULL); -} - -static void __cold ssp_write(int fd, const char *msg1, const char *msg2, const char *msg3) -{ - write(fd, msg1, strlen(msg1)); - write(fd, msg2, strlen(msg2)); - write(fd, msg3, strlen(msg3)); - write(fd, "()\n", 3); -#if defined __UCLIBC_HAS_SYSLOG__ - openlog("ssp", LOG_CONS | LOG_PID, LOG_USER); - syslog(LOG_INFO, "%s%s%s()", msg1, msg2, msg3); - closelog(); + if (sigaction(SSP_SIGTYPE, &sa, NULL) == 0) + (void)kill(pid, SSP_SIGTYPE); #endif -} - -static attribute_noreturn void terminate(void) -{ - (void) kill(getpid(), SSP_SIGTYPE); - _exit(127); + (void)kill(pid, SIGKILL); + /* The loop is added only to keep gcc happy. */ + while(1) + _exit(127); } #ifdef __UCLIBC_HAS_SSP_COMPAT__ -void __stack_smash_handler(char func[], int damaged __attribute__ ((unused))) attribute_noreturn __cold; -void __stack_smash_handler(char func[], int damaged) +void __stack_smash_handler(char func[], int damaged) attribute_noreturn __cold; +void __stack_smash_handler(char func[], int damaged attribute_unused) { - static const char message[] = ": stack smashing attack in function "; - - block_signals(); - - ssp_write(STDERR_FILENO, __uclibc_progname, message, func); - - /* The loop is added only to keep gcc happy. */ - while(1) - terminate(); + ssp_handler(func); } -#endif -#ifdef __UCLIBC_HAS_SSP__ void __stack_chk_fail(void) { - static const char msg1[] = "stack smashing detected: "; - static const char msg3[] = " terminated"; - - block_signals(); - - ssp_write(STDERR_FILENO, msg1, __uclibc_progname, msg3); - - /* The loop is added only to keep gcc happy. */ - while(1) - terminate(); + ssp_handler(NULL); } +#else +strong_alias(ssp_handler,__stack_chk_fail) #endif #ifdef __UCLIBC_HAS_FORTIFY__ +/* should be redone when activated to use common code above. + * for now, it works without debugging support */ void __chk_fail(void) { - static const char msg1[] = "buffer overflow detected: "; - static const char msg3[] = " terminated"; - - block_signals(); + static const char msg_fail[] = "*** buffer overflow detected ***: "; + static const char msg_terminated[] = " terminated"; + pid_t pid; - ssp_write(STDERR_FILENO, msg1, __uclibc_progname, msg3); + do_msg(msg_fail, __uclibc_progname, msg_terminated); + pid = getpid(); + (void)kill(pid, SIGKILL); /* The loop is added only to keep gcc happy. */ while(1) - terminate(); + _exit(127); } libc_hidden_def(__chk_fail) #endif -- 1.7.3.4 From rep.dot.nop at gmail.com Thu Apr 14 07:59:26 2011 From: rep.dot.nop at gmail.com (Bernhard Reutner-Fischer) Date: Thu, 14 Apr 2011 09:59:26 +0200 Subject: [git commit] buildsys: do_rm ARCH_HEADERS Message-ID: <20110415124217.2AD9582650@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=f6450b67cc92027352367be299cc28dd29cd8486 branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/master Signed-off-by: Bernhard Reutner-Fischer --- libc/sysdeps/linux/Makefile.commonarch | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/libc/sysdeps/linux/Makefile.commonarch b/libc/sysdeps/linux/Makefile.commonarch index 4e48159..c1bc5df 100644 --- a/libc/sysdeps/linux/Makefile.commonarch +++ b/libc/sysdeps/linux/Makefile.commonarch @@ -36,6 +36,6 @@ $(ARCH_HEADERS_OUT): headers-y += $(ARCH_HEADERS_OUT) headers_clean-y += HEADERCLEAN_$(subst $(top_builddir),,$(ARCH_OUT)) HEADERCLEAN_$(subst $(top_builddir),,$(ARCH_OUT)): - $(RM) $(ARCH_HEADERS_OUT) + $(do_rm) $(ARCH_HEADERS_OUT) endif -- 1.7.3.4 From rep.dot.nop at gmail.com Thu Apr 14 07:59:26 2011 From: rep.dot.nop at gmail.com (Bernhard Reutner-Fischer) Date: Thu, 14 Apr 2011 09:59:26 +0200 Subject: [git commit future] buildsys: do_rm ARCH_HEADERS Message-ID: <20110416005412.12A03826D0@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=f6450b67cc92027352367be299cc28dd29cd8486 branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/future Signed-off-by: Bernhard Reutner-Fischer Patch is too large, so refusing to show it From ps.m at gmx.net Thu Apr 14 07:59:26 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Thu, 14 Apr 2011 09:59:26 +0200 Subject: [git commit future] internals.h: LT_OLD->define correctly internal hidden __pthread_mutex_unlock Message-ID: <20110416005412.9D9F2826D0@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=3cba9026aa622cf2fe574c1e5f630c8462b600bd branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/future Signed-off-by: Peter S. Mazinger Patch is too large, so refusing to show it From ps.m at gmx.net Thu Apr 14 07:59:26 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Thu, 14 Apr 2011 09:59:26 +0200 Subject: [git commit future] errno.h: fix __progname_full type Message-ID: <20110416005413.574C6826D0@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=6c94a90455198459da7ab2037eb88b20a475b8ef branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/future Signed-off-by: Peter S. Mazinger --- include/errno.h | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/include/errno.h b/include/errno.h index 5340601..fb7c1f5 100644 --- a/include/errno.h +++ b/include/errno.h @@ -48,7 +48,7 @@ extern int errno; #endif #ifdef _LIBC -extern const char *__progname, __progname_full; +extern const char *__progname, *__progname_full; #endif #if defined __USE_GNU && defined __UCLIBC_HAS_PROGRAM_INVOCATION_NAME__ -- 1.7.3.4 From ps.m at gmx.net Thu Apr 14 07:59:26 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Thu, 14 Apr 2011 09:59:26 +0200 Subject: [git commit future] _stdio.c: pthread.h was already included by _stdio.h Message-ID: <20110416005414.2259C826D0@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=01fe694e42bd4951cff1f5d346433c9c1c858e53 branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/future Signed-off-by: Peter S. Mazinger --- libc/stdio/_stdio.c | 5 ----- 1 files changed, 0 insertions(+), 5 deletions(-) diff --git a/libc/stdio/_stdio.c b/libc/stdio/_stdio.c index 61b01c8..b66c41f 100644 --- a/libc/stdio/_stdio.c +++ b/libc/stdio/_stdio.c @@ -7,7 +7,6 @@ #include "_stdio.h" - /* This is pretty much straight from uClibc, but with one important * difference. * @@ -277,10 +276,6 @@ void _stdio_init(void) #error Assumption violated about __MASK_READING and __FLAG_UNGOT #endif -#ifdef __UCLIBC_HAS_THREADS__ -#include -#endif - #ifndef NDEBUG void _stdio_validate_FILE(const FILE *stream) -- 1.7.3.4 From ps.m at gmx.net Thu Apr 14 07:59:26 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Thu, 14 Apr 2011 09:59:26 +0200 Subject: [git commit future] avoid circular dependency in lseek and llseek, providing a stub lseek Message-ID: <20110416005414.8B144826D0@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=084cf94bfd399d6f66aaa625bfe9831cba4c7359 branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/future Signed-off-by: Peter S. Mazinger --- libc/sysdeps/linux/common/llseek.c | 15 +++++---------- libc/sysdeps/linux/common/lseek.c | 25 +++++++++++++++++++++++-- 2 files changed, 28 insertions(+), 12 deletions(-) diff --git a/libc/sysdeps/linux/common/llseek.c b/libc/sysdeps/linux/common/llseek.c index cd150ad..2181464 100644 --- a/libc/sysdeps/linux/common/llseek.c +++ b/libc/sysdeps/linux/common/llseek.c @@ -7,28 +7,23 @@ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. */ +#include <_lfs_64.h> #include -#include #include -#if defined __NR__llseek && defined __UCLIBC_HAS_LFS__ - +#ifdef __NR__llseek loff_t lseek64(int fd, loff_t offset, int whence) { loff_t result; - return (loff_t)(INLINE_SYSCALL(_llseek, 5, fd, (off_t) (offset >> 32), - (off_t) (offset & 0xffffffff), &result, whence) ?: result); + return (loff_t)INLINE_SYSCALL(_llseek, 5, fd, (off_t) (offset >> 32), + (off_t) (offset & 0xffffffff), &result, whence) ?: result; } - #else - loff_t lseek64(int fd, loff_t offset, int whence) { - return (loff_t)(lseek(fd, (off_t) (offset), whence)); + return (loff_t)lseek(fd, (off_t) (offset), whence); } - #endif - #ifndef __LINUXTHREADS_OLD__ libc_hidden_def(lseek64) #else diff --git a/libc/sysdeps/linux/common/lseek.c b/libc/sysdeps/linux/common/lseek.c index 9ff4240..1ed956e 100644 --- a/libc/sysdeps/linux/common/lseek.c +++ b/libc/sysdeps/linux/common/lseek.c @@ -12,12 +12,33 @@ #ifdef __NR_lseek _syscall3(__off_t, lseek, int, fildes, __off_t, offset, int, whence) -#else - +#elif defined __UCLIBC_HAS_LFS__ && defined __NR__llseek /* avoid circular dependency */ __off_t lseek(int fildes, __off_t offset, int whence) { return lseek64(fildes, offset, whence); } +#else +# include +__off_t lseek(int fildes, __off_t offset attribute_unused, int whence) +{ + if (fildes < 0) { + __set_errno(EBADF); + return -1; + } + + switch(whence) { + case SEEK_SET: + case SEEK_CUR: + case SEEK_END: + break; + default: + __set_errno(EINVAL); + return -1; + } + + __set_errno(ENOSYS); + return -1; +} #endif #ifndef __LINUXTHREADS_OLD__ libc_hidden_def(lseek) -- 1.7.3.4 From ps.m at gmx.net Thu Apr 14 07:59:26 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Thu, 14 Apr 2011 09:59:26 +0200 Subject: [git commit future] no need for hidden __sigpause, use an internal static function Message-ID: <20110416005416.0F112826D0@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=a7a4dc61d7f163d2eca2e8b5fc4be9c43a24bf39 branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/future Signed-off-by: Peter S. Mazinger --- include/signal.h | 1 - libc/signal/sigpause.c | 10 +++++----- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/include/signal.h b/include/signal.h index 455cd84..ca3e8ac 100644 --- a/include/signal.h +++ b/include/signal.h @@ -195,7 +195,6 @@ extern void psiginfo (__const siginfo_t *__pinfo, __const char *__s); This function is a cancellation point and therefore not marked with __THROW. */ extern int __sigpause (int __sig_or_mask, int __is_sig); -libc_hidden_proto(__sigpause) #ifdef __FAVOR_BSD /* Set the mask of blocked signals to MASK, diff --git a/libc/signal/sigpause.c b/libc/signal/sigpause.c index e773b3c..ebd7af3 100644 --- a/libc/signal/sigpause.c +++ b/libc/signal/sigpause.c @@ -32,7 +32,7 @@ /* Set the mask of blocked signals to MASK, wait for a signal to arrive, and then restore the mask. */ -int __sigpause (int sig_or_mask, int is_sig) +static int __internal_sigpause (int sig_or_mask, int is_sig) { sigset_t set; @@ -52,7 +52,7 @@ int __sigpause (int sig_or_mask, int is_sig) to do anything here. */ return sigsuspend (&set); } -libc_hidden_def(__sigpause) +strong_alias(__internal_sigpause,__sigpause) #undef sigpause @@ -63,16 +63,16 @@ int sigpause (int mask) { #ifdef __UCLIBC_HAS_THREADS_NATIVE__ if (SINGLE_THREAD_P) - return __sigpause (mask, 0); + return __internal_sigpause (mask, 0); int oldtype = LIBC_CANCEL_ASYNC (); - int result = __sigpause (mask, 0); + int result = __internal_sigpause (mask, 0); LIBC_CANCEL_RESET (oldtype); return result; #else - return __sigpause (mask, 0); + return __internal_sigpause (mask, 0); #endif } -- 1.7.3.4 From ps.m at gmx.net Thu Apr 14 07:59:26 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Thu, 14 Apr 2011 09:59:26 +0200 Subject: [git commit future] signal: cleanup, include only headers that are needed Message-ID: <20110416005413.C56EF826D0@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=b86ba6e879397217b3f52373dbaa5a26eccc0b30 branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/future Signed-off-by: Peter S. Mazinger --- include/signal.h | 2 +- libc/signal/allocrtsig.c | 1 - libc/signal/killpg.c | 1 - libc/signal/raise.c | 2 -- libc/signal/sigaction.c | 8 +++----- libc/signal/sigaddset.c | 5 ++++- libc/signal/sigblock.c | 1 - libc/signal/sigdelset.c | 5 ++++- libc/signal/sigempty.c | 7 +++++-- libc/signal/sigfillset.c | 9 +++++---- libc/signal/siggetmask.c | 1 - libc/signal/sighold.c | 1 - libc/signal/sigignore.c | 4 +--- libc/signal/sigintr.c | 8 ++++---- libc/signal/sigismem.c | 5 ++++- libc/signal/sigjmp.c | 2 +- libc/signal/signal.c | 2 +- libc/signal/sigpause.c | 3 ++- libc/signal/sigrelse.c | 1 - libc/signal/sigset.c | 3 +-- libc/signal/sigsetmask.c | 1 - libc/signal/sigsetops.h | 33 --------------------------------- libc/signal/sigwait.c | 8 +++++--- libc/signal/sysv_signal.c | 2 -- 24 files changed, 41 insertions(+), 74 deletions(-) delete mode 100644 libc/signal/sigsetops.h diff --git a/include/signal.h b/include/signal.h index 2924c7e..455cd84 100644 --- a/include/signal.h +++ b/include/signal.h @@ -258,7 +258,6 @@ extern int sigemptyset (sigset_t *__set) __THROW __nonnull ((1)); /* Set all signals in SET. */ extern int sigfillset (sigset_t *__set) __THROW __nonnull ((1)); -libc_hidden_proto(sigfillset) /* Add SIGNO to SET. */ extern int sigaddset (sigset_t *__set, int __signo) __THROW __nonnull ((1)); @@ -483,6 +482,7 @@ extern int __libc_current_sigrtmin (void) __THROW; extern int __libc_current_sigrtmax (void) __THROW; #ifdef _LIBC +extern sigset_t _sigintr attribute_hidden; /* simplified version without parameter checking */ # include # undef __sigemptyset diff --git a/libc/signal/allocrtsig.c b/libc/signal/allocrtsig.c index 05f3d6c..2b2098f 100644 --- a/libc/signal/allocrtsig.c +++ b/libc/signal/allocrtsig.c @@ -20,7 +20,6 @@ #include #include -#include #include /* Only enable rt signals when it is supported at compile time */ diff --git a/libc/signal/killpg.c b/libc/signal/killpg.c index c2dc713..73f48ec 100644 --- a/libc/signal/killpg.c +++ b/libc/signal/killpg.c @@ -19,7 +19,6 @@ #include #include - /* Send SIG to all processes in process group PGRP. If PGRP is zero, send SIG to all processes in the current process's process group. */ diff --git a/libc/signal/raise.c b/libc/signal/raise.c index aed9b46..d9dbab6 100644 --- a/libc/signal/raise.c +++ b/libc/signal/raise.c @@ -3,9 +3,7 @@ */ #include -#include #include -#include int raise(int signo) { diff --git a/libc/signal/sigaction.c b/libc/signal/sigaction.c index 7a31e06..9630df7 100644 --- a/libc/signal/sigaction.c +++ b/libc/signal/sigaction.c @@ -16,14 +16,9 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -#include -#include #include -#include #include -#include - #if defined __NR_rt_sigaction /* If ACT is not NULL, change the action for SIG to *ACT. @@ -42,6 +37,9 @@ __libc_sigaction(int sig, const struct sigaction *act, struct sigaction *oact) } #else +# define __need_NULL +# include +# include /* If ACT is not NULL, change the action for SIG to *ACT. If OACT is not NULL, put the old action for SIG in *OACT. */ diff --git a/libc/signal/sigaddset.c b/libc/signal/sigaddset.c index 7577d37..94fcc80 100644 --- a/libc/signal/sigaddset.c +++ b/libc/signal/sigaddset.c @@ -16,7 +16,10 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -#include "sigsetops.h" +#define __need_NULL +#include +#include +#include /* Add SIGNO to SET. */ int diff --git a/libc/signal/sigblock.c b/libc/signal/sigblock.c index ad3acb0..c3ce363 100644 --- a/libc/signal/sigblock.c +++ b/libc/signal/sigblock.c @@ -17,7 +17,6 @@ 02111-1307 USA. */ #define __UCLIBC_HIDE_DEPRECATED__ -#include #include #include "sigset-cvt-mask.h" diff --git a/libc/signal/sigdelset.c b/libc/signal/sigdelset.c index ff30303..9262b1a 100644 --- a/libc/signal/sigdelset.c +++ b/libc/signal/sigdelset.c @@ -16,7 +16,10 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -#include "sigsetops.h" +#define __need_NULL +#include +#include +#include /* Add SIGNO to SET. */ int sigdelset (sigset_t *set, int signo) diff --git a/libc/signal/sigempty.c b/libc/signal/sigempty.c index 2622c08..adbded6 100644 --- a/libc/signal/sigempty.c +++ b/libc/signal/sigempty.c @@ -16,9 +16,12 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -#include #include -#include +#if 0 +#define __need_NULL +#include +#include +#endif /* Clear all signals from SET. */ int sigemptyset (sigset_t *set) diff --git a/libc/signal/sigfillset.c b/libc/signal/sigfillset.c index 951e76b..ef60f10 100644 --- a/libc/signal/sigfillset.c +++ b/libc/signal/sigfillset.c @@ -16,10 +16,12 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -#include #include -#include - +#if 0 +#define __need_NULL +#include +#include +#endif /* Set all signals in SET. */ int @@ -46,4 +48,3 @@ sigfillset (sigset_t *set) return 0; } -libc_hidden_def(sigfillset) diff --git a/libc/signal/siggetmask.c b/libc/signal/siggetmask.c index 3992a7a..833de96 100644 --- a/libc/signal/siggetmask.c +++ b/libc/signal/siggetmask.c @@ -20,7 +20,6 @@ #define __UCLIBC_HIDE_DEPRECATED__ #include - int siggetmask (void) { diff --git a/libc/signal/sighold.c b/libc/signal/sighold.c index 6a2e718..2b1ecd1 100644 --- a/libc/signal/sighold.c +++ b/libc/signal/sighold.c @@ -22,7 +22,6 @@ #include #include - int sighold (int sig) { sigset_t set; diff --git a/libc/signal/sigignore.c b/libc/signal/sigignore.c index a74c105..984fd85 100644 --- a/libc/signal/sigignore.c +++ b/libc/signal/sigignore.c @@ -18,12 +18,10 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -#include #define __need_NULL #include #include -#include /* For the real memset prototype. */ - +#include int sigignore (int sig) { diff --git a/libc/signal/sigintr.c b/libc/signal/sigintr.c index 10567e9..210d493 100644 --- a/libc/signal/sigintr.c +++ b/libc/signal/sigintr.c @@ -16,16 +16,16 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -#include #include -#include - /* If INTERRUPT is nonzero, make signal SIG interrupt system calls (causing them to fail with EINTR); if INTERRUPT is zero, make system calls be restarted after signal SIG. */ #ifdef SA_RESTART -extern sigset_t _sigintr attribute_hidden; /* Defined in signal.c. */ +# define __need_NULL +# include +#else +# include #endif int siginterrupt (int sig, int interrupt) diff --git a/libc/signal/sigismem.c b/libc/signal/sigismem.c index b546f62..334a06f 100644 --- a/libc/signal/sigismem.c +++ b/libc/signal/sigismem.c @@ -16,7 +16,10 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -#include "sigsetops.h" +#define __need_NULL +#include +#include +#include /* Return 1 if SIGNO is in SET, 0 if not. */ int sigismember (const sigset_t *set, int signo) diff --git a/libc/signal/sigjmp.c b/libc/signal/sigjmp.c index a96d662..cf2be68 100644 --- a/libc/signal/sigjmp.c +++ b/libc/signal/sigjmp.c @@ -16,11 +16,11 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ +#define __need_NULL #include #include #include - /* This function is called by the `sigsetjmp' macro before doing a `__setjmp' on ENV[0].__jmpbuf. Always return zero. */ diff --git a/libc/signal/signal.c b/libc/signal/signal.c index 644617c..d82e421 100644 --- a/libc/signal/signal.c +++ b/libc/signal/signal.c @@ -22,7 +22,7 @@ #include #include /* For the real memset prototype. */ -sigset_t _sigintr attribute_hidden; /* Set by siginterrupt. */ +sigset_t _sigintr; /* Set by siginterrupt. */ /* Set the handler for the signal SIG to HANDLER, returning the old handler, or SIG_ERR on error. */ diff --git a/libc/signal/sigpause.c b/libc/signal/sigpause.c index 0856ba2..e773b3c 100644 --- a/libc/signal/sigpause.c +++ b/libc/signal/sigpause.c @@ -22,7 +22,8 @@ #include #define __FAVOR_BSD #include -#include /* For NULL. */ +#define __need_NULL +#include #ifdef __UCLIBC_HAS_THREADS_NATIVE__ #include #endif diff --git a/libc/signal/sigrelse.c b/libc/signal/sigrelse.c index 07e7fdd..b513648 100644 --- a/libc/signal/sigrelse.c +++ b/libc/signal/sigrelse.c @@ -22,7 +22,6 @@ #include #include - int sigrelse (int sig) { sigset_t set; diff --git a/libc/signal/sigset.c b/libc/signal/sigset.c index b91ce80..3b162df 100644 --- a/libc/signal/sigset.c +++ b/libc/signal/sigset.c @@ -20,8 +20,7 @@ #define __need_NULL #include #include -#include /* For the real memset prototype. */ - +#include /* Set the disposition for SIG. */ __sighandler_t sigset (int sig, __sighandler_t disp) diff --git a/libc/signal/sigsetmask.c b/libc/signal/sigsetmask.c index 64c8ad6..0a73179 100644 --- a/libc/signal/sigsetmask.c +++ b/libc/signal/sigsetmask.c @@ -17,7 +17,6 @@ 02111-1307 USA. */ #define __UCLIBC_HIDE_DEPRECATED__ -#include #include #include "sigset-cvt-mask.h" diff --git a/libc/signal/sigsetops.h b/libc/signal/sigsetops.h deleted file mode 100644 index 52081c2..0000000 --- a/libc/signal/sigsetops.h +++ /dev/null @@ -1,33 +0,0 @@ -/* Copyright (C) 1991, 1995, 1996 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -/* Definitions relevant to functions that operate on `sigset_t's. */ - -#include -#include -#include - -#define BITS (_NSIG - 1) -#define ELT(signo) (((signo) - 1) / BITS) -#define MASK(signo) (1 << (((signo) - 1) % BITS)) - -#undef sigemptyset -#undef sigfillset -#undef sigaddset -#undef sigdelset -#undef sigismember diff --git a/libc/signal/sigwait.c b/libc/signal/sigwait.c index 634a18d..5e9c427 100644 --- a/libc/signal/sigwait.c +++ b/libc/signal/sigwait.c @@ -19,15 +19,15 @@ * Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA * 02111-1307 USA. */ -#include +#define __need_NULL +#include #include -#include -#include #ifdef __UCLIBC_HAS_THREADS_NATIVE__ # include # ifdef __NR_rt_sigtimedwait +# include /* Return any pending signal or wait for one for the given time. */ static int do_sigwait(const sigset_t *set, int *sig) @@ -104,6 +104,8 @@ int sigwait (const sigset_t *set, int *sig) } # else /* __UCLIBC_HAS_REALTIME__ */ +# include +# include /* smallint */ /* variant without REALTIME extensions */ static smallint was_sig; /* obviously not thread-safe */ diff --git a/libc/signal/sysv_signal.c b/libc/signal/sysv_signal.c index a696a54..65d8190 100644 --- a/libc/signal/sysv_signal.c +++ b/libc/signal/sysv_signal.c @@ -18,8 +18,6 @@ #include #include -#include /* For the real memset prototype. */ - /* Tolerate non-threads versions of Posix */ #ifndef SA_ONESHOT -- 1.7.3.4 From ps.m at gmx.net Thu Apr 14 07:59:26 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Thu, 14 Apr 2011 09:59:26 +0200 Subject: [git commit future] poll.c: do not inline syscall Message-ID: <20110416005416.698D9826D0@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=78dbb0a651fca64a039ac0dc2edec94049cae405 branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/future While there, remove libc_hidden_protos Signed-off-by: Peter S. Mazinger --- libc/sysdeps/linux/common/poll.c | 9 ++------- 1 files changed, 2 insertions(+), 7 deletions(-) diff --git a/libc/sysdeps/linux/common/poll.c b/libc/sysdeps/linux/common/poll.c index 3895e0d..92c90da 100644 --- a/libc/sysdeps/linux/common/poll.c +++ b/libc/sysdeps/linux/common/poll.c @@ -27,13 +27,11 @@ #define SINGLE_THREAD_P 1 #endif -libc_hidden_proto(poll) - #if defined __ASSUME_POLL_SYSCALL && defined __NR_poll #define __NR___syscall_poll __NR_poll -static inline _syscall3(int, __syscall_poll, struct pollfd *, fds, - unsigned long int, nfds, int, timeout); +static _syscall3(int, __syscall_poll, struct pollfd *, fds, + unsigned long int, nfds, int, timeout); int poll(struct pollfd *fds, nfds_t nfds, int timeout) { @@ -57,9 +55,6 @@ int poll(struct pollfd *fds, nfds_t nfds, int timeout) #include #include -libc_hidden_proto(getdtablesize) -libc_hidden_proto(select) - /* uClinux 2.0 doesn't have poll, emulate it using select */ /* Poll the file descriptors described by the NFDS structures starting at -- 1.7.3.4 From ps.m at gmx.net Thu Apr 14 07:59:26 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Thu, 14 Apr 2011 09:59:26 +0200 Subject: [git commit future] resolv.c: shrink code a bit in getnameinfo. Message-ID: <20110416005413.08C99826D0@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=d9246e2ceb9d0118e4b61d79ff6398b4399b953c branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/future Signed-off-by: Peter S. Mazinger --- libc/inet/resolv.c | 10 ++++------ 1 files changed, 4 insertions(+), 6 deletions(-) diff --git a/libc/inet/resolv.c b/libc/inet/resolv.c index 6cdd6e0..7c3921c 100644 --- a/libc/inet/resolv.c +++ b/libc/inet/resolv.c @@ -1771,7 +1771,7 @@ int getnameinfo(const struct sockaddr *sa, unsigned flags) { int serrno = errno; - unsigned ok; + bool ok = 0; struct hostent *hoste = NULL; char domain[256]; @@ -1781,16 +1781,15 @@ int getnameinfo(const struct sockaddr *sa, if (sa == NULL || addrlen < sizeof(sa_family_t)) return EAI_FAMILY; - ok = sa->sa_family; - if (ok == AF_LOCAL) /* valid */; + if (sa->sa_family == AF_LOCAL) /* valid */; #ifdef __UCLIBC_HAS_IPV4__ - else if (ok == AF_INET) { + else if (sa->sa_family == AF_INET) { if (addrlen < sizeof(struct sockaddr_in)) return EAI_FAMILY; } #endif #ifdef __UCLIBC_HAS_IPV6__ - else if (ok == AF_INET6) { + else if (sa->sa_family == AF_INET6) { if (addrlen < sizeof(struct sockaddr_in6)) return EAI_FAMILY; } @@ -1798,7 +1797,6 @@ int getnameinfo(const struct sockaddr *sa, else return EAI_FAMILY; - ok = 0; if (host != NULL && hostlen > 0) switch (sa->sa_family) { case AF_INET: -- 1.7.3.4 From ps.m at gmx.net Thu Apr 14 07:59:26 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Thu, 14 Apr 2011 09:59:26 +0200 Subject: [git commit future] stubs.c: add renameat stub Message-ID: <20110416005416.C4813826D0@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=5d5f03c932fc6cabfb8e89f0447cbb1f9179524f branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/future Signed-off-by: Peter S. Mazinger --- libc/sysdeps/linux/common/stubs.c | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-) diff --git a/libc/sysdeps/linux/common/stubs.c b/libc/sysdeps/linux/common/stubs.c index e146c71..4c4f626 100644 --- a/libc/sysdeps/linux/common/stubs.c +++ b/libc/sysdeps/linux/common/stubs.c @@ -226,6 +226,10 @@ make_stub(openat64) # endif #endif +#ifndef __NR_renameat +make_stub(renameat) +#endif + #ifndef __NR_fadvise64 make_ret_stub(posix_fadvise) #endif -- 1.7.3.4 From ps.m at gmx.net Thu Apr 14 07:59:26 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Thu, 14 Apr 2011 09:59:26 +0200 Subject: [git commit future] rename.c: simplify code, include only necessary headers Message-ID: <20110416005417.0813E826D0@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=1a2392564cd59934f7b72ff36202138ba1cbd59a branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/future Signed-off-by: Peter S. Mazinger --- libc/sysdeps/linux/common/rename.c | 13 +------------ 1 files changed, 1 insertions(+), 12 deletions(-) diff --git a/libc/sysdeps/linux/common/rename.c b/libc/sysdeps/linux/common/rename.c index 9d8397a..6183cf4 100644 --- a/libc/sysdeps/linux/common/rename.c +++ b/libc/sysdeps/linux/common/rename.c @@ -8,17 +8,6 @@ */ #include -#include -#include -#include #include -#define __NR___syscall_rename __NR_rename -static __inline__ _syscall2(int, __syscall_rename, const char *, oldpath, - const char *, newpath) - -int rename(const char * oldpath, const char * newpath) -{ - return __syscall_rename(oldpath, newpath); -} - +_syscall2(int, rename, const char *, oldpath, const char *, newpath) -- 1.7.3.4 From ps.m at gmx.net Thu Apr 14 07:59:26 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Thu, 14 Apr 2011 09:59:26 +0200 Subject: [git commit future] add simplified __sigemptyset for internal use Message-ID: <20110416005413.827E6826D0@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=beb625c54e041be004019979218af09eca9cfd55 branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/future Use __sigemptyset instead of sigemptyset. Remove hidden sigemptyset. Signed-off-by: Peter S. Mazinger --- include/signal.h | 7 ++++++- libc/signal/sigempty.c | 2 -- .../nptl/sysdeps/unix/sysv/linux/timer_routines.c | 4 ++-- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/include/signal.h b/include/signal.h index a95ad15..2924c7e 100644 --- a/include/signal.h +++ b/include/signal.h @@ -255,7 +255,6 @@ typedef __sighandler_t sig_t; /* Clear all signals from SET. */ extern int sigemptyset (sigset_t *__set) __THROW __nonnull ((1)); -libc_hidden_proto(sigemptyset) /* Set all signals in SET. */ extern int sigfillset (sigset_t *__set) __THROW __nonnull ((1)); @@ -483,6 +482,12 @@ extern int __libc_current_sigrtmin (void) __THROW; /* Return number of available real-time signal with lowest priority. */ extern int __libc_current_sigrtmax (void) __THROW; +#ifdef _LIBC +/* simplified version without parameter checking */ +# include +# undef __sigemptyset +# define __sigemptyset(ss) (memset(ss, '\0', sizeof(sigset_t)), 0) +#endif #endif /* signal.h */ __END_DECLS diff --git a/libc/signal/sigempty.c b/libc/signal/sigempty.c index b4f180b..2622c08 100644 --- a/libc/signal/sigempty.c +++ b/libc/signal/sigempty.c @@ -20,7 +20,6 @@ #include #include - /* Clear all signals from SET. */ int sigemptyset (sigset_t *set) { @@ -36,4 +35,3 @@ int sigemptyset (sigset_t *set) return 0; } -libc_hidden_def(sigemptyset) diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/timer_routines.c b/libpthread/nptl/sysdeps/unix/sysv/linux/timer_routines.c index 1664af5..2f33e99 100644 --- a/libpthread/nptl/sysdeps/unix/sysv/linux/timer_routines.c +++ b/libpthread/nptl/sysdeps/unix/sysv/linux/timer_routines.c @@ -49,7 +49,7 @@ timer_sigev_thread (void *arg) surprising for user code, although valid. We unblock all signals. */ sigset_t ss; - sigemptyset (&ss); + __sigemptyset (&ss); INTERNAL_SYSCALL_DECL (err); INTERNAL_SYSCALL (rt_sigprocmask, err, 4, SIG_SETMASK, &ss, NULL, _NSIG / 8); @@ -75,7 +75,7 @@ timer_helper_thread (void *arg) /* Wait for the SIGTIMER signal, allowing the setXid signal, and none else. */ sigset_t ss; - sigemptyset (&ss); + __sigemptyset (&ss); __sigaddset (&ss, SIGTIMER); /* Endless loop of waiting for signals. The loop is only ended when -- 1.7.3.4 From ps.m at gmx.net Thu Apr 14 07:59:26 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Thu, 14 Apr 2011 09:59:26 +0200 Subject: [git commit future] addr.c: get rid of a compiler warning Message-ID: <20110416005412.C7841826D0@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=affabb20ec0bb7ebed7b33ae4abd89c105c8b740 branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/future Signed-off-by: Peter S. Mazinger --- libc/inet/addr.c | 14 +++++++------- 1 files changed, 7 insertions(+), 7 deletions(-) diff --git a/libc/inet/addr.c b/libc/inet/addr.c index 363adb6..cd7151a 100644 --- a/libc/inet/addr.c +++ b/libc/inet/addr.c @@ -151,18 +151,18 @@ libc_hidden_def(inet_ntoa) */ struct in_addr inet_makeaddr(in_addr_t net, in_addr_t host) { - in_addr_t addr; + struct in_addr in; if (net < 128) - addr = (net << IN_CLASSA_NSHIFT) | (host & IN_CLASSA_HOST); + in.s_addr = (net << IN_CLASSA_NSHIFT) | (host & IN_CLASSA_HOST); else if (net < 65536) - addr = (net << IN_CLASSB_NSHIFT) | (host & IN_CLASSB_HOST); + in.s_addr = (net << IN_CLASSB_NSHIFT) | (host & IN_CLASSB_HOST); else if (net < 16777216UL) - addr = (net << IN_CLASSC_NSHIFT) | (host & IN_CLASSC_HOST); + in.s_addr = (net << IN_CLASSC_NSHIFT) | (host & IN_CLASSC_HOST); else - addr = net | host; - addr = htonl(addr); - return *(struct in_addr *)&addr; + in.s_addr = net | host; + in.s_addr = htonl(in.s_addr); + return in; } libc_hidden_def(inet_makeaddr) #endif -- 1.7.3.4 From ps.m at gmx.net Thu Apr 14 07:59:26 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Thu, 14 Apr 2011 09:59:26 +0200 Subject: [git commit future] handle the type mismatch of ftell[o] and fseek[o] if long int != off_t Message-ID: <20110416005413.ED654826D0@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=0c6c71e3733f39be7820d99216dfbdde68d33dd8 branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/future Signed-off-by: Peter S. Mazinger --- libc/stdio/fseeko.c | 2 +- libc/stdio/ftello.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/libc/stdio/fseeko.c b/libc/stdio/fseeko.c index 3caf1ac..16b0c04 100644 --- a/libc/stdio/fseeko.c +++ b/libc/stdio/fseeko.c @@ -77,5 +77,5 @@ int FSEEK(register FILE *stream, OFFSET_TYPE offset, int whence) libc_hidden_def(fseeko64) #else libc_hidden_def(fseek) -strong_alias(fseek,fseeko) +strong_alias_untyped(fseek,fseeko) #endif diff --git a/libc/stdio/ftello.c b/libc/stdio/ftello.c index e8ff365..219b699 100644 --- a/libc/stdio/ftello.c +++ b/libc/stdio/ftello.c @@ -53,5 +53,5 @@ OFFSET_TYPE FTELL(register FILE *stream) libc_hidden_def(ftello64) #else libc_hidden_def(ftell) -strong_alias(ftell,ftello) +strong_alias_untyped(ftell,ftello) #endif -- 1.7.3.4 From ps.m at gmx.net Thu Apr 14 07:59:26 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Thu, 14 Apr 2011 09:59:26 +0200 Subject: [git commit future] getopt.h: cleanup header, remove anything already in cdefs.h Message-ID: <20110416005414.4DE71826D0@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=eb98a4c6f969555e2ae32f6c95586e01f2192a32 branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/future Signed-off-by: Peter S. Mazinger --- libc/sysdeps/linux/common/bits/getopt.h | 38 +----------------------------- 1 files changed, 2 insertions(+), 36 deletions(-) diff --git a/libc/sysdeps/linux/common/bits/getopt.h b/libc/sysdeps/linux/common/bits/getopt.h index 7edb7bb..eb1a1db 100644 --- a/libc/sysdeps/linux/common/bits/getopt.h +++ b/libc/sysdeps/linux/common/bits/getopt.h @@ -26,31 +26,7 @@ # define _GETOPT_H 1 #endif -/* If __GNU_LIBRARY__ is not already defined, either we are being used - standalone, or this is the first header included in the source file. - If we are being used with glibc, we need to include , but - that does not exist if we are standalone. So: if __GNU_LIBRARY__ is - not defined, include , which will pull in for us - if it's from glibc. (Why ctype.h? It's guaranteed to exist and it - doesn't flood the namespace with stuff the way some other headers do.) */ -#if !defined __GNU_LIBRARY__ && !defined __UCLIBC__ -# include -#endif - -#ifndef __THROW -# ifndef __GNUC_PREREQ -# define __GNUC_PREREQ(maj, min) (0) -# endif -# if defined __cplusplus && __GNUC_PREREQ (2,8) -# define __THROW throw () -# else -# define __THROW -# endif -#endif - -#ifdef __cplusplus -extern "C" { -#endif +__BEGIN_DECLS /* For communication from `getopt' to the caller. When `getopt' finds an option that takes an argument, @@ -147,17 +123,9 @@ struct option arguments to the option '\0'. This behavior is specific to the GNU `getopt'. */ -#if defined __GNU_LIBRARY__ || defined __UCLIBC__ -/* Many other libraries have conflicting prototypes for getopt, with - differences in the consts, in stdlib.h. To avoid compilation - errors, only prototype getopt for the GNU C library. */ extern int getopt (int ___argc, char *const *___argv, const char *__shortopts) __THROW; libc_hidden_proto(getopt) -#else /* not __GNU_LIBRARY__ */ -extern int getopt (); -libc_hidden_proto(getopt) -#endif /* __GNU_LIBRARY__ */ #if defined __UCLIBC_HAS_GNU_GETOPT__ || defined __UCLIBC_HAS_GETOPT_LONG__ #ifndef __need_getopt @@ -173,9 +141,7 @@ extern int getopt_long_only (int ___argc, char *const *___argv, #endif #endif -#ifdef __cplusplus -} -#endif +__END_DECLS /* Make sure we later can get all the definitions and declarations. */ #undef __need_getopt -- 1.7.3.4 From ps.m at gmx.net Thu Apr 14 07:59:26 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Thu, 14 Apr 2011 09:59:26 +0200 Subject: [git commit future] llseek.c: use off64_t instead of loff_t as in header Message-ID: <20110416005414.E0A58826D0@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=05f1cefa06b6c336e93b6985cdda5c1f4af82122 branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/future Signed-off-by: Peter S. Mazinger --- libc/sysdeps/linux/common/llseek.c | 10 +++++----- 1 files changed, 5 insertions(+), 5 deletions(-) diff --git a/libc/sysdeps/linux/common/llseek.c b/libc/sysdeps/linux/common/llseek.c index 2181464..d04a5ec 100644 --- a/libc/sysdeps/linux/common/llseek.c +++ b/libc/sysdeps/linux/common/llseek.c @@ -12,16 +12,16 @@ #include #ifdef __NR__llseek -loff_t lseek64(int fd, loff_t offset, int whence) +off64_t lseek64(int fd, off64_t offset, int whence) { - loff_t result; - return (loff_t)INLINE_SYSCALL(_llseek, 5, fd, (off_t) (offset >> 32), + off64_t result; + return (off64_t)INLINE_SYSCALL(_llseek, 5, fd, (off_t) (offset >> 32), (off_t) (offset & 0xffffffff), &result, whence) ?: result; } #else -loff_t lseek64(int fd, loff_t offset, int whence) +off64_t lseek64(int fd, off64_t offset, int whence) { - return (loff_t)lseek(fd, (off_t) (offset), whence); + return (off64_t)lseek(fd, (off_t) (offset), whence); } #endif #ifndef __LINUXTHREADS_OLD__ -- 1.7.3.4 From ps.m at gmx.net Thu Apr 14 07:59:26 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Thu, 14 Apr 2011 09:59:26 +0200 Subject: [git commit future] mmap64.c: use void * as in header, disable code that can't happen Message-ID: <20110416005414.B7925826D0@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=6db10dbc6d1651eee96d9e3a61678a37926e9cb6 branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/future Reorganize a bit. Signed-off-by: Peter S. Mazinger --- libc/sysdeps/linux/common/mmap64.c | 38 +++++++++++++++-------------------- 1 files changed, 16 insertions(+), 22 deletions(-) diff --git a/libc/sysdeps/linux/common/mmap64.c b/libc/sysdeps/linux/common/mmap64.c index 4ef0397..65a7381 100644 --- a/libc/sysdeps/linux/common/mmap64.c +++ b/libc/sysdeps/linux/common/mmap64.c @@ -6,17 +6,11 @@ /* Massivly hacked up for uClibc by Erik Andersen */ #include <_lfs_64.h> - -#ifdef __UCLIBC_HAS_LFS__ - #include -#include -#include #include -#include - +#include -# if !defined __NR_mmap2 +#ifndef __NR_mmap2 /* * This version is a stub that just chops off everything at the mmap 32 bit @@ -26,7 +20,7 @@ * */ -__ptr_t mmap64(__ptr_t addr, size_t len, int prot, int flags, int fd, __off64_t offset) +void *mmap64(void *addr, size_t len, int prot, int flags, int fd, __off64_t offset) { if (offset != (off_t) offset || (offset + len) != (off_t) (offset + len)) { @@ -37,36 +31,36 @@ __ptr_t mmap64(__ptr_t addr, size_t len, int prot, int flags, int fd, __off64_t return mmap(addr, len, prot, flags, fd, (off_t) offset); } -# else +#else +# include -# define __NR___syscall_mmap2 __NR_mmap2 -static __inline__ _syscall6(__ptr_t, __syscall_mmap2, __ptr_t, addr, +# define __NR___syscall_mmap2 __NR_mmap2 +static __inline__ _syscall6(void *, __syscall_mmap2, void *, addr, size_t, len, int, prot, int, flags, int, fd, off_t, offset) -/* Some architectures always use 12 as page shift for mmap2() eventhough the +/* Some architectures always use 12 as page shift for mmap2() even though the * real PAGE_SHIFT != 12. Other architectures use the same value as * PAGE_SHIFT... */ -# ifndef MMAP2_PAGE_SHIFT -# define MMAP2_PAGE_SHIFT 12 -# endif +# ifndef MMAP2_PAGE_SHIFT +# define MMAP2_PAGE_SHIFT 12 +# endif -__ptr_t mmap64(__ptr_t addr, size_t len, int prot, int flags, int fd, __off64_t offset) +void *mmap64(void *addr, size_t len, int prot, int flags, int fd, __off64_t offset) { if (offset & ((1 << MMAP2_PAGE_SHIFT) - 1)) { __set_errno(EINVAL); return MAP_FAILED; } -# ifdef __USE_FILE_OFFSET64 +# if 0 /*def __USE_FILE_OFFSET64 can't happen due to _lfs_64.h */ return __syscall_mmap2(addr, len, prot, flags, fd, ((__u_quad_t) offset >> MMAP2_PAGE_SHIFT)); -# else +# else return __syscall_mmap2(addr, len, prot, flags, fd, ((__u_long) offset >> MMAP2_PAGE_SHIFT)); -# endif +# endif } -# endif -#endif /* __UCLIBC_HAS_LFS__ */ +#endif -- 1.7.3.4 From ps.m at gmx.net Thu Apr 14 07:59:26 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Thu, 14 Apr 2011 09:59:26 +0200 Subject: [git commit future] openat*: use a static function with the different type and strong_alias_untyped Message-ID: <20110416005415.34ED4826D0@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=aa08c1a99e3c07b99307e516db5f2e9d63b4210f branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/future No need for hidden openat64 _lfs_64.h does not allow to compile *64.c if LFS is not enabled, remove guard Signed-off-by: Peter S. Mazinger --- include/fcntl.h | 1 - libc/sysdeps/linux/common/openat.c | 12 +++--------- libc/sysdeps/linux/common/openat64.c | 17 +++-------------- 3 files changed, 6 insertions(+), 24 deletions(-) diff --git a/include/fcntl.h b/include/fcntl.h index fc71368..f2b4629 100644 --- a/include/fcntl.h +++ b/include/fcntl.h @@ -135,7 +135,6 @@ extern int __REDIRECT (openat, (int __fd, __const char *__file, int __oflag, extern int openat64 (int __fd, __const char *__file, int __oflag, ...) __nonnull ((2)); -libc_hidden_proto(openat64) #endif /* Create and open FILE, with mode MODE. This takes an `int' MODE diff --git a/libc/sysdeps/linux/common/openat.c b/libc/sysdeps/linux/common/openat.c index 8380ec6..f6032da 100644 --- a/libc/sysdeps/linux/common/openat.c +++ b/libc/sysdeps/linux/common/openat.c @@ -6,19 +6,13 @@ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. */ -#define openat __xx_openat #include #include -#undef openat #ifdef __NR_openat -/* The openat() prototype is varargs based, but we don't care about that - * here, so need to provide our own dedicated signature. - */ -extern int openat(int fd, const char *file, int oflag, mode_t mode); -libc_hidden_proto(openat) - -_syscall4(int, openat, int, fd, const char *, file, int, oflag, mode_t, mode) +# define __NR___syscall_openat __NR_openat +static __inline__ _syscall4(int, __syscall_openat, int, fd, const char *, file, int, oflag, mode_t, mode) +strong_alias_untyped(__syscall_openat,openat) libc_hidden_def(openat) #else /* should add emulation with open() and /proc/self/fd/ ... */ diff --git a/libc/sysdeps/linux/common/openat64.c b/libc/sysdeps/linux/common/openat64.c index 06a5819..eda3e7d 100644 --- a/libc/sysdeps/linux/common/openat64.c +++ b/libc/sysdeps/linux/common/openat64.c @@ -6,27 +6,16 @@ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. */ -#define openat64 __xx_openat +#include <_lfs_64.h> #include #include -#undef openat64 - -#ifdef __UCLIBC_HAS_LFS__ #ifdef __NR_openat -/* The openat() prototype is varargs based, but we don't care about that - * here, so need to provide our own dedicated signature. - */ -extern int openat64(int fd, const char *file, int oflag, mode_t mode); -libc_hidden_proto(openat64) - -int openat64(int fd, const char *file, int oflag, mode_t mode) +static int __openat64(int fd, const char *file, int oflag, mode_t mode) { return openat(fd, file, oflag | O_LARGEFILE, mode); } -libc_hidden_def(openat64) +strong_alias_untyped(__openat64,openat64) #else /* should add emulation with open() and /proc/self/fd/ ... */ #endif - -#endif -- 1.7.3.4 From ps.m at gmx.net Thu Apr 14 07:59:26 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Thu, 14 Apr 2011 09:59:26 +0200 Subject: [git commit future] Reorder includes and include only what is necessary Message-ID: <20110416005415.D9A09826D0@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=67d53a0af4900ab5d7ba36a540d2689dcd8152f7 branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/future Use param.h instead of MIN. Use stddef.h instead of offsetof. Signed-off-by: Peter S. Mazinger --- libc/sysdeps/linux/common/alarm.c | 4 +--- libc/sysdeps/linux/common/arch_prctl.c | 2 +- libc/sysdeps/linux/common/capget.c | 3 ++- libc/sysdeps/linux/common/capset.c | 2 +- libc/sysdeps/linux/common/fchdir.c | 3 ++- libc/sysdeps/linux/common/ftruncate.c | 1 - libc/sysdeps/linux/common/getdents.c | 28 ++++++++++++++-------------- libc/sysdeps/linux/common/getrlimit.c | 7 +++---- libc/sysdeps/linux/common/init_module.c | 5 +++-- libc/sysdeps/linux/common/sendfile.c | 12 ++++-------- libc/sysdeps/linux/common/setrlimit.c | 18 ++++++++++-------- libc/sysdeps/linux/common/truncate.c | 1 - libc/sysdeps/linux/i386/sysdep.h | 5 +---- librt/timer_create.c | 5 +---- 14 files changed, 43 insertions(+), 53 deletions(-) diff --git a/libc/sysdeps/linux/common/alarm.c b/libc/sysdeps/linux/common/alarm.c index cfd68fe..a2dd77b 100644 --- a/libc/sysdeps/linux/common/alarm.c +++ b/libc/sysdeps/linux/common/alarm.c @@ -10,12 +10,10 @@ #include #include - #ifdef __NR_alarm _syscall1(unsigned int, alarm, unsigned int, seconds) #else -#include - +# include unsigned int alarm(unsigned int seconds) { diff --git a/libc/sysdeps/linux/common/arch_prctl.c b/libc/sysdeps/linux/common/arch_prctl.c index 5816f53..9fc5948 100644 --- a/libc/sysdeps/linux/common/arch_prctl.c +++ b/libc/sysdeps/linux/common/arch_prctl.c @@ -10,6 +10,6 @@ #include #ifdef __NR_arch_prctl -extern int arch_prctl(int code, unsigned long addr); +int arch_prctl(int code, unsigned long addr); _syscall2(int, arch_prctl, int, code, unsigned long, addr) #endif diff --git a/libc/sysdeps/linux/common/capget.c b/libc/sysdeps/linux/common/capget.c index c3e8c57..e420f6a 100644 --- a/libc/sysdeps/linux/common/capget.c +++ b/libc/sysdeps/linux/common/capget.c @@ -8,7 +8,8 @@ */ #include -int capget(void *header, void *data); + #ifdef __NR_capget +int capget(void *header, void *data); _syscall2(int, capget, void *, header, void *, data) #endif diff --git a/libc/sysdeps/linux/common/capset.c b/libc/sysdeps/linux/common/capset.c index c0cf5de..493cf14 100644 --- a/libc/sysdeps/linux/common/capset.c +++ b/libc/sysdeps/linux/common/capset.c @@ -9,7 +9,7 @@ #include -int capset(void *header, const void *data); #ifdef __NR_capset +int capset(void *header, const void *data); _syscall2(int, capset, void *, header, const void *, data) #endif diff --git a/libc/sysdeps/linux/common/fchdir.c b/libc/sysdeps/linux/common/fchdir.c index 4d54ef8..05e9890 100644 --- a/libc/sysdeps/linux/common/fchdir.c +++ b/libc/sysdeps/linux/common/fchdir.c @@ -10,6 +10,7 @@ #include #include - +#if defined __USE_BSD || defined __USE_XOPEN_EXTENDED _syscall1(int, fchdir, int, fd) libc_hidden_def(fchdir) +#endif diff --git a/libc/sysdeps/linux/common/ftruncate.c b/libc/sysdeps/linux/common/ftruncate.c index 3bdef3f..ea4dfc0 100644 --- a/libc/sysdeps/linux/common/ftruncate.c +++ b/libc/sysdeps/linux/common/ftruncate.c @@ -10,6 +10,5 @@ #include #include - _syscall2(int, ftruncate, int, fd, __off_t, length) libc_hidden_def(ftruncate) diff --git a/libc/sysdeps/linux/common/getdents.c b/libc/sysdeps/linux/common/getdents.c index f321aea..f4fb747 100644 --- a/libc/sysdeps/linux/common/getdents.c +++ b/libc/sysdeps/linux/common/getdents.c @@ -4,22 +4,17 @@ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. */ -#include -#include +#include +#include + +#if !(defined __UCLIBC_HAS_LFS__ && defined __NR_getdents64 && __WORDSIZE == 64) + #include -#include -#include #include -#include -#include -#include #include -#include #include #include -#include -#if !(defined __UCLIBC_HAS_LFS__ && defined __NR_getdents64 && __WORDSIZE == 64) /* If the condition above is met, __getdents is defined as an alias * for __getdents64 (see getdents64.c). Otherwise... */ @@ -31,10 +26,6 @@ * version / arch details. */ -#ifndef offsetof -# define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER) -#endif - struct kernel_dirent { long int d_ino; @@ -77,6 +68,13 @@ ssize_t __getdents (int fd, char *buf, size_t nbytes) #elif ! defined __UCLIBC_HAS_LFS__ || ! defined __NR_getdents64 +# include +# include +# include +# include +# include +# include + ssize_t __getdents (int fd, char *buf, size_t nbytes) { struct dirent *dp; @@ -138,6 +136,8 @@ ssize_t __getdents (int fd, char *buf, size_t nbytes) #elif __WORDSIZE == 32 +# include + ssize_t __getdents (int fd, char *buf, size_t nbytes) { struct dirent *dp; diff --git a/libc/sysdeps/linux/common/getrlimit.c b/libc/sysdeps/linux/common/getrlimit.c index f9d70f3..3b2ce3b 100644 --- a/libc/sysdeps/linux/common/getrlimit.c +++ b/libc/sysdeps/linux/common/getrlimit.c @@ -8,8 +8,8 @@ */ #include -#include #include +#include /* Only wrap getrlimit if the new ugetrlimit is not present and getrlimit sucks */ @@ -22,14 +22,14 @@ _syscall2(int, __syscall_ugetrlimit, enum __rlimit_resource, resource, struct rlimit *, rlim) int getrlimit(__rlimit_resource_t resource, struct rlimit *rlimits) { - return (__syscall_ugetrlimit(resource, rlimits)); + return __syscall_ugetrlimit(resource, rlimits); } #elif !defined(__UCLIBC_HANDLE_OLDER_RLIMIT__) /* We don't need to wrap getrlimit() */ _syscall2(int, getrlimit, __rlimit_resource_t, resource, - struct rlimit *, rlim) + struct rlimit *, rlim) #else @@ -56,7 +56,6 @@ int getrlimit(__rlimit_resource_t resource, struct rlimit *rlimits) return result; } #endif - libc_hidden_def(getrlimit) #if defined __UCLIBC_HAS_LFS__ && __WORDSIZE == 64 diff --git a/libc/sysdeps/linux/common/init_module.c b/libc/sysdeps/linux/common/init_module.c index cf6d747..a2a3e02 100644 --- a/libc/sysdeps/linux/common/init_module.c +++ b/libc/sysdeps/linux/common/init_module.c @@ -8,12 +8,13 @@ */ #include -int init_module(void *first, void *second, void *third, void *fourth, void *fifth); + #ifdef __NR_init_module +int init_module(void *first, void *second, void *third, void *fourth, void *fifth); /* This may have 5 arguments (for old 2.0 kernels) or 2 arguments * (for 2.2 and 2.4 kernels). Use the greatest common denominator, * and let the kernel cope with whatever it gets. It's good at that. */ _syscall5(int, init_module, void *, first, void *, second, void *, third, - void *, fourth, void *, fifth) + void *, fourth, void *, fifth) #endif diff --git a/libc/sysdeps/linux/common/sendfile.c b/libc/sysdeps/linux/common/sendfile.c index 89bab9f..80f2e2e 100644 --- a/libc/sysdeps/linux/common/sendfile.c +++ b/libc/sysdeps/linux/common/sendfile.c @@ -8,16 +8,12 @@ */ #include -#include -#include #ifdef __NR_sendfile - +# include _syscall4(ssize_t, sendfile, int, out_fd, int, in_fd, __off_t *, offset, - size_t, count) - -#if ! defined __NR_sendfile64 && defined __UCLIBC_HAS_LFS__ + size_t, count) +# if ! defined __NR_sendfile64 && defined __UCLIBC_HAS_LFS__ strong_alias(sendfile,sendfile64) +# endif #endif - -#endif /* __NR_sendfile */ diff --git a/libc/sysdeps/linux/common/setrlimit.c b/libc/sysdeps/linux/common/setrlimit.c index 6817a9c..d96700a 100644 --- a/libc/sysdeps/linux/common/setrlimit.c +++ b/libc/sysdeps/linux/common/setrlimit.c @@ -8,8 +8,8 @@ */ #include -#include #include +#include /* Only wrap setrlimit if the new usetrlimit is not present and setrlimit sucks */ @@ -22,7 +22,7 @@ _syscall2(int, __syscall_usetrlimit, enum __rlimit_resource, resource, const struct rlimit *, rlim) int setrlimit(__rlimit_resource_t resource, struct rlimit *rlimits) { - return (__syscall_usetrlimit(resource, rlimits)); + return __syscall_usetrlimit(resource, rlimits); } #elif !defined(__UCLIBC_HANDLE_OLDER_RLIMIT__) @@ -33,6 +33,11 @@ _syscall2(int, setrlimit, __rlimit_resource_t, resource, #else +# define __need_NULL +# include +# include +# include + /* we have to handle old style setrlimit() */ # define __NR___syscall_setrlimit __NR_setrlimit static __always_inline @@ -49,16 +54,13 @@ int setrlimit(__rlimit_resource_t resource, const struct rlimit *rlimits) /* We might have to correct the limits values. Since the old values * were signed the new values might be too large. */ -# define RMIN(x, y) ((x) < (y) ? (x) : (y)) - rlimits_small.rlim_cur = RMIN((unsigned long int) rlimits->rlim_cur, + rlimits_small.rlim_cur = MIN((unsigned long int) rlimits->rlim_cur, RLIM_INFINITY >> 1); - rlimits_small.rlim_max = RMIN((unsigned long int) rlimits->rlim_max, + rlimits_small.rlim_max = MIN((unsigned long int) rlimits->rlim_max, RLIM_INFINITY >> 1); -#undef RMIN - return (__syscall_setrlimit(resource, &rlimits_small)); + return __syscall_setrlimit(resource, &rlimits_small); } #endif - libc_hidden_def(setrlimit) #if defined __UCLIBC_HAS_LFS__ && __WORDSIZE == 64 diff --git a/libc/sysdeps/linux/common/truncate.c b/libc/sysdeps/linux/common/truncate.c index 2331bdd..fe7bda9 100644 --- a/libc/sysdeps/linux/common/truncate.c +++ b/libc/sysdeps/linux/common/truncate.c @@ -10,6 +10,5 @@ #include #include - _syscall2(int, truncate, const char *, path, __off_t, length) libc_hidden_def(truncate) diff --git a/libc/sysdeps/linux/i386/sysdep.h b/libc/sysdeps/linux/i386/sysdep.h index b06d392..4137b97 100644 --- a/libc/sysdeps/linux/i386/sysdep.h +++ b/libc/sysdeps/linux/i386/sysdep.h @@ -150,10 +150,6 @@ __x86.get_pc_thunk.reg: \ #undef __i686 #endif /* __ASSEMBLER__ */ -#ifndef offsetof -# define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER) -#endif - /* For Linux we can use the system call table in the header file /usr/include/asm/unistd.h of the kernel. But these symbols do not follow the SYS_* syntax @@ -444,6 +440,7 @@ __x86.get_pc_thunk.reg: \ # define PTR_DEMANGLE(reg) rorl $9, reg; \ xorl %gs:POINTER_GUARD, reg # else +# include # define PTR_MANGLE(var) __asm__ ("xorl %%gs:%c2, %0\n" \ "roll $9, %0" \ : "=r" (var) \ diff --git a/librt/timer_create.c b/librt/timer_create.c index 9298a37..f52a36f 100644 --- a/librt/timer_create.c +++ b/librt/timer_create.c @@ -2,6 +2,7 @@ * timer_create.c - create a per-process timer. */ +#include #include #include #include @@ -13,10 +14,6 @@ #ifdef __NR_timer_create -#ifndef offsetof -# define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER) -#endif - #define __NR___syscall_timer_create __NR_timer_create static __inline__ _syscall3(int, __syscall_timer_create, clockid_t, clock_id, struct sigevent *, evp, kernel_timer_t *, ktimerid); -- 1.7.3.4 From ps.m at gmx.net Thu Apr 14 07:59:26 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Thu, 14 Apr 2011 09:59:26 +0200 Subject: [git commit future] ppoll: no need for hidden version Message-ID: <20110416005416.3783E826D0@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=c076842fee22fcaf181c69562f77b02dbb313ea2 branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/future Guard as GNU extension. Reorganize a bit. Signed-off-by: Peter S. Mazinger --- include/sys/poll.h | 1 - libc/sysdeps/linux/common/ppoll.c | 11 +++++------ 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/include/sys/poll.h b/include/sys/poll.h index 53ba6e2..1f5e12c 100644 --- a/include/sys/poll.h +++ b/include/sys/poll.h @@ -68,7 +68,6 @@ libc_hidden_proto(poll) extern int ppoll (struct pollfd *__fds, nfds_t __nfds, __const struct timespec *__timeout, __const __sigset_t *__ss); -libc_hidden_proto(ppoll) #endif __END_DECLS diff --git a/libc/sysdeps/linux/common/ppoll.c b/libc/sysdeps/linux/common/ppoll.c index 09b2b15..3ca3f73 100644 --- a/libc/sysdeps/linux/common/ppoll.c +++ b/libc/sysdeps/linux/common/ppoll.c @@ -17,13 +17,13 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -#include #include -#include -#define __need_NULL -#include -#if defined __NR_ppoll && defined __UCLIBC_LINUX_SPECIFIC__ +#if defined __NR_ppoll && defined __UCLIBC_LINUX_SPECIFIC__ && defined __USE_GNU +# define __need_NULL +# include +# include +# include # ifdef __UCLIBC_HAS_THREADS_NATIVE__ # include # else @@ -51,5 +51,4 @@ ppoll(struct pollfd *fds, nfds_t nfds, const struct timespec *timeout, return result; # endif } -libc_hidden_def(ppoll) #endif -- 1.7.3.4 From ps.m at gmx.net Thu Apr 14 07:59:26 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Thu, 14 Apr 2011 09:59:26 +0200 Subject: [git commit future] sched_setaffinity.c: make use of the syscall Message-ID: <20110416005417.32CB2826D0@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=9257584932820cef82712a6c1b3e158fd9784c98 branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/future Fix arg type (const missing). Reorganize a bit. Signed-off-by: Peter S. Mazinger --- libc/sysdeps/linux/common/sched_setaffinity.c | 26 +++++++++--------------- 1 files changed, 10 insertions(+), 16 deletions(-) diff --git a/libc/sysdeps/linux/common/sched_setaffinity.c b/libc/sysdeps/linux/common/sched_setaffinity.c index 980c441..e239cd7 100644 --- a/libc/sysdeps/linux/common/sched_setaffinity.c +++ b/libc/sysdeps/linux/common/sched_setaffinity.c @@ -16,22 +16,17 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -#include -#ifdef __USE_GNU - -#include -#include #include -#include -#include -#include -#include - -#if defined __NR_sched_setaffinity -#define __NR___syscall_sched_setaffinity __NR_sched_setaffinity -static __inline__ _syscall3(int, __syscall_sched_setaffinity, __kernel_pid_t, pid, - size_t, cpusetsize, cpu_set_t *, cpuset) +#if defined __NR_sched_setaffinity && defined __USE_GNU +# include +# include +# include +# include +# include +# define __NR___syscall_sched_setaffinity __NR_sched_setaffinity +static __always_inline _syscall3(int, __syscall_sched_setaffinity, __kernel_pid_t, pid, + size_t, cpusetsize, const cpu_set_t *, cpuset) static size_t __kernel_cpumask_size; @@ -68,7 +63,6 @@ int sched_setaffinity(pid_t pid, size_t cpusetsize, const cpu_set_t *cpuset) return -1; } - return INLINE_SYSCALL (sched_setaffinity, 3, pid, cpusetsize, cpuset); + return __syscall_sched_setaffinity(pid, cpusetsize, cpuset); } #endif -#endif /* __USE_GNU */ -- 1.7.3.4 From ps.m at gmx.net Thu Apr 14 07:59:26 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Thu, 14 Apr 2011 09:59:26 +0200 Subject: [git commit future] sched_getaffinity.c: mark syscall as __always_inline Message-ID: <20110416005417.646A9826D0@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=bde9e813b4cb4e43d838cb06d91736ba8f678ce0 branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/future Reorganize a bit. Signed-off-by: Peter S. Mazinger --- libc/sysdeps/linux/common/sched_getaffinity.c | 21 ++++++++------------- 1 files changed, 8 insertions(+), 13 deletions(-) diff --git a/libc/sysdeps/linux/common/sched_getaffinity.c b/libc/sysdeps/linux/common/sched_getaffinity.c index 8982582..0854516 100644 --- a/libc/sysdeps/linux/common/sched_getaffinity.c +++ b/libc/sysdeps/linux/common/sched_getaffinity.c @@ -16,20 +16,16 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -#include -#ifdef __USE_GNU - -#include -#include #include -#include -#include - -#if defined __NR_sched_getaffinity -#define __NR___syscall_sched_getaffinity __NR_sched_getaffinity -static __inline__ _syscall3(int, __syscall_sched_getaffinity, __kernel_pid_t, pid, - size_t, cpusetsize, cpu_set_t *, cpuset) +#if defined __NR_sched_getaffinity && defined __USE_GNU +# include +# include +# include +# include +# define __NR___syscall_sched_getaffinity __NR_sched_getaffinity +static __always_inline _syscall3(int, __syscall_sched_getaffinity, __kernel_pid_t, pid, + size_t, cpusetsize, cpu_set_t *, cpuset) int sched_getaffinity(pid_t pid, size_t cpusetsize, cpu_set_t *cpuset) { @@ -45,4 +41,3 @@ int sched_getaffinity(pid_t pid, size_t cpusetsize, cpu_set_t *cpuset) return res; } #endif -#endif -- 1.7.3.4 From ps.m at gmx.net Thu Apr 14 07:59:26 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Thu, 14 Apr 2011 09:59:26 +0200 Subject: [git commit future] prctl.c: no need to include stdarg.h and extern Message-ID: <20110416005417.91DFB826D0@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=f93ebe521c927723f052baade0b7519aee9d2643 branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/future Signed-off-by: Peter S. Mazinger --- libc/sysdeps/linux/common/prctl.c | 3 +-- 1 files changed, 1 insertions(+), 2 deletions(-) diff --git a/libc/sysdeps/linux/common/prctl.c b/libc/sysdeps/linux/common/prctl.c index 39c0d4f..67732bb 100644 --- a/libc/sysdeps/linux/common/prctl.c +++ b/libc/sysdeps/linux/common/prctl.c @@ -8,10 +8,9 @@ */ #include -#include /* psm: including sys/prctl.h would depend on kernel headers */ #ifdef __NR_prctl -extern int prctl (int, long, long, long, long); +int prctl (int, long, long, long, long); _syscall5(int, prctl, int, option, long, _a2, long, _a3, long, _a4, long, _a5) #endif -- 1.7.3.4 From ps.m at gmx.net Thu Apr 14 07:59:26 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Thu, 14 Apr 2011 09:59:26 +0200 Subject: [git commit future] correct sendfile for 32/64 bit archs Message-ID: <20110416005417.C1A61826D0@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=431412f98981dc5ff84a13418d3333c48586f1ac branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/future Signed-off-by: Peter S. Mazinger --- libc/sysdeps/linux/common/sendfile.c | 5 +++-- libc/sysdeps/linux/common/sendfile64.c | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/libc/sysdeps/linux/common/sendfile.c b/libc/sysdeps/linux/common/sendfile.c index 80f2e2e..64c200e 100644 --- a/libc/sysdeps/linux/common/sendfile.c +++ b/libc/sysdeps/linux/common/sendfile.c @@ -11,9 +11,10 @@ #ifdef __NR_sendfile # include +# include _syscall4(ssize_t, sendfile, int, out_fd, int, in_fd, __off_t *, offset, size_t, count) -# if ! defined __NR_sendfile64 && defined __UCLIBC_HAS_LFS__ -strong_alias(sendfile,sendfile64) +# if defined __UCLIBC_HAS_LFS__ && (!defined __NR_sendfile64 || __WORDSIZE == 64) +strong_alias_untyped(sendfile,sendfile64) # endif #endif diff --git a/libc/sysdeps/linux/common/sendfile64.c b/libc/sysdeps/linux/common/sendfile64.c index 2442b80..705e6fd 100644 --- a/libc/sysdeps/linux/common/sendfile64.c +++ b/libc/sysdeps/linux/common/sendfile64.c @@ -12,8 +12,9 @@ #include <_lfs_64.h> #include +#include -#ifdef __NR_sendfile64 +#if defined __NR_sendfile64 && __WORDSIZE != 64 # include _syscall4(ssize_t,sendfile64, int, out_fd, int, in_fd, __off64_t *, offset, size_t, count) #endif -- 1.7.3.4 From ps.m at gmx.net Thu Apr 14 07:59:26 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Thu, 14 Apr 2011 09:59:26 +0200 Subject: [git commit future] pause.c: no need for __UCLIBC_HIDE_DEPRECATED__, the code does not use old functions Message-ID: <20110416005417.EF44F826D0@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=8236b613d66fe3f550a21fd2b35aa7998bec88fb branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/future Remove syscall.h as well, not needed anymore. Signed-off-by: Peter S. Mazinger --- libc/sysdeps/linux/common/pause.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/libc/sysdeps/linux/common/pause.c b/libc/sysdeps/linux/common/pause.c index ab16fa7..a77c4d5 100644 --- a/libc/sysdeps/linux/common/pause.c +++ b/libc/sysdeps/linux/common/pause.c @@ -7,8 +7,8 @@ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. */ -#define __UCLIBC_HIDE_DEPRECATED__ -#include +#define __need_NULL +#include #include #ifdef __UCLIBC_HAS_THREADS_NATIVE__ -- 1.7.3.4 From ps.m at gmx.net Thu Apr 14 07:59:26 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Thu, 14 Apr 2011 09:59:26 +0200 Subject: [git commit future] setgroups.c: move around some headers, always_inline syscall Message-ID: <20110416005418.3AC0B826D0@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=c344a3557e9de9cc0585622515b6eecf924177c6 branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/future Signed-off-by: Peter S. Mazinger --- libc/sysdeps/linux/common/setgroups.c | 16 ++++++++-------- 1 files changed, 8 insertions(+), 8 deletions(-) diff --git a/libc/sysdeps/linux/common/setgroups.c b/libc/sysdeps/linux/common/setgroups.c index 72c9878..d97859f 100644 --- a/libc/sysdeps/linux/common/setgroups.c +++ b/libc/sysdeps/linux/common/setgroups.c @@ -8,12 +8,9 @@ */ #include -#include -#include -#include #ifdef __USE_BSD - +#include #if defined(__NR_setgroups32) # undef __NR_setgroups @@ -24,11 +21,14 @@ _syscall2(int, setgroups, size_t, size, const gid_t *, list) _syscall2(int, setgroups, size_t, size, const gid_t *, list) #else +# include +# include +# include +# include - -#define __NR___syscall_setgroups __NR_setgroups -static __inline__ _syscall2(int, __syscall_setgroups, - size_t, size, const __kernel_gid_t *, list) +# define __NR___syscall_setgroups __NR_setgroups +static __always_inline _syscall2(int, __syscall_setgroups, + size_t, size, const __kernel_gid_t *, list) int setgroups(size_t size, const gid_t *groups) { -- 1.7.3.4 From ps.m at gmx.net Thu Apr 14 07:59:26 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Thu, 14 Apr 2011 09:59:26 +0200 Subject: [git commit future] pivot_root.c: move prototype into guard Message-ID: <20110416005416.92604826D0@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=f157b90b579db6153e77e60ecb81292240f54eca branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/future Signed-off-by: Peter S. Mazinger --- libc/sysdeps/linux/common/pivot_root.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/libc/sysdeps/linux/common/pivot_root.c b/libc/sysdeps/linux/common/pivot_root.c index 0e738d5..78f71ef 100644 --- a/libc/sysdeps/linux/common/pivot_root.c +++ b/libc/sysdeps/linux/common/pivot_root.c @@ -9,7 +9,7 @@ #include -int pivot_root(const char *new_root, const char *put_old); #ifdef __NR_pivot_root +int pivot_root(const char *new_root, const char *put_old); _syscall2(int, pivot_root, const char *, new_root, const char *, put_old) #endif -- 1.7.3.4 From ps.m at gmx.net Thu Apr 14 07:59:26 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Thu, 14 Apr 2011 09:59:26 +0200 Subject: [git commit future] stubs.c: add openat* stubs Message-ID: <20110416005415.AC7B5826D0@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=385ef3dd8d11c19d9478020d5fdab4b2a70de7c6 branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/future Signed-off-by: Peter S. Mazinger --- libc/sysdeps/linux/common/stubs.c | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-) diff --git a/libc/sysdeps/linux/common/stubs.c b/libc/sysdeps/linux/common/stubs.c index 883bd34..e146c71 100644 --- a/libc/sysdeps/linux/common/stubs.c +++ b/libc/sysdeps/linux/common/stubs.c @@ -219,6 +219,13 @@ make_stub(lutimes) # endif #endif +#ifndef __NR_openat +make_stub(openat) +# ifdef __UCLIBC_HAS_LFS__ +make_stub(openat64) +# endif +#endif + #ifndef __NR_fadvise64 make_ret_stub(posix_fadvise) #endif -- 1.7.3.4 From ps.m at gmx.net Thu Apr 14 07:59:26 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Thu, 14 Apr 2011 09:59:26 +0200 Subject: [git commit future] *64.[cS]: use _lfs_64.h instead of features.h and remove LFS guard Message-ID: <20110416005415.66333826D0@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=a6c60dd44fdccb91b71b533d52711286dfc44a57 branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/future _lfs_64.h makes the compile fail, if LFS is not enabled, no need for the guard. Reorganize to include only the minimal necessary headers. Signed-off-by: Peter S. Mazinger --- libc/sysdeps/linux/arm/mmap64.S | 4 +- libc/sysdeps/linux/common/__syscall_fcntl64.c | 10 +++--- libc/sysdeps/linux/common/creat64.c | 4 -- libc/sysdeps/linux/common/fstat64.c | 17 ++++----- libc/sysdeps/linux/common/fstatat64.c | 9 ++--- libc/sysdeps/linux/common/ftruncate64.c | 43 +++++++++------------- libc/sysdeps/linux/common/getdents64.c | 17 +++------ libc/sysdeps/linux/common/getrlimit64.c | 7 +--- libc/sysdeps/linux/common/lstat64.c | 9 ++--- libc/sysdeps/linux/common/open64.c | 6 +--- libc/sysdeps/linux/common/posix_fadvise64.c | 2 +- libc/sysdeps/linux/common/sendfile64.c | 11 ++---- libc/sysdeps/linux/common/setrlimit64.c | 7 +--- libc/sysdeps/linux/common/stat64.c | 14 +++---- libc/sysdeps/linux/common/truncate64.c | 47 +++++++++---------------- libc/sysdeps/linux/frv/fstat64.c | 4 +-- libc/sysdeps/linux/frv/lstat64.c | 4 +-- libc/sysdeps/linux/frv/stat64.c | 4 +-- libc/sysdeps/linux/i386/mmap64.S | 5 +-- libc/sysdeps/linux/i386/posix_fadvise64.S | 3 +- libc/sysdeps/linux/mips/posix_fadvise64.c | 2 +- 21 files changed, 86 insertions(+), 143 deletions(-) diff --git a/libc/sysdeps/linux/arm/mmap64.S b/libc/sysdeps/linux/arm/mmap64.S index 7071541..bc9d4f1 100644 --- a/libc/sysdeps/linux/arm/mmap64.S +++ b/libc/sysdeps/linux/arm/mmap64.S @@ -16,13 +16,13 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -#include +#include <_lfs_64.h> #define _ERRNO_H #include #include #include -#if defined __UCLIBC_HAS_LFS__ && defined __NR_mmap2 +#ifdef __NR_mmap2 /* The mmap2 system call takes six arguments, all in registers. */ .text diff --git a/libc/sysdeps/linux/common/__syscall_fcntl64.c b/libc/sysdeps/linux/common/__syscall_fcntl64.c index e8782e9..09291e5 100644 --- a/libc/sysdeps/linux/common/__syscall_fcntl64.c +++ b/libc/sysdeps/linux/common/__syscall_fcntl64.c @@ -7,13 +7,13 @@ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. */ +#include <_lfs_64.h> #include -#include -#include -#if defined __UCLIBC_HAS_LFS__ && defined __NR_fcntl64 - -#define __NR___syscall_fcntl64 __NR_fcntl64 +#ifdef __NR_fcntl64 +# include +# include +# define __NR___syscall_fcntl64 __NR_fcntl64 static __inline__ _syscall3(int, __syscall_fcntl64, int, fd, int, cmd, long, arg) int fcntl64(int fd, int cmd, ...) { diff --git a/libc/sysdeps/linux/common/creat64.c b/libc/sysdeps/linux/common/creat64.c index 577ad14..550e88a 100644 --- a/libc/sysdeps/linux/common/creat64.c +++ b/libc/sysdeps/linux/common/creat64.c @@ -17,14 +17,10 @@ 02111-1307 USA. */ #include <_lfs_64.h> - -#ifdef __UCLIBC_HAS_LFS__ #include -#include /* Create FILE with protections MODE. */ int creat64(const char *file, mode_t mode) { return open64(file, O_WRONLY|O_CREAT|O_TRUNC, mode); } -#endif /* __UCLIBC_HAS_LFS__ */ diff --git a/libc/sysdeps/linux/common/fstat64.c b/libc/sysdeps/linux/common/fstat64.c index 6061343..7460c26 100644 --- a/libc/sysdeps/linux/common/fstat64.c +++ b/libc/sysdeps/linux/common/fstat64.c @@ -7,17 +7,16 @@ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. */ +#include <_lfs_64.h> #include -#if defined __UCLIBC_HAS_LFS__ && defined __NR_fstat64 -#include -#include -#include "xstatconv.h" - - -#define __NR___syscall_fstat64 __NR_fstat64 -static __inline__ _syscall2(int, __syscall_fstat64, - int, filedes, struct kernel_stat64 *, buf) +#ifdef __NR_fstat64 +# include +# include +# include "xstatconv.h" +# define __NR___syscall_fstat64 __NR_fstat64 +static __always_inline _syscall2(int, __syscall_fstat64, + int, filedes, struct kernel_stat64 *, buf) int fstat64(int fd, struct stat64 *buf) { diff --git a/libc/sysdeps/linux/common/fstatat64.c b/libc/sysdeps/linux/common/fstatat64.c index 95627af..6be8ba4 100644 --- a/libc/sysdeps/linux/common/fstatat64.c +++ b/libc/sysdeps/linux/common/fstatat64.c @@ -6,11 +6,8 @@ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. */ +#include <_lfs_64.h> #include -#include -#include "xstatconv.h" - -#ifdef __UCLIBC_HAS_LFS__ /* 64bit ports tend to favor newfstatat() */ #ifdef __NR_newfstatat @@ -18,6 +15,8 @@ #endif #ifdef __NR_fstatat64 +# include +# include "xstatconv.h" int fstatat64(int fd, const char *file, struct stat64 *buf, int flag) { int ret; @@ -32,5 +31,3 @@ int fstatat64(int fd, const char *file, struct stat64 *buf, int flag) #else /* should add emulation with fstat64() and /proc/self/fd/ ... */ #endif - -#endif diff --git a/libc/sysdeps/linux/common/ftruncate64.c b/libc/sysdeps/linux/common/ftruncate64.c index c5a6160..012a1f4 100644 --- a/libc/sysdeps/linux/common/ftruncate64.c +++ b/libc/sysdeps/linux/common/ftruncate64.c @@ -10,47 +10,42 @@ * just the macro we need to order things, __LONG_LONG_PAIR. */ -#include +#include <_lfs_64.h> +#include +#include -#ifdef __UCLIBC_HAS_LFS__ +#ifdef __NR_ftruncate64 +# include -# include -# include -# include -# include -# include -# include - - -# ifdef __NR_ftruncate64 - -# if __WORDSIZE == 64 +# if __WORDSIZE == 64 /* For a 64 bit machine, life is simple... */ _syscall2(int, ftruncate64, int, fd, __off64_t, length) -# elif __WORDSIZE == 32 +# elif __WORDSIZE == 32 +# include +# include /* The exported ftruncate64 function. */ int ftruncate64 (int fd, __off64_t length) { uint32_t low = length & 0xffffffff; uint32_t high = length >> 32; -# if defined(__UCLIBC_TRUNCATE64_HAS_4_ARGS__) +# if defined(__UCLIBC_TRUNCATE64_HAS_4_ARGS__) return INLINE_SYSCALL(ftruncate64, 4, fd, 0, __LONG_LONG_PAIR (high, low)); -# else +# else return INLINE_SYSCALL(ftruncate64, 3, fd, __LONG_LONG_PAIR (high, low)); -# endif +# endif } -# else /* __WORDSIZE */ -# error Your machine is not 64 bit or 32 bit, I am dazed and confused. -# endif /* __WORDSIZE */ - -# else /* __NR_ftruncate64 */ +# else /* __WORDSIZE */ +# error Your machine is not 64 bit or 32 bit, I am dazed and confused. +# endif /* __WORDSIZE */ +#else /* __NR_ftruncate64 */ +# include int ftruncate64 (int fd, __off64_t length) { @@ -65,7 +60,5 @@ int ftruncate64 (int fd, __off64_t length) return -1; } -# endif /* __NR_ftruncate64 */ +#endif /* __NR_ftruncate64 */ libc_hidden_def(ftruncate64) - -#endif /* __UCLIBC_HAS_LFS__ */ diff --git a/libc/sysdeps/linux/common/getdents64.c b/libc/sysdeps/linux/common/getdents64.c index e1133ff..aacbe97 100644 --- a/libc/sysdeps/linux/common/getdents64.c +++ b/libc/sysdeps/linux/common/getdents64.c @@ -4,7 +4,11 @@ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. */ -#include +#include <_lfs_64.h> +#include + +#ifdef __NR_getdents64 + #include #include #include @@ -12,19 +16,10 @@ #include #include #include -#include #include -#include -#include -#include +#include #include -#if defined __UCLIBC_HAS_LFS__ && defined __NR_getdents64 - -# ifndef offsetof -# define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER) -# endif - struct kernel_dirent64 { uint64_t d_ino; diff --git a/libc/sysdeps/linux/common/getrlimit64.c b/libc/sysdeps/linux/common/getrlimit64.c index d537241..2945e6d 100644 --- a/libc/sysdeps/linux/common/getrlimit64.c +++ b/libc/sysdeps/linux/common/getrlimit64.c @@ -17,15 +17,12 @@ 02111-1307 USA. */ #include <_lfs_64.h> - -#include -#include #include /* the regular getrlimit will work just fine for 64bit users */ +#if __WORDSIZE == 32 -#if defined __UCLIBC_HAS_LFS__ && __WORDSIZE == 32 - +# include /* Put the soft and hard limits for RESOURCE in *RLIMITS. Returns 0 if successful, -1 if not (and sets errno). */ diff --git a/libc/sysdeps/linux/common/lstat64.c b/libc/sysdeps/linux/common/lstat64.c index 235b76d..85e2698 100644 --- a/libc/sysdeps/linux/common/lstat64.c +++ b/libc/sysdeps/linux/common/lstat64.c @@ -7,17 +7,17 @@ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. */ +#include <_lfs_64.h> #include -#if defined __UCLIBC_HAS_LFS__ && defined __NR_lstat64 +#ifdef __NR_lstat64 # include # include # include "xstatconv.h" - # define __NR___syscall_lstat64 __NR_lstat64 -static __inline__ _syscall2(int, __syscall_lstat64, const char *, file_name, - struct kernel_stat64 *, buf) +static __always_inline _syscall2(int, __syscall_lstat64, const char *, file_name, + struct kernel_stat64 *, buf) int lstat64(const char *file_name, struct stat64 *buf) { @@ -31,5 +31,4 @@ int lstat64(const char *file_name, struct stat64 *buf) return result; } libc_hidden_def(lstat64) - #endif diff --git a/libc/sysdeps/linux/common/open64.c b/libc/sysdeps/linux/common/open64.c index c1f5400..91931fa 100644 --- a/libc/sysdeps/linux/common/open64.c +++ b/libc/sysdeps/linux/common/open64.c @@ -4,7 +4,7 @@ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. */ -#include +#include <_lfs_64.h> #include #include #ifdef __UCLIBC_HAS_THREADS_NATIVE__ @@ -12,8 +12,6 @@ #include #endif -#ifdef __UCLIBC_HAS_LFS__ - #ifndef O_LARGEFILE # define O_LARGEFILE 0100000 #endif @@ -53,5 +51,3 @@ libc_hidden_def(open64) libc_hidden_weak(open64) strong_alias(open64,__libc_open64) #endif - -#endif /* __UCLIBC_HAS_LFS__ */ diff --git a/libc/sysdeps/linux/common/posix_fadvise64.c b/libc/sysdeps/linux/common/posix_fadvise64.c index de813ba..0670854 100644 --- a/libc/sysdeps/linux/common/posix_fadvise64.c +++ b/libc/sysdeps/linux/common/posix_fadvise64.c @@ -16,7 +16,7 @@ # define __NR_fadvise64_64 __NR_arm_fadvise64_64 #endif -#if defined __NR_fadvise64_64 && defined __UCLIBC_HAS_LFS__ && __WORDSIZE == 32 +#if defined __NR_fadvise64_64 && __WORDSIZE == 32 # include # include diff --git a/libc/sysdeps/linux/common/sendfile64.c b/libc/sysdeps/linux/common/sendfile64.c index fc5155f..2442b80 100644 --- a/libc/sysdeps/linux/common/sendfile64.c +++ b/libc/sysdeps/linux/common/sendfile64.c @@ -10,15 +10,10 @@ * just the macro we need to order things, __LONG_LONG_PAIR. */ -#include -#include -#include -#include -#include -#include +#include <_lfs_64.h> #include -#include -#if defined __UCLIBC_HAS_LFS__ && defined __NR_sendfile64 +#ifdef __NR_sendfile64 +# include _syscall4(ssize_t,sendfile64, int, out_fd, int, in_fd, __off64_t *, offset, size_t, count) #endif diff --git a/libc/sysdeps/linux/common/setrlimit64.c b/libc/sysdeps/linux/common/setrlimit64.c index 8705c6f..8ec6e58 100644 --- a/libc/sysdeps/linux/common/setrlimit64.c +++ b/libc/sysdeps/linux/common/setrlimit64.c @@ -17,15 +17,12 @@ 02111-1307 USA. */ #include <_lfs_64.h> - -#include -#include #include /* the regular setrlimit will work just fine for 64bit users */ +#if __WORDSIZE == 32 -#if defined __UCLIBC_HAS_LFS__ && __WORDSIZE == 32 - +# include /* Set the soft and hard limits for RESOURCE to *RLIMITS. Only the super-user can increase hard limits. diff --git a/libc/sysdeps/linux/common/stat64.c b/libc/sysdeps/linux/common/stat64.c index a76f182..ef34faf 100644 --- a/libc/sysdeps/linux/common/stat64.c +++ b/libc/sysdeps/linux/common/stat64.c @@ -7,17 +7,15 @@ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. */ +#include <_lfs_64.h> #include -#include -#if defined __UCLIBC_HAS_LFS__ && defined __NR_stat64 - -# define __NR___syscall_stat64 __NR_stat64 -# include +#ifdef __NR_stat64 +# include # include "xstatconv.h" - -static __inline__ _syscall2(int, __syscall_stat64, - const char *, file_name, struct kernel_stat64 *, buf) +# define __NR___syscall_stat64 __NR_stat64 +static __always_inline _syscall2(int, __syscall_stat64, + const char *, file_name, struct kernel_stat64 *, buf) int stat64(const char *file_name, struct stat64 *buf) { diff --git a/libc/sysdeps/linux/common/truncate64.c b/libc/sysdeps/linux/common/truncate64.c index 1f6c459..6dfdc4c 100644 --- a/libc/sysdeps/linux/common/truncate64.c +++ b/libc/sysdeps/linux/common/truncate64.c @@ -10,46 +10,36 @@ * just the macro we need to order things, __LONG_LONG_PAIR. */ -#include -#include -#include -#include -#include -#include +#include <_lfs_64.h> #include +#include -#if defined __UCLIBC_HAS_LFS__ - -#if defined __NR_truncate64 - -#if __WORDSIZE == 64 +#ifdef __NR_truncate64 +# include -/* For a 64 bit machine, life is simple... */ +# if __WORDSIZE == 64 _syscall2(int, truncate64, const char *, path, __off64_t, length) - -#elif __WORDSIZE == 32 - -/* The exported truncate64 function. */ +# elif __WORDSIZE == 32 +# include +# include int truncate64(const char * path, __off64_t length) { uint32_t low = length & 0xffffffff; uint32_t high = length >> 32; -#if defined(__UCLIBC_TRUNCATE64_HAS_4_ARGS__) +# if defined(__UCLIBC_TRUNCATE64_HAS_4_ARGS__) return INLINE_SYSCALL(truncate64, 4, path, 0, __LONG_LONG_PAIR(high, low)); -#else +# else return INLINE_SYSCALL(truncate64, 3, path, __LONG_LONG_PAIR(high, low)); -#endif +# endif } +# else +# error Your machine is not 64 bit nor 32 bit, I am dazed and confused. +# endif -#else /* __WORDSIZE */ -#error Your machine is not 64 bit nor 32 bit, I am dazed and confused. -#endif /* __WORDSIZE */ - -#else /* __NR_truncate64 */ - - +#else +# include int truncate64(const char * path, __off64_t length) { __off_t x = (__off_t) length; @@ -62,7 +52,4 @@ int truncate64(const char * path, __off64_t length) return -1; } - -#endif /* __NR_truncate64 */ - -#endif /* __UCLIBC_HAS_LFS__ */ +#endif diff --git a/libc/sysdeps/linux/frv/fstat64.c b/libc/sysdeps/linux/frv/fstat64.c index f795342..75383b2 100644 --- a/libc/sysdeps/linux/frv/fstat64.c +++ b/libc/sysdeps/linux/frv/fstat64.c @@ -9,11 +9,9 @@ * Adapted to FR-V by Alexandre Oliva */ +#include <_lfs_64.h> #include -#include #include -#ifdef __UCLIBC_HAS_LFS__ _syscall2(int, fstat64, int, fd, struct stat64 *, buf) libc_hidden_def(fstat64) -#endif diff --git a/libc/sysdeps/linux/frv/lstat64.c b/libc/sysdeps/linux/frv/lstat64.c index f038fb0..e84581c 100644 --- a/libc/sysdeps/linux/frv/lstat64.c +++ b/libc/sysdeps/linux/frv/lstat64.c @@ -9,11 +9,9 @@ * Adapted to FR-V by Alexandre Oliva */ +#include <_lfs_64.h> #include -#include #include -#ifdef __UCLIBC_HAS_LFS__ _syscall2(int, lstat64, const char *, file_name, struct stat64 *, buf) libc_hidden_def(lstat64) -#endif diff --git a/libc/sysdeps/linux/frv/stat64.c b/libc/sysdeps/linux/frv/stat64.c index 675e634..a13d1c3 100644 --- a/libc/sysdeps/linux/frv/stat64.c +++ b/libc/sysdeps/linux/frv/stat64.c @@ -9,11 +9,9 @@ * Adapted to FR-V by Alexandre Oliva */ +#include <_lfs_64.h> #include -#include #include -#ifdef __UCLIBC_HAS_LFS__ _syscall2(int, stat64, const char *, file_name, struct stat64 *, buf) libc_hidden_def(stat64) -#endif diff --git a/libc/sysdeps/linux/i386/mmap64.S b/libc/sysdeps/linux/i386/mmap64.S index a6b4aa0..33f7db7 100644 --- a/libc/sysdeps/linux/i386/mmap64.S +++ b/libc/sysdeps/linux/i386/mmap64.S @@ -17,13 +17,12 @@ 02111-1307 USA. */ +#include <_lfs_64.h> #define _ERRNO_H 1 -#include #include #include -#if defined __UCLIBC_HAS_LFS__ && defined __NR_mmap2 - +#ifdef __NR_mmap2 #define LINKAGE 4 #define PTR_SIZE 4 diff --git a/libc/sysdeps/linux/i386/posix_fadvise64.S b/libc/sysdeps/linux/i386/posix_fadvise64.S index 5f966a5..4b171c0 100644 --- a/libc/sysdeps/linux/i386/posix_fadvise64.S +++ b/libc/sysdeps/linux/i386/posix_fadvise64.S @@ -17,9 +17,10 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ +#include <_lfs_64.h> #include -#if defined __NR_fadvise64_64 && defined __UCLIBC_HAS_LFS__ +#ifdef __NR_fadvise64_64 .text .global posix_fadvise64 diff --git a/libc/sysdeps/linux/mips/posix_fadvise64.c b/libc/sysdeps/linux/mips/posix_fadvise64.c index f97dab9..02244aa 100644 --- a/libc/sysdeps/linux/mips/posix_fadvise64.c +++ b/libc/sysdeps/linux/mips/posix_fadvise64.c @@ -13,7 +13,7 @@ #include /* MIPS kernel only has NR_fadvise64 which acts as NR_fadvise64_64 */ -#if defined __NR_fadvise64 && defined __UCLIBC_HAS_LFS__ && __WORDSIZE == 32 +#if defined __NR_fadvise64 && __WORDSIZE == 32 # include # include -- 1.7.3.4 From ps.m at gmx.net Thu Apr 14 07:59:26 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Thu, 14 Apr 2011 09:59:26 +0200 Subject: [git commit ldso-future] ldso: include dl-startup.h in correct order Message-ID: <20110416005432.5355F826D0@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=437a81b948dd1cbf448436c1858094e8b5356467 branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/ldso-future Signed-off-by: Peter S. Mazinger --- ldso/include/dl-defs.h | 3 +++ ldso/ldso/bfin/dl-startup.h | 1 - ldso/ldso/c6x/dl-startup.h | 1 - ldso/ldso/dl-startup.c | 3 --- ldso/ldso/frv/dl-startup.h | 1 - 5 files changed, 3 insertions(+), 6 deletions(-) diff --git a/ldso/include/dl-defs.h b/ldso/include/dl-defs.h index 4dc4461..7de76aa 100644 --- a/ldso/include/dl-defs.h +++ b/ldso/include/dl-defs.h @@ -76,6 +76,9 @@ typedef struct { #ifdef _LIBC /* arch specific defines */ +#ifdef IS_IN_rtld +# include +#endif #include #endif diff --git a/ldso/ldso/bfin/dl-startup.h b/ldso/ldso/bfin/dl-startup.h index 9f9e4d6..1da3166 100644 --- a/ldso/ldso/bfin/dl-startup.h +++ b/ldso/ldso/bfin/dl-startup.h @@ -84,7 +84,6 @@ __asm__( " .size __start,.-__start\n" ); -#undef DL_START #define DL_START(X) \ static void __attribute_used__ \ _dl_start (Elf32_Addr dl_boot_got_pointer, \ diff --git a/ldso/ldso/c6x/dl-startup.h b/ldso/ldso/c6x/dl-startup.h index da3e6f7..210cfe1 100644 --- a/ldso/ldso/c6x/dl-startup.h +++ b/ldso/ldso/c6x/dl-startup.h @@ -7,7 +7,6 @@ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. */ -#undef DL_START #define DL_START(X) \ int \ _dl_start (unsigned placeholder, \ diff --git a/ldso/ldso/dl-startup.c b/ldso/ldso/dl-startup.c index 78bed69..d1c2068 100644 --- a/ldso/ldso/dl-startup.c +++ b/ldso/ldso/dl-startup.c @@ -94,9 +94,6 @@ /* Needed for standalone execution */ static __attribute_used__ unsigned long _dl_skip_args = 0; -/* Pull in all the arch specific stuff */ -#include - /* Static declarations */ static int (*_dl_elf_main) (int, char **, char **); diff --git a/ldso/ldso/frv/dl-startup.h b/ldso/ldso/frv/dl-startup.h index 82e75aa..3781c6d 100644 --- a/ldso/ldso/frv/dl-startup.h +++ b/ldso/ldso/frv/dl-startup.h @@ -63,7 +63,6 @@ __asm__("" \ ); #define _dl_boot _dl_boot2 -#undef DL_START #define DL_START(X) \ static void __attribute_used__ \ _dl_boot (void *dl_boot_got_pointer, \ -- 1.7.3.4 From ps.m at gmx.net Thu Apr 14 07:59:26 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Thu, 14 Apr 2011 09:59:26 +0200 Subject: [git commit ldso-future] rename __printf to printf Message-ID: <20110416005432.A98408041A@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=c5732ee5c2a87838c612422caa185e20ab34ea92 branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/ldso-future Signed-off-by: Peter S. Mazinger --- libc/stdio/_fpmaxtostr.c | 12 ++++++------ libc/stdlib/system.c | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/libc/stdio/_fpmaxtostr.c b/libc/stdio/_fpmaxtostr.c index f7ea792..ecb7dc7 100644 --- a/libc/stdio/_fpmaxtostr.c +++ b/libc/stdio/_fpmaxtostr.c @@ -680,12 +680,12 @@ ssize_t _fpmaxtostr(FILE * fp, __fpmax_t x, struct printf_info *info, cnt += num_groups * tslen; /* Adjust count now for sep chars. */ -/* __printf("\n"); */ +/* printf("\n"); */ do { if (!blk) { /* Initial group could be 0 digits long! */ blk = nblk2; } else if (len >= blk) { /* Enough digits for a group. */ -/* __printf("norm: len=%d blk=%d \"%.*s\"\n", len, blk, blk, gp); */ +/* printf("norm: len=%d blk=%d \"%.*s\"\n", len, blk, blk, gp); */ if (fp_outfunc(fp, *ppc, blk, (intptr_t) gp) != blk) { return -1; } @@ -695,9 +695,9 @@ ssize_t _fpmaxtostr(FILE * fp, __fpmax_t x, struct printf_info *info, } len -= blk; } else { /* Transition to 0s. */ -/* __printf("trans: len=%d blk=%d \"%.*s\"\n", len, blk, len, gp); */ +/* printf("trans: len=%d blk=%d \"%.*s\"\n", len, blk, len, gp); */ if (len) { -/* __printf("len\n"); */ +/* printf("len\n"); */ if (fp_outfunc(fp, *ppc, len, (intptr_t) gp) != len) { return -1; } @@ -705,7 +705,7 @@ ssize_t _fpmaxtostr(FILE * fp, __fpmax_t x, struct printf_info *info, } if (ppc[3] == FPO_ZERO_PAD) { /* Need to group 0s */ -/* __printf("zeropad\n"); */ +/* printf("zeropad\n"); */ cnt += ppc[1]; ppc += 3; gp = (const char *) ppc[2]; @@ -728,7 +728,7 @@ ssize_t _fpmaxtostr(FILE * fp, __fpmax_t x, struct printf_info *info, } blk = nblk2; -/* __printf("num_groups=%d blk=%d\n", num_groups, blk); */ +/* printf("num_groups=%d blk=%d\n", num_groups, blk); */ } while (1); } else diff --git a/libc/stdlib/system.c b/libc/stdlib/system.c index a0ff726..622886b 100644 --- a/libc/stdlib/system.c +++ b/libc/stdlib/system.c @@ -61,7 +61,7 @@ int __libc_system(const char *command) signal(SIGINT, SIG_IGN); #if 0 - __printf("Waiting for child %d\n", pid); + printf("Waiting for child %d\n", pid); #endif if (wait4(pid, &wait_val, 0, 0) == -1) -- 1.7.3.4 From rep.dot.nop at gmail.com Thu Apr 14 07:59:26 2011 From: rep.dot.nop at gmail.com (Bernhard Reutner-Fischer) Date: Thu, 14 Apr 2011 09:59:26 +0200 Subject: [git commit ldso-future] resolv: fix res_close not to hang with ipv6 Message-ID: <20110416005430.A192F826D0@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=c277cc3c99a2499183fed84cdeb25c45a06f141d branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/ldso-future Timo Ter?s writes: The memory release loop is missing an obvious counter increment. Signed-off-by: Bernhard Reutner-Fischer Patch is too large, so refusing to show it From rep.dot.nop at gmail.com Thu Apr 14 07:59:26 2011 From: rep.dot.nop at gmail.com (Bernhard Reutner-Fischer) Date: Thu, 14 Apr 2011 09:59:26 +0200 Subject: [git commit ldso-future] buildsys: do not use $(and) Message-ID: <20110416005430.DD8AC826D0@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=7da4d1e7553a766f2ddc6a9a7d36423c1cf68a80 branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/ldso-future make-3.80 does not have $(and) and $(or), so workaround for now. Signed-off-by: Bernhard Reutner-Fischer --- Rules.mak | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Rules.mak b/Rules.mak index 0aa6843..49ca207 100644 --- a/Rules.mak +++ b/Rules.mak @@ -531,7 +531,7 @@ ifdef LD_FLAG_NO_ASNEEDED export CC_FLAG_NO_ASNEEDED:=-Wl,$(LD_FLAG_NO_ASNEEDED) endif endif -link.asneeded = $(if $(and $(CC_FLAG_ASNEEDED),$(CC_FLAG_NO_ASNEEDED)),$(CC_FLAG_ASNEEDED) $(1) $(CC_FLAG_NO_ASNEEDED)) +link.asneeded = $(if $(findstring yy,$(CC_FLAG_ASNEEDED)$(CC_FLAG_NO_ASNEEDED)),$(CC_FLAG_ASNEEDED) $(1) $(CC_FLAG_NO_ASNEEDED)) # Check for AS_NEEDED support in linker script (binutils>=2.16.1 has it) ifndef ASNEEDED -- 1.7.3.4 From rep.dot.nop at gmail.com Thu Apr 14 07:59:26 2011 From: rep.dot.nop at gmail.com (Bernhard Reutner-Fischer) Date: Thu, 14 Apr 2011 09:59:26 +0200 Subject: [git commit ldso-future] resolv: really fix res_close not to hang with ipv6 Message-ID: <20110416005431.08D83826D0@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=d37cda884e573638aa3fafcb7505d733cf8d9eae branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/ldso-future Fix goof in previous commit. Signed-off-by: Bernhard Reutner-Fischer --- libc/inet/resolv.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/libc/inet/resolv.c b/libc/inet/resolv.c index 05a1335..021d5bf 100644 --- a/libc/inet/resolv.c +++ b/libc/inet/resolv.c @@ -3008,8 +3008,8 @@ void res_close(void) char *p1 = (char*) &(_res.nsaddr_list[0]); int m = 0; /* free nsaddrs[m] if they do not point to nsaddr_list[x] */ - while (m++ < ARRAY_SIZE(_res._u._ext.nsaddrs)) { - char *p2 = (char*)(_res._u._ext.nsaddrs[m]); + while (m < ARRAY_SIZE(_res._u._ext.nsaddrs)) { + char *p2 = (char*)(_res._u._ext.nsaddrs[m++]); if (p2 < p1 || (p2 - p1) > sizeof(_res.nsaddr_list)) free(p2); } -- 1.7.3.4 From ps.m at gmx.net Thu Apr 14 07:59:26 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Thu, 14 Apr 2011 09:59:26 +0200 Subject: [git commit ldso-future] dl-startup.h: rename DL_BOOT to DL_START Message-ID: <20110416005431.C147A826D0@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=c969e95b4ed40315c34b9c8269db18e0e4f63f14 branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/ldso-future Signed-off-by: Peter S. Mazinger Patch is too large, so refusing to show it From ps.m at gmx.net Thu Apr 14 07:59:26 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Thu, 14 Apr 2011 09:59:26 +0200 Subject: [git commit ldso-future] use __attribute_used__ instead of hardcoded __attribute__((used)) Message-ID: <20110416005431.DEEA8826D0@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=207261322ee0abca9e0d1ac2b9c40109fccf5268 branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/ldso-future Signed-off-by: Peter S. Mazinger --- ldso/ldso/bfin/dl-startup.h | 2 +- ldso/ldso/frv/dl-startup.h | 2 +- libc/sysdeps/linux/arm/aeabi_lcsts.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ldso/ldso/bfin/dl-startup.h b/ldso/ldso/bfin/dl-startup.h index 31b4726..9f9e4d6 100644 --- a/ldso/ldso/bfin/dl-startup.h +++ b/ldso/ldso/bfin/dl-startup.h @@ -86,7 +86,7 @@ __asm__( #undef DL_START #define DL_START(X) \ -static void __attribute__ ((used)) \ +static void __attribute_used__ \ _dl_start (Elf32_Addr dl_boot_got_pointer, \ struct elf32_fdpic_loadmap *dl_boot_progmap, \ struct elf32_fdpic_loadmap *dl_boot_ldsomap, \ diff --git a/ldso/ldso/frv/dl-startup.h b/ldso/ldso/frv/dl-startup.h index 0c41cd6..82e75aa 100644 --- a/ldso/ldso/frv/dl-startup.h +++ b/ldso/ldso/frv/dl-startup.h @@ -65,7 +65,7 @@ __asm__("" \ #define _dl_boot _dl_boot2 #undef DL_START #define DL_START(X) \ -static void __attribute__ ((used)) \ +static void __attribute_used__ \ _dl_boot (void *dl_boot_got_pointer, \ struct elf32_fdpic_loadmap *dl_boot_progmap, \ struct elf32_fdpic_loadmap *dl_boot_ldsomap, \ diff --git a/libc/sysdeps/linux/arm/aeabi_lcsts.c b/libc/sysdeps/linux/arm/aeabi_lcsts.c index 0c620d4..0bd2680 100644 --- a/libc/sysdeps/linux/arm/aeabi_lcsts.c +++ b/libc/sysdeps/linux/arm/aeabi_lcsts.c @@ -85,7 +85,7 @@ FILE *__aeabi_stdin attribute_hidden; FILE *__aeabi_stdout attribute_hidden; FILE *__aeabi_stderr attribute_hidden; -static void __attribute__ ((used)) +static void __attribute_used__ setup_aeabi_stdio (void) { __aeabi_stdin = stdin; -- 1.7.3.4 From ps.m at gmx.net Thu Apr 14 07:59:26 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Thu, 14 Apr 2011 09:59:26 +0200 Subject: [git commit ldso-future] dl-elf.c: fix comment s|_dl_symbol_table|_dl_symbol_tables| Message-ID: <20110416005432.0F6EF826D0@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=2f457e82ebebea1b4602afc860411f1552f0130c branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/ldso-future Signed-off-by: Peter S. Mazinger --- ldso/ldso/dl-elf.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/ldso/ldso/dl-elf.c b/ldso/ldso/dl-elf.c index 9d504cc..3cd154d 100644 --- a/ldso/ldso/dl-elf.c +++ b/ldso/ldso/dl-elf.c @@ -784,7 +784,7 @@ static struct elf_resolve *_dl_load_elf_shared_library(int secure, #ifndef SHARED /* When statically linked, the first time we dlopen a DSO * the *rpnt is NULL, so we need to allocate memory for it, - * and initialize the _dl_symbol_table. + * and initialize the _dl_symbol_tables. */ else { *rpnt = GL(dl_symbol_tables) = _dl_malloc(sizeof(struct dyn_elf)); -- 1.7.3.4 From bugzilla at busybox.net Sat Apr 16 21:19:37 2011 From: bugzilla at busybox.net (bugzilla at busybox.net) Date: Sat, 16 Apr 2011 21:19:37 +0000 (UTC) Subject: [Bug 2089] errno not threadsafe In-Reply-To: References: Message-ID: <20110416211937.D912282707@busybox.osuosl.org> https://bugs.busybox.net/show_bug.cgi?id=2089 --- Comment #14 from Vasily Khoruzhick --- This bug affects mpd (it can't populate database), and I suspect that it affects libao+alsalib (it just segfaults when using libao with alsa as output). Tested with uclibc-0.9.31 and uclibc-0.9.32-rc2 via buildroot-2011.02. So, mpd and libao are unusable in mentioned buildroot version. -- Configure bugmail: https://bugs.busybox.net/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug. From bugzilla at busybox.net Sun Apr 17 06:34:30 2011 From: bugzilla at busybox.net (bugzilla at busybox.net) Date: Sun, 17 Apr 2011 06:34:30 +0000 (UTC) Subject: [Bug 2089] errno not threadsafe In-Reply-To: References: Message-ID: <20110417063430.AD01E8276A@busybox.osuosl.org> https://bugs.busybox.net/show_bug.cgi?id=2089 --- Comment #15 from Vasily Khoruzhick --- (In reply to comment #14) > This bug affects mpd (it can't populate database), and I suspect that it > affects libao+alsalib (it just segfaults when using libao with alsa as output). > Tested with uclibc-0.9.31 and uclibc-0.9.32-rc2 via buildroot-2011.02. > > So, mpd and libao are unusable in mentioned buildroot version. Just tested, with mentioned patch, mpd and libao+alsa problems just disappear. -- Configure bugmail: https://bugs.busybox.net/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug. From bugzilla at busybox.net Sun Apr 17 07:21:15 2011 From: bugzilla at busybox.net (bugzilla at busybox.net) Date: Sun, 17 Apr 2011 07:21:15 +0000 (UTC) Subject: [Bug 3637] New: getaddrinfo does NOT add domain to query when receive SERVFAIL Message-ID: https://bugs.busybox.net/show_bug.cgi?id=3637 Summary: getaddrinfo does NOT add domain to query when receive SERVFAIL Product: uClibc Version: 0.9.32 Platform: PC OS/Version: Linux Status: NEW Severity: normal Priority: P5 Component: Networking AssignedTo: unassigned at uclibc.org ReportedBy: aka at pxe.ru CC: uclibc-cvs at uclibc.org Estimated Hours: 0.0 Created attachment 3223 --> https://bugs.busybox.net/attachment.cgi?id=3223 Sniff from wireshark --- resolv.conf --- nameserver 195.144.192.60 domain Legion-Group.local ------------------- Command: ping dc Sniff domain.pcap: 1-4 packets. Query "dc", got NXDOMAIN, query "dc.Legion-Group.local". Unix bind at 195.144.192.60, right behaviour. Ok, next test: --- resolv.conf --- nameserver 10.100.50.75 domain Legion-Group.local ------------------- Command: ping dc Sniff: 5-10 packets. Microsoft DNS at 10.100.50.75 (domain controller for Legion-Group.local) return SERVFAIL. Query "dc", got SERVFAIL, query "dc" again. Bug: resolv.c does NOT add domain to query when receive SERVFAIL. Trivial patch to libc/inet/resolv.c: --- resolv.c-0.9.32-rc3-next 2011-04-16 13:29:51.000000000 +0000 +++ resolv.c 2011-04-16 14:34:09.000000000 +0000 @@ -1461,7 +1461,7 @@ /* bug 660 says we treat negative response as an error * and retry, which is, eh, an error. :) * We were incurring long delays because of this. */ - if (h.rcode == NXDOMAIN) { + if (h.rcode == NXDOMAIN || h.rcode == SERVFAIL) { /* if possible, try next search domain */ if (!ends_with_dot) { DPRINTF("variant:%d sdomains:%d\n", variant, sdomains); -- Configure bugmail: https://bugs.busybox.net/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug. From bugzilla at busybox.net Sun Apr 17 07:21:48 2011 From: bugzilla at busybox.net (bugzilla at busybox.net) Date: Sun, 17 Apr 2011 07:21:48 +0000 (UTC) Subject: [Bug 3637] getaddrinfo does NOT add domain to query when receive SERVFAIL In-Reply-To: References: Message-ID: <20110417072148.6E7A982747@busybox.osuosl.org> https://bugs.busybox.net/show_bug.cgi?id=3637 --- Comment #1 from Andrey Kovalev --- Created attachment 3229 --> https://bugs.busybox.net/attachment.cgi?id=3229 Patch -- Configure bugmail: https://bugs.busybox.net/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug. From carmelo.amoroso at st.com Mon Apr 18 06:44:16 2011 From: carmelo.amoroso at st.com (Carmelo Amoroso) Date: Mon, 18 Apr 2011 08:44:16 +0200 Subject: [git commit] MIPS LDSO: pass sym_ref parameter to _dl_find_hash() to support PROTECTED symbols Message-ID: <20110418064531.C36228253F@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=b228ddac5b221b7c474ed902bad124934e61a527 branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/master _dl_find_hash() relies on sym_ref parameter to check if the looked-up symbol is protected. The code fixes a case when _dl_perform_mips_global_got_relocations() was calling _dl_find_hash() without providing sym_ref parameter. The bug was causing hangs if a library exporting non-protected symbol was earlier in link order than library with the same symbol declared as protected. Signed-off-by: Maksim Rayskiy Signed-off-by: Carmelo Amoroso --- ldso/ldso/mips/elfinterp.c | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-) diff --git a/ldso/ldso/mips/elfinterp.c b/ldso/ldso/mips/elfinterp.c index 2886f33..82f740d 100644 --- a/ldso/ldso/mips/elfinterp.c +++ b/ldso/ldso/mips/elfinterp.c @@ -378,8 +378,11 @@ void _dl_perform_mips_global_got_relocations(struct elf_resolve *tpnt, int lazy) *got_entry += (unsigned long) tpnt->loadaddr; } else { + struct symbol_ref sym_ref; + sym_ref.sym = sym; + sym_ref.tpnt = NULL; *got_entry = (unsigned long) _dl_find_hash(strtab + - sym->st_name, tpnt->symbol_scope, tpnt, ELF_RTYPE_CLASS_PLT, NULL); + sym->st_name, tpnt->symbol_scope, tpnt, ELF_RTYPE_CLASS_PLT, &sym_ref); } got_entry++; -- 1.7.3.4 From carmelo.amoroso at st.com Mon Apr 18 06:59:33 2011 From: carmelo.amoroso at st.com (Carmelo Amoroso) Date: Mon, 18 Apr 2011 08:59:33 +0200 Subject: [git commit] dl-startup: fix typos in block comment Message-ID: <20110418065957.04845827DA@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=4580f142b4b1ce176320fe5c2c5bee09871a01e7 branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/master Signed-off-by: Kevin Cernekee Signed-off-by: Carmelo Amoroso --- ldso/ldso/dl-startup.c | 16 ++++++++-------- 1 files changed, 8 insertions(+), 8 deletions(-) diff --git a/ldso/ldso/dl-startup.c b/ldso/ldso/dl-startup.c index a51b583..4492660 100644 --- a/ldso/ldso/dl-startup.c +++ b/ldso/ldso/dl-startup.c @@ -32,8 +32,8 @@ /* * The main trick with this program is that initially, we ourselves are not - * dynamicly linked. This means that we cannot access any global variables or - * call any functions. No globals initially, since the Global Offset Table + * dynamically linked. This means that we cannot access any global variables + * or call any functions. No globals initially, since the Global Offset Table * (GOT) is initialized by the linker assuming a virtual address of 0, and no * function calls initially since the Procedure Linkage Table (PLT) is not yet * initialized. @@ -55,12 +55,12 @@ * * Fortunately, the linker itself leaves a few clues lying around, and when the * kernel starts the image, there are a few further clues. First of all, there - * is Auxiliary Vector Table information sitting on which is provided to us by - * the kernel, and which includes information about the load address that the - * program interpreter was loaded at, the number of sections, the address the - * application was loaded at and so forth. Here this information is stored in - * the array auxvt. For details see linux/fs/binfmt_elf.c where it calls - * NEW_AUX_ENT() a bunch of time.... + * is Auxiliary Vector Table information sitting on the stack which is provided + * to us by the kernel, and which includes information about the address + * that the program interpreter was loaded at, the number of sections, the + * address the application was loaded at, and so forth. Here this information + * is stored in the array auxvt. For details see linux/fs/binfmt_elf.c where + * it calls NEW_AUX_ENT() a bunch of times.... * * Next, we need to find the GOT. On most arches there is a register pointing * to the GOT, but just in case (and for new ports) I've added some (slow) C -- 1.7.3.4 From carmelo.amoroso at st.com Mon Apr 18 10:23:43 2011 From: carmelo.amoroso at st.com (Carmelo Amoroso) Date: Mon, 18 Apr 2011 12:23:43 +0200 Subject: [git commit] test: fix tst-tls13 expected result and timeout Message-ID: <20110418103747.BE03E827D8@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=3a411b5d8a6c6311778e22280706047cd1a8c8d4 branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/master tst-tls13 is expected to return 0 when passing. Set higher timeout to avoid failure on slow archs. Signed-off-by: Salvatore Cro Signed-off-by: Carmelo Amoroso --- test/tls/Makefile.in | 1 - test/tls/tst-tls13.c | 2 +- 2 files changed, 1 insertions(+), 2 deletions(-) diff --git a/test/tls/Makefile.in b/test/tls/Makefile.in index d19d347..875c607 100644 --- a/test/tls/Makefile.in +++ b/test/tls/Makefile.in @@ -140,7 +140,6 @@ tst-tlsmod18a%.so: tst-tlsmod18a.c $(LDFLAGS_tst-tlsmod18a.so) tst-tls-at-ctor: tst-tlsmod-at-ctor.so -RET_tst-tls13 := 1 ifeq ($(TARGET_ARCH),mips) RET_tst-tls15 := 1 endif diff --git a/test/tls/tst-tls13.c b/test/tls/tst-tls13.c index 55fb62e..beee91b 100644 --- a/test/tls/tst-tls13.c +++ b/test/tls/tst-tls13.c @@ -26,5 +26,5 @@ do_test (void) } #define TEST_FUNCTION do_test () -#define TIMEOUT 3 +#define TIMEOUT 20 #include "../test-skeleton.c" -- 1.7.3.4 From rep.dot.nop at gmail.com Wed Apr 20 10:50:38 2011 From: rep.dot.nop at gmail.com (Bernhard Reutner-Fischer) Date: Wed, 20 Apr 2011 12:50:38 +0200 Subject: [git commit] Added fts support for traversing UNIX file hierarchies. Message-ID: <20110420155524.2D214827D8@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=a4aa01c128b04c7174d57a28f61656f966d2bd6c branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/master It is required by libdwfl in elfutils package. Signed-off-by: Salvatore Cro Signed-off-by: Bernhard Reutner-Fischer Patch is too large, so refusing to show it From ps.m at gmx.net Wed Apr 20 10:50:38 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Wed, 20 Apr 2011 12:50:38 +0200 Subject: [git commit future] setpgrp.c: remove unneeded header Message-ID: <20110421232838.CAAC382960@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=150d7c41434e3f2ab06ad735fccd0a1988cd9507 branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/future Signed-off-by: Peter S. Mazinger --- libc/sysdeps/linux/common/setpgrp.c | 2 -- 1 files changed, 0 insertions(+), 2 deletions(-) diff --git a/libc/sysdeps/linux/common/setpgrp.c b/libc/sysdeps/linux/common/setpgrp.c index 1a82ac8..bc8e894 100644 --- a/libc/sysdeps/linux/common/setpgrp.c +++ b/libc/sysdeps/linux/common/setpgrp.c @@ -4,10 +4,8 @@ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. */ -#include #include - int setpgrp(void) { return setpgid(0,0); -- 1.7.3.4 From ps.m at gmx.net Wed Apr 20 10:50:38 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Wed, 20 Apr 2011 12:50:38 +0200 Subject: [git commit future] setsid.c: whitespace only Message-ID: <20110421232839.05EA782960@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=60bab54c97521e6ef57de86bb5f71dc0f8365797 branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/future Signed-off-by: Peter S. Mazinger --- libc/sysdeps/linux/common/setsid.c | 1 - 1 files changed, 0 insertions(+), 1 deletions(-) diff --git a/libc/sysdeps/linux/common/setsid.c b/libc/sysdeps/linux/common/setsid.c index 4ca95fc..5da65b9 100644 --- a/libc/sysdeps/linux/common/setsid.c +++ b/libc/sysdeps/linux/common/setsid.c @@ -10,6 +10,5 @@ #include #include - _syscall0(pid_t, setsid) libc_hidden_def(setsid) -- 1.7.3.4 From ps.m at gmx.net Wed Apr 20 10:50:38 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Wed, 20 Apr 2011 12:50:38 +0200 Subject: [git commit future] setuid.c: always_inline syscall Message-ID: <20110421232839.3EBCB82960@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=2db8cd04a3a4b0b86458282f12aa5229d280d951 branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/future Signed-off-by: Peter S. Mazinger --- libc/sysdeps/linux/common/setuid.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/libc/sysdeps/linux/common/setuid.c b/libc/sysdeps/linux/common/setuid.c index 7fd8c65..470be1f 100644 --- a/libc/sysdeps/linux/common/setuid.c +++ b/libc/sysdeps/linux/common/setuid.c @@ -22,7 +22,7 @@ _syscall1(int, setuid, uid_t, uid) #else # define __NR___syscall_setuid __NR_setuid -static __inline__ _syscall1(int, __syscall_setuid, __kernel_uid_t, uid) +static __always_inline _syscall1(int, __syscall_setuid, __kernel_uid_t, uid) int setuid(uid_t uid) { @@ -30,6 +30,6 @@ int setuid(uid_t uid) __set_errno(EINVAL); return -1; } - return (__syscall_setuid(uid)); + return __syscall_setuid(uid); } #endif -- 1.7.3.4 From ps.m at gmx.net Wed Apr 20 10:50:38 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Wed, 20 Apr 2011 12:50:38 +0200 Subject: [git commit future] provide stime and settimeofday functions if at least one of the syscalls is available Message-ID: <20110421232839.5FCB382960@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=8a14e2c5d3d588ddda7b73d68e6676ce4aef8b02 branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/future Add hidden stime for possible use in settimeofday. Add stubs for both functions if none of the syscalls is present. Avoid circular dependency. Signed-off-by: Peter S. Mazinger --- include/time.h | 1 + libc/sysdeps/linux/common/settimeofday.c | 30 +++++++++++++++++++++++++++--- libc/sysdeps/linux/common/stime.c | 19 ++++++++++++------- libc/sysdeps/linux/common/stubs.c | 5 +++++ 4 files changed, 45 insertions(+), 10 deletions(-) diff --git a/include/time.h b/include/time.h index bea5623..50a412d 100644 --- a/include/time.h +++ b/include/time.h @@ -318,6 +318,7 @@ extern long int timezone; /* Set the system time to *WHEN. This call is restricted to the superuser. */ extern int stime (__const time_t *__when) __THROW; +libc_hidden_proto(stime) # endif diff --git a/libc/sysdeps/linux/common/settimeofday.c b/libc/sysdeps/linux/common/settimeofday.c index 7e508ae..e6b396e 100644 --- a/libc/sysdeps/linux/common/settimeofday.c +++ b/libc/sysdeps/linux/common/settimeofday.c @@ -8,12 +8,36 @@ */ #include -#include #ifdef __USE_BSD +# include +# ifdef __NR_settimeofday +_syscall2(int, settimeofday, const struct timeval *, tv, + const struct timezone *, tz) +# elif defined __USE_SVID && defined __NR_stime +# define __need_NULL +# include +# include +# include +int settimeofday(const struct timeval *tv, const struct timezone *tz) +{ + time_t when; + if (tv == NULL) { + __set_errno(EINVAL); + return -1; + } -_syscall2(int, settimeofday, const struct timeval *, tv, - const struct timezone *, tz) + if (tz != NULL || tv->tv_usec % 1000000 != 0) { + __set_errno(ENOSYS); + return -1; + } + + when = tv->tv_sec + (tv->tv_usec / 1000000); + return stime(&when); +} +# endif +# if defined __NR_settimeofday || (defined __USE_SVID && defined __NR_stime) libc_hidden_def(settimeofday) +# endif #endif diff --git a/libc/sysdeps/linux/common/stime.c b/libc/sysdeps/linux/common/stime.c index cb7e804..b30884d 100644 --- a/libc/sysdeps/linux/common/stime.c +++ b/libc/sysdeps/linux/common/stime.c @@ -8,15 +8,17 @@ */ #include -#include -#include #ifdef __USE_SVID -#ifdef __NR_stime +# include +# ifdef __NR_stime _syscall1(int, stime, const time_t *, t) -#else - -int stime(const time_t * when) +# elif defined __USE_BSD && defined __NR_settimeofday +# define __need_NULL +# include +# include +# include +int stime(const time_t *when) { struct timeval tv; @@ -28,5 +30,8 @@ int stime(const time_t * when) tv.tv_usec = 0; return settimeofday(&tv, (struct timezone *) 0); } -#endif +# endif +# if defined __NR_stime || (defined __USE_BSD && defined __NR_settimeofday) +libc_hidden_def(stime) +# endif #endif diff --git a/libc/sysdeps/linux/common/stubs.c b/libc/sysdeps/linux/common/stubs.c index 4c4f626..314ebd2 100644 --- a/libc/sysdeps/linux/common/stubs.c +++ b/libc/sysdeps/linux/common/stubs.c @@ -230,6 +230,11 @@ make_stub(openat64) make_stub(renameat) #endif +#if !defined __NR_stime && !defined __NR_settimeofday +make_stub(stime) +make_stub(settimeofday) +#endif + #ifndef __NR_fadvise64 make_ret_stub(posix_fadvise) #endif -- 1.7.3.4 From ps.m at gmx.net Wed Apr 20 10:50:38 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Wed, 20 Apr 2011 12:50:38 +0200 Subject: [git commit future] add swapoff,swapon and symlink stubs Message-ID: <20110421232840.0FBB18216E@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=4391066fefd9b1dd6e59944bd7212b662c41d18f branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/future Compile symlink only if syscall is available. Signed-off-by: Peter S. Mazinger --- libc/sysdeps/linux/common/stubs.c | 12 ++++++++++++ libc/sysdeps/linux/common/symlink.c | 5 +++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/libc/sysdeps/linux/common/stubs.c b/libc/sysdeps/linux/common/stubs.c index 314ebd2..c412bf1 100644 --- a/libc/sysdeps/linux/common/stubs.c +++ b/libc/sysdeps/linux/common/stubs.c @@ -235,6 +235,18 @@ make_stub(stime) make_stub(settimeofday) #endif +#ifndef __NR_swapoff +make_stub(swapoff) +#endif + +#ifndef __NR_swapon +make_stub(swapon) +#endif + +#ifndef __NR_symlink +make_stub(symlink) +#endif + #ifndef __NR_fadvise64 make_ret_stub(posix_fadvise) #endif diff --git a/libc/sysdeps/linux/common/symlink.c b/libc/sysdeps/linux/common/symlink.c index e53e8d4..15a576d 100644 --- a/libc/sysdeps/linux/common/symlink.c +++ b/libc/sysdeps/linux/common/symlink.c @@ -8,7 +8,8 @@ */ #include -#if defined __USE_BSD || defined __USE_UNIX98 || defined __USE_XOPEN2K -#include + +#if defined __NR_symlink && (defined __USE_BSD || defined __USE_UNIX98 || defined __USE_XOPEN2K) +# include _syscall2(int, symlink, const char *, oldpath, const char *, newpath) #endif -- 1.7.3.4 From ps.m at gmx.net Wed Apr 20 10:50:38 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Wed, 20 Apr 2011 12:50:38 +0200 Subject: [git commit future] update acct.h Message-ID: <20110421232839.D370782962@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=8687235e80736a043119e79a9017bdbf0fb06ba4 branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/future Signed-off-by: Peter S. Mazinger --- libc/sysdeps/linux/common/sys/acct.h | 73 ++++++++++++++++++++++++--------- 1 files changed, 53 insertions(+), 20 deletions(-) diff --git a/libc/sysdeps/linux/common/sys/acct.h b/libc/sysdeps/linux/common/sys/acct.h index 9ee8564..25f8293 100644 --- a/libc/sysdeps/linux/common/sys/acct.h +++ b/libc/sysdeps/linux/common/sys/acct.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1996, 1997, 1998, 1999 Free Software Foundation, Inc. +/* Copyright (C) 1996, 1997, 1998, 1999, 2007 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -21,6 +21,7 @@ #include +#include #define __need_time_t #include #include @@ -38,25 +39,51 @@ __BEGIN_DECLS typedef u_int16_t comp_t; struct acct - { - char ac_flag; /* Accounting flags. */ - u_int16_t ac_uid; /* Accounting user ID. */ - u_int16_t ac_gid; /* Accounting group ID. */ - u_int16_t ac_tty; /* Controlling tty. */ - u_int32_t ac_btime; /* Beginning time. */ - comp_t ac_utime; /* Accounting user time. */ - comp_t ac_stime; /* Accounting system time. */ - comp_t ac_etime; /* Accounting elapsed time. */ - comp_t ac_mem; /* Accounting average memory usage. */ - comp_t ac_io; /* Accounting chars transferred. */ - comp_t ac_rw; /* Accounting blocks read or written. */ - comp_t ac_minflt; /* Accounting minor pagefaults. */ - comp_t ac_majflt; /* Accounting major pagefaults. */ - comp_t ac_swaps; /* Accounting number of swaps. */ - u_int32_t ac_exitcode; /* Accounting process exitcode. */ - char ac_comm[ACCT_COMM+1]; /* Accounting command name. */ - char ac_pad[10]; /* Accounting padding bytes. */ - }; +{ + char ac_flag; /* Flags. */ + u_int16_t ac_uid; /* Real user ID. */ + u_int16_t ac_gid; /* Real group ID. */ + u_int16_t ac_tty; /* Controlling terminal. */ + u_int32_t ac_btime; /* Beginning time. */ + comp_t ac_utime; /* User time. */ + comp_t ac_stime; /* System time. */ + comp_t ac_etime; /* Elapsed time. */ + comp_t ac_mem; /* Average memory usage. */ + comp_t ac_io; /* Chars transferred. */ + comp_t ac_rw; /* Blocks read or written. */ + comp_t ac_minflt; /* Minor pagefaults. */ + comp_t ac_majflt; /* Major pagefaults. */ + comp_t ac_swaps; /* Number of swaps. */ + u_int32_t ac_exitcode; /* Process exitcode. */ + char ac_comm[ACCT_COMM+1]; /* Command name. */ + char ac_pad[10]; /* Padding bytes. */ +}; + +#if 0 +struct acct_v3 +{ + char ac_flag; /* Flags */ + char ac_version; /* Always set to ACCT_VERSION */ + u_int16_t ac_tty; /* Control Terminal */ + u_int32_t ac_exitcode; /* Exitcode */ + u_int32_t ac_uid; /* Real User ID */ + u_int32_t ac_gid; /* Real Group ID */ + u_int32_t ac_pid; /* Process ID */ + u_int32_t ac_ppid; /* Parent Process ID */ + u_int32_t ac_btime; /* Process Creation Time */ + float ac_etime; /* Elapsed Time */ + comp_t ac_utime; /* User Time */ + comp_t ac_stime; /* System Time */ + comp_t ac_mem; /* Average Memory Usage */ + comp_t ac_io; /* Chars Transferred */ + comp_t ac_rw; /* Blocks Read or Written */ + comp_t ac_minflt; /* Minor Pagefaults */ + comp_t ac_majflt; /* Major Pagefaults */ + comp_t ac_swaps; /* Number of Swaps */ + char ac_comm[ACCT_COMM]; /* Command Name */ +}; +#endif + enum { @@ -66,6 +93,12 @@ enum AXSIG = 0x10 /* Killed by a signal. */ }; +#if __BYTE_ORDER == __BIG_ENDIAN +# define ACCT_BYTEORDER 0x80 /* Accounting file is big endian. */ +#else +# define ACCT_BYTEORDER 0x00 /* Accounting file is little endian. */ +#endif + #define AHZ 100 -- 1.7.3.4 From ps.m at gmx.net Wed Apr 20 10:50:38 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Wed, 20 Apr 2011 12:50:38 +0200 Subject: [git commit future] sigsuspend.c: make build fail, if rt_sigsuspend is not available and NPTL is defined Message-ID: <20110421232840.376BA8216E@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=9369f2c8e96588b648e7826dbca3b64ee14076ce branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/future Rework a bit for less code. always_inline syscall used only once, do not inline syscall used twice. Signed-off-by: Peter S. Mazinger --- libc/sysdeps/linux/common/sigsuspend.c | 43 +++++++++++++------------------ 1 files changed, 18 insertions(+), 25 deletions(-) diff --git a/libc/sysdeps/linux/common/sigsuspend.c b/libc/sysdeps/linux/common/sigsuspend.c index ded2aad..c26ad16 100644 --- a/libc/sysdeps/linux/common/sigsuspend.c +++ b/libc/sysdeps/linux/common/sigsuspend.c @@ -9,48 +9,41 @@ #include -#if defined __USE_POSIX +#ifdef __USE_POSIX #include -#undef sigsuspend -libc_hidden_proto(sigsuspend) +#ifdef __UCLIBC_HAS_THREADS_NATIVE__ +# ifndef __NR_rt_sigsuspend +# error break build, NPTL needs rt_sigsuspend syscall +# endif +# include +#else +# define SINGLE_THREAD_P 1 +#endif #ifdef __NR_rt_sigsuspend -# define __NR___rt_sigsuspend __NR_rt_sigsuspend - -# ifdef __UCLIBC_HAS_THREADS_NATIVE__ -# include -# include +static _syscall2(int, rt_sigsuspend, const sigset_t *, set, size_t, size) /* Change the set of blocked signals to SET, wait until a signal arrives, and restore the set of blocked signals. */ -int sigsuspend (const sigset_t *set) +int sigsuspend(const sigset_t *set) { if (SINGLE_THREAD_P) - return INLINE_SYSCALL (rt_sigsuspend, 2, set, _NSIG / 8); + return rt_sigsuspend(set, _NSIG / 8); +# ifdef __UCLIBC_HAS_THREADS_NATIVE__ int oldtype = LIBC_CANCEL_ASYNC (); - - int result = INLINE_SYSCALL (rt_sigsuspend, 2, set, _NSIG / 8); - + int result = rt_sigsuspend(set, _NSIG / 8); LIBC_CANCEL_RESET (oldtype); - return result; -} -# else -static inline _syscall2(int, __rt_sigsuspend, const sigset_t *, mask, size_t, size) - -int sigsuspend(const sigset_t * mask) -{ - return __rt_sigsuspend(mask, _NSIG / 8); -} # endif +} #else # define __NR___syscall_sigsuspend __NR_sigsuspend -static __inline__ _syscall3(int, __syscall_sigsuspend, int, a, unsigned long int, b, - unsigned long int, c) +static __always_inline _syscall3(int, __syscall_sigsuspend, int, a, unsigned long int, b, + unsigned long int, c) -int sigsuspend(const sigset_t * set) +int sigsuspend(const sigset_t *set) { return __syscall_sigsuspend(0, 0, set->__val[0]); } -- 1.7.3.4 From ps.m at gmx.net Wed Apr 20 10:50:38 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Wed, 20 Apr 2011 12:50:38 +0200 Subject: [git commit future] sync.c: simplify code Message-ID: <20110421232839.B1C5582962@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=fa18f2d20757d739355ebbe93a371fa7e18f3213 branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/future Signed-off-by: Peter S. Mazinger --- libc/sysdeps/linux/common/sync.c | 10 +++------- 1 files changed, 3 insertions(+), 7 deletions(-) diff --git a/libc/sysdeps/linux/common/sync.c b/libc/sysdeps/linux/common/sync.c index 126f40d..d7ac449 100644 --- a/libc/sysdeps/linux/common/sync.c +++ b/libc/sysdeps/linux/common/sync.c @@ -8,12 +8,8 @@ */ #include -# if defined __USE_BSD || defined __USE_UNIX98 -#include -#include -void sync(void) -{ - INLINE_SYSCALL(sync, 0); -} +#if defined __USE_BSD || defined __USE_UNIX98 +# include +_syscall0(void, sync) #endif -- 1.7.3.4 From ps.m at gmx.net Wed Apr 20 10:50:38 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Wed, 20 Apr 2011 12:50:38 +0200 Subject: [git commit future] syscalls.h: remove unused headers Message-ID: <20110421232840.B1E128216E@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=f5a35a43dc898726f61d77484c804445055a4f54 branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/future Signed-off-by: Peter S. Mazinger --- libc/sysdeps/linux/common/syscalls.h | 24 ------------------------ 1 files changed, 0 insertions(+), 24 deletions(-) delete mode 100644 libc/sysdeps/linux/common/syscalls.h diff --git a/libc/sysdeps/linux/common/syscalls.h b/libc/sysdeps/linux/common/syscalls.h deleted file mode 100644 index c4f6a44..0000000 --- a/libc/sysdeps/linux/common/syscalls.h +++ /dev/null @@ -1,24 +0,0 @@ -/* vi: set sw=4 ts=4: */ -/* - * Common header file for uClibc syscalls - * - * Copyright (C) 2000-2006 Erik Andersen - * - * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. - */ - -#define _LARGEFILE64_SOURCE -#include -#include -#include -#include -#include - -#undef __OPTIMIZE__ -/* We absolutely do _NOT_ want interfaces silently - * being renamed under us or very bad things will happen... */ -#ifdef __USE_FILE_OFFSET64 -# undef __USE_FILE_OFFSET64 -#endif - -#include -- 1.7.3.4 From ps.m at gmx.net Wed Apr 20 10:50:38 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Wed, 20 Apr 2011 12:50:38 +0200 Subject: [git commit future] provide sysinfo stub Message-ID: <20110421232840.D9B578216E@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=30c622afc4edab58475b0b741adee6dbe5341a07 branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/future Signed-off-by: Peter S. Mazinger --- libc/sysdeps/linux/common/stubs.c | 4 ++++ libc/sysdeps/linux/common/sysinfo.c | 5 ++++- 2 files changed, 8 insertions(+), 1 deletions(-) diff --git a/libc/sysdeps/linux/common/stubs.c b/libc/sysdeps/linux/common/stubs.c index c412bf1..8082644 100644 --- a/libc/sysdeps/linux/common/stubs.c +++ b/libc/sysdeps/linux/common/stubs.c @@ -247,6 +247,10 @@ make_stub(swapon) make_stub(symlink) #endif +#ifndef __NR_sysinfo +make_stub(sysinfo) +#endif + #ifndef __NR_fadvise64 make_ret_stub(posix_fadvise) #endif diff --git a/libc/sysdeps/linux/common/sysinfo.c b/libc/sysdeps/linux/common/sysinfo.c index fc37aaf..7eb2926 100644 --- a/libc/sysdeps/linux/common/sysinfo.c +++ b/libc/sysdeps/linux/common/sysinfo.c @@ -8,5 +8,8 @@ */ #include -#include + +#ifdef __NR_sysinfo +# include _syscall1(int, sysinfo, struct sysinfo *, info) +#endif -- 1.7.3.4 From ps.m at gmx.net Wed Apr 20 10:50:38 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Wed, 20 Apr 2011 12:50:38 +0200 Subject: [git commit future] brk.c: remove libc_hidden_proto, always_inline syscall Message-ID: <20110421232840.60D078216E@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=4963ab79f6859f7a3e07791563ee1fd9d0c8f01b branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/future Signed-off-by: Peter S. Mazinger --- libc/sysdeps/linux/common/brk.c | 4 +--- 1 files changed, 1 insertions(+), 3 deletions(-) diff --git a/libc/sysdeps/linux/common/brk.c b/libc/sysdeps/linux/common/brk.c index 18836ba..77a26c0 100644 --- a/libc/sysdeps/linux/common/brk.c +++ b/libc/sysdeps/linux/common/brk.c @@ -8,10 +8,8 @@ #include #include -libc_hidden_proto(brk) - #define __NR___syscall_brk __NR_brk -static inline _syscall1(void *, __syscall_brk, void *, end) +static __always_inline _syscall1(void *, __syscall_brk, void *, end) /* This must be initialized data because commons can't have aliases. */ void * __curbrk attribute_hidden = 0; -- 1.7.3.4 From ps.m at gmx.net Wed Apr 20 10:50:38 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Wed, 20 Apr 2011 12:50:38 +0200 Subject: [git commit future] time.c: move included header for fallback case Message-ID: <20110421232841.364EC8216E@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=d8679891197da37bdbceb85e332c2bd90ea39347 branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/future Signed-off-by: Peter S. Mazinger --- libc/sysdeps/linux/common/time.c | 6 ++---- 1 files changed, 2 insertions(+), 4 deletions(-) diff --git a/libc/sysdeps/linux/common/time.c b/libc/sysdeps/linux/common/time.c index e13b44f..cd87fb3 100644 --- a/libc/sysdeps/linux/common/time.c +++ b/libc/sysdeps/linux/common/time.c @@ -9,12 +9,11 @@ #include #include -#include - #ifdef __NR_time _syscall_noerr1(time_t, time, time_t *, t) #else +# include time_t time(time_t * t) { time_t result; @@ -25,9 +24,8 @@ time_t time(time_t * t) */ gettimeofday(&tv, NULL); result = (time_t) tv.tv_sec; - if (t != NULL) { + if (t != NULL) *t = result; - } return result; } #endif -- 1.7.3.4 From ps.m at gmx.net Wed Apr 20 10:50:38 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Wed, 20 Apr 2011 12:50:38 +0200 Subject: [git commit future] umask.c: umask always succeeds, use _syscall_noerr1 Message-ID: <20110421232841.6FDD08216E@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=1e9d99cdc7597489b993819cd760ab480ebead59 branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/future Signed-off-by: Peter S. Mazinger --- libc/sysdeps/linux/common/umask.c | 8 +------- 1 files changed, 1 insertions(+), 7 deletions(-) diff --git a/libc/sysdeps/linux/common/umask.c b/libc/sysdeps/linux/common/umask.c index b838e17..b558885 100644 --- a/libc/sysdeps/linux/common/umask.c +++ b/libc/sysdeps/linux/common/umask.c @@ -10,10 +10,4 @@ #include #include -#define __NR___syscall_umask __NR_umask -static __inline__ _syscall1(__kernel_mode_t, __syscall_umask, __kernel_mode_t, mode) - -mode_t umask(mode_t mode) -{ - return __syscall_umask(mode); -} +_syscall_noerr1(mode_t, umask, mode_t, mode) -- 1.7.3.4 From ps.m at gmx.net Wed Apr 20 10:50:38 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Wed, 20 Apr 2011 12:50:38 +0200 Subject: [git commit future] nanosleep.c, fsync.c: do not inline syscall, it is used twice Message-ID: <20110421232840.8AA1F8216E@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=0ae027931edc6d7e1b037e6afd9c249d64299093 branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/future Signed-off-by: Peter S. Mazinger --- libc/sysdeps/linux/common/fsync.c | 2 +- libc/sysdeps/linux/common/nanosleep.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/libc/sysdeps/linux/common/fsync.c b/libc/sysdeps/linux/common/fsync.c index 711811f..dcf77eb 100644 --- a/libc/sysdeps/linux/common/fsync.c +++ b/libc/sysdeps/linux/common/fsync.c @@ -17,7 +17,7 @@ #endif #define __NR___syscall_fsync __NR_fsync -static inline _syscall1(int, __syscall_fsync, int, fd) +static _syscall1(int, __syscall_fsync, int, fd) extern __typeof(fsync) __libc_fsync; diff --git a/libc/sysdeps/linux/common/nanosleep.c b/libc/sysdeps/linux/common/nanosleep.c index 26ce4a6..1e692bb 100644 --- a/libc/sysdeps/linux/common/nanosleep.c +++ b/libc/sysdeps/linux/common/nanosleep.c @@ -18,8 +18,8 @@ #endif #define __NR___syscall_nanosleep __NR_nanosleep -static inline _syscall2(int, __syscall_nanosleep, const struct timespec *, req, - struct timespec *, rem); +static _syscall2(int, __syscall_nanosleep, const struct timespec *, req, + struct timespec *, rem); extern __typeof(nanosleep) __libc_nanosleep; -- 1.7.3.4 From ps.m at gmx.net Wed Apr 20 10:50:38 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Wed, 20 Apr 2011 12:50:38 +0200 Subject: [git commit future] times.c: whitespace only Message-ID: <20110421232841.978548216E@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=cdf3765c7315df4a0723107bdaf7778cd1c3fc22 branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/future Signed-off-by: Peter S. Mazinger --- libc/sysdeps/linux/common/times.c | 1 - 1 files changed, 0 insertions(+), 1 deletions(-) diff --git a/libc/sysdeps/linux/common/times.c b/libc/sysdeps/linux/common/times.c index 37ae040..e35c4ef 100644 --- a/libc/sysdeps/linux/common/times.c +++ b/libc/sysdeps/linux/common/times.c @@ -10,6 +10,5 @@ #include #include - _syscall_noerr1(clock_t, times, struct tms *, buf) libc_hidden_def(times) -- 1.7.3.4 From ps.m at gmx.net Wed Apr 20 10:50:38 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Wed, 20 Apr 2011 12:50:38 +0200 Subject: [git commit future] gettimeofday.c: use the same type as in header Message-ID: <20110421232841.0DA798216E@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=32c5760e5af51f5f684b43eccbeac72261eee90d branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/future Signed-off-by: Peter S. Mazinger --- libc/sysdeps/linux/common/gettimeofday.c | 6 +----- 1 files changed, 1 insertions(+), 5 deletions(-) diff --git a/libc/sysdeps/linux/common/gettimeofday.c b/libc/sysdeps/linux/common/gettimeofday.c index 52490fe..d9b2a22 100644 --- a/libc/sysdeps/linux/common/gettimeofday.c +++ b/libc/sysdeps/linux/common/gettimeofday.c @@ -10,9 +10,5 @@ #include #include -#ifdef __USE_BSD -_syscall2(int, gettimeofday, struct timeval *, tv, struct timezone *, tz) -#else -_syscall2(int, gettimeofday, struct timeval *, tv, void *, tz) -#endif +_syscall2(int, gettimeofday, struct timeval *, tv, __timezone_ptr_t, tz) libc_hidden_def(gettimeofday) -- 1.7.3.4 From ps.m at gmx.net Wed Apr 20 10:50:38 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Wed, 20 Apr 2011 12:50:38 +0200 Subject: [git commit future] uname.c,unlink.c: whitespace only Message-ID: <20110421232842.02BEF8216E@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=391b50228430dbcb6c38985debe816f9dbae3281 branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/future Signed-off-by: Peter S. Mazinger --- libc/sysdeps/linux/common/uname.c | 1 - libc/sysdeps/linux/common/unlink.c | 1 - 2 files changed, 0 insertions(+), 2 deletions(-) diff --git a/libc/sysdeps/linux/common/uname.c b/libc/sysdeps/linux/common/uname.c index 0feec93..72dd7da 100644 --- a/libc/sysdeps/linux/common/uname.c +++ b/libc/sysdeps/linux/common/uname.c @@ -10,6 +10,5 @@ #include #include - _syscall1(int, uname, struct utsname *, buf) libc_hidden_def(uname) diff --git a/libc/sysdeps/linux/common/unlink.c b/libc/sysdeps/linux/common/unlink.c index 513cdd5..d4504d4 100644 --- a/libc/sysdeps/linux/common/unlink.c +++ b/libc/sysdeps/linux/common/unlink.c @@ -10,6 +10,5 @@ #include #include - _syscall1(int, unlink, const char *, pathname) libc_hidden_def(unlink) -- 1.7.3.4 From ps.m at gmx.net Wed Apr 20 10:50:38 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Wed, 20 Apr 2011 12:50:38 +0200 Subject: [git commit future] ustat.c: always_inline syscall Message-ID: <20110421232842.272348216E@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=4b71d35fdb4e2fc9fbfc913add6e18b48875633c branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/future Signed-off-by: Peter S. Mazinger --- libc/sysdeps/linux/common/ustat.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/libc/sysdeps/linux/common/ustat.c b/libc/sysdeps/linux/common/ustat.c index e97fa76..157b3be 100644 --- a/libc/sysdeps/linux/common/ustat.c +++ b/libc/sysdeps/linux/common/ustat.c @@ -16,9 +16,9 @@ * long sys_ustat(unsigned dev, struct ustat __user * ubuf), * thus we use unsigned, not __kernel_dev_t. */ -static __inline__ _syscall2(int, __syscall_ustat, - unsigned, kdev_t, - struct ustat *, ubuf) +static __always_inline _syscall2(int, __syscall_ustat, + unsigned, kdev_t, + struct ustat *, ubuf) int ustat(dev_t dev, struct ustat *ubuf) { -- 1.7.3.4 From ps.m at gmx.net Wed Apr 20 10:50:38 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Wed, 20 Apr 2011 12:50:38 +0200 Subject: [git commit future] umount: make umount2 depend on UCLIBC_LINUX_SPECIFIC Message-ID: <20110421232841.D40AD8216E@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=85a8d7a6f833b615b7979ca3e1aeb56ca71bfc43 branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/future Add hidden umount2 to be used in umount eventually. Rework umount to either use directly umount2 syscall or function. docs say, that mount and umount are also Linux specific Signed-off-by: Peter S. Mazinger --- include/sys/mount.h | 3 +++ libc/sysdeps/linux/common/Makefile.in | 5 +++-- libc/sysdeps/linux/common/umount.c | 17 ++++------------- libc/sysdeps/linux/common/umount2.c | 7 +++---- 4 files changed, 13 insertions(+), 19 deletions(-) diff --git a/include/sys/mount.h b/include/sys/mount.h index 57d440f..f3198e6 100644 --- a/include/sys/mount.h +++ b/include/sys/mount.h @@ -115,8 +115,11 @@ extern int mount (__const char *__special_file, __const char *__dir, /* Unmount a filesystem. */ extern int umount (__const char *__special_file) __THROW; +#ifdef __UCLIBC_LINUX_SPECIFIC__ /* Unmount a filesystem. Force unmounting if FLAGS is set to MNT_FORCE. */ extern int umount2 (__const char *__special_file, int __flags) __THROW; +libc_hidden_proto(umount2) +#endif __END_DECLS diff --git a/libc/sysdeps/linux/common/Makefile.in b/libc/sysdeps/linux/common/Makefile.in index c8fbeb5..da2bad1 100644 --- a/libc/sysdeps/linux/common/Makefile.in +++ b/libc/sysdeps/linux/common/Makefile.in @@ -25,8 +25,9 @@ CSRC-$(UCLIBC_LINUX_SPECIFIC) += capget.c capset.c inotify.c ioperm.c iopl.c \ modify_ldt.c personality.c ppoll.c prctl.c readahead.c reboot.c \ remap_file_pages.c sched_getaffinity.c sched_setaffinity.c \ sendfile64.c sendfile.c setfsgid.c setfsuid.c setresuid.c \ - splice.c vmsplice.c tee.c signalfd.c swapoff.c swapon.c \ - sync_file_range.c sysctl.c sysinfo.c timerfd.c uselib.c vhangup.c + splice.c signalfd.c swapoff.c swapon.c sync_file_range.c \ + sysctl.c sysinfo.c tee.c timerfd.c uselib.c umount2.c \ + vhangup.c vmsplice.c ifeq ($(UCLIBC_LINUX_SPECIFIC)$(UCLIBC_HAS_THREADS_NATIVE),yy) CSRC-y += madvise.c endif diff --git a/libc/sysdeps/linux/common/umount.c b/libc/sysdeps/linux/common/umount.c index a084d29..916c6c8 100644 --- a/libc/sysdeps/linux/common/umount.c +++ b/libc/sysdeps/linux/common/umount.c @@ -9,24 +9,15 @@ #include -#if defined __USE_GNU #include - -/* arch provides umount() syscall */ #ifdef __NR_umount - _syscall1(int, umount, const char *, specialfile) - -/* arch provides umount2() syscall */ #elif defined __NR_umount2 - -# define __NR___syscall_umount2 __NR_umount2 -static __inline__ _syscall2(int, __syscall_umount2, const char *, special_file, int, flags) - +# ifndef __UCLIBC_LINUX_SPECIFIC__ +static __always_inline _syscall2(int, umount2, const char *, special_file, int, flags) +# endif int umount(const char *special_file) { - return (__syscall_umount2(special_file, 0)); + return umount2(special_file, 0); } - -#endif #endif diff --git a/libc/sysdeps/linux/common/umount2.c b/libc/sysdeps/linux/common/umount2.c index 2cc4a23..08e0f33 100644 --- a/libc/sysdeps/linux/common/umount2.c +++ b/libc/sysdeps/linux/common/umount2.c @@ -9,9 +9,8 @@ #include -#if defined __USE_GNU -#include -#ifdef __NR_umount2 /* Old kernels don't have umount2 */ +#if defined __UCLIBC_LINUX_SPECIFIC__ && defined __NR_umount2 +# include _syscall2(int, umount2, const char *, special_file, int, flags) -#endif +libc_hidden_def(umount2) #endif -- 1.7.3.4 From ps.m at gmx.net Wed Apr 20 10:50:38 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Wed, 20 Apr 2011 12:50:38 +0200 Subject: [git commit future] utime[s]: avoid circular dependency Message-ID: <20110421232842.528208216E@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=5e3a9eeaa061b15b7a867ca9cbf322b5c0327ccb branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/future utime.c: fix a cast, tv_sec is of type time_t Add stub for utimes. Signed-off-by: Peter S. Mazinger --- libc/sysdeps/linux/common/stubs.c | 5 +++++ libc/sysdeps/linux/common/utime.c | 8 +++++--- libc/sysdeps/linux/common/utimes.c | 4 +++- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/libc/sysdeps/linux/common/stubs.c b/libc/sysdeps/linux/common/stubs.c index 8082644..d41710d 100644 --- a/libc/sysdeps/linux/common/stubs.c +++ b/libc/sysdeps/linux/common/stubs.c @@ -251,6 +251,11 @@ make_stub(symlink) make_stub(sysinfo) #endif +#if !defined __NR_utime && !defined __NR_utimes +/*make_stub(utime) obsoleted */ +make_stub(utimes) +#endif + #ifndef __NR_fadvise64 make_ret_stub(posix_fadvise) #endif diff --git a/libc/sysdeps/linux/common/utime.c b/libc/sysdeps/linux/common/utime.c index 2573e00..ab63a24 100644 --- a/libc/sysdeps/linux/common/utime.c +++ b/libc/sysdeps/linux/common/utime.c @@ -12,7 +12,7 @@ #ifdef __NR_utime _syscall2(int, utime, const char *, file, const struct utimbuf *, times) -#else +#elif defined __NR_utimes /* alpha || ia64 */ # define __need_NULL # include # include @@ -24,11 +24,13 @@ int utime(const char *file, const struct utimbuf *times) if (times != NULL) { timevals[0].tv_usec = 0L; timevals[1].tv_usec = 0L; - timevals[0].tv_sec = (long int) times->actime; - timevals[1].tv_sec = (long int) times->modtime; + timevals[0].tv_sec = (time_t) times->actime; + timevals[1].tv_sec = (time_t) times->modtime; } return utimes(file, times ? timevals : NULL); } #endif +#if defined __NR_utime || defined __NR_utimes link_warning(utime, "the use of OBSOLESCENT `utime' is discouraged, use `utimes'") libc_hidden_def(utime) +#endif diff --git a/libc/sysdeps/linux/common/utimes.c b/libc/sysdeps/linux/common/utimes.c index ac9aff5..5d6f168 100644 --- a/libc/sysdeps/linux/common/utimes.c +++ b/libc/sysdeps/linux/common/utimes.c @@ -12,7 +12,7 @@ #ifdef __NR_utimes _syscall2(int, utimes, const char *, file, const struct timeval *, tvp) -#else +#elif defined __NR_utime # define __need_NULL # include # include @@ -31,4 +31,6 @@ int utimes(const char *file, const struct timeval tvp[2]) return utime(file, times); } #endif +#if defined __NR_utimes || defined __NR_utime libc_hidden_def(utimes) +#endif -- 1.7.3.4 From ps.m at gmx.net Wed Apr 20 10:50:38 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Wed, 20 Apr 2011 12:50:38 +0200 Subject: [git commit future] wait4.c: provide hidden __wait4_nocancel independent of any guards Message-ID: <20110421232842.AF9598216E@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=583a5e2020c50d7b55a2294444f936acb4b514f2 branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/future Correct wait4 guard (it is only __USE_BSD) wait3, system: use __wait4_nocancel Signed-off-by: Peter S. Mazinger --- include/sys/wait.h | 5 ++++- libc/stdlib/system.c | 2 +- libc/sysdeps/linux/common/wait3.c | 16 ++++------------ libc/sysdeps/linux/common/wait4.c | 16 +++++++--------- 4 files changed, 16 insertions(+), 23 deletions(-) diff --git a/include/sys/wait.h b/include/sys/wait.h index 4beb3e2..b09c28d 100644 --- a/include/sys/wait.h +++ b/include/sys/wait.h @@ -171,9 +171,12 @@ extern __pid_t wait3 (__WAIT_STATUS __stat_loc, int __options, /* PID is like waitpid. Other args are like wait3. */ extern __pid_t wait4 (__pid_t __pid, __WAIT_STATUS __stat_loc, int __options, struct rusage *__usage) __THROW; -libc_hidden_proto(wait4) #endif /* Use BSD. */ +#ifdef _LIBC +extern __pid_t __wait4_nocancel(__pid_t, __WAIT_STATUS, int, struct rusage *) attribute_hidden; +#endif + __END_DECLS diff --git a/libc/stdlib/system.c b/libc/stdlib/system.c index a0ff726..ebcdc03 100644 --- a/libc/stdlib/system.c +++ b/libc/stdlib/system.c @@ -64,7 +64,7 @@ int __libc_system(const char *command) __printf("Waiting for child %d\n", pid); #endif - if (wait4(pid, &wait_val, 0, 0) == -1) + if (__wait4_nocancel(pid, &wait_val, 0, 0) == -1) wait_val = -1; signal(SIGQUIT, save_quit); diff --git a/libc/sysdeps/linux/common/wait3.c b/libc/sysdeps/linux/common/wait3.c index 0d480ec..a4391fd 100644 --- a/libc/sysdeps/linux/common/wait3.c +++ b/libc/sysdeps/linux/common/wait3.c @@ -5,20 +5,12 @@ */ #include -#include -#include -#include -#if defined __USE_BSD +#if defined __USE_BSD || defined __USE_XOPEN_EXTENDED +# include - -/* Wait for a child to exit. When one does, put its status in *STAT_LOC and - * return its process ID. For errors return (pid_t) -1. If USAGE is not nil, - * store information about the child's resource usage (as a `struct rusage') - * there. If the WUNTRACED bit is set in OPTIONS, return status for stopped - * children; otherwise don't. */ -pid_t wait3 (__WAIT_STATUS stat_loc, int options, struct rusage * usage) +pid_t wait3(__WAIT_STATUS stat_loc, int options, struct rusage *usage) { - return wait4 (WAIT_ANY, stat_loc, options, usage); + return __wait4_nocancel(WAIT_ANY, stat_loc, options, usage); } #endif diff --git a/libc/sysdeps/linux/common/wait4.c b/libc/sysdeps/linux/common/wait4.c index dceab41..b7952ad 100644 --- a/libc/sysdeps/linux/common/wait4.c +++ b/libc/sysdeps/linux/common/wait4.c @@ -8,18 +8,16 @@ */ #include -#if defined __USE_BSD || defined __USE_XOPEN_EXTENDED #include -#include +# define __NR___syscall_wait4 __NR_wait4 +static __always_inline _syscall4(int, __syscall_wait4, __kernel_pid_t, pid, + int *, status, int, opts, struct rusage *, rusage) -#define __NR___syscall_wait4 __NR_wait4 -static __inline__ _syscall4(int, __syscall_wait4, __kernel_pid_t, pid, - int *, status, int, opts, struct rusage *, rusage) - -pid_t wait4(pid_t pid, int *status, int opts, struct rusage *rusage) +pid_t __wait4_nocancel(pid_t pid, int *status, int opts, struct rusage *rusage) { - return (__syscall_wait4(pid, status, opts, rusage)); + return __syscall_wait4(pid, status, opts, rusage); } -libc_hidden_def(wait4) +#ifdef __USE_BSD +strong_alias(__wait4_nocancel,wait4) #endif -- 1.7.3.4 From ps.m at gmx.net Wed Apr 20 10:50:38 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Wed, 20 Apr 2011 12:50:38 +0200 Subject: [git commit future] fix condition for fdatasync stub Message-ID: <20110421232842.DFBC18216E@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=cb775cc7196cb3f2b0f1e715a82643147e858e22 branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/future Signed-off-by: Peter S. Mazinger --- libc/sysdeps/linux/common/stubs.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/libc/sysdeps/linux/common/stubs.c b/libc/sysdeps/linux/common/stubs.c index d41710d..6c3bc79 100644 --- a/libc/sysdeps/linux/common/stubs.c +++ b/libc/sysdeps/linux/common/stubs.c @@ -90,7 +90,7 @@ make_stub(epoll_wait) make_stub(epoll_pwait) #endif -#ifndef __NR_fdatasync +#if !defined __NR_fdatasync && !defined __NR_osf_fdatasync make_stub(fdatasync) #endif -- 1.7.3.4 From ps.m at gmx.net Wed Apr 20 10:50:38 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Wed, 20 Apr 2011 12:50:38 +0200 Subject: [git commit future] vfork: make all archs consistent Message-ID: <20110421232842.8005D8216E@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=0bf91042155bc5db2805ad3adfb8ce1f6e4a7f49 branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/future __vfork is hidden. __GI_vfork is strong (not weak as it was). vfork is weak. e1 can use the generic version. Note: libc_hidden_def(x) has different meaning in .c and .S files. Signed-off-by: Peter S. Mazinger --- libc/sysdeps/linux/arm/vfork.S | 2 +- libc/sysdeps/linux/avr32/vfork.S | 4 ++-- libc/sysdeps/linux/common/vfork.c | 22 +++++++--------------- libc/sysdeps/linux/cris/sysdep.h | 8 ++++++++ libc/sysdeps/linux/cris/vfork.S | 4 ++-- libc/sysdeps/linux/e1/Makefile | 2 +- libc/sysdeps/linux/e1/vfork.c | 14 -------------- libc/sysdeps/linux/frv/vfork.S | 8 ++------ libc/sysdeps/linux/h8300/vfork.S | 5 ++--- libc/sysdeps/linux/i386/vfork.S | 2 +- libc/sysdeps/linux/i960/vfork.S | 3 ++- libc/sysdeps/linux/ia64/sysdep.h | 9 +++++++++ libc/sysdeps/linux/ia64/vfork.S | 4 ++-- libc/sysdeps/linux/m68k/vfork.S | 7 ++----- libc/sysdeps/linux/microblaze/vfork.S | 12 +++--------- libc/sysdeps/linux/mips/vfork.S | 4 +++- libc/sysdeps/linux/nios/vfork.S | 5 +---- libc/sysdeps/linux/nios2/vfork.S | 8 ++------ libc/sysdeps/linux/powerpc/vfork.S | 2 +- libc/sysdeps/linux/sh/vfork.S | 4 +--- libc/sysdeps/linux/sparc/vfork.S | 2 +- libc/sysdeps/linux/v850/vfork.S | 12 +++--------- libc/sysdeps/linux/x86_64/vfork.S | 2 +- libc/sysdeps/linux/xtensa/sysdep.h | 10 ++++++++++ libc/sysdeps/linux/xtensa/vfork.S | 5 ++--- 25 files changed, 69 insertions(+), 91 deletions(-) delete mode 100644 libc/sysdeps/linux/e1/vfork.c diff --git a/libc/sysdeps/linux/arm/vfork.S b/libc/sysdeps/linux/arm/vfork.S index 17d6a4d..6a1c65e 100644 --- a/libc/sysdeps/linux/arm/vfork.S +++ b/libc/sysdeps/linux/arm/vfork.S @@ -104,5 +104,5 @@ __error: .size __vfork,.-__vfork weak_alias(__vfork,vfork) -libc_hidden_weak(vfork) +libc_hidden_def(vfork) #endif diff --git a/libc/sysdeps/linux/avr32/vfork.S b/libc/sysdeps/linux/avr32/vfork.S index 03ca99f..b2c5ceb 100644 --- a/libc/sysdeps/linux/avr32/vfork.S +++ b/libc/sysdeps/linux/avr32/vfork.S @@ -17,10 +17,10 @@ * Fortunately, the Linux kernel preserves LR across system calls. */ -#include #include .global __vfork + .hidden __vfork .type __vfork, at function .align 1 __vfork: @@ -55,4 +55,4 @@ __vfork: .size __vfork, . - __vfork weak_alias(__vfork,vfork) -libc_hidden_weak(vfork) +libc_hidden_def(vfork) diff --git a/libc/sysdeps/linux/common/vfork.c b/libc/sysdeps/linux/common/vfork.c index e7c9208..a70ed4a 100644 --- a/libc/sysdeps/linux/common/vfork.c +++ b/libc/sysdeps/linux/common/vfork.c @@ -4,30 +4,22 @@ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. */ -#include -#include #include +#if (defined __NR_vfork || (defined __ARCH_USE_MMU__ && defined __NR_fork)) && (defined __USE_BSD || defined __USE_XOPEN_EXTENDED) +# include extern __typeof(vfork) __vfork attribute_hidden; -#ifdef __NR_vfork - -# define __NR___vfork __NR_vfork +# ifdef __NR_vfork +# define __NR___vfork __NR_vfork _syscall0(pid_t, __vfork) - -weak_alias(__vfork,vfork) -libc_hidden_weak(vfork) - -#elif defined __ARCH_USE_MMU__ && defined __NR_fork - +# else /* Trivial implementation for arches that lack vfork */ - pid_t __vfork(void) { return fork(); } - -weak_alias(__vfork,vfork) +# endif +strong_alias(__vfork,vfork) libc_hidden_weak(vfork) - #endif diff --git a/libc/sysdeps/linux/cris/sysdep.h b/libc/sysdeps/linux/cris/sysdep.h index 5960fe2..921dbb3 100644 --- a/libc/sysdeps/linux/cris/sysdep.h +++ b/libc/sysdeps/linux/cris/sysdep.h @@ -127,6 +127,14 @@ .align ALIGNARG (2) @ \ C_LABEL(name) +#define HIDDEN_ENTRY(name) \ + .text @ \ + ASM_GLOBAL_DIRECTIVE C_SYMBOL_NAME (name) @ \ + .hidden C_SYMBOL_NAME (name) @ \ + ASM_TYPE_DIRECTIVE (C_SYMBOL_NAME (name), function) @ \ + .align ALIGNARG (2) @ \ + C_LABEL(name) + #undef END #define END(name) \ ASM_SIZE_DIRECTIVE (C_SYMBOL_NAME (name)) diff --git a/libc/sysdeps/linux/cris/vfork.S b/libc/sysdeps/linux/cris/vfork.S index ea8a81d..964eca4 100644 --- a/libc/sysdeps/linux/cris/vfork.S +++ b/libc/sysdeps/linux/cris/vfork.S @@ -16,7 +16,7 @@ * enclosing function */ -ENTRY(__vfork) +HIDDEN_ENTRY(__vfork) movu.w __NR_vfork,$r9 break 13 cmps.w -4096,$r10 @@ -27,4 +27,4 @@ ENTRY(__vfork) PSEUDO_END(__vfork) weak_alias(__vfork,vfork) -libc_hidden_weak(vfork) +libc_hidden_def(vfork) diff --git a/libc/sysdeps/linux/e1/Makefile b/libc/sysdeps/linux/e1/Makefile index c69ccb9..29d1c9e 100644 --- a/libc/sysdeps/linux/e1/Makefile +++ b/libc/sysdeps/linux/e1/Makefile @@ -17,7 +17,7 @@ CRT_OBJ := crt0.o CTOR_TARGETS := $(TOPDIR)lib/crti.o $(TOPDIR)lib/crtn.o # why is crt1.c listed in CSRC ? -CSRC := crt1.c syscalls.c longjmp.c setjmp.c vfork.c +CSRC := crt1.c syscalls.c longjmp.c setjmp.c OBJS := $(patsubst %.c,%.o, $(CSRC)) OBJ_LIST := ../../../obj.sysdeps.$(TARGET_ARCH) diff --git a/libc/sysdeps/linux/e1/vfork.c b/libc/sysdeps/linux/e1/vfork.c deleted file mode 100644 index c7caafd..0000000 --- a/libc/sysdeps/linux/e1/vfork.c +++ /dev/null @@ -1,14 +0,0 @@ -/* - * Copyright (C) 2000-2006 Erik Andersen - * - * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. - */ - -#include -#include -#include - -#define __NR___vfork __NR_vfork -attribute_hidden _syscall0(pid_t, __vfork) -weak_alias(__vfork,vfork) -libc_hidden_weak(vfork) diff --git a/libc/sysdeps/linux/frv/vfork.S b/libc/sysdeps/linux/frv/vfork.S index 8935a12..4fefffd 100644 --- a/libc/sysdeps/linux/frv/vfork.S +++ b/libc/sysdeps/linux/frv/vfork.S @@ -17,11 +17,7 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -#include - -#include -#define _ERRNO_H 1 -#include +#include .text .globl __vfork @@ -44,4 +40,4 @@ __vfork: .size __vfork,.-__vfork weak_alias(__vfork,vfork) -libc_hidden_weak(vfork) +libc_hidden_def(vfork) diff --git a/libc/sysdeps/linux/h8300/vfork.S b/libc/sysdeps/linux/h8300/vfork.S index 35c04e5..9b65f4f 100644 --- a/libc/sysdeps/linux/h8300/vfork.S +++ b/libc/sysdeps/linux/h8300/vfork.S @@ -1,5 +1,5 @@ -#include +#include #ifndef __NR_vfork #define __NR_vfork __NR_fork /* uClinux-2.0 only has fork which is vfork */ @@ -12,7 +12,6 @@ #endif .text .align 2 - .globl _errno .globl ___vfork .hidden ___vfork .type ___vfork, at function @@ -38,4 +37,4 @@ fix_errno: jmp @er1 /* don't return, just jmp directly */ weak_alias(__vfork,vfork) -libc_hidden_weak(vfork) +libc_hidden_def(vfork) diff --git a/libc/sysdeps/linux/i386/vfork.S b/libc/sysdeps/linux/i386/vfork.S index c9db2f4..d85726f 100644 --- a/libc/sysdeps/linux/i386/vfork.S +++ b/libc/sysdeps/linux/i386/vfork.S @@ -38,4 +38,4 @@ __vfork: .size __vfork,.-__vfork weak_alias(__vfork,vfork) -libc_hidden_weak(vfork) +libc_hidden_def(vfork) diff --git a/libc/sysdeps/linux/i960/vfork.S b/libc/sysdeps/linux/i960/vfork.S index 1646e1b..e43146c 100644 --- a/libc/sysdeps/linux/i960/vfork.S +++ b/libc/sysdeps/linux/i960/vfork.S @@ -18,6 +18,7 @@ .globl ___vfork .hidden ___vfork + .type ___vfork, at function ___vfork: mov g13, r3 ldconst __NR_vfork, g13 @@ -30,4 +31,4 @@ ___vfork: ret weak_alias(__vfork,vfork) -libc_hidden_weak(vfork) +libc_hidden_def(vfork) diff --git a/libc/sysdeps/linux/ia64/sysdep.h b/libc/sysdeps/linux/ia64/sysdep.h index d10020a..bae27d1 100644 --- a/libc/sysdeps/linux/ia64/sysdep.h +++ b/libc/sysdeps/linux/ia64/sysdep.h @@ -49,6 +49,15 @@ C_LABEL(name) \ CALL_MCOUNT +#define HIDDEN_ENTRY(name) \ + .text; \ + .align 32; \ + .proc C_SYMBOL_NAME(name); \ + .global C_SYMBOL_NAME(name); \ + .hidden C_SYMBOL_NAME(name); \ + C_LABEL(name) \ + CALL_MCOUNT + #define LEAF(name) \ .text; \ .align 32; \ diff --git a/libc/sysdeps/linux/ia64/vfork.S b/libc/sysdeps/linux/ia64/vfork.S index f233b05..ba0a862 100644 --- a/libc/sysdeps/linux/ia64/vfork.S +++ b/libc/sysdeps/linux/ia64/vfork.S @@ -29,7 +29,7 @@ /* pid_t vfork(void); */ /* Implemented as __clone_syscall(CLONE_VFORK | CLONE_VM | SIGCHLD, 0) */ -ENTRY(__vfork) +HIDDEN_ENTRY(__vfork) alloc r2=ar.pfs,0,0,2,0 mov out0=CLONE_VM+CLONE_VFORK+SIGCHLD mov out1=0 /* Standard sp value. */ @@ -41,4 +41,4 @@ ENTRY(__vfork) PSEUDO_END(__vfork) weak_alias(__vfork,vfork) -libc_hidden_weak(vfork) +libc_hidden_def(vfork) diff --git a/libc/sysdeps/linux/m68k/vfork.S b/libc/sysdeps/linux/m68k/vfork.S index 56d57f7..b2fe033 100644 --- a/libc/sysdeps/linux/m68k/vfork.S +++ b/libc/sysdeps/linux/m68k/vfork.S @@ -4,9 +4,7 @@ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. */ -#include - -#include +#include #ifndef __NR_vfork #define __NR_vfork __NR_fork /* uClinux-2.0 only has fork which is vfork */ @@ -16,7 +14,6 @@ .text .align 2 - .globl errno .globl __vfork .hidden __vfork .type __vfork, at function @@ -42,4 +39,4 @@ fix_errno: .size __vfork,.-__vfork weak_alias(__vfork,vfork) -libc_hidden_weak(vfork) +libc_hidden_def(vfork) diff --git a/libc/sysdeps/linux/microblaze/vfork.S b/libc/sysdeps/linux/microblaze/vfork.S index c4b4dbf..f5eb10d 100644 --- a/libc/sysdeps/linux/microblaze/vfork.S +++ b/libc/sysdeps/linux/microblaze/vfork.S @@ -13,21 +13,15 @@ * Microblaze port by John Williams */ -#define _ERRNO_H 1 -#include -#define _SYSCALL_H -#include - -#include +#include /* Clone the calling process, but without copying the whole address space. The calling process is suspended until the new process exits or is replaced by a call to `execve'. Return -1 for errors, 0 to the new process, and the process ID of the new process to the old process. */ -.global C_SYMBOL_NAME(errno) - .globl __vfork + .hidden __vfork .align 4 __vfork: addi r12, r0, SYS_vfork @@ -43,4 +37,4 @@ __vfork: .size __vfork, .-__vfork weak_alias(__vfork,vfork) -libc_hidden_weak(vfork) +libc_hidden_def(vfork) diff --git a/libc/sysdeps/linux/mips/vfork.S b/libc/sysdeps/linux/mips/vfork.S index b307447..65a3bb3 100644 --- a/libc/sysdeps/linux/mips/vfork.S +++ b/libc/sysdeps/linux/mips/vfork.S @@ -18,6 +18,7 @@ /* vfork() is just a special case of clone(). */ +#include #include #include @@ -34,6 +35,7 @@ /* int vfork() */ .text + .hidden __vfork LOCALSZ= 1 FRAMESZ= (((NARGSAVE+LOCALSZ)*SZREG)+ALSZ)&ALMASK GPOFF= FRAMESZ-(1*SZREG) @@ -95,6 +97,6 @@ L(error): END(__vfork) weak_alias(__vfork,vfork) -libc_hidden_weak(vfork) +libc_hidden_def(vfork) #endif diff --git a/libc/sysdeps/linux/nios/vfork.S b/libc/sysdeps/linux/nios/vfork.S index f8a6d03..603a07e 100644 --- a/libc/sysdeps/linux/nios/vfork.S +++ b/libc/sysdeps/linux/nios/vfork.S @@ -10,9 +10,6 @@ * Written by Wentao Xu */ -#include - -#include #include #include "NM_Macros.S" @@ -51,4 +48,4 @@ fix_errno: .size __vfork,.-__vfork weak_alias(__vfork,vfork) -libc_hidden_weak(vfork) +libc_hidden_def(vfork) diff --git a/libc/sysdeps/linux/nios2/vfork.S b/libc/sysdeps/linux/nios2/vfork.S index 5d275ff..5d61db0 100644 --- a/libc/sysdeps/linux/nios2/vfork.S +++ b/libc/sysdeps/linux/nios2/vfork.S @@ -10,11 +10,7 @@ * Written by Wentao Xu */ -#include - -#define _ERRNO_H -#include -#include +#include #ifndef __NR_vfork #define __NR_vfork __NR_fork /* uClinux-2.0 only has fork which is vfork */ @@ -53,4 +49,4 @@ fix_errno: .size __vfork,.-__vfork weak_alias(__vfork,vfork) -libc_hidden_weak(vfork) +libc_hidden_def(vfork) diff --git a/libc/sysdeps/linux/powerpc/vfork.S b/libc/sysdeps/linux/powerpc/vfork.S index 0083742..0f31eda 100644 --- a/libc/sysdeps/linux/powerpc/vfork.S +++ b/libc/sysdeps/linux/powerpc/vfork.S @@ -27,4 +27,4 @@ __vfork: .size __vfork,.-__vfork weak_alias(__vfork,vfork) -libc_hidden_weak(vfork) +libc_hidden_def(vfork) diff --git a/libc/sysdeps/linux/sh/vfork.S b/libc/sysdeps/linux/sh/vfork.S index d311bff..a60a7ef 100644 --- a/libc/sysdeps/linux/sh/vfork.S +++ b/libc/sysdeps/linux/sh/vfork.S @@ -20,11 +20,9 @@ respective copyright holders. */ -#include #include #define _ERRNO_H #include -#include /* Clone the calling process, but without copying the whole address space. The calling process is suspended until the new process exits or is @@ -109,6 +107,6 @@ __vfork: .size __vfork, .-__vfork weak_alias(__vfork,vfork) -libc_hidden_weak(vfork) +libc_hidden_def(vfork) #include "syscall_error.S" diff --git a/libc/sysdeps/linux/sparc/vfork.S b/libc/sysdeps/linux/sparc/vfork.S index ed3e1a0..626183b 100644 --- a/libc/sysdeps/linux/sparc/vfork.S +++ b/libc/sysdeps/linux/sparc/vfork.S @@ -52,4 +52,4 @@ __vfork: .size __vfork,.-__vfork weak_alias(__vfork,vfork) -libc_hidden_weak(vfork) +libc_hidden_def(vfork) diff --git a/libc/sysdeps/linux/v850/vfork.S b/libc/sysdeps/linux/v850/vfork.S index 2533853..b67ebf8 100644 --- a/libc/sysdeps/linux/v850/vfork.S +++ b/libc/sysdeps/linux/v850/vfork.S @@ -11,12 +11,7 @@ * Written by Miles Bader */ -#include -#define _ERRNO_H 1 -#include -#define _SYSCALL_H -#include - +#include #include /* Clone the calling process, but without copying the whole address space. @@ -24,8 +19,7 @@ replaced by a call to `execve'. Return -1 for errors, 0 to the new process, and the process ID of the new process to the old process. */ -.global C_SYMBOL_NAME(errno) - +/* this should be made hidden */ C_ENTRY (__vfork): addi SYS_vfork, r0, r12 trap 0 @@ -39,4 +33,4 @@ C_ENTRY (__vfork): jmp [lp] /* error return */ C_END(__vfork) weak_alias(__vfork,vfork) -libc_hidden_weak(vfork) +libc_hidden_def(vfork) diff --git a/libc/sysdeps/linux/x86_64/vfork.S b/libc/sysdeps/linux/x86_64/vfork.S index 97c9c5b..8467fcc 100644 --- a/libc/sysdeps/linux/x86_64/vfork.S +++ b/libc/sysdeps/linux/x86_64/vfork.S @@ -63,4 +63,4 @@ __vfork: .size __vfork,.-__vfork weak_alias(__vfork,vfork) -libc_hidden_weak(vfork) +libc_hidden_def(vfork) diff --git a/libc/sysdeps/linux/xtensa/sysdep.h b/libc/sysdeps/linux/xtensa/sysdep.h index 4c32c2c..fb691f8 100644 --- a/libc/sysdeps/linux/xtensa/sysdep.h +++ b/libc/sysdeps/linux/xtensa/sysdep.h @@ -38,6 +38,16 @@ entry sp, FRAMESIZE; \ CALL_MCOUNT +#define HIDDEN_ENTRY(name) \ + ASM_GLOBAL_DIRECTIVE C_SYMBOL_NAME(name); \ + .hidden C_SYMBOL_NAME(name); \ + ASM_TYPE_DIRECTIVE (C_SYMBOL_NAME(name), @function); \ + .align ALIGNARG(2); \ + LITERAL_POSITION; \ + C_LABEL(name) \ + entry sp, FRAMESIZE; \ + CALL_MCOUNT + #undef END #define END(name) ASM_SIZE_DIRECTIVE(name) diff --git a/libc/sysdeps/linux/xtensa/vfork.S b/libc/sysdeps/linux/xtensa/vfork.S index 6e490fe..977064c 100644 --- a/libc/sysdeps/linux/xtensa/vfork.S +++ b/libc/sysdeps/linux/xtensa/vfork.S @@ -49,7 +49,7 @@ /* pid_t vfork(void); Implemented as __clone_syscall(CLONE_VFORK | CLONE_VM | SIGCHLD, 0) */ -ENTRY (__vfork) +HIDDEN_ENTRY (__vfork) movi a6, .Ljumptable extui a2, a0, 30, 2 /* call-size: call4/8/12 = 1/2/3 */ @@ -165,6 +165,5 @@ ENTRY (__vfork) .Lpseudo_end: retw -libc_hidden_def (__vfork) - weak_alias (__vfork, vfork) +libc_hidden_def(vfork) -- 1.7.3.4 From rep.dot.nop at gmail.com Wed Apr 20 10:50:38 2011 From: rep.dot.nop at gmail.com (Bernhard Reutner-Fischer) Date: Wed, 20 Apr 2011 12:50:38 +0200 Subject: [git commit future] Added fts support for traversing UNIX file hierarchies. Message-ID: <20110421232844.1D64C8216E@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=a4aa01c128b04c7174d57a28f61656f966d2bd6c branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/future It is required by libdwfl in elfutils package. Signed-off-by: Salvatore Cro Signed-off-by: Bernhard Reutner-Fischer Patch is too large, so refusing to show it From salvatore.cro at st.com Wed Apr 20 10:50:38 2011 From: salvatore.cro at st.com (Salvatore Cro) Date: Wed, 20 Apr 2011 12:50:38 +0200 Subject: [git commit future] test: fix tst-tls13 expected result and timeout Message-ID: <20110421232843.E2E248216E@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=3a411b5d8a6c6311778e22280706047cd1a8c8d4 branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/future tst-tls13 is expected to return 0 when passing. Set higher timeout to avoid failure on slow archs. Signed-off-by: Salvatore Cro Signed-off-by: Carmelo Amoroso --- test/tls/Makefile.in | 1 - test/tls/tst-tls13.c | 2 +- 2 files changed, 1 insertions(+), 2 deletions(-) diff --git a/test/tls/Makefile.in b/test/tls/Makefile.in index d19d347..875c607 100644 --- a/test/tls/Makefile.in +++ b/test/tls/Makefile.in @@ -140,7 +140,6 @@ tst-tlsmod18a%.so: tst-tlsmod18a.c $(LDFLAGS_tst-tlsmod18a.so) tst-tls-at-ctor: tst-tlsmod-at-ctor.so -RET_tst-tls13 := 1 ifeq ($(TARGET_ARCH),mips) RET_tst-tls15 := 1 endif diff --git a/test/tls/tst-tls13.c b/test/tls/tst-tls13.c index 55fb62e..beee91b 100644 --- a/test/tls/tst-tls13.c +++ b/test/tls/tst-tls13.c @@ -26,5 +26,5 @@ do_test (void) } #define TEST_FUNCTION do_test () -#define TIMEOUT 3 +#define TIMEOUT 20 #include "../test-skeleton.c" -- 1.7.3.4 From ps.m at gmx.net Wed Apr 20 10:50:38 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Wed, 20 Apr 2011 12:50:38 +0200 Subject: [git commit future] endian.h: add some handy macros to be used in syscalls Message-ID: <20110421232844.E61D682962@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=341208e9023427a2510f5eed34f9acd87729e79e branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/future Signed-off-by: Peter S. Mazinger --- include/endian.h | 11 +++++++++++ 1 files changed, 11 insertions(+), 0 deletions(-) diff --git a/include/endian.h b/include/endian.h index 0ba7384..1e2fc93 100644 --- a/include/endian.h +++ b/include/endian.h @@ -55,6 +55,17 @@ # define __LONG_LONG_PAIR(HI, LO) HI, LO #endif +#ifdef _LIBC +# ifndef __ASSEMBLER__ +# include +# define OFF_HI(offset) (offset >> 31) +# define OFF_LO(offset) (offset) +# define OFF64_HI(offset) (uint32_t)(offset >> 32) +# define OFF64_LO(offset) (uint32_t)(offset & 0xffffffff) +# define OFF_HI_LO(offset) __LONG_LONG_PAIR(OFF_HI(offset), OFF_LO(offset)) +# define OFF64_HI_LO(offset) __LONG_LONG_PAIR(OFF64_HI(offset), OFF64_LO(offset)) +# endif +#endif #ifdef __USE_BSD /* Conversion interfaces. */ -- 1.7.3.4 From ps.m at gmx.net Wed Apr 20 10:50:38 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Wed, 20 Apr 2011 12:50:38 +0200 Subject: [git commit future] fork: provide __libc_fork only if THREADS are enabled Message-ID: <20110421232845.4D90782963@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=3f90b43e1fb48cbe7b43bb04953a03beb49c1d14 branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/future Signed-off-by: Peter S. Mazinger --- include/unistd.h | 2 ++ libc/sysdeps/linux/common/fork.c | 18 +++++++++--------- libc/sysdeps/linux/cris/fork.c | 12 ++++++++---- libc/sysdeps/linux/ia64/fork.S | 14 +++++++++----- libc/sysdeps/linux/sparc/fork.S | 17 +++++++++++------ libc/sysdeps/linux/xtensa/fork.c | 17 ++++++++++------- 6 files changed, 49 insertions(+), 31 deletions(-) diff --git a/include/unistd.h b/include/unistd.h index 9337c8b..e646e04 100644 --- a/include/unistd.h +++ b/include/unistd.h @@ -805,7 +805,9 @@ libc_hidden_proto(setresgid) and the process ID of the new process to the old process. */ extern __pid_t fork (void) __THROW; # ifdef _LIBC +# ifdef __UCLIBC_HAS_THREADS__ extern __typeof(fork) __libc_fork; +# endif libc_hidden_proto(fork) # endif #endif diff --git a/libc/sysdeps/linux/common/fork.c b/libc/sysdeps/linux/common/fork.c index 88958b1..fa1f4af 100644 --- a/libc/sysdeps/linux/common/fork.c +++ b/libc/sysdeps/linux/common/fork.c @@ -8,15 +8,15 @@ */ #include -#include -#ifdef __ARCH_USE_MMU__ - -#ifdef __NR_fork -#define __NR___libc_fork __NR_fork -_syscall0(pid_t, __libc_fork) -weak_alias(__libc_fork,fork) +#if defined __NR_fork && defined __ARCH_USE_MMU__ +# include +# include +_syscall0(pid_t, fork) +# ifdef __UCLIBC_HAS_THREADS__ +strong_alias(fork,__libc_fork) libc_hidden_weak(fork) -#endif - +# else +libc_hidden_def(fork) +# endif #endif diff --git a/libc/sysdeps/linux/cris/fork.c b/libc/sysdeps/linux/cris/fork.c index 19aa172..7aff489 100644 --- a/libc/sysdeps/linux/cris/fork.c +++ b/libc/sysdeps/linux/cris/fork.c @@ -6,13 +6,17 @@ #include "sysdep.h" -#define __NR___libc_fork __NR_fork -SYSCALL__ (__libc_fork, 0) +#if defined __NR_fork && defined __ARCH_USE_MMU__ +# include + +SYSCALL__ (fork, 0) /* R1 is now 0 for the parent and 1 for the child. Decrement it to make it -1 (all bits set) for the parent, and 0 (no bits set) for the child. Then AND it with R0, so the parent gets R0&-1==R0, and the child gets R0&0==0. */ /* i dunno what the blurb above is useful for. we just return. */ __asm__("ret\n\tnop"); -weak_alias(__libc_fork,fork) -libc_hidden_weak(fork) + +lt_strong_alias(fork) +lt_libc_hidden(fork) +#endif diff --git a/libc/sysdeps/linux/ia64/fork.S b/libc/sysdeps/linux/ia64/fork.S index 0023a3b..968bb1c 100644 --- a/libc/sysdeps/linux/ia64/fork.S +++ b/libc/sysdeps/linux/ia64/fork.S @@ -24,7 +24,10 @@ /* pid_t fork(void); */ /* Implemented as a clone system call with parameters SIGCHLD and 0 */ -ENTRY(__libc_fork) +#ifdef __UCLIBC_HAS_THREADS__ +.weak fork +#endif +ENTRY(fork) alloc r2=ar.pfs,0,0,2,0 mov out0=SIGCHLD /* Return SIGCHLD when child finishes */ /* no other clone flags; nothing shared */ @@ -34,7 +37,8 @@ ENTRY(__libc_fork) cmp.eq p6,p0=-1,r10 (p6) br.cond.spnt.few __syscall_error ret -PSEUDO_END(__libc_fork) - -weak_alias (__libc_fork, fork) -libc_hidden_weak (fork) +PSEUDO_END(fork) +#ifdef __UCLIBC_HAS_THREADS__ +strong_alias(fork,__libc_fork) +#endif +libc_hidden_def(fork) diff --git a/libc/sysdeps/linux/sparc/fork.S b/libc/sysdeps/linux/sparc/fork.S index 7ead409..1795eb6 100644 --- a/libc/sysdeps/linux/sparc/fork.S +++ b/libc/sysdeps/linux/sparc/fork.S @@ -23,11 +23,14 @@ #include .text -.global __libc_fork -.type __libc_fork,%function +.global fork +#ifdef __UCLIBC_HAS_THREADS__ +.weak fork +#endif +.type fork,%function .align 4 -__libc_fork: +fork: mov __NR_fork, %g1 ta 0x10 bcc,a 9000f @@ -44,6 +47,8 @@ __libc_fork: retl and %o0, %o1, %o0 -.size __libc_fork,.-__libc_fork -weak_alias(__libc_fork,fork) -libc_hidden_weak(fork) +.size fork,.-fork +#ifdef __UCLIBC_HAS_THREADS__ +strong_alias(fork,__libc_fork) +#endif +libc_hidden_def(fork) diff --git a/libc/sysdeps/linux/xtensa/fork.c b/libc/sysdeps/linux/xtensa/fork.c index f8b77bf..e9b681c 100644 --- a/libc/sysdeps/linux/xtensa/fork.c +++ b/libc/sysdeps/linux/xtensa/fork.c @@ -7,16 +7,19 @@ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. */ -#include -#include -#define _SIGNAL_H -#include /* Xtensa doesn't provide a 'fork' system call, so we use 'clone'. */ +#include + +#if defined __NR_clone && defined __ARCH_USE_MMU__ +# include +# include +# include -pid_t __libc_fork(void) +pid_t fork(void) { return (pid_t) INLINE_SYSCALL(clone, 2, SIGCHLD, 0); } -weak_alias(__libc_fork, fork) -libc_hidden_weak(fork) +lt_strong_alias(fork) +lt_libc_hidden(fork) +#endif -- 1.7.3.4 From ps.m at gmx.net Wed Apr 20 10:50:38 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Wed, 20 Apr 2011 12:50:38 +0200 Subject: [git commit future] creat*.c: add LIBC_CANCEL_HANDLED to know that it is cancellable (handled by open) Message-ID: <20110421232845.C3CAD82962@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=dadc1aa0f025d9b999e1bc85da57c3b038e6fcf0 branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/future Signed-off-by: Peter S. Mazinger --- libc/sysdeps/linux/common/creat.c | 3 +++ libc/sysdeps/linux/common/creat64.c | 5 ++++- 2 files changed, 7 insertions(+), 1 deletions(-) diff --git a/libc/sysdeps/linux/common/creat.c b/libc/sysdeps/linux/common/creat.c index 77cf44e..1792919 100644 --- a/libc/sysdeps/linux/common/creat.c +++ b/libc/sysdeps/linux/common/creat.c @@ -8,8 +8,11 @@ */ #include +#include int creat(const char *file, mode_t mode) { return open(file, O_WRONLY | O_CREAT | O_TRUNC, mode); } +/* open handled cancellation, noop on uClibc */ +LIBC_CANCEL_HANDLED(); diff --git a/libc/sysdeps/linux/common/creat64.c b/libc/sysdeps/linux/common/creat64.c index 550e88a..5010d76 100644 --- a/libc/sysdeps/linux/common/creat64.c +++ b/libc/sysdeps/linux/common/creat64.c @@ -18,9 +18,12 @@ #include <_lfs_64.h> #include +#include /* Create FILE with protections MODE. */ int creat64(const char *file, mode_t mode) { - return open64(file, O_WRONLY|O_CREAT|O_TRUNC, mode); + return open64(file, O_WRONLY | O_CREAT | O_TRUNC, mode); } +/* open handled cancellation, noop on uClibc */ +LIBC_CANCEL_HANDLED(); -- 1.7.3.4 From ps.m at gmx.net Wed Apr 20 10:50:38 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Wed, 20 Apr 2011 12:50:38 +0200 Subject: [git commit future] select: adapt cancelation to use cancel.h Message-ID: <20110421232845.7F76482963@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=5aa1448caef9a897b916d2d3679ef6c433f4004c branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/future Signed-off-by: Peter S. Mazinger --- include/sys/select.h | 3 + libc/sysdeps/linux/common/select.c | 75 ++++++++++-------------------------- 2 files changed, 24 insertions(+), 54 deletions(-) diff --git a/include/sys/select.h b/include/sys/select.h index 6ffe4e2..5436e20 100644 --- a/include/sys/select.h +++ b/include/sys/select.h @@ -110,7 +110,10 @@ extern int select (int __nfds, fd_set *__restrict __readfds, fd_set *__restrict __writefds, fd_set *__restrict __exceptfds, struct timeval *__restrict __timeout); +#ifdef _LIBC +extern __typeof(select) __select_nocancel attribute_hidden; libc_hidden_proto(select) +#endif #ifdef __USE_XOPEN2K /* Same as above only that the TIMEOUT value is given with higher diff --git a/libc/sysdeps/linux/common/select.c b/libc/sysdeps/linux/common/select.c index 029fb08..c13bd04 100644 --- a/libc/sysdeps/linux/common/select.c +++ b/libc/sysdeps/linux/common/select.c @@ -9,27 +9,24 @@ #include #include -#include +#include -#ifdef __UCLIBC_HAS_THREADS_NATIVE__ -#include -#else -#define SINGLE_THREAD_P 1 +#ifdef __NR__newselect +# undef __NR_select +# define __NR_select __NR__newselect #endif -#define USEC_PER_SEC 1000000L - -extern __typeof(select) __libc_select; - -#if !defined(__NR__newselect) && !defined(__NR_select) && defined __USE_XOPEN2K -# define __NR___libc_pselect6 __NR_pselect6 -static _syscall6(int, __libc_pselect6, int, n, fd_set *, readfds, fd_set *, writefds, - fd_set *, exceptfds, const struct timespec *, timeout, - const sigset_t *, sigmask) +#if !defined __NR_select && defined __NR_pselect6 +# include +# define USEC_PER_SEC 1000000L +#endif -int __libc_select(int n, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, - struct timeval *timeout) +int __NC(select)(int n, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, + struct timeval *timeout) { +#ifdef __NR_select + return INLINE_SYSCALL(select, 5, n, readfds, writefds, exceptfds, timeout); +#elif defined __NR_pselect6 struct timespec _ts, *ts = 0; if (timeout) { uint32_t usec; @@ -51,44 +48,14 @@ int __libc_select(int n, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, ts = &_ts; } - - if (SINGLE_THREAD_P) - return __libc_pselect6(n, readfds, writefds, exceptfds, ts, 0); -#ifdef __UCLIBC_HAS_THREADS_NATIVE__ - int oldtype = LIBC_CANCEL_ASYNC (); - int result = __libc_pselect6(n, readfds, writefds, exceptfds, ts, 0); - LIBC_CANCEL_RESET (oldtype); - return result; -#endif - -} - -#else - -#ifdef __NR__newselect -# define __NR___syscall_select __NR__newselect -#else -# define __NR___syscall_select __NR_select -#endif - -static _syscall5(int, __syscall_select, int, n, fd_set *, readfds, - fd_set *, writefds, fd_set *, exceptfds, struct timeval *, timeout); - -int __libc_select(int n, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, - struct timeval *timeout) -{ - if (SINGLE_THREAD_P) - return __syscall_select(n, readfds, writefds, exceptfds, timeout); - -#ifdef __UCLIBC_HAS_THREADS_NATIVE__ - int oldtype = LIBC_CANCEL_ASYNC (); - int result = __syscall_select(n, readfds, writefds, exceptfds, timeout); - LIBC_CANCEL_RESET (oldtype); - return result; + return INLINE_SYSCALL(pselect6, 6, n, readfds, writefds, exceptfds, ts, 0); #endif } - +/* we should guard it, but we need it in other files, so let it fail + * if we miss any of the syscalls */ +#if 1 /*defined __NR_select || defined __NR_pselect6*/ +CANCELLABLE_SYSCALL(int, select, (int n, fd_set *readfds, fd_set *writefds, + fd_set *exceptfds, struct timeval *timeout), + (n, readfds, writefds, exceptfds, timeout)) +lt_libc_hidden(select) #endif - -weak_alias(__libc_select,select) -libc_hidden_weak(select) -- 1.7.3.4 From ps.m at gmx.net Wed Apr 20 10:50:38 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Wed, 20 Apr 2011 12:50:38 +0200 Subject: [git commit future] open64.c: no need for separate cancellation, open handles it already Message-ID: <20110421232846.1A8A58216E@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=7b25ef37b275e5e34a4fa40973a387dbc4e61b68 branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/future Signed-off-by: Peter S. Mazinger --- libc/sysdeps/linux/common/open64.c | 51 ++++++++++-------------------------- 1 files changed, 14 insertions(+), 37 deletions(-) diff --git a/libc/sysdeps/linux/common/open64.c b/libc/sysdeps/linux/common/open64.c index 91931fa..bbb12cd 100644 --- a/libc/sysdeps/linux/common/open64.c +++ b/libc/sysdeps/linux/common/open64.c @@ -7,47 +7,24 @@ #include <_lfs_64.h> #include #include -#ifdef __UCLIBC_HAS_THREADS_NATIVE__ -#include -#include -#endif - -#ifndef O_LARGEFILE -# define O_LARGEFILE 0100000 -#endif +#include /* Open FILE with access OFLAG. If OFLAG includes O_CREAT, a third argument is the file protection. */ -int open64 (const char *file, int oflag, ...) +int open64(const char *file, int oflag, ...) { - mode_t mode = 0; - - if (oflag & O_CREAT) - { - va_list arg; - va_start (arg, oflag); - mode = va_arg (arg, mode_t); - va_end (arg); - } - -#ifdef __UCLIBC_HAS_THREADS_NATIVE__ - if (SINGLE_THREAD_P) - return INLINE_SYSCALL (open, 3, file, oflag | O_LARGEFILE, mode); - - int oldtype = LIBC_CANCEL_ASYNC (); - - int result = INLINE_SYSCALL (open, 3, file, oflag | O_LARGEFILE, mode); + mode_t mode = 0; - LIBC_CANCEL_RESET (oldtype); + if (oflag & O_CREAT) { + va_list arg; + va_start (arg, oflag); + mode = va_arg (arg, mode_t); + va_end (arg); + } - return result; -#else - return open(file, oflag | O_LARGEFILE, mode); -#endif + return open(file, oflag | O_LARGEFILE, mode); } -#ifndef __LINUXTHREADS_OLD__ -libc_hidden_def(open64) -#else -libc_hidden_weak(open64) -strong_alias(open64,__libc_open64) -#endif +lt_strong_alias(open64) +lt_libc_hidden(open64) +/* open handled cancellation, noop on uClibc */ +LIBC_CANCEL_HANDLED(); -- 1.7.3.4 From ps.m at gmx.net Wed Apr 20 10:50:38 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Wed, 20 Apr 2011 12:50:38 +0200 Subject: [git commit future] adapt fdatasync, fsync, msync to use cancel.h Message-ID: <20110421232845.E74698216E@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=6fd9946086ab1e100fbb7a4e8806bc09d7d6d587 branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/future Signed-off-by: Peter S. Mazinger --- libc/sysdeps/linux/common/fdatasync.c | 29 ++++-------------------- libc/sysdeps/linux/common/fsync.c | 28 +++-------------------- libc/sysdeps/linux/common/msync.c | 38 ++++++-------------------------- 3 files changed, 16 insertions(+), 79 deletions(-) diff --git a/libc/sysdeps/linux/common/fdatasync.c b/libc/sysdeps/linux/common/fdatasync.c index e51c723..6c2f4f9 100644 --- a/libc/sysdeps/linux/common/fdatasync.c +++ b/libc/sysdeps/linux/common/fdatasync.c @@ -8,36 +8,17 @@ */ #include -#include #if !defined __NR_fdatasync && defined __NR_osf_fdatasync # define __NR_fdatasync __NR_osf_fdatasync #endif #ifdef __NR_fdatasync +# include +# include -# ifdef __UCLIBC_HAS_THREADS_NATIVE__ -# include -# else -# define SINGLE_THREAD_P 1 -# endif - -#define __NR___syscall_fdatasync __NR_fdatasync - -static __always_inline -_syscall1(int, __syscall_fdatasync, int, fd) - -int fdatasync(int fd) -{ - if (SINGLE_THREAD_P) - return __syscall_fdatasync(fd); - -# ifdef __UCLIBC_HAS_THREADS_NATIVE__ - int oldtype = LIBC_CANCEL_ASYNC (); - int result = __syscall_fdatasync(fd); - LIBC_CANCEL_RESET (oldtype); - return result; -# endif -} +# define __NR___fdatasync_nocancel __NR_fdatasync +static _syscall1(int, __NC(fdatasync), int, fd) +CANCELLABLE_SYSCALL(int, fdatasync, (int fd), (fd)) #endif diff --git a/libc/sysdeps/linux/common/fsync.c b/libc/sysdeps/linux/common/fsync.c index dcf77eb..f13a1e6 100644 --- a/libc/sysdeps/linux/common/fsync.c +++ b/libc/sysdeps/linux/common/fsync.c @@ -9,29 +9,9 @@ #include #include +#include -#ifdef __UCLIBC_HAS_THREADS_NATIVE__ -#include "sysdep-cancel.h" -#else -#define SINGLE_THREAD_P 1 -#endif +#define __NR___fsync_nocancel __NR_fsync +static _syscall1(int, __NC(fsync), int, fd) -#define __NR___syscall_fsync __NR_fsync -static _syscall1(int, __syscall_fsync, int, fd) - -extern __typeof(fsync) __libc_fsync; - -int __libc_fsync(int fd) -{ - if (SINGLE_THREAD_P) - return __syscall_fsync(fd); - -#ifdef __UCLIBC_HAS_THREADS_NATIVE__ - int oldtype = LIBC_CANCEL_ASYNC (); - int result = __syscall_fsync(fd); - LIBC_CANCEL_RESET (oldtype); - return result; -#endif -} - -weak_alias(__libc_fsync, fsync) +CANCELLABLE_SYSCALL(int, fsync, (int fd), (fd)) diff --git a/libc/sysdeps/linux/common/msync.c b/libc/sysdeps/linux/common/msync.c index 844dbaa..e183fbf 100644 --- a/libc/sysdeps/linux/common/msync.c +++ b/libc/sysdeps/linux/common/msync.c @@ -8,38 +8,14 @@ */ #include -#include -#include -#ifdef __NR_msync +#if defined __NR_msync && defined __ARCH_USE_MMU__ +# include +# include -#ifdef __UCLIBC_HAS_THREADS_NATIVE__ -#include -#else -#define SINGLE_THREAD_P 1 -#endif - -#define __NR___syscall_msync __NR_msync -static __always_inline _syscall3(int, __syscall_msync, void *, addr, size_t, length, - int, flags) - -extern __typeof(msync) __libc_msync; -int __libc_msync(void * addr, size_t length, int flags) -{ -#ifdef __UCLIBC_HAS_THREADS_NATIVE__ - int oldtype, result; -#endif - - if (SINGLE_THREAD_P) - return __syscall_msync(addr, length, flags); - -#ifdef __UCLIBC_HAS_THREADS_NATIVE__ - oldtype = LIBC_CANCEL_ASYNC (); - result = __syscall_msync(addr, length, flags); - LIBC_CANCEL_RESET (oldtype); - return result; -#endif -} -weak_alias(__libc_msync,msync) +# define __NR___msync_nocancel __NR_msync +static _syscall3(int, __NC(msync), void *, addr, size_t, length, int, flags) +CANCELLABLE_SYSCALL(int, msync, (void *addr, size_t length, int flags), + (addr, length, flags)) #endif -- 1.7.3.4 From ps.m at gmx.net Wed Apr 20 10:50:38 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Wed, 20 Apr 2011 12:50:38 +0200 Subject: [git commit future] open.c: add cancellation using cancel.h Message-ID: <20110421232846.44A0A8216E@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=5338bcce480343b26de5c8bbfcfbdf0fc21c62ce branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/future Signed-off-by: Peter S. Mazinger --- libc/sysdeps/linux/common/open.c | 31 ++++++++++++++++++------------- 1 files changed, 18 insertions(+), 13 deletions(-) diff --git a/libc/sysdeps/linux/common/open.c b/libc/sysdeps/linux/common/open.c index 9fb694d..a72e84d 100644 --- a/libc/sysdeps/linux/common/open.c +++ b/libc/sysdeps/linux/common/open.c @@ -8,15 +8,17 @@ */ #include -#include -#include #include -#include -#include +#include +#include #define __NR___syscall_open __NR_open -static __inline__ _syscall3(int, __syscall_open, const char *, file, - int, flags, __kernel_mode_t, mode) +static __always_inline _syscall3(int, __syscall_open, const char *, file, + int, flags, __kernel_mode_t, mode) +strong_alias_untyped(__syscall_open,__NC(open)) + +#define __NR___open2_nocancel __NR_open +_syscall2(int, __NC(open2), const char *, file, int, flags) int open(const char *file, int oflag, ...) { @@ -29,11 +31,14 @@ int open(const char *file, int oflag, ...) va_end(arg); } - return __syscall_open(file, oflag, mode); -} -#ifndef __LINUXTHREADS_OLD__ -libc_hidden_def(open) -#else -libc_hidden_weak(open) -strong_alias(open,__libc_open) + if (SINGLE_THREAD_P) + return __NC(open)(file, oflag, mode); +#ifdef __NEW_THREADS + int oldtype = LIBC_CANCEL_ASYNC (); + int result = __NC(open)(file, oflag, mode); + LIBC_CANCEL_RESET (oldtype); + return result; #endif +} +lt_strong_alias(open) +lt_libc_hidden(open) -- 1.7.3.4 From ps.m at gmx.net Wed Apr 20 10:50:38 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Wed, 20 Apr 2011 12:50:38 +0200 Subject: [git commit future] waitpid.c: provide __waitpid_nocancel, use cancel.h Message-ID: <20110421232846.6E5908216E@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=686e4558ecc74e0414415ce470e86ae57f0aaafa branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/future Use __wait4_nocancel since wait4 is not available all the time. Add a comment about not using waitpid syscall. Signed-off-by: Peter S. Mazinger --- include/sys/wait.h | 3 +++ libc/sysdeps/linux/common/waitpid.c | 32 ++++++++------------------------ 2 files changed, 11 insertions(+), 24 deletions(-) diff --git a/include/sys/wait.h b/include/sys/wait.h index b09c28d..2b68847 100644 --- a/include/sys/wait.h +++ b/include/sys/wait.h @@ -137,7 +137,10 @@ extern __pid_t wait (__WAIT_STATUS __stat_loc); This function is a cancellation point and therefore not marked with __THROW. */ extern __pid_t waitpid (__pid_t __pid, int *__stat_loc, int __options); +#ifdef _LIBC +extern __typeof(waitpid) __waitpid_nocancel attribute_hidden; libc_hidden_proto(waitpid) +#endif #if defined __USE_SVID || defined __USE_XOPEN # define __need_siginfo_t diff --git a/libc/sysdeps/linux/common/waitpid.c b/libc/sysdeps/linux/common/waitpid.c index d043719..b5a9b18 100644 --- a/libc/sysdeps/linux/common/waitpid.c +++ b/libc/sysdeps/linux/common/waitpid.c @@ -6,32 +6,16 @@ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. */ -#include -#include #include -#include +#include -#ifdef __UCLIBC_HAS_THREADS_NATIVE__ -#include "sysdep-cancel.h" -#else -#define SINGLE_THREAD_P 1 -#endif - -libc_hidden_proto(wait4) - -extern __typeof(waitpid) __libc_waitpid; -__pid_t __libc_waitpid(__pid_t pid, int *wait_stat, int options) +pid_t __NC(waitpid)(pid_t pid, int *wait_stat, int options) { - if (SINGLE_THREAD_P) - return wait4(pid, wait_stat, options, NULL); - -#ifdef __UCLIBC_HAS_THREADS_NATIVE__ - int oldtype = LIBC_CANCEL_ASYNC (); - int result = wait4(pid, wait_stat, options, NULL); - LIBC_CANCEL_RESET (oldtype); - return result; +#if 1 /* kernel says to avoid waitpid syscall */ + return __wait4_nocancel(pid, wait_stat, options, NULL); +#else + return INLINE_SYSCALL(waitpid, 3, pid, wait_stat, options); #endif } -libc_hidden_proto(waitpid) -weak_alias(__libc_waitpid,waitpid) -libc_hidden_weak(waitpid) +CANCELLABLE_SYSCALL(pid_t, waitpid, (pid_t pid, int *wait_stat, int options), (pid, wait_stat, options)) +lt_libc_hidden(waitpid) -- 1.7.3.4 From ps.m at gmx.net Wed Apr 20 10:50:38 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Wed, 20 Apr 2011 12:50:38 +0200 Subject: [git commit future] readv, writev: rewrite to use cancel.h Message-ID: <20110421232846.A307A8216E@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=2afd661bf9c6ffac67c7e88a24966e2602cd7552 branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/future Signed-off-by: Peter S. Mazinger --- libc/sysdeps/linux/common/readv.c | 40 +++++++++--------------------------- libc/sysdeps/linux/common/writev.c | 40 ++++++++--------------------------- 2 files changed, 19 insertions(+), 61 deletions(-) diff --git a/libc/sysdeps/linux/common/readv.c b/libc/sysdeps/linux/common/readv.c index fce396d..9418ea4 100644 --- a/libc/sysdeps/linux/common/readv.c +++ b/libc/sysdeps/linux/common/readv.c @@ -10,41 +10,21 @@ #include #include - -#ifdef __UCLIBC_HAS_THREADS_NATIVE__ -#include +#include /* We should deal with kernel which have a smaller UIO_FASTIOV as well as a very big count. */ -static ssize_t __readv (int fd, const struct iovec *vector, int count) +static ssize_t __NC(readv)(int fd, const struct iovec *vector, int count) { - ssize_t bytes_read; - - bytes_read = INLINE_SYSCALL (readv, 3, fd, vector, count); - - if (bytes_read >= 0 || errno != EINVAL || count <= UIO_FASTIOV) - return bytes_read; - - /* glibc tries again, but we do not. */ - //return __atomic_readv_replacement (fd, vector, count); - - return -1; -} - -ssize_t readv (int fd, const struct iovec *vector, int count) -{ - if (SINGLE_THREAD_P) - return __readv (fd, vector, count); - - int oldtype = LIBC_CANCEL_ASYNC (); + ssize_t bytes_read = INLINE_SYSCALL(readv, 3, fd, vector, count); - int result = __readv (fd, vector, count); + if (bytes_read >= 0 || errno != EINVAL || count <= UIO_FASTIOV) + return bytes_read; - LIBC_CANCEL_RESET (oldtype); + /* glibc tries again, but we do not. */ + /* return __atomic_readv_replacement (fd, vector, count); */ - return result; + return -1; } -#else -_syscall3(ssize_t, readv, int, filedes, const struct iovec *, vector, - int, count) -#endif +CANCELLABLE_SYSCALL(ssize_t, readv, (int fd, const struct iovec *vector, int count), + (fd, vector, count)) diff --git a/libc/sysdeps/linux/common/writev.c b/libc/sysdeps/linux/common/writev.c index bd0e407..9b59228 100644 --- a/libc/sysdeps/linux/common/writev.c +++ b/libc/sysdeps/linux/common/writev.c @@ -9,42 +9,20 @@ #include #include - -#ifdef __UCLIBC_HAS_THREADS_NATIVE__ -#include -#include +#include /* We should deal with kernel which have a smaller UIO_FASTIOV as well as a very big count. */ -static ssize_t __writev (int fd, const struct iovec *vector, int count) +static ssize_t __NC(writev)(int fd, const struct iovec *vector, int count) { - ssize_t bytes_written; - - bytes_written = INLINE_SYSCALL (writev, 3, fd, vector, count); - - if (bytes_written >= 0 || errno != EINVAL || count <= UIO_FASTIOV) - return bytes_written; - - /* glibc tries again, but we do not. */ - /* return __atomic_writev_replacement (fd, vector, count); */ - - return -1; -} - -ssize_t writev (int fd, const struct iovec *vector, int count) -{ - if (SINGLE_THREAD_P) - return __writev (fd, vector, count); - - int oldtype = LIBC_CANCEL_ASYNC (); + ssize_t bytes_written = INLINE_SYSCALL(writev, 3, fd, vector, count); - ssize_t result = __writev (fd, vector, count); + if (bytes_written >= 0 || errno != EINVAL || count <= UIO_FASTIOV) + return bytes_written; - LIBC_CANCEL_RESET (oldtype); + /* glibc tries again, but we do not. */ + /* return __atomic_writev_replacement (fd, vector, count); */ - return result; + return -1; } -#else -_syscall3(ssize_t, writev, int, filedes, const struct iovec *, vector, - int, count) -#endif +CANCELLABLE_SYSCALL(ssize_t, writev, (int fd, const struct iovec *vector, int count), (fd, vector, count)) -- 1.7.3.4 From ps.m at gmx.net Wed Apr 20 10:50:38 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Wed, 20 Apr 2011 12:50:38 +0200 Subject: [git commit future] waitid.c: use cancel.h Message-ID: <20110421232846.C429E8216E@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=854b3c873836ebf3a01cad18ca818bcca38476b3 branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/future Signed-off-by: Peter S. Mazinger --- libc/sysdeps/linux/common/waitid.c | 56 ++++++++++------------------------- 1 files changed, 16 insertions(+), 40 deletions(-) diff --git a/libc/sysdeps/linux/common/waitid.c b/libc/sysdeps/linux/common/waitid.c index c8115f9..c36e63a 100644 --- a/libc/sysdeps/linux/common/waitid.c +++ b/libc/sysdeps/linux/common/waitid.c @@ -8,43 +8,19 @@ #include #if defined __USE_SVID || defined __USE_XOPEN -# include -# include -# include -# include - -# ifdef __NR_waitid -# ifdef __UCLIBC_HAS_THREADS_NATIVE__ -# include -# else -# define SINGLE_THREAD_P 1 -# endif - -/* The waitid() POSIX interface takes 4 arguments, but the kernel function - * actually takes 5. The fifth is a pointer to struct rusage. Make sure - * we pass NULL rather than letting whatever was in the register bleed up. - */ -#define __NR_waitid5 __NR_waitid -static __always_inline -_syscall5(int, waitid5, idtype_t, idtype, id_t, id, siginfo_t*, infop, - int, options, struct rusage*, ru) -# endif +#include +#include +#include +#ifndef __NR_waitid +# include +#endif -int waitid(idtype_t idtype, id_t id, siginfo_t *infop, int options) +static int __NC(waitid)(idtype_t idtype, id_t id, siginfo_t *infop, int options) { -# ifdef __NR_waitid - if (SINGLE_THREAD_P) - return waitid5(idtype, id, infop, options, NULL); - -# ifdef __UCLIBC_HAS_THREADS_NATIVE__ - int oldtype = LIBC_CANCEL_ASYNC (); - int result = waitid5(idtype, id, infop, options, NULL); - LIBC_CANCEL_RESET (oldtype); - return result; -# endif - -# elif defined __NR_waitpid +#ifdef __NR_waitid + return INLINE_SYSCALL(waitid, 5, idtype, id, infop, options, NULL); +#else switch (idtype) { case P_PID: if (id <= 0) @@ -66,16 +42,16 @@ int waitid(idtype_t idtype, id_t id, siginfo_t *infop, int options) memset(infop, 0, sizeof *infop); infop->si_pid = waitpid(id, &infop->si_status, options -# ifdef WEXITED +# ifdef WEXITED &~ WEXITED -# endif +# endif ); if (infop->si_pid < 0) return infop->si_pid; return 0; -# else - __set_errno(ENOSYS); - return -1; -# endif +#endif } +CANCELLABLE_SYSCALL(int, waitid, (idtype_t idtype, id_t id, siginfo_t *infop, int options), + (idtype, id, infop, options)) + #endif -- 1.7.3.4 From ps.m at gmx.net Wed Apr 20 10:50:38 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Wed, 20 Apr 2011 12:50:38 +0200 Subject: [git commit future] ptfork.c: use strong_alias for vfork Message-ID: <20110421232846.E980D8216E@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=952c7844986a8da8545144ef7629de75ea36d032 branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/future Signed-off-by: Peter S. Mazinger --- libpthread/linuxthreads.old/ptfork.c | 6 +----- 1 files changed, 1 insertions(+), 5 deletions(-) diff --git a/libpthread/linuxthreads.old/ptfork.c b/libpthread/linuxthreads.old/ptfork.c index 98c63fe..6f1e2d3 100644 --- a/libpthread/linuxthreads.old/ptfork.c +++ b/libpthread/linuxthreads.old/ptfork.c @@ -148,11 +148,7 @@ static pid_t __fork(void) return pid; } strong_alias(__fork,fork) - -pid_t vfork(void) -{ - return __fork(); -} +strong_alias(__fork,vfork) #else -- 1.7.3.4 From ps.m at gmx.net Wed Apr 20 10:50:38 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Wed, 20 Apr 2011 12:50:38 +0200 Subject: [git commit future] fcntl.h: add missing prototypes for __open[2]_nocancel Message-ID: <20110421232847.64B1C8216E@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=2d6853e2c04c4c61323941d6bf8186c5706d4885 branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/future Signed-off-by: Peter S. Mazinger --- include/fcntl.h | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-) diff --git a/include/fcntl.h b/include/fcntl.h index e4a00cf..38b28bb 100644 --- a/include/fcntl.h +++ b/include/fcntl.h @@ -102,7 +102,11 @@ libc_hidden_proto(fcntl64) __THROW. */ #ifndef __USE_FILE_OFFSET64 extern int open (__const char *__file, int __oflag, ...) __nonnull ((1)); +# ifdef _LIBC +extern int __open2_nocancel(const char *, int) __nonnull ((1)) attribute_hidden; +extern int __open_nocancel(const char *, int, mode_t) __nonnull ((1)) attribute_hidden; libc_hidden_proto(open) +# endif #else # ifdef __REDIRECT extern int __REDIRECT (open, (__const char *__file, int __oflag, ...), open64) -- 1.7.3.4 From ps.m at gmx.net Wed Apr 20 10:50:38 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Wed, 20 Apr 2011 12:50:38 +0200 Subject: [git commit future] mount.c: whitespace only Message-ID: <20110421232841.B51E48216E@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=c5ab0f76573cc83a9eea1f19baf9ce1375a7b5ed branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/future Signed-off-by: Peter S. Mazinger --- libc/sysdeps/linux/common/mount.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/libc/sysdeps/linux/common/mount.c b/libc/sysdeps/linux/common/mount.c index 39e5db1..e2c344c 100644 --- a/libc/sysdeps/linux/common/mount.c +++ b/libc/sysdeps/linux/common/mount.c @@ -10,5 +10,5 @@ #include #include _syscall5(int, mount, const char *, specialfile, const char *, dir, - const char *, filesystemtype, unsigned long, rwflag, - const void *, data) + const char *, filesystemtype, unsigned long, rwflag, + const void *, data) -- 1.7.3.4 From ps.m at gmx.net Wed Apr 20 10:50:38 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Wed, 20 Apr 2011 12:50:38 +0200 Subject: [git commit future] wait.c: use cancel.h Message-ID: <20110421232847.83FD58216E@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=934358883f680f6991747cdda0dad165e986ac2d branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/future Use __wait4_nocancel, since wait4 is not available all the time Signed-off-by: Peter S. Mazinger --- libc/sysdeps/linux/common/wait.c | 38 ++++---------------------------------- 1 files changed, 4 insertions(+), 34 deletions(-) diff --git a/libc/sysdeps/linux/common/wait.c b/libc/sysdeps/linux/common/wait.c index 9b529eb..df40058 100644 --- a/libc/sysdeps/linux/common/wait.c +++ b/libc/sysdeps/linux/common/wait.c @@ -4,41 +4,11 @@ * * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. */ -#include -#include -#include #include -#include +#include -extern __typeof(wait) __libc_wait; -/* Wait for a child to die. When one does, put its status in *STAT_LOC - * and return its process ID. For errors, return (pid_t) -1. */ -#ifdef __UCLIBC_HAS_THREADS_NATIVE__ -#include -#include - -pid_t attribute_hidden -__libc_wait (__WAIT_STATUS_DEFN stat_loc) -{ - if (SINGLE_THREAD_P) - return INLINE_SYSCALL (wait4, 4, WAIT_ANY, stat_loc, 0, - (struct rusage *) NULL); - - int oldtype = LIBC_CANCEL_ASYNC (); - - pid_t result = INLINE_SYSCALL (wait4, 4, WAIT_ANY, stat_loc, 0, - (struct rusage *) NULL); - - LIBC_CANCEL_RESET (oldtype); - - return result; -} -#else -/* Wait for a child to die. When one does, put its status in *STAT_LOC - * and return its process ID. For errors, return (pid_t) -1. */ -__pid_t __libc_wait (__WAIT_STATUS_DEFN stat_loc) +static pid_t __NC(wait)(__WAIT_STATUS_DEFN stat_loc) { - return wait4 (WAIT_ANY, stat_loc, 0, (struct rusage *) NULL); + return __wait4_nocancel(WAIT_ANY, stat_loc, 0, (struct rusage *)NULL); } -#endif -weak_alias(__libc_wait,wait) +CANCELLABLE_SYSCALL(pid_t, wait, (__WAIT_STATUS_DEFN stat_loc), (stat_loc)) -- 1.7.3.4 From ps.m at gmx.net Wed Apr 20 10:50:38 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Wed, 20 Apr 2011 12:50:38 +0200 Subject: [git commit future] nanosleep.c: use cancel.h Message-ID: <20110421232847.AA6908216E@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=a7dd5fc09e47b244bdd5a8245857c5ea2853e158 branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/future Signed-off-by: Peter S. Mazinger --- libc/sysdeps/linux/common/nanosleep.c | 33 +++++++-------------------------- 1 files changed, 7 insertions(+), 26 deletions(-) diff --git a/libc/sysdeps/linux/common/nanosleep.c b/libc/sysdeps/linux/common/nanosleep.c index 1e692bb..dd3f4dd 100644 --- a/libc/sysdeps/linux/common/nanosleep.c +++ b/libc/sysdeps/linux/common/nanosleep.c @@ -9,32 +9,13 @@ #include #include +#include -#ifdef __UCLIBC_HAS_THREADS_NATIVE__ -#include -#include -#else -#define SINGLE_THREAD_P 1 -#endif - -#define __NR___syscall_nanosleep __NR_nanosleep -static _syscall2(int, __syscall_nanosleep, const struct timespec *, req, +#define __NR___nanosleep_nocancel __NR_nanosleep +static _syscall2(int, __NC(nanosleep), const struct timespec *, req, struct timespec *, rem); -extern __typeof(nanosleep) __libc_nanosleep; - -int __libc_nanosleep(const struct timespec *req, struct timespec *rem) -{ - if (SINGLE_THREAD_P) - return __syscall_nanosleep(req, rem); - -#ifdef __UCLIBC_HAS_THREADS_NATIVE__ - int oldtype = LIBC_CANCEL_ASYNC (); - int result = __syscall_nanosleep(req, rem); - LIBC_CANCEL_RESET (oldtype); - return result; -#endif -} - -weak_alias(__libc_nanosleep,nanosleep) -libc_hidden_weak(nanosleep) +CANCELLABLE_SYSCALL(int, nanosleep, + (const struct timespec *req, struct timespec *rem), + (req, rem)) +lt_libc_hidden(nanosleep) -- 1.7.3.4 From ps.m at gmx.net Wed Apr 20 10:50:38 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Wed, 20 Apr 2011 12:50:38 +0200 Subject: [git commit future] ioctl.c: use cancel.h Message-ID: <20110421232847.CBE4D8216E@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=d010303dba49b16336eb2cfde413daf77ef7816a branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/future Guard changed from NPTL to __NEW_THREADS to cover LT new as well. Signed-off-by: Peter S. Mazinger --- libc/sysdeps/linux/common/ioctl.c | 16 ++++------------ 1 files changed, 4 insertions(+), 12 deletions(-) diff --git a/libc/sysdeps/linux/common/ioctl.c b/libc/sysdeps/linux/common/ioctl.c index f2f0f53..9a00e61 100644 --- a/libc/sysdeps/linux/common/ioctl.c +++ b/libc/sysdeps/linux/common/ioctl.c @@ -10,14 +10,7 @@ #include #include #include - -#ifdef __UCLIBC_HAS_THREADS_NATIVE__ -#include -#else -#define SINGLE_THREAD_P 1 -#endif - -libc_hidden_proto(ioctl) +#include #define __NR___syscall_ioctl __NR_ioctl static __always_inline @@ -30,17 +23,16 @@ int ioctl(int fd, unsigned long int request, ...) va_start(list, request); arg = va_arg(list, void *); - va_end(list); if (SINGLE_THREAD_P) return __syscall_ioctl(fd, request, arg); - -#ifdef __UCLIBC_HAS_THREADS_NATIVE__ +#ifdef __NEW_THREADS int oldtype = LIBC_CANCEL_ASYNC (); int result = __syscall_ioctl(fd, request, arg); LIBC_CANCEL_RESET (oldtype); return result; #endif } -libc_hidden_def(ioctl) +lt_strong_alias(ioctl) +lt_libc_hidden(ioctl) -- 1.7.3.4 From ps.m at gmx.net Wed Apr 20 10:50:38 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Wed, 20 Apr 2011 12:50:38 +0200 Subject: [git commit future] pselect.c: avoid handling cancellation twice Message-ID: <20110421232847.EBD338216E@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=dee37bd5b9189c8bcfdbe60ddc6668c3bce8e3b3 branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/future Use __select_nocancel instead of select Signed-off-by: Peter S. Mazinger --- libc/sysdeps/linux/common/pselect.c | 107 +++++++++++++---------------------- 1 files changed, 39 insertions(+), 68 deletions(-) diff --git a/libc/sysdeps/linux/common/pselect.c b/libc/sysdeps/linux/common/pselect.c index 7e93537..d89b7b4 100644 --- a/libc/sysdeps/linux/common/pselect.c +++ b/libc/sysdeps/linux/common/pselect.c @@ -17,78 +17,49 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -#include -#include -#include /* For NULL. */ -#include -#include -#ifdef __UCLIBC_HAS_THREADS_NATIVE__ -#include -#endif +#include -libc_hidden_proto(sigprocmask) -libc_hidden_proto(select) +#ifdef __USE_XOPEN2K +#include +#include +#include +#include -/* Check the first NFDS descriptors each in READFDS (if not NULL) for read - readiness, in WRITEFDS (if not NULL) for write readiness, and in EXCEPTFDS - (if not NULL) for exceptional conditions. If TIMEOUT is not NULL, time out - after waiting the interval specified therein. Additionally set the sigmask - SIGMASK for this call. Returns the number of ready descriptors, or -1 for - errors. */ -#ifdef __UCLIBC_HAS_THREADS_NATIVE__ -static int -__pselect (int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, -#else -int -pselect (int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, -#endif - const struct timespec *timeout, const sigset_t *sigmask) +static int __NC(pselect)(int nfds, fd_set *readfds, fd_set *writefds, + fd_set *exceptfds, const struct timespec *timeout, + const sigset_t *sigmask) { - struct timeval tval; - int retval; - sigset_t savemask; - - /* Change nanosecond number to microseconds. This might mean losing - precision and therefore the `pselect` should be available. But - for now it is hardly found. */ - if (timeout != NULL) - TIMESPEC_TO_TIMEVAL (&tval, timeout); - - /* The setting and restoring of the signal mask and the select call - should be an atomic operation. This can't be done without kernel - help. */ - if (sigmask != NULL) - sigprocmask (SIG_SETMASK, sigmask, &savemask); - - /* Note the pselect() is a cancellation point. But since we call - select() which itself is a cancellation point we do not have - to do anything here. */ - retval = select (nfds, readfds, writefds, exceptfds, - timeout != NULL ? &tval : NULL); - - if (sigmask != NULL) - sigprocmask (SIG_SETMASK, &savemask, NULL); - - return retval; + struct timeval tval; + int retval; + sigset_t savemask; + + /* Change nanosecond number to microseconds. This might mean losing + precision and therefore the `pselect` should be available. But + for now it is hardly found. */ + if (timeout != NULL) + TIMESPEC_TO_TIMEVAL (&tval, timeout); + + /* The setting and restoring of the signal mask and the select call + should be an atomic operation. This can't be done without kernel + help. */ + if (sigmask != NULL) + sigprocmask (SIG_SETMASK, sigmask, &savemask); + + /* The comment below does not apply on uClibc, since we use __select_nocancel */ + /* Note the pselect() is a cancellation point. But since we call + select() which itself is a cancellation point we do not have + to do anything here. */ + retval = __NC(select)(nfds, readfds, writefds, exceptfds, + timeout != NULL ? &tval : NULL); + + if (sigmask != NULL) + sigprocmask (SIG_SETMASK, &savemask, NULL); + + return retval; } +CANCELLABLE_SYSCALL(int, pselect, (int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, + const struct timespec *timeout, const sigset_t *sigmask), + (nfds, readfds, writefds, exceptfds, timeout, sigmask)) -#ifdef __UCLIBC_HAS_THREADS_NATIVE__ -int -pselect (int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, - const struct timespec *timeout, const sigset_t *sigmask) -{ - if (SINGLE_THREAD_P) - return __pselect (nfds, readfds, writefds, exceptfds, - timeout, sigmask); - - int oldtype = LIBC_CANCEL_ASYNC (); - - int result = __pselect (nfds, readfds, writefds, exceptfds, - timeout, sigmask); - - LIBC_CANCEL_RESET (oldtype); - - return result; -} #endif -- 1.7.3.4 From ps.m at gmx.net Wed Apr 20 10:50:38 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Wed, 20 Apr 2011 12:50:38 +0200 Subject: [git commit future] lseek, lseek64: add cancellation for all THREADS Message-ID: <20110421232848.3BC608216E@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=fba47965cff1ab2a104a7ec7379162dd6c47f812 branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/future LT_OLD provides cancellable versions, do it for all THREADS. llseek.c: use newly added macros for offset handling. Add a comment about endianness issue around offset. Compile llseek.c only on 32bit archs. Provide aliases for 64bit archs or if syscall is not available. Signed-off-by: Peter S. Mazinger --- libc/sysdeps/linux/common/llseek.c | 27 +++++++++++---------------- libc/sysdeps/linux/common/lseek.c | 22 +++++++++------------- 2 files changed, 20 insertions(+), 29 deletions(-) diff --git a/libc/sysdeps/linux/common/llseek.c b/libc/sysdeps/linux/common/llseek.c index d04a5ec..c46fcee 100644 --- a/libc/sysdeps/linux/common/llseek.c +++ b/libc/sysdeps/linux/common/llseek.c @@ -8,25 +8,20 @@ */ #include <_lfs_64.h> -#include #include +#include -#ifdef __NR__llseek -off64_t lseek64(int fd, off64_t offset, int whence) +#if defined __NR__llseek && __WORDSIZE == 32 +# include +# include +# include +static off64_t __NC(lseek64)(int fd, off64_t offset, int whence) { off64_t result; - return (off64_t)INLINE_SYSCALL(_llseek, 5, fd, (off_t) (offset >> 32), - (off_t) (offset & 0xffffffff), &result, whence) ?: result; + /* do we not need to handle the offset with __LONG_LONG_PAIR depending on endianness? */ + return (off64_t)INLINE_SYSCALL(_llseek, 5, fd, (off_t) OFF64_HI(offset), + (off_t) OFF64_LO(offset), &result, whence) ?: result; } -#else -off64_t lseek64(int fd, off64_t offset, int whence) -{ - return (off64_t)lseek(fd, (off_t) (offset), whence); -} -#endif -#ifndef __LINUXTHREADS_OLD__ -libc_hidden_def(lseek64) -#else -libc_hidden_weak(lseek64) -strong_alias(lseek64,__libc_lseek64) +CANCELLABLE_SYSCALL(off64_t, lseek64, (int fd, off64_t offset, int whence), (fd, offset, whence)) +lt_libc_hidden(lseek64) #endif diff --git a/libc/sysdeps/linux/common/lseek.c b/libc/sysdeps/linux/common/lseek.c index 1ed956e..2896e0f 100644 --- a/libc/sysdeps/linux/common/lseek.c +++ b/libc/sysdeps/linux/common/lseek.c @@ -9,19 +9,15 @@ #include #include +#include #ifdef __NR_lseek -_syscall3(__off_t, lseek, int, fildes, __off_t, offset, int, whence) -#elif defined __UCLIBC_HAS_LFS__ && defined __NR__llseek /* avoid circular dependency */ -__off_t lseek(int fildes, __off_t offset, int whence) -{ - return lseek64(fildes, offset, whence); -} +static _syscall3(off_t, __NC(lseek), int, fd, off_t, offset, int, whence) #else # include -__off_t lseek(int fildes, __off_t offset attribute_unused, int whence) +static off_t __NC(lseek)(int fd, off_t offset attribute_unused, int whence) { - if (fildes < 0) { + if (fd < 0) { __set_errno(EBADF); return -1; } @@ -40,9 +36,9 @@ __off_t lseek(int fildes, __off_t offset attribute_unused, int whence) return -1; } #endif -#ifndef __LINUXTHREADS_OLD__ -libc_hidden_def(lseek) -#else -libc_hidden_weak(lseek) -strong_alias(lseek,__libc_lseek) +CANCELLABLE_SYSCALL(off_t, lseek, (int fd, off_t offset, int whence), (fd, offset, whence)) +lt_libc_hidden(lseek) +#if defined __UCLIBC_HAS_LFS__ && (__WORDSIZE == 64 || !defined __NR__llseek) +strong_alias_untyped(lseek,lseek64) +lt_libc_hidden(lseek64) #endif -- 1.7.3.4 From ps.m at gmx.net Wed Apr 20 10:50:38 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Wed, 20 Apr 2011 12:50:38 +0200 Subject: [git commit future] poll, ppoll: use cancel.h Message-ID: <20110421232848.7AC1F8216E@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=cc788e790e858c7a0f47704de022e1d4e037d136 branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/future use __SYSCALL_SIGSET_T_SIZE use non-cancellable select in fallback Signed-off-by: Peter S. Mazinger --- libc/sysdeps/linux/common/poll.c | 36 ++++++++++------------------------ libc/sysdeps/linux/common/ppoll.c | 38 +++++++++++++++--------------------- 2 files changed, 27 insertions(+), 47 deletions(-) diff --git a/libc/sysdeps/linux/common/poll.c b/libc/sysdeps/linux/common/poll.c index 92c90da..891d2fb 100644 --- a/libc/sysdeps/linux/common/poll.c +++ b/libc/sysdeps/linux/common/poll.c @@ -20,31 +20,14 @@ #include #include #include - -#ifdef __UCLIBC_HAS_THREADS_NATIVE__ -#include -#else -#define SINGLE_THREAD_P 1 -#endif +#include #if defined __ASSUME_POLL_SYSCALL && defined __NR_poll -#define __NR___syscall_poll __NR_poll -static _syscall3(int, __syscall_poll, struct pollfd *, fds, - unsigned long int, nfds, int, timeout); +#define __NR___poll_nocancel __NR_poll +static _syscall3(int, __NC(poll), struct pollfd *, fds, + unsigned long int, nfds, int, timeout) -int poll(struct pollfd *fds, nfds_t nfds, int timeout) -{ - if (SINGLE_THREAD_P) - return __syscall_poll(fds, nfds, timeout); - -#ifdef __UCLIBC_HAS_THREADS_NATIVE__ - int oldtype = LIBC_CANCEL_ASYNC (); - int result = __syscall_poll(fds, nfds, timeout); - LIBC_CANCEL_RESET (oldtype); - return result; -#endif -} #else /* !__NR_poll */ #include @@ -54,6 +37,7 @@ int poll(struct pollfd *fds, nfds_t nfds, int timeout) #include #include #include +#include /* uClinux 2.0 doesn't have poll, emulate it using select */ @@ -63,7 +47,7 @@ int poll(struct pollfd *fds, nfds_t nfds, int timeout) Returns the number of file descriptors with events, zero if timed out, or -1 for errors. */ -int poll(struct pollfd *fds, nfds_t nfds, int timeout) +int __NC(poll)(struct pollfd *fds, nfds_t nfds, int timeout) { static int max_fd_size; struct timeval tv; @@ -134,7 +118,7 @@ int poll(struct pollfd *fds, nfds_t nfds, int timeout) while (1) { - ready = select (maxfd + 1, rset, wset, xset, + ready = __NC(select) (maxfd + 1, rset, wset, xset, timeout == -1 ? NULL : &tv); /* It might be that one or more of the file descriptors is invalid. @@ -177,7 +161,7 @@ int poll(struct pollfd *fds, nfds_t nfds, int timeout) if (f->events & POLLPRI) FD_SET (f->fd, sngl_xset); - n = select (f->fd + 1, sngl_rset, sngl_wset, sngl_xset, + n = __NC(select) (f->fd + 1, sngl_rset, sngl_wset, sngl_xset, &sngl_tv); if (n != -1) { @@ -222,4 +206,6 @@ int poll(struct pollfd *fds, nfds_t nfds, int timeout) } #endif -libc_hidden_def(poll) +CANCELLABLE_SYSCALL(int, poll, (struct pollfd *fds, nfds_t nfds, int timeout), + (fds, nfds, timeout)) +lt_libc_hidden(poll) diff --git a/libc/sysdeps/linux/common/ppoll.c b/libc/sysdeps/linux/common/ppoll.c index 3ca3f73..9135fe5 100644 --- a/libc/sysdeps/linux/common/ppoll.c +++ b/libc/sysdeps/linux/common/ppoll.c @@ -20,19 +20,16 @@ #include #if defined __NR_ppoll && defined __UCLIBC_LINUX_SPECIFIC__ && defined __USE_GNU -# define __need_NULL -# include -# include -# include -# ifdef __UCLIBC_HAS_THREADS_NATIVE__ -# include -# else -# define SINGLE_THREAD_P 1 -# endif - -int -ppoll(struct pollfd *fds, nfds_t nfds, const struct timespec *timeout, - const sigset_t *sigmask) + +#define __need_NULL +#include +#include +#include +#include + +static int +__NC(ppoll)(struct pollfd *fds, nfds_t nfds, const struct timespec *timeout, + const sigset_t *sigmask) { /* The Linux kernel can in some situations update the timeout value. We do not want that so use a local variable. */ @@ -41,14 +38,11 @@ ppoll(struct pollfd *fds, nfds_t nfds, const struct timespec *timeout, tval = *timeout; timeout = &tval; } - if (SINGLE_THREAD_P) - return INLINE_SYSCALL(ppoll, 5, fds, nfds, timeout, sigmask, _NSIG / 8); - -# ifdef __UCLIBC_HAS_THREADS_NATIVE__ - int oldtype = LIBC_CANCEL_ASYNC (); - int result = INLINE_SYSCALL(ppoll, 5, fds, nfds, timeout, sigmask, _NSIG / 8); - LIBC_CANCEL_RESET (oldtype); - return result; -# endif + return INLINE_SYSCALL(ppoll, 5, fds, nfds, timeout, sigmask, __SYSCALL_SIGSET_T_SIZE); } + +CANCELLABLE_SYSCALL(int, ppoll, (struct pollfd *fds, nfds_t nfds, const struct timespec *timeout, + const sigset_t *sigmask), + (fds, nfds, timeout, sigmask)) + #endif -- 1.7.3.4 From ps.m at gmx.net Wed Apr 20 10:50:38 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Wed, 20 Apr 2011 12:50:38 +0200 Subject: [git commit future] fork: do not add fork() to libpthread Message-ID: <20110421232848.D24CC8216E@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=d7449031a6b0fcd81e9ddbcbd75aaffc8bab93ad branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/future No need for __libc_fork either. Signed-off-by: Peter S. Mazinger --- libpthread/nptl/sysdeps/unix/sysv/linux/fork.c | 5 ++--- libpthread/nptl/sysdeps/unix/sysv/linux/pt-fork.c | 2 ++ 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/fork.c b/libpthread/nptl/sysdeps/unix/sysv/linux/fork.c index ab4a6e6..d4eaf77 100644 --- a/libpthread/nptl/sysdeps/unix/sysv/linux/fork.c +++ b/libpthread/nptl/sysdeps/unix/sysv/linux/fork.c @@ -59,7 +59,7 @@ fresetlockfiles (void) } pid_t -__libc_fork (void) +fork (void) { pid_t pid; struct used_handler @@ -222,5 +222,4 @@ __libc_fork (void) return pid; } -weak_alias(__libc_fork,fork) -libc_hidden_weak(fork) +libc_hidden_def(fork) diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/pt-fork.c b/libpthread/nptl/sysdeps/unix/sysv/linux/pt-fork.c index b8a938c..417477e 100644 --- a/libpthread/nptl/sysdeps/unix/sysv/linux/pt-fork.c +++ b/libpthread/nptl/sysdeps/unix/sysv/linux/pt-fork.c @@ -19,9 +19,11 @@ #include +#if 0 static pid_t __fork (void) { return __libc_fork (); } strong_alias (__fork, fork) +#endif -- 1.7.3.4 From ps.m at gmx.net Wed Apr 20 10:50:38 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Wed, 20 Apr 2011 12:50:38 +0200 Subject: [git commit future] cancel.h: add generic file to ease cancellation support Message-ID: <20110421232844.B33068216E@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=27bbb5b9e753a0307586b9cf0d8d8bfa145affdf branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/future Signed-off-by: Peter S. Mazinger Patch is too large, so refusing to show it From ps.m at gmx.net Wed Apr 20 10:50:38 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Wed, 20 Apr 2011 12:50:38 +0200 Subject: [git commit future] rework cancellation for sigwait, sigtimedwait and sigwaitinfo Message-ID: <20110421232848.5BDD18216E@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=0a5dec8ec0aa0be75f7eb6aa0cf208773863e1a7 branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/future sigtimedwait: - provide __sigtimedwait_nocancel - use __SYSCALL_SIGSET_T_SIZE instead of _NSIG / 8 - do not provide __sigtimedwait - guard a section to avoid failure on archs if SI_TKILL/SI_USER are not defined sigwaitinfo: - simply use sigtimedwait since that handles cancellation already sigwait: - use non-cancellable functions (sigtimedwait, sigsuspend) - get rid of code already done in __sigtimedwait_nocancel Signed-off-by: Peter S. Mazinger --- include/signal.h | 3 +- libc/signal/sigwait.c | 91 +++++-------------------- libc/sysdeps/linux/common/__rt_sigtimedwait.c | 75 ++++++++------------- libc/sysdeps/linux/common/__rt_sigwaitinfo.c | 78 ++------------------- 4 files changed, 56 insertions(+), 191 deletions(-) diff --git a/include/signal.h b/include/signal.h index f564d58..8c7b3cd 100644 --- a/include/signal.h +++ b/include/signal.h @@ -371,7 +371,8 @@ extern int sigtimedwait (__const sigset_t *__restrict __set, __const struct timespec *__restrict __timeout) __nonnull ((1)); #ifdef _LIBC -extern __typeof(sigtimedwait) __sigtimedwait attribute_hidden; +extern __typeof(sigtimedwait) __sigtimedwait_nocancel attribute_hidden; +libc_hidden_def(sigtimedwait) #endif /* Send signal SIG to the process PID. Associate data in VAL with the diff --git a/libc/signal/sigwait.c b/libc/signal/sigwait.c index 5e9c427..7d47f99 100644 --- a/libc/signal/sigwait.c +++ b/libc/signal/sigwait.c @@ -21,92 +21,36 @@ #define __need_NULL #include +#include #include +#include -#ifdef __UCLIBC_HAS_THREADS_NATIVE__ -# include +#if defined __NR_rt_sigtimedwait && defined __UCLIBC_HAS_REALTIME__ -# ifdef __NR_rt_sigtimedwait -# include +#include /* Return any pending signal or wait for one for the given time. */ -static int do_sigwait(const sigset_t *set, int *sig) +static int __NC(sigwait)(const sigset_t *set, int *sig) { int ret; -# ifdef SIGCANCEL - sigset_t tmpset; - if (set != NULL - && (__builtin_expect (__sigismember (set, SIGCANCEL), 0) -# ifdef SIGSETXID - || __builtin_expect (__sigismember (set, SIGSETXID), 0) -# endif - )) - { - /* Create a temporary mask without the bit for SIGCANCEL set. */ - // We are not copying more than we have to. - memcpy(&tmpset, set, _NSIG / 8); - __sigdelset(&tmpset, SIGCANCEL); -# ifdef SIGSETXID - __sigdelset(&tmpset, SIGSETXID); -# endif - set = &tmpset; - } -# endif - - /* XXX The size argument hopefully will have to be changed to the - real size of the user-level sigset_t. */ - INTERNAL_SYSCALL_DECL(err); do - ret = INTERNAL_SYSCALL (rt_sigtimedwait, err, 4, set, NULL, - NULL, _NSIG / 8); - while (INTERNAL_SYSCALL_ERROR_P (ret, err) - && INTERNAL_SYSCALL_ERRNO (ret, err) == EINTR); - if (! INTERNAL_SYSCALL_ERROR_P (ret, err)) - { + /* we might as well use sigtimedwait and do not care about cancellation */ + ret = __NC(sigtimedwait)(set, NULL, NULL); + while (ret == -1 && errno == EINTR); + if (ret != -1) { *sig = ret; ret = 0; - } -else - ret = INTERNAL_SYSCALL_ERRNO (ret, err); + } else + ret = errno; return ret; } -int sigwait (const sigset_t *set, int *sig) -{ - if(SINGLE_THREAD_P) - return do_sigwait(set, sig); - - int oldtype = LIBC_CANCEL_ASYNC(); - - int result = do_sigwait(set, sig); - - LIBC_CANCEL_RESET(oldtype); - - return result; -} -# else /* __NR_rt_sigtimedwait */ -# error We must have rt_sigtimedwait defined!!! -# endif -#else /* __UCLIBC_HAS_THREADS_NATIVE__ */ +#else /* __NR_rt_sigtimedwait */ -# if defined __UCLIBC_HAS_REALTIME__ - -int sigwait (const sigset_t *set, int *sig) -{ - int ret = 1; - if ((ret = __sigwaitinfo(set, NULL)) != -1) { - *sig = ret; - return 0; - } - return 1; -} - -# else /* __UCLIBC_HAS_REALTIME__ */ -# include -# include /* smallint */ /* variant without REALTIME extensions */ +#include /* smallint */ static smallint was_sig; /* obviously not thread-safe */ @@ -115,7 +59,7 @@ static void ignore_signal(int sig) was_sig = sig; } -int sigwait (const sigset_t *set, int *sig) +static int __NC(sigwait)(const sigset_t *set, int *sig) { sigset_t tmp_mask; struct sigaction saved[NSIG]; @@ -149,7 +93,7 @@ int sigwait (const sigset_t *set, int *sig) } /* Now we can wait for signals. */ - sigsuspend (&tmp_mask); + __NC(sigsuspend)(&tmp_mask); restore_handler: save_errno = errno; @@ -165,5 +109,6 @@ int sigwait (const sigset_t *set, int *sig) *sig = was_sig; return was_sig == -1 ? -1 : 0; } -# endif /* __UCLIBC_HAS_REALTIME__ */ -#endif /* __UCLIBC_HAS_THREADS_NATIVE__ */ +#endif /* __NR_rt_sigtimedwait */ + +CANCELLABLE_SYSCALL(int, sigwait, (const sigset_t *set, int *sig), (set, sig)) diff --git a/libc/sysdeps/linux/common/__rt_sigtimedwait.c b/libc/sysdeps/linux/common/__rt_sigtimedwait.c index 168e380..962ccb0 100644 --- a/libc/sysdeps/linux/common/__rt_sigtimedwait.c +++ b/libc/sysdeps/linux/common/__rt_sigtimedwait.c @@ -9,41 +9,46 @@ */ #include -#include -#include #ifdef __NR_rt_sigtimedwait +# include +# include +# ifdef SIGCANCEL /* defined only in NPTL's pthreadP.h */ +# define __need_NULL +# include +# include +# endif -# ifdef __UCLIBC_HAS_THREADS_NATIVE__ -# include - -static int do_sigtimedwait(const sigset_t *set, siginfo_t *info, - const struct timespec *timeout) +int __NC(sigtimedwait)(const sigset_t *set, siginfo_t *info, + const struct timespec *timeout) { -# ifdef SIGCANCEL +# ifdef SIGCANCEL sigset_t tmpset; if (set != NULL && (__builtin_expect (__sigismember (set, SIGCANCEL), 0) -# ifdef SIGSETXID +# ifdef SIGSETXID || __builtin_expect (__sigismember (set, SIGSETXID), 0) -# endif +# endif )) { /* Create a temporary mask without the bit for SIGCANCEL set. */ // We are not copying more than we have to. memcpy (&tmpset, set, _NSIG / 8); __sigdelset (&tmpset, SIGCANCEL); -# ifdef SIGSETXID +# ifdef SIGSETXID __sigdelset (&tmpset, SIGSETXID); -# endif +# endif set = &tmpset; } -# endif +# endif +/* if this is enabled, enable the disabled section in sigwait.c */ +# if defined SI_TKILL && defined SI_USER /* XXX The size argument hopefully will have to be changed to the real size of the user-level sigset_t. */ - int result = INLINE_SYSCALL (rt_sigtimedwait, 4, set, info, - timeout, _NSIG / 8); + /* on uClibc we use the kernel sigset_t size */ + int result = INLINE_SYSCALL(rt_sigtimedwait, 4, set, info, + timeout, __SYSCALL_SIGSET_T_SIZE); /* The kernel generates a SI_TKILL code in si_code in case tkill is used. tkill is transparently used in raise(). Since having @@ -53,38 +58,14 @@ static int do_sigtimedwait(const sigset_t *set, siginfo_t *info, info->si_code = SI_USER; return result; -} - -/* Return any pending signal or wait for one for the given time. */ -int __sigtimedwait(const sigset_t *set, siginfo_t *info, - const struct timespec *timeout) -{ - if(SINGLE_THREAD_P) - return do_sigtimedwait(set, info, timeout); - - int oldtype = LIBC_CANCEL_ASYNC(); - - /* XXX The size argument hopefully will have to be changed to the - real size of the user-level sigset_t. */ - int result = do_sigtimedwait(set, info, timeout); - - LIBC_CANCEL_RESET(oldtype); - - return result; -} # else -# define __need_NULL -# include -# define __NR___rt_sigtimedwait __NR_rt_sigtimedwait -static _syscall4(int, __rt_sigtimedwait, const sigset_t *, set, - siginfo_t *, info, const struct timespec *, timeout, - size_t, setsize); - -int __sigtimedwait(const sigset_t * set, siginfo_t * info, - const struct timespec *timeout) -{ - return __rt_sigtimedwait(set, info, timeout, _NSIG / 8); + /* on uClibc we use the kernel sigset_t size */ + return INLINE_SYSCALL(rt_sigtimedwait, 4, set, info, + timeout, __SYSCALL_SIGSET_T_SIZE); +# endif } -# endif /* !__UCLIBC_HAS_THREADS_NATIVE__ */ -weak_alias(__sigtimedwait,sigtimedwait) +CANCELLABLE_SYSCALL(int, sigtimedwait, + (const sigset_t *set, siginfo_t *info, const struct timespec *timeout), + (set, info, timeout)) +lt_libc_hidden(sigtimedwait) #endif diff --git a/libc/sysdeps/linux/common/__rt_sigwaitinfo.c b/libc/sysdeps/linux/common/__rt_sigwaitinfo.c index 74db6d6..ad1a7a8 100644 --- a/libc/sysdeps/linux/common/__rt_sigwaitinfo.c +++ b/libc/sysdeps/linux/common/__rt_sigwaitinfo.c @@ -9,79 +9,17 @@ */ #include -#include -#include #ifdef __NR_rt_sigtimedwait +# define __need_NULL +# include +# include +# include -# ifdef __UCLIBC_HAS_THREADS_NATIVE__ -# include - -static int do_sigwaitinfo(const sigset_t *set, siginfo_t *info) -{ -# ifdef SIGCANCEL - sigset_t tmpset; - - if (set != NULL && (__builtin_expect (__sigismember (set, SIGCANCEL), 0) -# ifdef SIGSETXID - || __builtin_expect (__sigismember (set, SIGSETXID), 0) -# endif - )) - { - /* Create a temporary mask without the bit for SIGCANCEL set. */ - // We are not copying more than we have to. - memcpy (&tmpset, set, _NSIG / 8); - __sigdelset (&tmpset, SIGCANCEL); -# ifdef SIGSETXID - __sigdelset (&tmpset, SIGSETXID); -# endif - set = &tmpset; - } -# endif - - /* XXX The size argument hopefully will have to be changed to the - real size of the user-level sigset_t. */ - int result = INLINE_SYSCALL (rt_sigtimedwait, 4, set, info, - NULL, _NSIG / 8); - - /* The kernel generates a SI_TKILL code in si_code in case tkill is - used. tkill is transparently used in raise(). Since having - SI_TKILL as a code is useful in general we fold the results - here. */ - if (result != -1 && info != NULL && info->si_code == SI_TKILL) - info->si_code = SI_USER; - - return result; -} - -/* Return any pending signal or wait for one for the given time. */ -int __sigwaitinfo(const sigset_t *set, siginfo_t *info) -{ - if(SINGLE_THREAD_P) - return do_sigwaitinfo(set, info); - - int oldtype = LIBC_CANCEL_ASYNC(); - - /* XXX The size argument hopefully will have to be changed to the - real size of the user-level sigset_t. */ - int result = do_sigwaitinfo(set, info); - - LIBC_CANCEL_RESET(oldtype); - - return result; -} -# else -# define __need_NULL -# include -# define __NR___rt_sigwaitinfo __NR_rt_sigtimedwait -static _syscall4(int, __rt_sigwaitinfo, const sigset_t *, set, - siginfo_t *, info, const struct timespec *, timeout, - size_t, setsize); - -int __sigwaitinfo(const sigset_t * set, siginfo_t * info) +int sigwaitinfo(const sigset_t *set, siginfo_t *info) { - return __rt_sigwaitinfo(set, info, NULL, _NSIG / 8); + return sigtimedwait(set, info, NULL); } -# endif -weak_alias (__sigwaitinfo, sigwaitinfo) +/* cancellation handled by sigtimedwait, noop on uClibc */ +LIBC_CANCEL_HANDLED(); #endif -- 1.7.3.4 From ps.m at gmx.net Wed Apr 20 10:50:38 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Wed, 20 Apr 2011 12:50:38 +0200 Subject: [git commit future] lseek[64]: provide hidden __lseek[64]_nocancel needed later Message-ID: <20110421232849.3AB7B8216E@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=7ccf73675edfd3e4f7d7afd269393247dac79754 branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/future Signed-off-by: Peter S. Mazinger --- include/unistd.h | 6 ++++++ libc/sysdeps/linux/common/llseek.c | 2 +- libc/sysdeps/linux/common/lseek.c | 5 +++-- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/include/unistd.h b/include/unistd.h index e646e04..432ba6b 100644 --- a/include/unistd.h +++ b/include/unistd.h @@ -333,7 +333,10 @@ extern int faccessat (int __fd, __const char *__file, int __type, int __flag) Return the new file position. */ #ifndef __USE_FILE_OFFSET64 extern __off_t lseek (int __fd, __off_t __offset, int __whence) __THROW; +# ifdef _LIBC +extern __typeof(lseek) __lseek_nocancel attribute_hidden; libc_hidden_proto(lseek) +# endif #else # ifdef __REDIRECT_NTH extern __off64_t __REDIRECT_NTH (lseek, @@ -346,7 +349,10 @@ extern __off64_t __REDIRECT_NTH (lseek, #ifdef __USE_LARGEFILE64 extern __off64_t lseek64 (int __fd, __off64_t __offset, int __whence) __THROW; +# ifdef _LIBC +extern __typeof(lseek64) __lseek64_nocancel attribute_hidden; libc_hidden_proto(lseek64) +# endif #endif /* Close the file descriptor FD. diff --git a/libc/sysdeps/linux/common/llseek.c b/libc/sysdeps/linux/common/llseek.c index c46fcee..55221d8 100644 --- a/libc/sysdeps/linux/common/llseek.c +++ b/libc/sysdeps/linux/common/llseek.c @@ -15,7 +15,7 @@ # include # include # include -static off64_t __NC(lseek64)(int fd, off64_t offset, int whence) +off64_t __NC(lseek64)(int fd, off64_t offset, int whence) { off64_t result; /* do we not need to handle the offset with __LONG_LONG_PAIR depending on endianness? */ diff --git a/libc/sysdeps/linux/common/lseek.c b/libc/sysdeps/linux/common/lseek.c index 2896e0f..ce769d3 100644 --- a/libc/sysdeps/linux/common/lseek.c +++ b/libc/sysdeps/linux/common/lseek.c @@ -12,10 +12,10 @@ #include #ifdef __NR_lseek -static _syscall3(off_t, __NC(lseek), int, fd, off_t, offset, int, whence) +_syscall3(off_t, __NC(lseek), int, fd, off_t, offset, int, whence) #else # include -static off_t __NC(lseek)(int fd, off_t offset attribute_unused, int whence) +off_t __NC(lseek)(int fd, off_t offset attribute_unused, int whence) { if (fd < 0) { __set_errno(EBADF); @@ -39,6 +39,7 @@ static off_t __NC(lseek)(int fd, off_t offset attribute_unused, int whence) CANCELLABLE_SYSCALL(off_t, lseek, (int fd, off_t offset, int whence), (fd, offset, whence)) lt_libc_hidden(lseek) #if defined __UCLIBC_HAS_LFS__ && (__WORDSIZE == 64 || !defined __NR__llseek) +strong_alias_untyped(__NC(lseek),__NC(lseek64)) strong_alias_untyped(lseek,lseek64) lt_libc_hidden(lseek64) #endif -- 1.7.3.4 From ps.m at gmx.net Wed Apr 20 10:50:38 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Wed, 20 Apr 2011 12:50:38 +0200 Subject: [git commit future] enable the common code for NPTL Message-ID: <20110421232849.0AE218216E@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=7a1aedf980b970f9d9bad81341578bfd68926f01 branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/future the generic open, close, waitpid, read, write are good for NPTL too no good reason to have the same sleep in both libc and libpthread (NPTL) no good reason to add sigwaitinfo, sigtimedwait and sigwait to libpthread (NPTL) Signed-off-by: Peter S. Mazinger --- libc/sysdeps/linux/common/Makefile.in | 8 +++--- libc/unistd/Makefile.in | 6 ++-- .../sysdeps/unix/sysv/linux/Makefile.commonarch | 29 ++++++++++--------- 3 files changed, 22 insertions(+), 21 deletions(-) diff --git a/libc/sysdeps/linux/common/Makefile.in b/libc/sysdeps/linux/common/Makefile.in index da2bad1..8cbffc2 100644 --- a/libc/sysdeps/linux/common/Makefile.in +++ b/libc/sysdeps/linux/common/Makefile.in @@ -32,20 +32,20 @@ ifeq ($(UCLIBC_LINUX_SPECIFIC)$(UCLIBC_HAS_THREADS_NATIVE),yy) CSRC-y += madvise.c endif ifeq ($(UCLIBC_HAS_THREADS_NATIVE),y) -CSRC- += fork.c getpid.c raise.c open.c close.c read.c write.c +CSRC- += fork.c getpid.c raise.c #open.c close.c read.c write.c CSRC- += $(if $(findstring =arm=,=$(TARGET_ARCH)=),vfork.c) CSRC- += $(if $(findstring =x86_64=,=$(TARGET_ARCH)=),vfork.c) -CSRC- += $(if $(findstring =mips=y=,=$(TARGET_ARCH)=$(CONFIG_MIPS_O32_ABI)=),waitpid.c) +#CSRC- += $(if $(findstring =mips=y=,=$(TARGET_ARCH)=$(CONFIG_MIPS_O32_ABI)=),waitpid.c) endif # stubbed out in mman.h CSRC-$(ARCH_USE_MMU) += msync.c # we need these internally: getdomainname.c CSRC-$(UCLIBC_BSD_SPECIFIC) += mincore.c setdomainname.c CSRC-$(UCLIBC_NTP_LEGACY) += ntp_gettime.c -# aio_cancel|aio_error|aio_fsync|aio_read|aio_return|aio_suspend|aio_write|clock_getres|clock_gettime|clock_settime|clock_settime|fdatasync|lio_listio|mlockall|munlockall|mlock|munlock|mq_close|mq_getattr|mq_notify|mq_open|mq_receive|mq_timedreceive|mq_send|mq_timedsend|mq_setattr|mq_unlink|nanosleep|sched_getparam|sched_get_priority_max|sched_get_priority_min|sched_getscheduler|sched_rr_get_interval|sched_setparam|sched_setscheduler|sem_close|sem_destroy|sem_getvalue|sem_init|sem_open|sem_post|sem_trywait|sem_wait|sem_unlink|sem_wait|shm_open|shm_unlink|sigqueue|sigtimedwait|sigwaitinfo|sigwaitinfo|timer_create|timer_delete|timer_getoverrun|timer_gettime|timer_settime +# aio_cancel|aio_error|aio_fsync|aio_read|aio_return|aio_suspend|aio_write|clock_getres|clock_gettime|clock_settime|clock_settime|fdatasync|lio_listio|mlockall|munlockall|mlock|munlock|mq_close|mq_getattr|mq_notify|mq_open|mq_receive|mq_timedreceive|mq_send|mq_timedsend|mq_setattr|mq_unlink|nanosleep|sched_getparam|sched_get_priority_max|sched_get_priority_min|sched_getscheduler|sched_rr_get_interval|sched_setparam|sched_setscheduler|sem_close|sem_destroy|sem_getvalue|sem_init|sem_open|sem_post|sem_trywait|sem_wait|sem_unlink|sem_wait|shm_open|shm_unlink|sigqueue|sigtimedwait|sigwaitinfo|timer_create|timer_delete|timer_getoverrun|timer_gettime|timer_settime CSRC-$(UCLIBC_HAS_REALTIME) += clock_getres.c clock_gettime.c clock_settime.c \ fdatasync.c mlockall.c mlock.c munlockall.c munlock.c \ - nanosleep.c __rt_sigtimedwait.c sched_getparam.c \ + nanosleep.c __rt_sigtimedwait.c __rt_sigwaitinfo.c sched_getparam.c \ sched_get_priority_max.c sched_get_priority_min.c sched_getscheduler.c \ sched_rr_get_interval.c sched_setparam.c sched_setscheduler.c sigqueue.c # clock_getcpuclockid|clock_nanosleep|mq_timedreceive|mq_timedsend|posix_fadvise|posix_fallocate|posix_madvise|posix_memalign|posix_mem_offset|posix_spawnattr_destroy|posix_spawnattr_init|posix_spawnattr_getflags|posix_spawnattr_setflags|posix_spawnattr_getpgroup|posix_spawnattr_setpgroup|posix_spawnattr_getschedparam|posix_spawnattr_setschedparam|posix_spawnattr_getschedpolicy|posix_spawnattr_setschedpolicy|posix_spawnattr_getsigdefault|posix_spawnattr_setsigdefault|posix_spawnattr_getsigmask|posix_spawnattr_setsigmask|posix_spawnattr_init|posix_spawnattr_setflags|posix_spawnattr_setpgroup|posix_spawnattr_setschedparam|posix_spawnattr_setschedpolicy|posix_spawnattr_setsigdefault|posix_spawnattr_setsigmask|posix_spawn_file_actions_addclose|posix_spawn_file_actions_addopen|posix_spawn_file_actions_adddup2|posix_spawn_file_actions_addopen|posix_spawn_file_actions_destroy|posix_spawn_file_actions_init|posix_spawn_file_actions_init|posix_spawn|posix_spawnp|posix_spawnp|posix_typ ed_mem_get_info|pthread_mutex_timedlock|sem_timedwait diff --git a/libc/unistd/Makefile.in b/libc/unistd/Makefile.in index 2704177..98edc6a 100644 --- a/libc/unistd/Makefile.in +++ b/libc/unistd/Makefile.in @@ -37,9 +37,9 @@ ifneq ($(UCLIBC_SUSV3_LEGACY),y) CSRC := $(filter-out ualarm.c usleep.c,$(CSRC)) endif -ifeq ($(UCLIBC_HAS_THREADS_NATIVE),y) -CSRC := $(filter-out sleep.c,$(CSRC)) -endif +#ifeq ($(UCLIBC_HAS_THREADS_NATIVE),y) +#CSRC := $(filter-out sleep.c,$(CSRC)) +#endif UNISTD_SRC := $(patsubst %.c,$(UNISTD_DIR)/%.c,$(CSRC)) UNISTD_OBJ := $(patsubst %.c,$(UNISTD_OUT)/%.o,$(CSRC)) diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/Makefile.commonarch b/libpthread/nptl/sysdeps/unix/sysv/linux/Makefile.commonarch index 29e9ea0..ab2990d 100644 --- a/libpthread/nptl/sysdeps/unix/sysv/linux/Makefile.commonarch +++ b/libpthread/nptl/sysdeps/unix/sysv/linux/Makefile.commonarch @@ -62,22 +62,23 @@ libpthread_linux_CSRC += pthread_attr_getaffinity.c pthread_attr_setaffinity.c \ pthread_getcpuclockid.c pthread_kill.c \ pthread_mutex_cond_lock.c pthread_yield.c \ sem_post.c sem_timedwait.c sem_trywait.c sem_wait.c \ - pt-fork.c pt-sleep.c pthread_sigqueue.c \ - sigtimedwait.c sigwaitinfo.c sigwait.c \ + pthread_sigqueue.c \ lowlevellock.c lowlevelrobustlock.c +# pt-sleep.c pt-fork.c sigtimedwait.c sigwaitinfo.c sigwait.c \ libpthread_linux_SSRC := #ptw-close.S ptw-open.S ptw-waitid.S ptw-waidpid.S ptw-write.S libc_linux_CSRC += libc_pthread_init.c libc_multiple_threads.c \ register-atfork.c unregister-atfork.c getpid.c \ - raise.c sleep.c jmp-unwind.c libc-lowlevellock.c + raise.c jmp-unwind.c libc-lowlevellock.c + #sleep.c librt_linux_CSRC += mq_notify.c timer_create.c timer_delete.c \ timer_getoverr.c timer_gettime.c timer_routines.c \ timer_settime.c # These provide both a cancellable and a not cancellable implementation -libc_linux_SSRC = close.S open.S write.S read.S waitpid.S +libc_linux_SSRC = #close.S open.S write.S read.S waitpid.S libc_linux_SSRC := $(filter-out $(libc_linux_arch_SSRC-OMIT),$(libc_linux_SSRC)) libpthread_linux_CSRC := $(filter-out $(notdir $(libpthread_linux_arch_OBJS:.o=.c)),$(libpthread_linux_CSRC)) @@ -140,11 +141,11 @@ CFLAGS-OMIT-sleep.c = -DNOT_IN_libc -DIS_IN_libpthread CFLAGS-OMIT-jmp-unwind.c = -DNOT_IN_libc -DIS_IN_libpthread CFLAGS-OMIT-libc-lowlevellock.c = -DNOT_IN_libc -DIS_IN_libpthread -CFLAGS-OMIT-close.S = -DNOT_IN_libc -DIS_IN_libpthread -CFLAGS-OMIT-open.S = -DNOT_IN_libc -DIS_IN_libpthread -CFLAGS-OMIT-read.S = -DNOT_IN_libc -DIS_IN_libpthread -CFLAGS-OMIT-write.S = -DNOT_IN_libc -DIS_IN_libpthread -CFLAGS-OMIT-waitpid.S = -DNOT_IN_libc -DIS_IN_libpthread +#CFLAGS-OMIT-close.S = -DNOT_IN_libc -DIS_IN_libpthread +#CFLAGS-OMIT-open.S = -DNOT_IN_libc -DIS_IN_libpthread +#CFLAGS-OMIT-read.S = -DNOT_IN_libc -DIS_IN_libpthread +#CFLAGS-OMIT-write.S = -DNOT_IN_libc -DIS_IN_libpthread +#CFLAGS-OMIT-waitpid.S = -DNOT_IN_libc -DIS_IN_libpthread CFLAGS-OMIT-mq_notify.c = -DIS_IN_libpthread CFLAGS-OMIT-timer_create.c = -DIS_IN_libpthread @@ -154,11 +155,11 @@ CFLAGS-OMIT-timer_gettime.c = -DIS_IN_libpthread CFLAGS-OMIT-timer_routines.c = -DIS_IN_libpthread CFLAGS-OMIT-timer_settime.c = -DIS_IN_libpthread -ASFLAGS-open.S = -D_LIBC_REENTRANT -ASFLAGS-close.S = -D_LIBC_REENTRANT -ASFLAGS-read.S = -D_LIBC_REENTRANT -ASFLAGS-write.S = -D_LIBC_REENTRANT -ASFLAGS-waitpid.S = -D_LIBC_REENTRANT +#ASFLAGS-open.S = -D_LIBC_REENTRANT +#ASFLAGS-close.S = -D_LIBC_REENTRANT +#ASFLAGS-read.S = -D_LIBC_REENTRANT +#ASFLAGS-write.S = -D_LIBC_REENTRANT +#ASFLAGS-waitpid.S = -D_LIBC_REENTRANT # # Create header files. -- 1.7.3.4 From ps.m at gmx.net Wed Apr 20 10:50:38 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Wed, 20 Apr 2011 12:50:38 +0200 Subject: [git commit future] add cancellation to generic pread_write Message-ID: <20110421232849.73D4282962@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=1ae00a8cd9641e22f2984b90ca83441bd26ff9ca branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/future Prepare the file to be used in all arch specific files Signed-off-by: Peter S. Mazinger --- libc/sysdeps/linux/common/pread_write.c | 169 ++++++++++++++----------------- 1 files changed, 77 insertions(+), 92 deletions(-) diff --git a/libc/sysdeps/linux/common/pread_write.c b/libc/sysdeps/linux/common/pread_write.c index 88e6957..125378f 100644 --- a/libc/sysdeps/linux/common/pread_write.c +++ b/libc/sysdeps/linux/common/pread_write.c @@ -15,69 +15,48 @@ #include #include -#include #include +#include +#include -extern __typeof(pread) __libc_pread; -extern __typeof(pwrite) __libc_pwrite; -#ifdef __UCLIBC_HAS_LFS__ -extern __typeof(pread64) __libc_pread64; -extern __typeof(pwrite64) __libc_pwrite64; +#ifdef __NR_pread64 +# define __NR_pread __NR_pread64 #endif -#include - -#ifdef __NR_pread - -# define __NR___syscall_pread __NR_pread -static __inline__ _syscall5(ssize_t, __syscall_pread, int, fd, void *, buf, - size_t, count, off_t, offset_hi, off_t, offset_lo) - -ssize_t __libc_pread(int fd, void *buf, size_t count, off_t offset) -{ - return __syscall_pread(fd, buf, count, __LONG_LONG_PAIR(offset >> 31, offset)); -} -weak_alias(__libc_pread,pread) - -# ifdef __UCLIBC_HAS_LFS__ -ssize_t __libc_pread64(int fd, void *buf, size_t count, off64_t offset) -{ - uint32_t low = offset & 0xffffffff; - uint32_t high = offset >> 32; - return __syscall_pread(fd, buf, count, __LONG_LONG_PAIR(high, low)); -} -weak_alias(__libc_pread64,pread64) -# endif /* __UCLIBC_HAS_LFS__ */ - -#endif /* __NR_pread */ - -#ifdef __NR_pwrite - -# define __NR___syscall_pwrite __NR_pwrite -static __inline__ _syscall5(ssize_t, __syscall_pwrite, int, fd, const void *, buf, - size_t, count, off_t, offset_hi, off_t, offset_lo) - -ssize_t __libc_pwrite(int fd, const void *buf, size_t count, off_t offset) -{ - return __syscall_pwrite(fd, buf, count, __LONG_LONG_PAIR(offset >> 31, offset)); -} -weak_alias(__libc_pwrite,pwrite) +#ifndef MY_PREAD +# ifdef __NR_pread +# define __NR___syscall_pread __NR_pread +static _syscall5(ssize_t, __syscall_pread, int, fd, void *, buf, + size_t, count, off_t, offset_hi, off_t, offset_lo) +# define MY_PREAD(fd, buf, count, offset) __syscall_pread(fd, buf, count, OFF_HI_LO(offset)) +# define MY_PREAD64(fd, buf, count, offset) __syscall_pread(fd, buf, count, OFF64_HI_LO(offset)) +# else +# define MY_PREAD(fd, buf, count, offset) __fake_pread_pwrite(fd, buf, count, offset, 0) +# define MY_PREAD64(fd, buf, count, offset) __fake_pread_pwrite64(fd, buf, count, offset, 0) +# endif +#endif -# ifdef __UCLIBC_HAS_LFS__ -ssize_t __libc_pwrite64(int fd, const void *buf, size_t count, off64_t offset) -{ - uint32_t low = offset & 0xffffffff; - uint32_t high = offset >> 32; - return __syscall_pwrite(fd, buf, count, __LONG_LONG_PAIR(high, low)); -} -weak_alias(__libc_pwrite64,pwrite64) -# endif /* __UCLIBC_HAS_LFS__ */ -#endif /* __NR_pwrite */ +#ifdef __NR_pwrite64 +# define __NR_pwrite __NR_pwrite64 +#endif -#if ! defined __NR_pread || ! defined __NR_pwrite +#ifndef MY_PWRITE +# ifdef __NR_pwrite +# define __NR___syscall_pwrite __NR_pwrite +static _syscall5(ssize_t, __syscall_pwrite, int, fd, const void *, buf, + size_t, count, off_t, offset_hi, off_t, offset_lo) +# define MY_PWRITE(fd, buf, count, offset) __syscall_pwrite(fd, buf, count, OFF_HI_LO(offset)) +# define MY_PWRITE64(fd, buf, count, offset) __syscall_pwrite(fd, buf, count, OFF64_HI_LO(offset)) +# else +# define MY_PWRITE(fd, buf, count, offset) __fake_pread_pwrite(fd, buf, count, offset, 1) +# define MY_PWRITE64(fd, buf, count, offset) __fake_pread_pwrite64(fd, buf, count, offset, 1) +# endif +#endif +#if !defined __NR_pread || !defined __NR_pwrite static ssize_t __fake_pread_write(int fd, void *buf, - size_t count, off_t offset, int do_pwrite) + size_t count, off_t offset, + int do_pwrite) { int save_errno; ssize_t result; @@ -85,25 +64,25 @@ static ssize_t __fake_pread_write(int fd, void *buf, /* Since we must not change the file pointer preserve the * value so that we can restore it later. */ - if ((old_offset=lseek(fd, 0, SEEK_CUR)) == (off_t) -1) + if ((old_offset = __NC(lseek)(fd, 0, SEEK_CUR)) == (off_t) -1) return -1; /* Set to wanted position. */ - if (lseek(fd, offset, SEEK_SET) == (off_t) -1) + if (__NC(lseek)(fd, offset, SEEK_SET) == (off_t) -1) return -1; if (do_pwrite == 1) { /* Write the data. */ - result = write(fd, buf, count); + result = __NC(write)(fd, buf, count); } else { /* Read the data. */ - result = read(fd, buf, count); + result = __NC(read)(fd, buf, count); } /* Now we have to restore the position. If this fails we * have to return this as an error. */ save_errno = errno; - if (lseek(fd, old_offset, SEEK_SET) == (off_t) -1) + if (__NC(lseek)(fd, old_offset, SEEK_SET) == (off_t) -1) { if (result == -1) __set_errno(save_errno); @@ -113,10 +92,10 @@ static ssize_t __fake_pread_write(int fd, void *buf, return(result); } -# ifdef __UCLIBC_HAS_LFS__ - +# if defined __UCLIBC_HAS_LFS__ && __WORDSIZE == 32 static ssize_t __fake_pread_write64(int fd, void *buf, - size_t count, off64_t offset, int do_pwrite) + size_t count, off64_t offset, + int do_pwrite) { int save_errno; ssize_t result; @@ -124,24 +103,24 @@ static ssize_t __fake_pread_write64(int fd, void *buf, /* Since we must not change the file pointer preserve the * value so that we can restore it later. */ - if ((old_offset=lseek64(fd, 0, SEEK_CUR)) == (off64_t) -1) + if ((old_offset = __NC(lseek64)(fd, 0, SEEK_CUR)) == (off64_t) -1) return -1; /* Set to wanted position. */ - if (lseek64(fd, offset, SEEK_SET) == (off64_t) -1) + if (__NC(lseek64)(fd, offset, SEEK_SET) == (off64_t) -1) return -1; if (do_pwrite == 1) { /* Write the data. */ - result = write(fd, buf, count); + result = __NC(write)(fd, buf, count); } else { /* Read the data. */ - result = read(fd, buf, count); + result = __NC(read)(fd, buf, count); } /* Now we have to restore the position. */ save_errno = errno; - if (lseek64(fd, old_offset, SEEK_SET) == (off64_t) -1) { + if (__NC(lseek64)(fd, old_offset, SEEK_SET) == (off64_t) -1) { if (result == -1) __set_errno (save_errno); return -1; @@ -149,39 +128,45 @@ static ssize_t __fake_pread_write64(int fd, void *buf, __set_errno (save_errno); return result; } -# endif /* __UCLIBC_HAS_LFS__ */ -#endif /* ! defined __NR_pread || ! defined __NR_pwrite */ +# endif +#endif /* ! __NR_pread || ! __NR_pwrite */ -#ifndef __NR_pread -ssize_t __libc_pread(int fd, void *buf, size_t count, off_t offset) +static ssize_t __NC(pread)(int fd, void *buf, size_t count, off_t offset) { - return __fake_pread_write(fd, buf, count, offset, 0); + return MY_PREAD(fd, buf, count, offset); } -weak_alias(__libc_pread,pread) +CANCELLABLE_SYSCALL(ssize_t, pread, (int fd, void *buf, size_t count, off_t offset), + (fd, buf, count, offset)) -# ifdef __UCLIBC_HAS_LFS__ -ssize_t __libc_pread64(int fd, void *buf, size_t count, off64_t offset) +static ssize_t __NC(pwrite)(int fd, const void *buf, size_t count, off_t offset) { - return __fake_pread_write64(fd, buf, count, offset, 0); + return MY_PWRITE(fd, buf, count, offset); } -weak_alias(__libc_pread64,pread64) -# endif /* __UCLIBC_HAS_LFS__ */ -#endif /* ! __NR_pread */ +CANCELLABLE_SYSCALL(ssize_t, pwrite, (int fd, const void *buf, size_t count, off_t offset), + (fd, buf, count, offset)) -#ifndef __NR_pwrite -ssize_t __libc_pwrite(int fd, const void *buf, size_t count, off_t offset) +#ifdef __UCLIBC_HAS_LFS__ +# if __WORDSIZE == 32 +static ssize_t __NC(pread64)(int fd, void *buf, size_t count, off64_t offset) { - /* we won't actually be modifying the buffer, - *just cast it to get rid of warnings */ - return __fake_pread_write(fd, (void*)buf, count, offset, 1); + return MY_PREAD64(fd, buf, count, offset); } -weak_alias(__libc_pwrite,pwrite) +CANCELLABLE_SYSCALL(ssize_t, pread64, (int fd, void *buf, size_t count, off64_t offset), + (fd, buf, count, offset)) -# ifdef __UCLIBC_HAS_LFS__ -ssize_t __libc_pwrite64(int fd, const void *buf, size_t count, off64_t offset) +static ssize_t __NC(pwrite64)(int fd, const void *buf, size_t count, off64_t offset) { - return __fake_pread_write64(fd, (void*)buf, count, offset, 1); + return MY_PWRITE64(fd, buf, count, offset); } -weak_alias(__libc_pwrite64,pwrite64) -# endif /* __UCLIBC_HAS_LFS__ */ -#endif /* ! __NR_pwrite */ +CANCELLABLE_SYSCALL(ssize_t, pwrite64, (int fd, const void *buf, size_t count, off64_t offset), + (fd, buf, count, offset)) +# else +# ifdef __LINUXTHREADS_OLD__ +weak_alias(pread,pread64) +weak_alias(pwrite,pwrite64) +# else +strong_alias_untyped(pread,pread64) +strong_alias_untyped(pwrite,pwrite64) +# endif +# endif +#endif -- 1.7.3.4 From ps.m at gmx.net Wed Apr 20 10:50:38 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Wed, 20 Apr 2011 12:50:38 +0200 Subject: [git commit future] add cancellation for read, write, close Message-ID: <20110421232845.2300A82962@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=32c01513bf544eb74906af03e8717004fcc1fac1 branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/future close.c: add function __close_nocancel_no_status to be used internally in libc avoiding inlining it everywhere. Signed-off-by: Peter S. Mazinger --- include/unistd.h | 10 ++++++++++ libc/sysdeps/linux/common/close.c | 15 ++++++++------- libc/sysdeps/linux/common/read.c | 14 +++++++------- libc/sysdeps/linux/common/write.c | 18 ++++++------------ 4 files changed, 31 insertions(+), 26 deletions(-) diff --git a/include/unistd.h b/include/unistd.h index 41d08ce..9337c8b 100644 --- a/include/unistd.h +++ b/include/unistd.h @@ -354,7 +354,11 @@ libc_hidden_proto(lseek64) This function is a cancellation point and therefore not marked with __THROW. */ extern int close (int __fd); +#ifdef _LIBC +extern __typeof(close) __close_nocancel attribute_hidden; +extern void __close_nocancel_no_status(int) attribute_hidden; libc_hidden_proto(close) +#endif /* Read NBYTES into BUF from FD. Return the number read, -1 for errors or 0 for EOF. @@ -362,14 +366,20 @@ libc_hidden_proto(close) This function is a cancellation point and therefore not marked with __THROW. */ extern ssize_t read (int __fd, void *__buf, size_t __nbytes) __wur; +#ifdef _LIBC +extern __typeof(read) __read_nocancel attribute_hidden; libc_hidden_proto(read) +#endif /* Write N bytes of BUF to FD. Return the number written, or -1. This function is a cancellation point and therefore not marked with __THROW. */ extern ssize_t write (int __fd, __const void *__buf, size_t __n) __wur; +#ifdef _LIBC +extern __typeof(write) __write_nocancel attribute_hidden; libc_hidden_proto(write) +#endif #ifdef __USE_UNIX98 # ifndef __USE_FILE_OFFSET64 diff --git a/libc/sysdeps/linux/common/close.c b/libc/sysdeps/linux/common/close.c index d6b5fbb..2e05bd0 100644 --- a/libc/sysdeps/linux/common/close.c +++ b/libc/sysdeps/linux/common/close.c @@ -9,12 +9,13 @@ #include #include +#include -_syscall1(int, close, int, fd) +#define __NR___close_nocancel __NR_close +_syscall1(int, __NC(close), int, fd) -#ifndef __LINUXTHREADS_OLD__ -libc_hidden_def(close) -#else -libc_hidden_weak(close) -strong_alias(close,__libc_close) -#endif +#define __NR___close_nocancel_no_status __NR_close +_syscall1_noerr(void, __close_nocancel_no_status, int, fd) + +CANCELLABLE_SYSCALL(int, close, (int fd), (fd)) +lt_libc_hidden(close) diff --git a/libc/sysdeps/linux/common/read.c b/libc/sysdeps/linux/common/read.c index 9e122fc..67c29b5 100644 --- a/libc/sysdeps/linux/common/read.c +++ b/libc/sysdeps/linux/common/read.c @@ -9,11 +9,11 @@ #include #include +#include -_syscall3(ssize_t, read, int, fd, __ptr_t, buf, size_t, count) -#ifndef __LINUXTHREADS_OLD__ -libc_hidden_def(read) -#else -libc_hidden_weak(read) -strong_alias(read,__libc_read) -#endif +#define __NR___read_nocancel __NR_read +_syscall3(ssize_t, __NC(read), int, fd, void *, buf, size_t, count) + +CANCELLABLE_SYSCALL(ssize_t, read, (int fd, void *buf, size_t count), + (fd, buf, count)) +lt_libc_hidden(read) diff --git a/libc/sysdeps/linux/common/write.c b/libc/sysdeps/linux/common/write.c index 5a6f722..e4d3ab8 100644 --- a/libc/sysdeps/linux/common/write.c +++ b/libc/sysdeps/linux/common/write.c @@ -9,17 +9,11 @@ #include #include +#include -_syscall3(ssize_t, write, int, fd, const __ptr_t, buf, size_t, count) -#ifndef __LINUXTHREADS_OLD__ -libc_hidden_def(write) -#else -libc_hidden_weak(write) -strong_alias(write,__libc_write) -#endif +#define __NR___write_nocancel __NR_write +_syscall3(ssize_t, __NC(write), int, fd, const void *, buf, size_t, count) -#if 0 -/* Stupid libgcc.a from gcc 2.95.x uses __write in pure.o - * which is a blatant GNU libc-ism... */ -strong_alias(write,__write) -#endif +CANCELLABLE_SYSCALL(ssize_t, write, (int fd, const void *buf, size_t count), + (fd, buf, count)) +lt_libc_hidden(write) -- 1.7.3.4 From ps.m at gmx.net Wed Apr 20 10:50:38 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Wed, 20 Apr 2011 12:50:38 +0200 Subject: [git commit future] pause.c: use cancel.h, provide __libc_pause only for LT_OLD Message-ID: <20110421232845.A09C18216E@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=ab8cd519b1e42e78bf863dd1a6619ea995dd6f29 branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/future Signed-off-by: Peter S. Mazinger --- libc/sysdeps/linux/common/pause.c | 33 ++++++++++++--------------------- 1 files changed, 12 insertions(+), 21 deletions(-) diff --git a/libc/sysdeps/linux/common/pause.c b/libc/sysdeps/linux/common/pause.c index a77c4d5..8a4d821 100644 --- a/libc/sysdeps/linux/common/pause.c +++ b/libc/sysdeps/linux/common/pause.c @@ -10,32 +10,23 @@ #define __need_NULL #include #include - -#ifdef __UCLIBC_HAS_THREADS_NATIVE__ -#include -#endif - #include +#include -/* Suspend the process until a signal arrives. - This always returns -1 and sets errno to EINTR. */ -extern __typeof(pause) __libc_pause; int -__libc_pause (void) +#ifdef __LINUXTHREADS_OLD__ +weak_function +#endif +pause(void) { - sigset_t set; + sigset_t set; - /*__sigemptyset (&set); - why? */ - sigprocmask (SIG_BLOCK, NULL, &set); + /*__sigemptyset (&set); - why? */ + sigprocmask (SIG_BLOCK, NULL, &set); - /* pause is a cancellation point, but so is sigsuspend. - So no need for anything special here. */ - - return sigsuspend (&set); + /* pause is a cancellation point, but so is sigsuspend. + So no need for anything special here. */ + return sigsuspend(&set); } -weak_alias (__libc_pause, pause) - -#ifdef __UCLIBC_HAS_THREADS_NATIVE__ +lt_strong_alias(pause) LIBC_CANCEL_HANDLED (); /* sigsuspend handles our cancellation. */ -#endif - -- 1.7.3.4 From ps.m at gmx.net Wed Apr 20 10:50:38 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Wed, 20 Apr 2011 12:50:38 +0200 Subject: [git commit future] fcntl: add cancellation to fcntl64, use cancel.h Message-ID: <20110421232847.473BB8216E@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=1beb8e206f0cd8f6030539a74ddd7e3b52004766 branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/future fcntl64 missed cancellation. Guard fcntl64 for 32bit archs. Reuse as much code as possible in __syscall_fcntl.c. Provide aliases fcntl64 if syscall is not available or on 64bit archs. Signed-off-by: Peter S. Mazinger --- include/fcntl.h | 11 ++-- libc/sysdeps/linux/common/__syscall_fcntl.c | 75 +++++++------------------ libc/sysdeps/linux/common/__syscall_fcntl64.c | 26 ++++++-- 3 files changed, 45 insertions(+), 67 deletions(-) diff --git a/include/fcntl.h b/include/fcntl.h index f2b4629..e4a00cf 100644 --- a/include/fcntl.h +++ b/include/fcntl.h @@ -75,7 +75,10 @@ __BEGIN_DECLS __THROW. */ #if !defined(__USE_FILE_OFFSET64) || defined(__LP64__) extern int fcntl (int __fd, int __cmd, ...); +# ifdef _LIBC +extern int __fcntl_nocancel(int, int, void *) attribute_hidden; libc_hidden_proto(fcntl) +# endif #else # ifdef __REDIRECT extern int __REDIRECT (fcntl, (int __fd, int __cmd, ...), fcntl64); @@ -85,7 +88,10 @@ extern int __REDIRECT (fcntl, (int __fd, int __cmd, ...), fcntl64); #endif #if defined(__USE_LARGEFILE64) && !defined(__LP64__) extern int fcntl64 (int __fd, int __cmd, ...); +# ifdef _LIBC +extern int __fcntl64_nocancel(int, int, void *) attribute_hidden; libc_hidden_proto(fcntl64) +# endif #endif /* Open FILE and return a new file descriptor for it, or -1 on error. @@ -232,11 +238,6 @@ extern int posix_fallocate64 (int __fd, __off64_t __offset, __off64_t __len); # endif #endif -#ifdef _LIBC -extern int __fcntl_nocancel (int fd, int cmd, ...); -libc_hidden_proto(__fcntl_nocancel) -#endif - __END_DECLS #endif /* fcntl.h */ diff --git a/libc/sysdeps/linux/common/__syscall_fcntl.c b/libc/sysdeps/linux/common/__syscall_fcntl.c index 6d4c339..5ae6122 100644 --- a/libc/sysdeps/linux/common/__syscall_fcntl.c +++ b/libc/sysdeps/linux/common/__syscall_fcntl.c @@ -10,39 +10,26 @@ #include #include -#ifdef __UCLIBC_HAS_THREADS_NATIVE__ -#include /* Must come before . */ -#endif +#include /* Must come before . */ #include #include -extern __typeof(fcntl) __libc_fcntl; -libc_hidden_proto(__libc_fcntl) - -int __fcntl_nocancel (int fd, int cmd, ...) +int __NC(fcntl)(int fd, int cmd, void *arg) { - va_list ap; - void *arg; - - va_start (ap, cmd); - arg = va_arg (ap, void *); - va_end (ap); - -# if __WORDSIZE == 32 +#if __WORDSIZE == 32 if (cmd == F_GETLK64 || cmd == F_SETLK64 || cmd == F_SETLKW64) { -# if defined __UCLIBC_HAS_LFS__ && defined __NR_fcntl64 - return INLINE_SYSCALL (fcntl64, 3, fd, cmd, arg); -# else +# if defined __UCLIBC_HAS_LFS__ && defined __NR_fcntl64 + return __NC(fcntl64)(fd, cmd, arg); +# else __set_errno(ENOSYS); return -1; -# endif - } # endif - return INLINE_SYSCALL (fcntl, 3, fd, cmd, arg); + } +#endif + return INLINE_SYSCALL(fcntl, 3, fd, cmd, arg); } -libc_hidden_def(__fcntl_nocancel) -int __libc_fcntl (int fd, int cmd, ...) +int fcntl(int fd, int cmd, ...) { va_list ap; void *arg; @@ -51,41 +38,19 @@ int __libc_fcntl (int fd, int cmd, ...) arg = va_arg (ap, void *); va_end (ap); -#ifdef __UCLIBC_HAS_THREADS_NATIVE__ if (SINGLE_THREAD_P || (cmd != F_SETLKW && cmd != F_SETLKW64)) -# if defined __UCLIBC_HAS_LFS__ && defined __NR_fcntl64 - return INLINE_SYSCALL (fcntl64, 3, fd, cmd, arg); -# else - return INLINE_SYSCALL (fcntl, 3, fd, cmd, arg); -# endif - + return __NC(fcntl)(fd, cmd, arg); +#ifdef __NEW_THREADS int oldtype = LIBC_CANCEL_ASYNC (); - -# if defined __UCLIBC_HAS_LFS__ && defined __NR_fcntl64 - int result = INLINE_SYSCALL (fcntl64, 3, fd, cmd, arg); -# else - int result = INLINE_SYSCALL (fcntl, 3, fd, cmd, arg); -# endif - + int result = __NC(fcntl)(fd, cmd, arg); LIBC_CANCEL_RESET (oldtype); - return result; -#else -# if __WORDSIZE == 32 - if (cmd == F_GETLK64 || cmd == F_SETLK64 || cmd == F_SETLKW64) { -# if defined __UCLIBC_HAS_LFS__ && defined __NR_fcntl64 - return INLINE_SYSCALL (fcntl64, 3, fd, cmd, arg); -# else - __set_errno(ENOSYS); - return -1; -# endif - } -# endif - return INLINE_SYSCALL (fcntl, 3, fd, cmd, arg); #endif } -libc_hidden_def(__libc_fcntl) - -libc_hidden_proto(fcntl) -weak_alias(__libc_fcntl,fcntl) -libc_hidden_weak(fcntl) +lt_strong_alias(fcntl) +lt_libc_hidden(fcntl) +#if defined __UCLIBC_HAS_LFS__ && (__WORDSIZE == 64 || !defined __NR_fcntl64) +strong_alias_untyped(fcntl,fcntl64) +lt_strong_alias(fcntl64) +lt_libc_hidden(fcntl64) +#endif diff --git a/libc/sysdeps/linux/common/__syscall_fcntl64.c b/libc/sysdeps/linux/common/__syscall_fcntl64.c index 09291e5..f84cc57 100644 --- a/libc/sysdeps/linux/common/__syscall_fcntl64.c +++ b/libc/sysdeps/linux/common/__syscall_fcntl64.c @@ -9,22 +9,34 @@ #include <_lfs_64.h> #include +#include -#ifdef __NR_fcntl64 +#if defined __NR_fcntl64 && __WORDSIZE == 32 # include # include -# define __NR___syscall_fcntl64 __NR_fcntl64 -static __inline__ _syscall3(int, __syscall_fcntl64, int, fd, int, cmd, long, arg) +# include + +# define __NR___fcntl64_nocancel __NR_fcntl64 +_syscall3(int, __NC(fcntl64), int, fd, int, cmd, void *, arg) + int fcntl64(int fd, int cmd, ...) { - long arg; + void *arg; va_list list; va_start(list, cmd); - arg = va_arg(list, long); + arg = va_arg(list, void *); va_end(list); - return (__syscall_fcntl64(fd, cmd, arg)); + if (SINGLE_THREAD_P || (cmd != F_SETLKW64)) + return __NC(fcntl64)(fd, cmd, arg); +# ifdef __NEW_THREADS + int oldtype = LIBC_CANCEL_ASYNC(); + int result = __NC(fcntl64)(fd, cmd, arg); + LIBC_CANCEL_RESET(oldtype); + return result; +# endif } -libc_hidden_def(fcntl64) +lt_strong_alias(fcntl64) +lt_libc_hidden(fcntl64) #endif -- 1.7.3.4 From ps.m at gmx.net Wed Apr 20 10:50:38 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Wed, 20 Apr 2011 12:50:38 +0200 Subject: [git commit future] sigsuspend.c: add cancellation support independently of rt_sigsuspend Message-ID: <20110421232848.1D3E68216E@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=7ae1fd67e0d43fba36c584d31d4a69b229c7f299 branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/future signal.h: add __SYSCALL_SIGSET_T_SIZE, since kernel sigset_t is different on mips and use that instead of _NSIG / 8 Signed-off-by: Peter S. Mazinger --- include/signal.h | 13 ++++++++++ libc/sysdeps/linux/common/sigsuspend.c | 42 ++++++------------------------- 2 files changed, 21 insertions(+), 34 deletions(-) diff --git a/include/signal.h b/include/signal.h index ca3e8ac..f564d58 100644 --- a/include/signal.h +++ b/include/signal.h @@ -298,7 +298,10 @@ libc_hidden_proto(sigprocmask) This function is a cancellation point and therefore not marked with __THROW. */ extern int sigsuspend (__const sigset_t *__set) __nonnull ((1)); +#ifdef _LIBC +extern __typeof(sigsuspend) __sigsuspend_nocancel attribute_hidden; libc_hidden_proto(sigsuspend) +#endif /* Get and/or set the action for signal SIG. */ extern int sigaction (int __sig, __const struct sigaction *__restrict __act, @@ -324,6 +327,16 @@ extern int __syscall_rt_sigaction(int, __const struct sigaction *, ; extern __typeof(sigaction) __libc_sigaction; libc_hidden_proto(sigaction) + +# ifdef __mips__ +# define _KERNEL_NSIG_WORDS (_NSIG / _MIPS_SZLONG) +typedef struct { + unsigned long sig[_KERNEL_NSIG_WORDS]; +} kernel_sigset_t; +# define __SYSCALL_SIGSET_T_SIZE (sizeof(kernel_sigset_t)) +# else +# define __SYSCALL_SIGSET_T_SIZE (_NSIG / 8) +# endif #endif /* Put in SET all signals that are blocked and waiting to be delivered. */ diff --git a/libc/sysdeps/linux/common/sigsuspend.c b/libc/sysdeps/linux/common/sigsuspend.c index c26ad16..57a1a44 100644 --- a/libc/sysdeps/linux/common/sigsuspend.c +++ b/libc/sysdeps/linux/common/sigsuspend.c @@ -11,42 +11,16 @@ #ifdef __USE_POSIX #include +#include -#ifdef __UCLIBC_HAS_THREADS_NATIVE__ -# ifndef __NR_rt_sigsuspend -# error break build, NPTL needs rt_sigsuspend syscall -# endif -# include -#else -# define SINGLE_THREAD_P 1 -#endif - -#ifdef __NR_rt_sigsuspend -static _syscall2(int, rt_sigsuspend, const sigset_t *, set, size_t, size) - -/* Change the set of blocked signals to SET, - wait until a signal arrives, and restore the set of blocked signals. */ -int sigsuspend(const sigset_t *set) +int __NC(sigsuspend)(const sigset_t *set) { - if (SINGLE_THREAD_P) - return rt_sigsuspend(set, _NSIG / 8); - -# ifdef __UCLIBC_HAS_THREADS_NATIVE__ - int oldtype = LIBC_CANCEL_ASYNC (); - int result = rt_sigsuspend(set, _NSIG / 8); - LIBC_CANCEL_RESET (oldtype); - return result; -# endif -} +#ifdef __NR_rt_sigsuspend + return INLINE_SYSCALL(rt_sigsuspend, 2, set, __SYSCALL_SIGSET_T_SIZE); #else -# define __NR___syscall_sigsuspend __NR_sigsuspend -static __always_inline _syscall3(int, __syscall_sigsuspend, int, a, unsigned long int, b, - unsigned long int, c) - -int sigsuspend(const sigset_t *set) -{ - return __syscall_sigsuspend(0, 0, set->__val[0]); -} + return INLINE_SYSCALL(sigsuspend, 3, 0, 0, set->__val[0]); #endif -libc_hidden_def(sigsuspend) +} +CANCELLABLE_SYSCALL(int, sigsuspend, (const sigset_t *set), (set)) +lt_libc_hidden(sigsuspend) #endif -- 1.7.3.4 From ps.m at gmx.net Wed Apr 20 10:50:38 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Wed, 20 Apr 2011 12:50:38 +0200 Subject: [git commit future] make NPTL's getpid behave similar to the common one Message-ID: <20110421232848.A72828216E@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=d11c6ee589e7cf4787c23b59a417db47ffda2866 branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/future make __getpid static provide getppid alias if needed remove unneeded libc_hidden_proto Signed-off-by: Peter S. Mazinger --- libpthread/nptl/sysdeps/unix/sysv/linux/getpid.c | 11 ++++++++--- 1 files changed, 8 insertions(+), 3 deletions(-) diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/getpid.c b/libpthread/nptl/sysdeps/unix/sysv/linux/getpid.c index d4de3cd..d2b3384 100644 --- a/libpthread/nptl/sysdeps/unix/sysv/linux/getpid.c +++ b/libpthread/nptl/sysdeps/unix/sysv/linux/getpid.c @@ -21,6 +21,10 @@ #include #include +#ifdef __NR_getxpid +# undef __NR_getpid +# define __NR_getpid __NR_getxpid +#endif #ifndef NOT_IN_libc static inline __attribute__((always_inline)) pid_t really_getpid (pid_t oldval); @@ -46,8 +50,7 @@ really_getpid (pid_t oldval) } #endif -extern __typeof(getpid) __getpid; -pid_t +static pid_t __getpid (void) { #ifdef NOT_IN_libc @@ -60,6 +63,8 @@ __getpid (void) #endif return result; } -libc_hidden_proto(getpid) weak_alias(__getpid, getpid) libc_hidden_weak(getpid) +#if !defined NOT_IN_libc && !defined __NR_getppid +strong_alias(getpid,getppid) +#endif -- 1.7.3.4 From ps.m at gmx.net Wed Apr 20 10:50:38 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Wed, 20 Apr 2011 12:50:38 +0200 Subject: [git commit ldso-future] internals.h: LT_OLD->define correctly internal hidden __pthread_mutex_unlock Message-ID: <20110421232914.06D57827CF@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=3cba9026aa622cf2fe574c1e5f630c8462b600bd branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/ldso-future Signed-off-by: Peter S. Mazinger Patch is too large, so refusing to show it From ps.m at gmx.net Wed Apr 20 10:50:38 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Wed, 20 Apr 2011 12:50:38 +0200 Subject: [git commit ldso-future] addr.c: get rid of a compiler warning Message-ID: <20110421232914.3171B827CF@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=affabb20ec0bb7ebed7b33ae4abd89c105c8b740 branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/ldso-future Signed-off-by: Peter S. Mazinger --- libc/inet/addr.c | 14 +++++++------- 1 files changed, 7 insertions(+), 7 deletions(-) diff --git a/libc/inet/addr.c b/libc/inet/addr.c index 363adb6..cd7151a 100644 --- a/libc/inet/addr.c +++ b/libc/inet/addr.c @@ -151,18 +151,18 @@ libc_hidden_def(inet_ntoa) */ struct in_addr inet_makeaddr(in_addr_t net, in_addr_t host) { - in_addr_t addr; + struct in_addr in; if (net < 128) - addr = (net << IN_CLASSA_NSHIFT) | (host & IN_CLASSA_HOST); + in.s_addr = (net << IN_CLASSA_NSHIFT) | (host & IN_CLASSA_HOST); else if (net < 65536) - addr = (net << IN_CLASSB_NSHIFT) | (host & IN_CLASSB_HOST); + in.s_addr = (net << IN_CLASSB_NSHIFT) | (host & IN_CLASSB_HOST); else if (net < 16777216UL) - addr = (net << IN_CLASSC_NSHIFT) | (host & IN_CLASSC_HOST); + in.s_addr = (net << IN_CLASSC_NSHIFT) | (host & IN_CLASSC_HOST); else - addr = net | host; - addr = htonl(addr); - return *(struct in_addr *)&addr; + in.s_addr = net | host; + in.s_addr = htonl(in.s_addr); + return in; } libc_hidden_def(inet_makeaddr) #endif -- 1.7.3.4 From ps.m at gmx.net Wed Apr 20 10:50:38 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Wed, 20 Apr 2011 12:50:38 +0200 Subject: [git commit ldso-future] resolv.c: shrink code a bit in getnameinfo. Message-ID: <20110421232914.5B315827CF@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=d9246e2ceb9d0118e4b61d79ff6398b4399b953c branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/ldso-future Signed-off-by: Peter S. Mazinger --- libc/inet/resolv.c | 10 ++++------ 1 files changed, 4 insertions(+), 6 deletions(-) diff --git a/libc/inet/resolv.c b/libc/inet/resolv.c index 6cdd6e0..7c3921c 100644 --- a/libc/inet/resolv.c +++ b/libc/inet/resolv.c @@ -1771,7 +1771,7 @@ int getnameinfo(const struct sockaddr *sa, unsigned flags) { int serrno = errno; - unsigned ok; + bool ok = 0; struct hostent *hoste = NULL; char domain[256]; @@ -1781,16 +1781,15 @@ int getnameinfo(const struct sockaddr *sa, if (sa == NULL || addrlen < sizeof(sa_family_t)) return EAI_FAMILY; - ok = sa->sa_family; - if (ok == AF_LOCAL) /* valid */; + if (sa->sa_family == AF_LOCAL) /* valid */; #ifdef __UCLIBC_HAS_IPV4__ - else if (ok == AF_INET) { + else if (sa->sa_family == AF_INET) { if (addrlen < sizeof(struct sockaddr_in)) return EAI_FAMILY; } #endif #ifdef __UCLIBC_HAS_IPV6__ - else if (ok == AF_INET6) { + else if (sa->sa_family == AF_INET6) { if (addrlen < sizeof(struct sockaddr_in6)) return EAI_FAMILY; } @@ -1798,7 +1797,6 @@ int getnameinfo(const struct sockaddr *sa, else return EAI_FAMILY; - ok = 0; if (host != NULL && hostlen > 0) switch (sa->sa_family) { case AF_INET: -- 1.7.3.4 From ps.m at gmx.net Wed Apr 20 10:50:38 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Wed, 20 Apr 2011 12:50:38 +0200 Subject: [git commit ldso-future] errno.h: fix __progname_full type Message-ID: <20110421232914.B717C827CF@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=6c94a90455198459da7ab2037eb88b20a475b8ef branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/ldso-future Signed-off-by: Peter S. Mazinger --- include/errno.h | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/include/errno.h b/include/errno.h index 5340601..fb7c1f5 100644 --- a/include/errno.h +++ b/include/errno.h @@ -48,7 +48,7 @@ extern int errno; #endif #ifdef _LIBC -extern const char *__progname, __progname_full; +extern const char *__progname, *__progname_full; #endif #if defined __USE_GNU && defined __UCLIBC_HAS_PROGRAM_INVOCATION_NAME__ -- 1.7.3.4 From ps.m at gmx.net Wed Apr 20 10:50:38 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Wed, 20 Apr 2011 12:50:38 +0200 Subject: [git commit ldso-future] _stdio.c: pthread.h was already included by _stdio.h Message-ID: <20110421232915.66D21827CF@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=01fe694e42bd4951cff1f5d346433c9c1c858e53 branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/ldso-future Signed-off-by: Peter S. Mazinger --- libc/stdio/_stdio.c | 5 ----- 1 files changed, 0 insertions(+), 5 deletions(-) diff --git a/libc/stdio/_stdio.c b/libc/stdio/_stdio.c index 61b01c8..b66c41f 100644 --- a/libc/stdio/_stdio.c +++ b/libc/stdio/_stdio.c @@ -7,7 +7,6 @@ #include "_stdio.h" - /* This is pretty much straight from uClibc, but with one important * difference. * @@ -277,10 +276,6 @@ void _stdio_init(void) #error Assumption violated about __MASK_READING and __FLAG_UNGOT #endif -#ifdef __UCLIBC_HAS_THREADS__ -#include -#endif - #ifndef NDEBUG void _stdio_validate_FILE(const FILE *stream) -- 1.7.3.4 From ps.m at gmx.net Wed Apr 20 10:50:38 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Wed, 20 Apr 2011 12:50:38 +0200 Subject: [git commit ldso-future] getopt.h: cleanup header, remove anything already in cdefs.h Message-ID: <20110421232915.8EED7827CF@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=eb98a4c6f969555e2ae32f6c95586e01f2192a32 branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/ldso-future Signed-off-by: Peter S. Mazinger --- libc/sysdeps/linux/common/bits/getopt.h | 38 +----------------------------- 1 files changed, 2 insertions(+), 36 deletions(-) diff --git a/libc/sysdeps/linux/common/bits/getopt.h b/libc/sysdeps/linux/common/bits/getopt.h index 7edb7bb..eb1a1db 100644 --- a/libc/sysdeps/linux/common/bits/getopt.h +++ b/libc/sysdeps/linux/common/bits/getopt.h @@ -26,31 +26,7 @@ # define _GETOPT_H 1 #endif -/* If __GNU_LIBRARY__ is not already defined, either we are being used - standalone, or this is the first header included in the source file. - If we are being used with glibc, we need to include , but - that does not exist if we are standalone. So: if __GNU_LIBRARY__ is - not defined, include , which will pull in for us - if it's from glibc. (Why ctype.h? It's guaranteed to exist and it - doesn't flood the namespace with stuff the way some other headers do.) */ -#if !defined __GNU_LIBRARY__ && !defined __UCLIBC__ -# include -#endif - -#ifndef __THROW -# ifndef __GNUC_PREREQ -# define __GNUC_PREREQ(maj, min) (0) -# endif -# if defined __cplusplus && __GNUC_PREREQ (2,8) -# define __THROW throw () -# else -# define __THROW -# endif -#endif - -#ifdef __cplusplus -extern "C" { -#endif +__BEGIN_DECLS /* For communication from `getopt' to the caller. When `getopt' finds an option that takes an argument, @@ -147,17 +123,9 @@ struct option arguments to the option '\0'. This behavior is specific to the GNU `getopt'. */ -#if defined __GNU_LIBRARY__ || defined __UCLIBC__ -/* Many other libraries have conflicting prototypes for getopt, with - differences in the consts, in stdlib.h. To avoid compilation - errors, only prototype getopt for the GNU C library. */ extern int getopt (int ___argc, char *const *___argv, const char *__shortopts) __THROW; libc_hidden_proto(getopt) -#else /* not __GNU_LIBRARY__ */ -extern int getopt (); -libc_hidden_proto(getopt) -#endif /* __GNU_LIBRARY__ */ #if defined __UCLIBC_HAS_GNU_GETOPT__ || defined __UCLIBC_HAS_GETOPT_LONG__ #ifndef __need_getopt @@ -173,9 +141,7 @@ extern int getopt_long_only (int ___argc, char *const *___argv, #endif #endif -#ifdef __cplusplus -} -#endif +__END_DECLS /* Make sure we later can get all the definitions and declarations. */ #undef __need_getopt -- 1.7.3.4 From ps.m at gmx.net Wed Apr 20 10:50:38 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Wed, 20 Apr 2011 12:50:38 +0200 Subject: [git commit ldso-future] signal: cleanup, include only headers that are needed Message-ID: <20110421232915.1886F827CF@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=b86ba6e879397217b3f52373dbaa5a26eccc0b30 branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/ldso-future Signed-off-by: Peter S. Mazinger --- include/signal.h | 2 +- libc/signal/allocrtsig.c | 1 - libc/signal/killpg.c | 1 - libc/signal/raise.c | 2 -- libc/signal/sigaction.c | 8 +++----- libc/signal/sigaddset.c | 5 ++++- libc/signal/sigblock.c | 1 - libc/signal/sigdelset.c | 5 ++++- libc/signal/sigempty.c | 7 +++++-- libc/signal/sigfillset.c | 9 +++++---- libc/signal/siggetmask.c | 1 - libc/signal/sighold.c | 1 - libc/signal/sigignore.c | 4 +--- libc/signal/sigintr.c | 8 ++++---- libc/signal/sigismem.c | 5 ++++- libc/signal/sigjmp.c | 2 +- libc/signal/signal.c | 2 +- libc/signal/sigpause.c | 3 ++- libc/signal/sigrelse.c | 1 - libc/signal/sigset.c | 3 +-- libc/signal/sigsetmask.c | 1 - libc/signal/sigsetops.h | 33 --------------------------------- libc/signal/sigwait.c | 8 +++++--- libc/signal/sysv_signal.c | 2 -- 24 files changed, 41 insertions(+), 74 deletions(-) delete mode 100644 libc/signal/sigsetops.h diff --git a/include/signal.h b/include/signal.h index 2924c7e..455cd84 100644 --- a/include/signal.h +++ b/include/signal.h @@ -258,7 +258,6 @@ extern int sigemptyset (sigset_t *__set) __THROW __nonnull ((1)); /* Set all signals in SET. */ extern int sigfillset (sigset_t *__set) __THROW __nonnull ((1)); -libc_hidden_proto(sigfillset) /* Add SIGNO to SET. */ extern int sigaddset (sigset_t *__set, int __signo) __THROW __nonnull ((1)); @@ -483,6 +482,7 @@ extern int __libc_current_sigrtmin (void) __THROW; extern int __libc_current_sigrtmax (void) __THROW; #ifdef _LIBC +extern sigset_t _sigintr attribute_hidden; /* simplified version without parameter checking */ # include # undef __sigemptyset diff --git a/libc/signal/allocrtsig.c b/libc/signal/allocrtsig.c index 05f3d6c..2b2098f 100644 --- a/libc/signal/allocrtsig.c +++ b/libc/signal/allocrtsig.c @@ -20,7 +20,6 @@ #include #include -#include #include /* Only enable rt signals when it is supported at compile time */ diff --git a/libc/signal/killpg.c b/libc/signal/killpg.c index c2dc713..73f48ec 100644 --- a/libc/signal/killpg.c +++ b/libc/signal/killpg.c @@ -19,7 +19,6 @@ #include #include - /* Send SIG to all processes in process group PGRP. If PGRP is zero, send SIG to all processes in the current process's process group. */ diff --git a/libc/signal/raise.c b/libc/signal/raise.c index aed9b46..d9dbab6 100644 --- a/libc/signal/raise.c +++ b/libc/signal/raise.c @@ -3,9 +3,7 @@ */ #include -#include #include -#include int raise(int signo) { diff --git a/libc/signal/sigaction.c b/libc/signal/sigaction.c index 7a31e06..9630df7 100644 --- a/libc/signal/sigaction.c +++ b/libc/signal/sigaction.c @@ -16,14 +16,9 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -#include -#include #include -#include #include -#include - #if defined __NR_rt_sigaction /* If ACT is not NULL, change the action for SIG to *ACT. @@ -42,6 +37,9 @@ __libc_sigaction(int sig, const struct sigaction *act, struct sigaction *oact) } #else +# define __need_NULL +# include +# include /* If ACT is not NULL, change the action for SIG to *ACT. If OACT is not NULL, put the old action for SIG in *OACT. */ diff --git a/libc/signal/sigaddset.c b/libc/signal/sigaddset.c index 7577d37..94fcc80 100644 --- a/libc/signal/sigaddset.c +++ b/libc/signal/sigaddset.c @@ -16,7 +16,10 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -#include "sigsetops.h" +#define __need_NULL +#include +#include +#include /* Add SIGNO to SET. */ int diff --git a/libc/signal/sigblock.c b/libc/signal/sigblock.c index ad3acb0..c3ce363 100644 --- a/libc/signal/sigblock.c +++ b/libc/signal/sigblock.c @@ -17,7 +17,6 @@ 02111-1307 USA. */ #define __UCLIBC_HIDE_DEPRECATED__ -#include #include #include "sigset-cvt-mask.h" diff --git a/libc/signal/sigdelset.c b/libc/signal/sigdelset.c index ff30303..9262b1a 100644 --- a/libc/signal/sigdelset.c +++ b/libc/signal/sigdelset.c @@ -16,7 +16,10 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -#include "sigsetops.h" +#define __need_NULL +#include +#include +#include /* Add SIGNO to SET. */ int sigdelset (sigset_t *set, int signo) diff --git a/libc/signal/sigempty.c b/libc/signal/sigempty.c index 2622c08..adbded6 100644 --- a/libc/signal/sigempty.c +++ b/libc/signal/sigempty.c @@ -16,9 +16,12 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -#include #include -#include +#if 0 +#define __need_NULL +#include +#include +#endif /* Clear all signals from SET. */ int sigemptyset (sigset_t *set) diff --git a/libc/signal/sigfillset.c b/libc/signal/sigfillset.c index 951e76b..ef60f10 100644 --- a/libc/signal/sigfillset.c +++ b/libc/signal/sigfillset.c @@ -16,10 +16,12 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -#include #include -#include - +#if 0 +#define __need_NULL +#include +#include +#endif /* Set all signals in SET. */ int @@ -46,4 +48,3 @@ sigfillset (sigset_t *set) return 0; } -libc_hidden_def(sigfillset) diff --git a/libc/signal/siggetmask.c b/libc/signal/siggetmask.c index 3992a7a..833de96 100644 --- a/libc/signal/siggetmask.c +++ b/libc/signal/siggetmask.c @@ -20,7 +20,6 @@ #define __UCLIBC_HIDE_DEPRECATED__ #include - int siggetmask (void) { diff --git a/libc/signal/sighold.c b/libc/signal/sighold.c index 6a2e718..2b1ecd1 100644 --- a/libc/signal/sighold.c +++ b/libc/signal/sighold.c @@ -22,7 +22,6 @@ #include #include - int sighold (int sig) { sigset_t set; diff --git a/libc/signal/sigignore.c b/libc/signal/sigignore.c index a74c105..984fd85 100644 --- a/libc/signal/sigignore.c +++ b/libc/signal/sigignore.c @@ -18,12 +18,10 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -#include #define __need_NULL #include #include -#include /* For the real memset prototype. */ - +#include int sigignore (int sig) { diff --git a/libc/signal/sigintr.c b/libc/signal/sigintr.c index 10567e9..210d493 100644 --- a/libc/signal/sigintr.c +++ b/libc/signal/sigintr.c @@ -16,16 +16,16 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -#include #include -#include - /* If INTERRUPT is nonzero, make signal SIG interrupt system calls (causing them to fail with EINTR); if INTERRUPT is zero, make system calls be restarted after signal SIG. */ #ifdef SA_RESTART -extern sigset_t _sigintr attribute_hidden; /* Defined in signal.c. */ +# define __need_NULL +# include +#else +# include #endif int siginterrupt (int sig, int interrupt) diff --git a/libc/signal/sigismem.c b/libc/signal/sigismem.c index b546f62..334a06f 100644 --- a/libc/signal/sigismem.c +++ b/libc/signal/sigismem.c @@ -16,7 +16,10 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -#include "sigsetops.h" +#define __need_NULL +#include +#include +#include /* Return 1 if SIGNO is in SET, 0 if not. */ int sigismember (const sigset_t *set, int signo) diff --git a/libc/signal/sigjmp.c b/libc/signal/sigjmp.c index a96d662..cf2be68 100644 --- a/libc/signal/sigjmp.c +++ b/libc/signal/sigjmp.c @@ -16,11 +16,11 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ +#define __need_NULL #include #include #include - /* This function is called by the `sigsetjmp' macro before doing a `__setjmp' on ENV[0].__jmpbuf. Always return zero. */ diff --git a/libc/signal/signal.c b/libc/signal/signal.c index 644617c..d82e421 100644 --- a/libc/signal/signal.c +++ b/libc/signal/signal.c @@ -22,7 +22,7 @@ #include #include /* For the real memset prototype. */ -sigset_t _sigintr attribute_hidden; /* Set by siginterrupt. */ +sigset_t _sigintr; /* Set by siginterrupt. */ /* Set the handler for the signal SIG to HANDLER, returning the old handler, or SIG_ERR on error. */ diff --git a/libc/signal/sigpause.c b/libc/signal/sigpause.c index 0856ba2..e773b3c 100644 --- a/libc/signal/sigpause.c +++ b/libc/signal/sigpause.c @@ -22,7 +22,8 @@ #include #define __FAVOR_BSD #include -#include /* For NULL. */ +#define __need_NULL +#include #ifdef __UCLIBC_HAS_THREADS_NATIVE__ #include #endif diff --git a/libc/signal/sigrelse.c b/libc/signal/sigrelse.c index 07e7fdd..b513648 100644 --- a/libc/signal/sigrelse.c +++ b/libc/signal/sigrelse.c @@ -22,7 +22,6 @@ #include #include - int sigrelse (int sig) { sigset_t set; diff --git a/libc/signal/sigset.c b/libc/signal/sigset.c index b91ce80..3b162df 100644 --- a/libc/signal/sigset.c +++ b/libc/signal/sigset.c @@ -20,8 +20,7 @@ #define __need_NULL #include #include -#include /* For the real memset prototype. */ - +#include /* Set the disposition for SIG. */ __sighandler_t sigset (int sig, __sighandler_t disp) diff --git a/libc/signal/sigsetmask.c b/libc/signal/sigsetmask.c index 64c8ad6..0a73179 100644 --- a/libc/signal/sigsetmask.c +++ b/libc/signal/sigsetmask.c @@ -17,7 +17,6 @@ 02111-1307 USA. */ #define __UCLIBC_HIDE_DEPRECATED__ -#include #include #include "sigset-cvt-mask.h" diff --git a/libc/signal/sigsetops.h b/libc/signal/sigsetops.h deleted file mode 100644 index 52081c2..0000000 --- a/libc/signal/sigsetops.h +++ /dev/null @@ -1,33 +0,0 @@ -/* Copyright (C) 1991, 1995, 1996 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -/* Definitions relevant to functions that operate on `sigset_t's. */ - -#include -#include -#include - -#define BITS (_NSIG - 1) -#define ELT(signo) (((signo) - 1) / BITS) -#define MASK(signo) (1 << (((signo) - 1) % BITS)) - -#undef sigemptyset -#undef sigfillset -#undef sigaddset -#undef sigdelset -#undef sigismember diff --git a/libc/signal/sigwait.c b/libc/signal/sigwait.c index 634a18d..5e9c427 100644 --- a/libc/signal/sigwait.c +++ b/libc/signal/sigwait.c @@ -19,15 +19,15 @@ * Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA * 02111-1307 USA. */ -#include +#define __need_NULL +#include #include -#include -#include #ifdef __UCLIBC_HAS_THREADS_NATIVE__ # include # ifdef __NR_rt_sigtimedwait +# include /* Return any pending signal or wait for one for the given time. */ static int do_sigwait(const sigset_t *set, int *sig) @@ -104,6 +104,8 @@ int sigwait (const sigset_t *set, int *sig) } # else /* __UCLIBC_HAS_REALTIME__ */ +# include +# include /* smallint */ /* variant without REALTIME extensions */ static smallint was_sig; /* obviously not thread-safe */ diff --git a/libc/signal/sysv_signal.c b/libc/signal/sysv_signal.c index a696a54..65d8190 100644 --- a/libc/signal/sysv_signal.c +++ b/libc/signal/sysv_signal.c @@ -18,8 +18,6 @@ #include #include -#include /* For the real memset prototype. */ - /* Tolerate non-threads versions of Posix */ #ifndef SA_ONESHOT -- 1.7.3.4 From ps.m at gmx.net Wed Apr 20 10:50:38 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Wed, 20 Apr 2011 12:50:38 +0200 Subject: [git commit ldso-future] mmap64.c: use void * as in header, disable code that can't happen Message-ID: <20110421232915.E35F3827CF@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=6db10dbc6d1651eee96d9e3a61678a37926e9cb6 branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/ldso-future Reorganize a bit. Signed-off-by: Peter S. Mazinger --- libc/sysdeps/linux/common/mmap64.c | 38 +++++++++++++++-------------------- 1 files changed, 16 insertions(+), 22 deletions(-) diff --git a/libc/sysdeps/linux/common/mmap64.c b/libc/sysdeps/linux/common/mmap64.c index 4ef0397..65a7381 100644 --- a/libc/sysdeps/linux/common/mmap64.c +++ b/libc/sysdeps/linux/common/mmap64.c @@ -6,17 +6,11 @@ /* Massivly hacked up for uClibc by Erik Andersen */ #include <_lfs_64.h> - -#ifdef __UCLIBC_HAS_LFS__ - #include -#include -#include #include -#include - +#include -# if !defined __NR_mmap2 +#ifndef __NR_mmap2 /* * This version is a stub that just chops off everything at the mmap 32 bit @@ -26,7 +20,7 @@ * */ -__ptr_t mmap64(__ptr_t addr, size_t len, int prot, int flags, int fd, __off64_t offset) +void *mmap64(void *addr, size_t len, int prot, int flags, int fd, __off64_t offset) { if (offset != (off_t) offset || (offset + len) != (off_t) (offset + len)) { @@ -37,36 +31,36 @@ __ptr_t mmap64(__ptr_t addr, size_t len, int prot, int flags, int fd, __off64_t return mmap(addr, len, prot, flags, fd, (off_t) offset); } -# else +#else +# include -# define __NR___syscall_mmap2 __NR_mmap2 -static __inline__ _syscall6(__ptr_t, __syscall_mmap2, __ptr_t, addr, +# define __NR___syscall_mmap2 __NR_mmap2 +static __inline__ _syscall6(void *, __syscall_mmap2, void *, addr, size_t, len, int, prot, int, flags, int, fd, off_t, offset) -/* Some architectures always use 12 as page shift for mmap2() eventhough the +/* Some architectures always use 12 as page shift for mmap2() even though the * real PAGE_SHIFT != 12. Other architectures use the same value as * PAGE_SHIFT... */ -# ifndef MMAP2_PAGE_SHIFT -# define MMAP2_PAGE_SHIFT 12 -# endif +# ifndef MMAP2_PAGE_SHIFT +# define MMAP2_PAGE_SHIFT 12 +# endif -__ptr_t mmap64(__ptr_t addr, size_t len, int prot, int flags, int fd, __off64_t offset) +void *mmap64(void *addr, size_t len, int prot, int flags, int fd, __off64_t offset) { if (offset & ((1 << MMAP2_PAGE_SHIFT) - 1)) { __set_errno(EINVAL); return MAP_FAILED; } -# ifdef __USE_FILE_OFFSET64 +# if 0 /*def __USE_FILE_OFFSET64 can't happen due to _lfs_64.h */ return __syscall_mmap2(addr, len, prot, flags, fd, ((__u_quad_t) offset >> MMAP2_PAGE_SHIFT)); -# else +# else return __syscall_mmap2(addr, len, prot, flags, fd, ((__u_long) offset >> MMAP2_PAGE_SHIFT)); -# endif +# endif } -# endif -#endif /* __UCLIBC_HAS_LFS__ */ +#endif -- 1.7.3.4 From ps.m at gmx.net Wed Apr 20 10:50:38 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Wed, 20 Apr 2011 12:50:38 +0200 Subject: [git commit ldso-future] llseek.c: use off64_t instead of loff_t as in header Message-ID: <20110421232916.1D4CB827CF@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=05f1cefa06b6c336e93b6985cdda5c1f4af82122 branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/ldso-future Signed-off-by: Peter S. Mazinger --- libc/sysdeps/linux/common/llseek.c | 10 +++++----- 1 files changed, 5 insertions(+), 5 deletions(-) diff --git a/libc/sysdeps/linux/common/llseek.c b/libc/sysdeps/linux/common/llseek.c index 2181464..d04a5ec 100644 --- a/libc/sysdeps/linux/common/llseek.c +++ b/libc/sysdeps/linux/common/llseek.c @@ -12,16 +12,16 @@ #include #ifdef __NR__llseek -loff_t lseek64(int fd, loff_t offset, int whence) +off64_t lseek64(int fd, off64_t offset, int whence) { - loff_t result; - return (loff_t)INLINE_SYSCALL(_llseek, 5, fd, (off_t) (offset >> 32), + off64_t result; + return (off64_t)INLINE_SYSCALL(_llseek, 5, fd, (off_t) (offset >> 32), (off_t) (offset & 0xffffffff), &result, whence) ?: result; } #else -loff_t lseek64(int fd, loff_t offset, int whence) +off64_t lseek64(int fd, off64_t offset, int whence) { - return (loff_t)lseek(fd, (off_t) (offset), whence); + return (off64_t)lseek(fd, (off_t) (offset), whence); } #endif #ifndef __LINUXTHREADS_OLD__ -- 1.7.3.4 From ps.m at gmx.net Wed Apr 20 10:50:38 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Wed, 20 Apr 2011 12:50:38 +0200 Subject: [git commit ldso-future] stubs.c: add openat* stubs Message-ID: <20110421232916.9D0B0827CF@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=385ef3dd8d11c19d9478020d5fdab4b2a70de7c6 branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/ldso-future Signed-off-by: Peter S. Mazinger --- libc/sysdeps/linux/common/stubs.c | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-) diff --git a/libc/sysdeps/linux/common/stubs.c b/libc/sysdeps/linux/common/stubs.c index 883bd34..e146c71 100644 --- a/libc/sysdeps/linux/common/stubs.c +++ b/libc/sysdeps/linux/common/stubs.c @@ -219,6 +219,13 @@ make_stub(lutimes) # endif #endif +#ifndef __NR_openat +make_stub(openat) +# ifdef __UCLIBC_HAS_LFS__ +make_stub(openat64) +# endif +#endif + #ifndef __NR_fadvise64 make_ret_stub(posix_fadvise) #endif -- 1.7.3.4 From ps.m at gmx.net Wed Apr 20 10:50:38 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Wed, 20 Apr 2011 12:50:38 +0200 Subject: [git commit ldso-future] openat*: use a static function with the different type and strong_alias_untyped Message-ID: <20110421232916.46A4A827CF@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=aa08c1a99e3c07b99307e516db5f2e9d63b4210f branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/ldso-future No need for hidden openat64 _lfs_64.h does not allow to compile *64.c if LFS is not enabled, remove guard Signed-off-by: Peter S. Mazinger --- include/fcntl.h | 1 - libc/sysdeps/linux/common/openat.c | 12 +++--------- libc/sysdeps/linux/common/openat64.c | 17 +++-------------- 3 files changed, 6 insertions(+), 24 deletions(-) diff --git a/include/fcntl.h b/include/fcntl.h index fc71368..f2b4629 100644 --- a/include/fcntl.h +++ b/include/fcntl.h @@ -135,7 +135,6 @@ extern int __REDIRECT (openat, (int __fd, __const char *__file, int __oflag, extern int openat64 (int __fd, __const char *__file, int __oflag, ...) __nonnull ((2)); -libc_hidden_proto(openat64) #endif /* Create and open FILE, with mode MODE. This takes an `int' MODE diff --git a/libc/sysdeps/linux/common/openat.c b/libc/sysdeps/linux/common/openat.c index 8380ec6..f6032da 100644 --- a/libc/sysdeps/linux/common/openat.c +++ b/libc/sysdeps/linux/common/openat.c @@ -6,19 +6,13 @@ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. */ -#define openat __xx_openat #include #include -#undef openat #ifdef __NR_openat -/* The openat() prototype is varargs based, but we don't care about that - * here, so need to provide our own dedicated signature. - */ -extern int openat(int fd, const char *file, int oflag, mode_t mode); -libc_hidden_proto(openat) - -_syscall4(int, openat, int, fd, const char *, file, int, oflag, mode_t, mode) +# define __NR___syscall_openat __NR_openat +static __inline__ _syscall4(int, __syscall_openat, int, fd, const char *, file, int, oflag, mode_t, mode) +strong_alias_untyped(__syscall_openat,openat) libc_hidden_def(openat) #else /* should add emulation with open() and /proc/self/fd/ ... */ diff --git a/libc/sysdeps/linux/common/openat64.c b/libc/sysdeps/linux/common/openat64.c index 06a5819..eda3e7d 100644 --- a/libc/sysdeps/linux/common/openat64.c +++ b/libc/sysdeps/linux/common/openat64.c @@ -6,27 +6,16 @@ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. */ -#define openat64 __xx_openat +#include <_lfs_64.h> #include #include -#undef openat64 - -#ifdef __UCLIBC_HAS_LFS__ #ifdef __NR_openat -/* The openat() prototype is varargs based, but we don't care about that - * here, so need to provide our own dedicated signature. - */ -extern int openat64(int fd, const char *file, int oflag, mode_t mode); -libc_hidden_proto(openat64) - -int openat64(int fd, const char *file, int oflag, mode_t mode) +static int __openat64(int fd, const char *file, int oflag, mode_t mode) { return openat(fd, file, oflag | O_LARGEFILE, mode); } -libc_hidden_def(openat64) +strong_alias_untyped(__openat64,openat64) #else /* should add emulation with open() and /proc/self/fd/ ... */ #endif - -#endif -- 1.7.3.4 From ps.m at gmx.net Wed Apr 20 10:50:38 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Wed, 20 Apr 2011 12:50:38 +0200 Subject: [git commit ldso-future] ppoll: no need for hidden version Message-ID: <20110421232917.4442C827CF@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=c076842fee22fcaf181c69562f77b02dbb313ea2 branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/ldso-future Guard as GNU extension. Reorganize a bit. Signed-off-by: Peter S. Mazinger --- include/sys/poll.h | 1 - libc/sysdeps/linux/common/ppoll.c | 11 +++++------ 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/include/sys/poll.h b/include/sys/poll.h index 53ba6e2..1f5e12c 100644 --- a/include/sys/poll.h +++ b/include/sys/poll.h @@ -68,7 +68,6 @@ libc_hidden_proto(poll) extern int ppoll (struct pollfd *__fds, nfds_t __nfds, __const struct timespec *__timeout, __const __sigset_t *__ss); -libc_hidden_proto(ppoll) #endif __END_DECLS diff --git a/libc/sysdeps/linux/common/ppoll.c b/libc/sysdeps/linux/common/ppoll.c index 09b2b15..3ca3f73 100644 --- a/libc/sysdeps/linux/common/ppoll.c +++ b/libc/sysdeps/linux/common/ppoll.c @@ -17,13 +17,13 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -#include #include -#include -#define __need_NULL -#include -#if defined __NR_ppoll && defined __UCLIBC_LINUX_SPECIFIC__ +#if defined __NR_ppoll && defined __UCLIBC_LINUX_SPECIFIC__ && defined __USE_GNU +# define __need_NULL +# include +# include +# include # ifdef __UCLIBC_HAS_THREADS_NATIVE__ # include # else @@ -51,5 +51,4 @@ ppoll(struct pollfd *fds, nfds_t nfds, const struct timespec *timeout, return result; # endif } -libc_hidden_def(ppoll) #endif -- 1.7.3.4 From ps.m at gmx.net Wed Apr 20 10:50:38 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Wed, 20 Apr 2011 12:50:38 +0200 Subject: [git commit ldso-future] no need for hidden __sigpause, use an internal static function Message-ID: <20110421232917.14C7C827CF@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=a7a4dc61d7f163d2eca2e8b5fc4be9c43a24bf39 branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/ldso-future Signed-off-by: Peter S. Mazinger --- include/signal.h | 1 - libc/signal/sigpause.c | 10 +++++----- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/include/signal.h b/include/signal.h index 455cd84..ca3e8ac 100644 --- a/include/signal.h +++ b/include/signal.h @@ -195,7 +195,6 @@ extern void psiginfo (__const siginfo_t *__pinfo, __const char *__s); This function is a cancellation point and therefore not marked with __THROW. */ extern int __sigpause (int __sig_or_mask, int __is_sig); -libc_hidden_proto(__sigpause) #ifdef __FAVOR_BSD /* Set the mask of blocked signals to MASK, diff --git a/libc/signal/sigpause.c b/libc/signal/sigpause.c index e773b3c..ebd7af3 100644 --- a/libc/signal/sigpause.c +++ b/libc/signal/sigpause.c @@ -32,7 +32,7 @@ /* Set the mask of blocked signals to MASK, wait for a signal to arrive, and then restore the mask. */ -int __sigpause (int sig_or_mask, int is_sig) +static int __internal_sigpause (int sig_or_mask, int is_sig) { sigset_t set; @@ -52,7 +52,7 @@ int __sigpause (int sig_or_mask, int is_sig) to do anything here. */ return sigsuspend (&set); } -libc_hidden_def(__sigpause) +strong_alias(__internal_sigpause,__sigpause) #undef sigpause @@ -63,16 +63,16 @@ int sigpause (int mask) { #ifdef __UCLIBC_HAS_THREADS_NATIVE__ if (SINGLE_THREAD_P) - return __sigpause (mask, 0); + return __internal_sigpause (mask, 0); int oldtype = LIBC_CANCEL_ASYNC (); - int result = __sigpause (mask, 0); + int result = __internal_sigpause (mask, 0); LIBC_CANCEL_RESET (oldtype); return result; #else - return __sigpause (mask, 0); + return __internal_sigpause (mask, 0); #endif } -- 1.7.3.4 From ps.m at gmx.net Wed Apr 20 10:50:38 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Wed, 20 Apr 2011 12:50:38 +0200 Subject: [git commit ldso-future] stubs.c: add renameat stub Message-ID: <20110421232917.EBEA9827CF@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=5d5f03c932fc6cabfb8e89f0447cbb1f9179524f branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/ldso-future Signed-off-by: Peter S. Mazinger --- libc/sysdeps/linux/common/stubs.c | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-) diff --git a/libc/sysdeps/linux/common/stubs.c b/libc/sysdeps/linux/common/stubs.c index e146c71..4c4f626 100644 --- a/libc/sysdeps/linux/common/stubs.c +++ b/libc/sysdeps/linux/common/stubs.c @@ -226,6 +226,10 @@ make_stub(openat64) # endif #endif +#ifndef __NR_renameat +make_stub(renameat) +#endif + #ifndef __NR_fadvise64 make_ret_stub(posix_fadvise) #endif -- 1.7.3.4 From ps.m at gmx.net Wed Apr 20 10:50:38 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Wed, 20 Apr 2011 12:50:38 +0200 Subject: [git commit ldso-future] *64.[cS]: use _lfs_64.h instead of features.h and remove LFS guard Message-ID: <20110421232916.71D4C827CF@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=a6c60dd44fdccb91b71b533d52711286dfc44a57 branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/ldso-future _lfs_64.h makes the compile fail, if LFS is not enabled, no need for the guard. Reorganize to include only the minimal necessary headers. Signed-off-by: Peter S. Mazinger --- libc/sysdeps/linux/arm/mmap64.S | 4 +- libc/sysdeps/linux/common/__syscall_fcntl64.c | 10 +++--- libc/sysdeps/linux/common/creat64.c | 4 -- libc/sysdeps/linux/common/fstat64.c | 17 ++++----- libc/sysdeps/linux/common/fstatat64.c | 9 ++--- libc/sysdeps/linux/common/ftruncate64.c | 43 +++++++++------------- libc/sysdeps/linux/common/getdents64.c | 17 +++------ libc/sysdeps/linux/common/getrlimit64.c | 7 +--- libc/sysdeps/linux/common/lstat64.c | 9 ++--- libc/sysdeps/linux/common/open64.c | 6 +--- libc/sysdeps/linux/common/posix_fadvise64.c | 2 +- libc/sysdeps/linux/common/sendfile64.c | 11 ++---- libc/sysdeps/linux/common/setrlimit64.c | 7 +--- libc/sysdeps/linux/common/stat64.c | 14 +++---- libc/sysdeps/linux/common/truncate64.c | 47 +++++++++---------------- libc/sysdeps/linux/frv/fstat64.c | 4 +-- libc/sysdeps/linux/frv/lstat64.c | 4 +-- libc/sysdeps/linux/frv/stat64.c | 4 +-- libc/sysdeps/linux/i386/mmap64.S | 5 +-- libc/sysdeps/linux/i386/posix_fadvise64.S | 3 +- libc/sysdeps/linux/mips/posix_fadvise64.c | 2 +- 21 files changed, 86 insertions(+), 143 deletions(-) diff --git a/libc/sysdeps/linux/arm/mmap64.S b/libc/sysdeps/linux/arm/mmap64.S index 7071541..bc9d4f1 100644 --- a/libc/sysdeps/linux/arm/mmap64.S +++ b/libc/sysdeps/linux/arm/mmap64.S @@ -16,13 +16,13 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -#include +#include <_lfs_64.h> #define _ERRNO_H #include #include #include -#if defined __UCLIBC_HAS_LFS__ && defined __NR_mmap2 +#ifdef __NR_mmap2 /* The mmap2 system call takes six arguments, all in registers. */ .text diff --git a/libc/sysdeps/linux/common/__syscall_fcntl64.c b/libc/sysdeps/linux/common/__syscall_fcntl64.c index e8782e9..09291e5 100644 --- a/libc/sysdeps/linux/common/__syscall_fcntl64.c +++ b/libc/sysdeps/linux/common/__syscall_fcntl64.c @@ -7,13 +7,13 @@ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. */ +#include <_lfs_64.h> #include -#include -#include -#if defined __UCLIBC_HAS_LFS__ && defined __NR_fcntl64 - -#define __NR___syscall_fcntl64 __NR_fcntl64 +#ifdef __NR_fcntl64 +# include +# include +# define __NR___syscall_fcntl64 __NR_fcntl64 static __inline__ _syscall3(int, __syscall_fcntl64, int, fd, int, cmd, long, arg) int fcntl64(int fd, int cmd, ...) { diff --git a/libc/sysdeps/linux/common/creat64.c b/libc/sysdeps/linux/common/creat64.c index 577ad14..550e88a 100644 --- a/libc/sysdeps/linux/common/creat64.c +++ b/libc/sysdeps/linux/common/creat64.c @@ -17,14 +17,10 @@ 02111-1307 USA. */ #include <_lfs_64.h> - -#ifdef __UCLIBC_HAS_LFS__ #include -#include /* Create FILE with protections MODE. */ int creat64(const char *file, mode_t mode) { return open64(file, O_WRONLY|O_CREAT|O_TRUNC, mode); } -#endif /* __UCLIBC_HAS_LFS__ */ diff --git a/libc/sysdeps/linux/common/fstat64.c b/libc/sysdeps/linux/common/fstat64.c index 6061343..7460c26 100644 --- a/libc/sysdeps/linux/common/fstat64.c +++ b/libc/sysdeps/linux/common/fstat64.c @@ -7,17 +7,16 @@ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. */ +#include <_lfs_64.h> #include -#if defined __UCLIBC_HAS_LFS__ && defined __NR_fstat64 -#include -#include -#include "xstatconv.h" - - -#define __NR___syscall_fstat64 __NR_fstat64 -static __inline__ _syscall2(int, __syscall_fstat64, - int, filedes, struct kernel_stat64 *, buf) +#ifdef __NR_fstat64 +# include +# include +# include "xstatconv.h" +# define __NR___syscall_fstat64 __NR_fstat64 +static __always_inline _syscall2(int, __syscall_fstat64, + int, filedes, struct kernel_stat64 *, buf) int fstat64(int fd, struct stat64 *buf) { diff --git a/libc/sysdeps/linux/common/fstatat64.c b/libc/sysdeps/linux/common/fstatat64.c index 95627af..6be8ba4 100644 --- a/libc/sysdeps/linux/common/fstatat64.c +++ b/libc/sysdeps/linux/common/fstatat64.c @@ -6,11 +6,8 @@ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. */ +#include <_lfs_64.h> #include -#include -#include "xstatconv.h" - -#ifdef __UCLIBC_HAS_LFS__ /* 64bit ports tend to favor newfstatat() */ #ifdef __NR_newfstatat @@ -18,6 +15,8 @@ #endif #ifdef __NR_fstatat64 +# include +# include "xstatconv.h" int fstatat64(int fd, const char *file, struct stat64 *buf, int flag) { int ret; @@ -32,5 +31,3 @@ int fstatat64(int fd, const char *file, struct stat64 *buf, int flag) #else /* should add emulation with fstat64() and /proc/self/fd/ ... */ #endif - -#endif diff --git a/libc/sysdeps/linux/common/ftruncate64.c b/libc/sysdeps/linux/common/ftruncate64.c index c5a6160..012a1f4 100644 --- a/libc/sysdeps/linux/common/ftruncate64.c +++ b/libc/sysdeps/linux/common/ftruncate64.c @@ -10,47 +10,42 @@ * just the macro we need to order things, __LONG_LONG_PAIR. */ -#include +#include <_lfs_64.h> +#include +#include -#ifdef __UCLIBC_HAS_LFS__ +#ifdef __NR_ftruncate64 +# include -# include -# include -# include -# include -# include -# include - - -# ifdef __NR_ftruncate64 - -# if __WORDSIZE == 64 +# if __WORDSIZE == 64 /* For a 64 bit machine, life is simple... */ _syscall2(int, ftruncate64, int, fd, __off64_t, length) -# elif __WORDSIZE == 32 +# elif __WORDSIZE == 32 +# include +# include /* The exported ftruncate64 function. */ int ftruncate64 (int fd, __off64_t length) { uint32_t low = length & 0xffffffff; uint32_t high = length >> 32; -# if defined(__UCLIBC_TRUNCATE64_HAS_4_ARGS__) +# if defined(__UCLIBC_TRUNCATE64_HAS_4_ARGS__) return INLINE_SYSCALL(ftruncate64, 4, fd, 0, __LONG_LONG_PAIR (high, low)); -# else +# else return INLINE_SYSCALL(ftruncate64, 3, fd, __LONG_LONG_PAIR (high, low)); -# endif +# endif } -# else /* __WORDSIZE */ -# error Your machine is not 64 bit or 32 bit, I am dazed and confused. -# endif /* __WORDSIZE */ - -# else /* __NR_ftruncate64 */ +# else /* __WORDSIZE */ +# error Your machine is not 64 bit or 32 bit, I am dazed and confused. +# endif /* __WORDSIZE */ +#else /* __NR_ftruncate64 */ +# include int ftruncate64 (int fd, __off64_t length) { @@ -65,7 +60,5 @@ int ftruncate64 (int fd, __off64_t length) return -1; } -# endif /* __NR_ftruncate64 */ +#endif /* __NR_ftruncate64 */ libc_hidden_def(ftruncate64) - -#endif /* __UCLIBC_HAS_LFS__ */ diff --git a/libc/sysdeps/linux/common/getdents64.c b/libc/sysdeps/linux/common/getdents64.c index e1133ff..aacbe97 100644 --- a/libc/sysdeps/linux/common/getdents64.c +++ b/libc/sysdeps/linux/common/getdents64.c @@ -4,7 +4,11 @@ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. */ -#include +#include <_lfs_64.h> +#include + +#ifdef __NR_getdents64 + #include #include #include @@ -12,19 +16,10 @@ #include #include #include -#include #include -#include -#include -#include +#include #include -#if defined __UCLIBC_HAS_LFS__ && defined __NR_getdents64 - -# ifndef offsetof -# define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER) -# endif - struct kernel_dirent64 { uint64_t d_ino; diff --git a/libc/sysdeps/linux/common/getrlimit64.c b/libc/sysdeps/linux/common/getrlimit64.c index d537241..2945e6d 100644 --- a/libc/sysdeps/linux/common/getrlimit64.c +++ b/libc/sysdeps/linux/common/getrlimit64.c @@ -17,15 +17,12 @@ 02111-1307 USA. */ #include <_lfs_64.h> - -#include -#include #include /* the regular getrlimit will work just fine for 64bit users */ +#if __WORDSIZE == 32 -#if defined __UCLIBC_HAS_LFS__ && __WORDSIZE == 32 - +# include /* Put the soft and hard limits for RESOURCE in *RLIMITS. Returns 0 if successful, -1 if not (and sets errno). */ diff --git a/libc/sysdeps/linux/common/lstat64.c b/libc/sysdeps/linux/common/lstat64.c index 235b76d..85e2698 100644 --- a/libc/sysdeps/linux/common/lstat64.c +++ b/libc/sysdeps/linux/common/lstat64.c @@ -7,17 +7,17 @@ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. */ +#include <_lfs_64.h> #include -#if defined __UCLIBC_HAS_LFS__ && defined __NR_lstat64 +#ifdef __NR_lstat64 # include # include # include "xstatconv.h" - # define __NR___syscall_lstat64 __NR_lstat64 -static __inline__ _syscall2(int, __syscall_lstat64, const char *, file_name, - struct kernel_stat64 *, buf) +static __always_inline _syscall2(int, __syscall_lstat64, const char *, file_name, + struct kernel_stat64 *, buf) int lstat64(const char *file_name, struct stat64 *buf) { @@ -31,5 +31,4 @@ int lstat64(const char *file_name, struct stat64 *buf) return result; } libc_hidden_def(lstat64) - #endif diff --git a/libc/sysdeps/linux/common/open64.c b/libc/sysdeps/linux/common/open64.c index c1f5400..91931fa 100644 --- a/libc/sysdeps/linux/common/open64.c +++ b/libc/sysdeps/linux/common/open64.c @@ -4,7 +4,7 @@ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. */ -#include +#include <_lfs_64.h> #include #include #ifdef __UCLIBC_HAS_THREADS_NATIVE__ @@ -12,8 +12,6 @@ #include #endif -#ifdef __UCLIBC_HAS_LFS__ - #ifndef O_LARGEFILE # define O_LARGEFILE 0100000 #endif @@ -53,5 +51,3 @@ libc_hidden_def(open64) libc_hidden_weak(open64) strong_alias(open64,__libc_open64) #endif - -#endif /* __UCLIBC_HAS_LFS__ */ diff --git a/libc/sysdeps/linux/common/posix_fadvise64.c b/libc/sysdeps/linux/common/posix_fadvise64.c index de813ba..0670854 100644 --- a/libc/sysdeps/linux/common/posix_fadvise64.c +++ b/libc/sysdeps/linux/common/posix_fadvise64.c @@ -16,7 +16,7 @@ # define __NR_fadvise64_64 __NR_arm_fadvise64_64 #endif -#if defined __NR_fadvise64_64 && defined __UCLIBC_HAS_LFS__ && __WORDSIZE == 32 +#if defined __NR_fadvise64_64 && __WORDSIZE == 32 # include # include diff --git a/libc/sysdeps/linux/common/sendfile64.c b/libc/sysdeps/linux/common/sendfile64.c index fc5155f..2442b80 100644 --- a/libc/sysdeps/linux/common/sendfile64.c +++ b/libc/sysdeps/linux/common/sendfile64.c @@ -10,15 +10,10 @@ * just the macro we need to order things, __LONG_LONG_PAIR. */ -#include -#include -#include -#include -#include -#include +#include <_lfs_64.h> #include -#include -#if defined __UCLIBC_HAS_LFS__ && defined __NR_sendfile64 +#ifdef __NR_sendfile64 +# include _syscall4(ssize_t,sendfile64, int, out_fd, int, in_fd, __off64_t *, offset, size_t, count) #endif diff --git a/libc/sysdeps/linux/common/setrlimit64.c b/libc/sysdeps/linux/common/setrlimit64.c index 8705c6f..8ec6e58 100644 --- a/libc/sysdeps/linux/common/setrlimit64.c +++ b/libc/sysdeps/linux/common/setrlimit64.c @@ -17,15 +17,12 @@ 02111-1307 USA. */ #include <_lfs_64.h> - -#include -#include #include /* the regular setrlimit will work just fine for 64bit users */ +#if __WORDSIZE == 32 -#if defined __UCLIBC_HAS_LFS__ && __WORDSIZE == 32 - +# include /* Set the soft and hard limits for RESOURCE to *RLIMITS. Only the super-user can increase hard limits. diff --git a/libc/sysdeps/linux/common/stat64.c b/libc/sysdeps/linux/common/stat64.c index a76f182..ef34faf 100644 --- a/libc/sysdeps/linux/common/stat64.c +++ b/libc/sysdeps/linux/common/stat64.c @@ -7,17 +7,15 @@ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. */ +#include <_lfs_64.h> #include -#include -#if defined __UCLIBC_HAS_LFS__ && defined __NR_stat64 - -# define __NR___syscall_stat64 __NR_stat64 -# include +#ifdef __NR_stat64 +# include # include "xstatconv.h" - -static __inline__ _syscall2(int, __syscall_stat64, - const char *, file_name, struct kernel_stat64 *, buf) +# define __NR___syscall_stat64 __NR_stat64 +static __always_inline _syscall2(int, __syscall_stat64, + const char *, file_name, struct kernel_stat64 *, buf) int stat64(const char *file_name, struct stat64 *buf) { diff --git a/libc/sysdeps/linux/common/truncate64.c b/libc/sysdeps/linux/common/truncate64.c index 1f6c459..6dfdc4c 100644 --- a/libc/sysdeps/linux/common/truncate64.c +++ b/libc/sysdeps/linux/common/truncate64.c @@ -10,46 +10,36 @@ * just the macro we need to order things, __LONG_LONG_PAIR. */ -#include -#include -#include -#include -#include -#include +#include <_lfs_64.h> #include +#include -#if defined __UCLIBC_HAS_LFS__ - -#if defined __NR_truncate64 - -#if __WORDSIZE == 64 +#ifdef __NR_truncate64 +# include -/* For a 64 bit machine, life is simple... */ +# if __WORDSIZE == 64 _syscall2(int, truncate64, const char *, path, __off64_t, length) - -#elif __WORDSIZE == 32 - -/* The exported truncate64 function. */ +# elif __WORDSIZE == 32 +# include +# include int truncate64(const char * path, __off64_t length) { uint32_t low = length & 0xffffffff; uint32_t high = length >> 32; -#if defined(__UCLIBC_TRUNCATE64_HAS_4_ARGS__) +# if defined(__UCLIBC_TRUNCATE64_HAS_4_ARGS__) return INLINE_SYSCALL(truncate64, 4, path, 0, __LONG_LONG_PAIR(high, low)); -#else +# else return INLINE_SYSCALL(truncate64, 3, path, __LONG_LONG_PAIR(high, low)); -#endif +# endif } +# else +# error Your machine is not 64 bit nor 32 bit, I am dazed and confused. +# endif -#else /* __WORDSIZE */ -#error Your machine is not 64 bit nor 32 bit, I am dazed and confused. -#endif /* __WORDSIZE */ - -#else /* __NR_truncate64 */ - - +#else +# include int truncate64(const char * path, __off64_t length) { __off_t x = (__off_t) length; @@ -62,7 +52,4 @@ int truncate64(const char * path, __off64_t length) return -1; } - -#endif /* __NR_truncate64 */ - -#endif /* __UCLIBC_HAS_LFS__ */ +#endif diff --git a/libc/sysdeps/linux/frv/fstat64.c b/libc/sysdeps/linux/frv/fstat64.c index f795342..75383b2 100644 --- a/libc/sysdeps/linux/frv/fstat64.c +++ b/libc/sysdeps/linux/frv/fstat64.c @@ -9,11 +9,9 @@ * Adapted to FR-V by Alexandre Oliva */ +#include <_lfs_64.h> #include -#include #include -#ifdef __UCLIBC_HAS_LFS__ _syscall2(int, fstat64, int, fd, struct stat64 *, buf) libc_hidden_def(fstat64) -#endif diff --git a/libc/sysdeps/linux/frv/lstat64.c b/libc/sysdeps/linux/frv/lstat64.c index f038fb0..e84581c 100644 --- a/libc/sysdeps/linux/frv/lstat64.c +++ b/libc/sysdeps/linux/frv/lstat64.c @@ -9,11 +9,9 @@ * Adapted to FR-V by Alexandre Oliva */ +#include <_lfs_64.h> #include -#include #include -#ifdef __UCLIBC_HAS_LFS__ _syscall2(int, lstat64, const char *, file_name, struct stat64 *, buf) libc_hidden_def(lstat64) -#endif diff --git a/libc/sysdeps/linux/frv/stat64.c b/libc/sysdeps/linux/frv/stat64.c index 675e634..a13d1c3 100644 --- a/libc/sysdeps/linux/frv/stat64.c +++ b/libc/sysdeps/linux/frv/stat64.c @@ -9,11 +9,9 @@ * Adapted to FR-V by Alexandre Oliva */ +#include <_lfs_64.h> #include -#include #include -#ifdef __UCLIBC_HAS_LFS__ _syscall2(int, stat64, const char *, file_name, struct stat64 *, buf) libc_hidden_def(stat64) -#endif diff --git a/libc/sysdeps/linux/i386/mmap64.S b/libc/sysdeps/linux/i386/mmap64.S index a6b4aa0..33f7db7 100644 --- a/libc/sysdeps/linux/i386/mmap64.S +++ b/libc/sysdeps/linux/i386/mmap64.S @@ -17,13 +17,12 @@ 02111-1307 USA. */ +#include <_lfs_64.h> #define _ERRNO_H 1 -#include #include #include -#if defined __UCLIBC_HAS_LFS__ && defined __NR_mmap2 - +#ifdef __NR_mmap2 #define LINKAGE 4 #define PTR_SIZE 4 diff --git a/libc/sysdeps/linux/i386/posix_fadvise64.S b/libc/sysdeps/linux/i386/posix_fadvise64.S index 5f966a5..4b171c0 100644 --- a/libc/sysdeps/linux/i386/posix_fadvise64.S +++ b/libc/sysdeps/linux/i386/posix_fadvise64.S @@ -17,9 +17,10 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ +#include <_lfs_64.h> #include -#if defined __NR_fadvise64_64 && defined __UCLIBC_HAS_LFS__ +#ifdef __NR_fadvise64_64 .text .global posix_fadvise64 diff --git a/libc/sysdeps/linux/mips/posix_fadvise64.c b/libc/sysdeps/linux/mips/posix_fadvise64.c index f97dab9..02244aa 100644 --- a/libc/sysdeps/linux/mips/posix_fadvise64.c +++ b/libc/sysdeps/linux/mips/posix_fadvise64.c @@ -13,7 +13,7 @@ #include /* MIPS kernel only has NR_fadvise64 which acts as NR_fadvise64_64 */ -#if defined __NR_fadvise64 && defined __UCLIBC_HAS_LFS__ && __WORDSIZE == 32 +#if defined __NR_fadvise64 && __WORDSIZE == 32 # include # include -- 1.7.3.4 From ps.m at gmx.net Wed Apr 20 10:50:38 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Wed, 20 Apr 2011 12:50:38 +0200 Subject: [git commit ldso-future] Reorder includes and include only what is necessary Message-ID: <20110421232916.CB1AE827CF@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=67d53a0af4900ab5d7ba36a540d2689dcd8152f7 branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/ldso-future Use param.h instead of MIN. Use stddef.h instead of offsetof. Signed-off-by: Peter S. Mazinger --- libc/sysdeps/linux/common/alarm.c | 4 +--- libc/sysdeps/linux/common/arch_prctl.c | 2 +- libc/sysdeps/linux/common/capget.c | 3 ++- libc/sysdeps/linux/common/capset.c | 2 +- libc/sysdeps/linux/common/fchdir.c | 3 ++- libc/sysdeps/linux/common/ftruncate.c | 1 - libc/sysdeps/linux/common/getdents.c | 28 ++++++++++++++-------------- libc/sysdeps/linux/common/getrlimit.c | 7 +++---- libc/sysdeps/linux/common/init_module.c | 5 +++-- libc/sysdeps/linux/common/sendfile.c | 12 ++++-------- libc/sysdeps/linux/common/setrlimit.c | 18 ++++++++++-------- libc/sysdeps/linux/common/truncate.c | 1 - libc/sysdeps/linux/i386/sysdep.h | 5 +---- librt/timer_create.c | 5 +---- 14 files changed, 43 insertions(+), 53 deletions(-) diff --git a/libc/sysdeps/linux/common/alarm.c b/libc/sysdeps/linux/common/alarm.c index cfd68fe..a2dd77b 100644 --- a/libc/sysdeps/linux/common/alarm.c +++ b/libc/sysdeps/linux/common/alarm.c @@ -10,12 +10,10 @@ #include #include - #ifdef __NR_alarm _syscall1(unsigned int, alarm, unsigned int, seconds) #else -#include - +# include unsigned int alarm(unsigned int seconds) { diff --git a/libc/sysdeps/linux/common/arch_prctl.c b/libc/sysdeps/linux/common/arch_prctl.c index 5816f53..9fc5948 100644 --- a/libc/sysdeps/linux/common/arch_prctl.c +++ b/libc/sysdeps/linux/common/arch_prctl.c @@ -10,6 +10,6 @@ #include #ifdef __NR_arch_prctl -extern int arch_prctl(int code, unsigned long addr); +int arch_prctl(int code, unsigned long addr); _syscall2(int, arch_prctl, int, code, unsigned long, addr) #endif diff --git a/libc/sysdeps/linux/common/capget.c b/libc/sysdeps/linux/common/capget.c index c3e8c57..e420f6a 100644 --- a/libc/sysdeps/linux/common/capget.c +++ b/libc/sysdeps/linux/common/capget.c @@ -8,7 +8,8 @@ */ #include -int capget(void *header, void *data); + #ifdef __NR_capget +int capget(void *header, void *data); _syscall2(int, capget, void *, header, void *, data) #endif diff --git a/libc/sysdeps/linux/common/capset.c b/libc/sysdeps/linux/common/capset.c index c0cf5de..493cf14 100644 --- a/libc/sysdeps/linux/common/capset.c +++ b/libc/sysdeps/linux/common/capset.c @@ -9,7 +9,7 @@ #include -int capset(void *header, const void *data); #ifdef __NR_capset +int capset(void *header, const void *data); _syscall2(int, capset, void *, header, const void *, data) #endif diff --git a/libc/sysdeps/linux/common/fchdir.c b/libc/sysdeps/linux/common/fchdir.c index 4d54ef8..05e9890 100644 --- a/libc/sysdeps/linux/common/fchdir.c +++ b/libc/sysdeps/linux/common/fchdir.c @@ -10,6 +10,7 @@ #include #include - +#if defined __USE_BSD || defined __USE_XOPEN_EXTENDED _syscall1(int, fchdir, int, fd) libc_hidden_def(fchdir) +#endif diff --git a/libc/sysdeps/linux/common/ftruncate.c b/libc/sysdeps/linux/common/ftruncate.c index 3bdef3f..ea4dfc0 100644 --- a/libc/sysdeps/linux/common/ftruncate.c +++ b/libc/sysdeps/linux/common/ftruncate.c @@ -10,6 +10,5 @@ #include #include - _syscall2(int, ftruncate, int, fd, __off_t, length) libc_hidden_def(ftruncate) diff --git a/libc/sysdeps/linux/common/getdents.c b/libc/sysdeps/linux/common/getdents.c index f321aea..f4fb747 100644 --- a/libc/sysdeps/linux/common/getdents.c +++ b/libc/sysdeps/linux/common/getdents.c @@ -4,22 +4,17 @@ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. */ -#include -#include +#include +#include + +#if !(defined __UCLIBC_HAS_LFS__ && defined __NR_getdents64 && __WORDSIZE == 64) + #include -#include -#include #include -#include -#include -#include #include -#include #include #include -#include -#if !(defined __UCLIBC_HAS_LFS__ && defined __NR_getdents64 && __WORDSIZE == 64) /* If the condition above is met, __getdents is defined as an alias * for __getdents64 (see getdents64.c). Otherwise... */ @@ -31,10 +26,6 @@ * version / arch details. */ -#ifndef offsetof -# define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER) -#endif - struct kernel_dirent { long int d_ino; @@ -77,6 +68,13 @@ ssize_t __getdents (int fd, char *buf, size_t nbytes) #elif ! defined __UCLIBC_HAS_LFS__ || ! defined __NR_getdents64 +# include +# include +# include +# include +# include +# include + ssize_t __getdents (int fd, char *buf, size_t nbytes) { struct dirent *dp; @@ -138,6 +136,8 @@ ssize_t __getdents (int fd, char *buf, size_t nbytes) #elif __WORDSIZE == 32 +# include + ssize_t __getdents (int fd, char *buf, size_t nbytes) { struct dirent *dp; diff --git a/libc/sysdeps/linux/common/getrlimit.c b/libc/sysdeps/linux/common/getrlimit.c index f9d70f3..3b2ce3b 100644 --- a/libc/sysdeps/linux/common/getrlimit.c +++ b/libc/sysdeps/linux/common/getrlimit.c @@ -8,8 +8,8 @@ */ #include -#include #include +#include /* Only wrap getrlimit if the new ugetrlimit is not present and getrlimit sucks */ @@ -22,14 +22,14 @@ _syscall2(int, __syscall_ugetrlimit, enum __rlimit_resource, resource, struct rlimit *, rlim) int getrlimit(__rlimit_resource_t resource, struct rlimit *rlimits) { - return (__syscall_ugetrlimit(resource, rlimits)); + return __syscall_ugetrlimit(resource, rlimits); } #elif !defined(__UCLIBC_HANDLE_OLDER_RLIMIT__) /* We don't need to wrap getrlimit() */ _syscall2(int, getrlimit, __rlimit_resource_t, resource, - struct rlimit *, rlim) + struct rlimit *, rlim) #else @@ -56,7 +56,6 @@ int getrlimit(__rlimit_resource_t resource, struct rlimit *rlimits) return result; } #endif - libc_hidden_def(getrlimit) #if defined __UCLIBC_HAS_LFS__ && __WORDSIZE == 64 diff --git a/libc/sysdeps/linux/common/init_module.c b/libc/sysdeps/linux/common/init_module.c index cf6d747..a2a3e02 100644 --- a/libc/sysdeps/linux/common/init_module.c +++ b/libc/sysdeps/linux/common/init_module.c @@ -8,12 +8,13 @@ */ #include -int init_module(void *first, void *second, void *third, void *fourth, void *fifth); + #ifdef __NR_init_module +int init_module(void *first, void *second, void *third, void *fourth, void *fifth); /* This may have 5 arguments (for old 2.0 kernels) or 2 arguments * (for 2.2 and 2.4 kernels). Use the greatest common denominator, * and let the kernel cope with whatever it gets. It's good at that. */ _syscall5(int, init_module, void *, first, void *, second, void *, third, - void *, fourth, void *, fifth) + void *, fourth, void *, fifth) #endif diff --git a/libc/sysdeps/linux/common/sendfile.c b/libc/sysdeps/linux/common/sendfile.c index 89bab9f..80f2e2e 100644 --- a/libc/sysdeps/linux/common/sendfile.c +++ b/libc/sysdeps/linux/common/sendfile.c @@ -8,16 +8,12 @@ */ #include -#include -#include #ifdef __NR_sendfile - +# include _syscall4(ssize_t, sendfile, int, out_fd, int, in_fd, __off_t *, offset, - size_t, count) - -#if ! defined __NR_sendfile64 && defined __UCLIBC_HAS_LFS__ + size_t, count) +# if ! defined __NR_sendfile64 && defined __UCLIBC_HAS_LFS__ strong_alias(sendfile,sendfile64) +# endif #endif - -#endif /* __NR_sendfile */ diff --git a/libc/sysdeps/linux/common/setrlimit.c b/libc/sysdeps/linux/common/setrlimit.c index 6817a9c..d96700a 100644 --- a/libc/sysdeps/linux/common/setrlimit.c +++ b/libc/sysdeps/linux/common/setrlimit.c @@ -8,8 +8,8 @@ */ #include -#include #include +#include /* Only wrap setrlimit if the new usetrlimit is not present and setrlimit sucks */ @@ -22,7 +22,7 @@ _syscall2(int, __syscall_usetrlimit, enum __rlimit_resource, resource, const struct rlimit *, rlim) int setrlimit(__rlimit_resource_t resource, struct rlimit *rlimits) { - return (__syscall_usetrlimit(resource, rlimits)); + return __syscall_usetrlimit(resource, rlimits); } #elif !defined(__UCLIBC_HANDLE_OLDER_RLIMIT__) @@ -33,6 +33,11 @@ _syscall2(int, setrlimit, __rlimit_resource_t, resource, #else +# define __need_NULL +# include +# include +# include + /* we have to handle old style setrlimit() */ # define __NR___syscall_setrlimit __NR_setrlimit static __always_inline @@ -49,16 +54,13 @@ int setrlimit(__rlimit_resource_t resource, const struct rlimit *rlimits) /* We might have to correct the limits values. Since the old values * were signed the new values might be too large. */ -# define RMIN(x, y) ((x) < (y) ? (x) : (y)) - rlimits_small.rlim_cur = RMIN((unsigned long int) rlimits->rlim_cur, + rlimits_small.rlim_cur = MIN((unsigned long int) rlimits->rlim_cur, RLIM_INFINITY >> 1); - rlimits_small.rlim_max = RMIN((unsigned long int) rlimits->rlim_max, + rlimits_small.rlim_max = MIN((unsigned long int) rlimits->rlim_max, RLIM_INFINITY >> 1); -#undef RMIN - return (__syscall_setrlimit(resource, &rlimits_small)); + return __syscall_setrlimit(resource, &rlimits_small); } #endif - libc_hidden_def(setrlimit) #if defined __UCLIBC_HAS_LFS__ && __WORDSIZE == 64 diff --git a/libc/sysdeps/linux/common/truncate.c b/libc/sysdeps/linux/common/truncate.c index 2331bdd..fe7bda9 100644 --- a/libc/sysdeps/linux/common/truncate.c +++ b/libc/sysdeps/linux/common/truncate.c @@ -10,6 +10,5 @@ #include #include - _syscall2(int, truncate, const char *, path, __off_t, length) libc_hidden_def(truncate) diff --git a/libc/sysdeps/linux/i386/sysdep.h b/libc/sysdeps/linux/i386/sysdep.h index b06d392..4137b97 100644 --- a/libc/sysdeps/linux/i386/sysdep.h +++ b/libc/sysdeps/linux/i386/sysdep.h @@ -150,10 +150,6 @@ __x86.get_pc_thunk.reg: \ #undef __i686 #endif /* __ASSEMBLER__ */ -#ifndef offsetof -# define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER) -#endif - /* For Linux we can use the system call table in the header file /usr/include/asm/unistd.h of the kernel. But these symbols do not follow the SYS_* syntax @@ -444,6 +440,7 @@ __x86.get_pc_thunk.reg: \ # define PTR_DEMANGLE(reg) rorl $9, reg; \ xorl %gs:POINTER_GUARD, reg # else +# include # define PTR_MANGLE(var) __asm__ ("xorl %%gs:%c2, %0\n" \ "roll $9, %0" \ : "=r" (var) \ diff --git a/librt/timer_create.c b/librt/timer_create.c index 9298a37..f52a36f 100644 --- a/librt/timer_create.c +++ b/librt/timer_create.c @@ -2,6 +2,7 @@ * timer_create.c - create a per-process timer. */ +#include #include #include #include @@ -13,10 +14,6 @@ #ifdef __NR_timer_create -#ifndef offsetof -# define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER) -#endif - #define __NR___syscall_timer_create __NR_timer_create static __inline__ _syscall3(int, __syscall_timer_create, clockid_t, clock_id, struct sigevent *, evp, kernel_timer_t *, ktimerid); -- 1.7.3.4 From ps.m at gmx.net Wed Apr 20 10:50:38 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Wed, 20 Apr 2011 12:50:38 +0200 Subject: [git commit ldso-future] sched_setaffinity.c: make use of the syscall Message-ID: <20110421232918.41209827CF@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=9257584932820cef82712a6c1b3e158fd9784c98 branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/ldso-future Fix arg type (const missing). Reorganize a bit. Signed-off-by: Peter S. Mazinger --- libc/sysdeps/linux/common/sched_setaffinity.c | 26 +++++++++--------------- 1 files changed, 10 insertions(+), 16 deletions(-) diff --git a/libc/sysdeps/linux/common/sched_setaffinity.c b/libc/sysdeps/linux/common/sched_setaffinity.c index 980c441..e239cd7 100644 --- a/libc/sysdeps/linux/common/sched_setaffinity.c +++ b/libc/sysdeps/linux/common/sched_setaffinity.c @@ -16,22 +16,17 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -#include -#ifdef __USE_GNU - -#include -#include #include -#include -#include -#include -#include - -#if defined __NR_sched_setaffinity -#define __NR___syscall_sched_setaffinity __NR_sched_setaffinity -static __inline__ _syscall3(int, __syscall_sched_setaffinity, __kernel_pid_t, pid, - size_t, cpusetsize, cpu_set_t *, cpuset) +#if defined __NR_sched_setaffinity && defined __USE_GNU +# include +# include +# include +# include +# include +# define __NR___syscall_sched_setaffinity __NR_sched_setaffinity +static __always_inline _syscall3(int, __syscall_sched_setaffinity, __kernel_pid_t, pid, + size_t, cpusetsize, const cpu_set_t *, cpuset) static size_t __kernel_cpumask_size; @@ -68,7 +63,6 @@ int sched_setaffinity(pid_t pid, size_t cpusetsize, const cpu_set_t *cpuset) return -1; } - return INLINE_SYSCALL (sched_setaffinity, 3, pid, cpusetsize, cpuset); + return __syscall_sched_setaffinity(pid, cpusetsize, cpuset); } #endif -#endif /* __USE_GNU */ -- 1.7.3.4 From ps.m at gmx.net Wed Apr 20 10:50:38 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Wed, 20 Apr 2011 12:50:38 +0200 Subject: [git commit ldso-future] rename.c: simplify code, include only necessary headers Message-ID: <20110421232918.1E0E0827CF@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=1a2392564cd59934f7b72ff36202138ba1cbd59a branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/ldso-future Signed-off-by: Peter S. Mazinger --- libc/sysdeps/linux/common/rename.c | 13 +------------ 1 files changed, 1 insertions(+), 12 deletions(-) diff --git a/libc/sysdeps/linux/common/rename.c b/libc/sysdeps/linux/common/rename.c index 9d8397a..6183cf4 100644 --- a/libc/sysdeps/linux/common/rename.c +++ b/libc/sysdeps/linux/common/rename.c @@ -8,17 +8,6 @@ */ #include -#include -#include -#include #include -#define __NR___syscall_rename __NR_rename -static __inline__ _syscall2(int, __syscall_rename, const char *, oldpath, - const char *, newpath) - -int rename(const char * oldpath, const char * newpath) -{ - return __syscall_rename(oldpath, newpath); -} - +_syscall2(int, rename, const char *, oldpath, const char *, newpath) -- 1.7.3.4 From ps.m at gmx.net Wed Apr 20 10:50:38 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Wed, 20 Apr 2011 12:50:38 +0200 Subject: [git commit ldso-future] sched_getaffinity.c: mark syscall as __always_inline Message-ID: <20110421232918.65501827CF@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=bde9e813b4cb4e43d838cb06d91736ba8f678ce0 branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/ldso-future Reorganize a bit. Signed-off-by: Peter S. Mazinger --- libc/sysdeps/linux/common/sched_getaffinity.c | 21 ++++++++------------- 1 files changed, 8 insertions(+), 13 deletions(-) diff --git a/libc/sysdeps/linux/common/sched_getaffinity.c b/libc/sysdeps/linux/common/sched_getaffinity.c index 8982582..0854516 100644 --- a/libc/sysdeps/linux/common/sched_getaffinity.c +++ b/libc/sysdeps/linux/common/sched_getaffinity.c @@ -16,20 +16,16 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -#include -#ifdef __USE_GNU - -#include -#include #include -#include -#include - -#if defined __NR_sched_getaffinity -#define __NR___syscall_sched_getaffinity __NR_sched_getaffinity -static __inline__ _syscall3(int, __syscall_sched_getaffinity, __kernel_pid_t, pid, - size_t, cpusetsize, cpu_set_t *, cpuset) +#if defined __NR_sched_getaffinity && defined __USE_GNU +# include +# include +# include +# include +# define __NR___syscall_sched_getaffinity __NR_sched_getaffinity +static __always_inline _syscall3(int, __syscall_sched_getaffinity, __kernel_pid_t, pid, + size_t, cpusetsize, cpu_set_t *, cpuset) int sched_getaffinity(pid_t pid, size_t cpusetsize, cpu_set_t *cpuset) { @@ -45,4 +41,3 @@ int sched_getaffinity(pid_t pid, size_t cpusetsize, cpu_set_t *cpuset) return res; } #endif -#endif -- 1.7.3.4 From ps.m at gmx.net Wed Apr 20 10:50:38 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Wed, 20 Apr 2011 12:50:38 +0200 Subject: [git commit ldso-future] correct sendfile for 32/64 bit archs Message-ID: <20110421232918.A968482962@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=431412f98981dc5ff84a13418d3333c48586f1ac branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/ldso-future Signed-off-by: Peter S. Mazinger --- libc/sysdeps/linux/common/sendfile.c | 5 +++-- libc/sysdeps/linux/common/sendfile64.c | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/libc/sysdeps/linux/common/sendfile.c b/libc/sysdeps/linux/common/sendfile.c index 80f2e2e..64c200e 100644 --- a/libc/sysdeps/linux/common/sendfile.c +++ b/libc/sysdeps/linux/common/sendfile.c @@ -11,9 +11,10 @@ #ifdef __NR_sendfile # include +# include _syscall4(ssize_t, sendfile, int, out_fd, int, in_fd, __off_t *, offset, size_t, count) -# if ! defined __NR_sendfile64 && defined __UCLIBC_HAS_LFS__ -strong_alias(sendfile,sendfile64) +# if defined __UCLIBC_HAS_LFS__ && (!defined __NR_sendfile64 || __WORDSIZE == 64) +strong_alias_untyped(sendfile,sendfile64) # endif #endif diff --git a/libc/sysdeps/linux/common/sendfile64.c b/libc/sysdeps/linux/common/sendfile64.c index 2442b80..705e6fd 100644 --- a/libc/sysdeps/linux/common/sendfile64.c +++ b/libc/sysdeps/linux/common/sendfile64.c @@ -12,8 +12,9 @@ #include <_lfs_64.h> #include +#include -#ifdef __NR_sendfile64 +#if defined __NR_sendfile64 && __WORDSIZE != 64 # include _syscall4(ssize_t,sendfile64, int, out_fd, int, in_fd, __off64_t *, offset, size_t, count) #endif -- 1.7.3.4 From ps.m at gmx.net Wed Apr 20 10:50:38 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Wed, 20 Apr 2011 12:50:38 +0200 Subject: [git commit ldso-future] pause.c: no need for __UCLIBC_HIDE_DEPRECATED__, the code does not use old functions Message-ID: <20110421232918.C661D82962@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=8236b613d66fe3f550a21fd2b35aa7998bec88fb branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/ldso-future Remove syscall.h as well, not needed anymore. Signed-off-by: Peter S. Mazinger --- libc/sysdeps/linux/common/pause.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/libc/sysdeps/linux/common/pause.c b/libc/sysdeps/linux/common/pause.c index ab16fa7..a77c4d5 100644 --- a/libc/sysdeps/linux/common/pause.c +++ b/libc/sysdeps/linux/common/pause.c @@ -7,8 +7,8 @@ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. */ -#define __UCLIBC_HIDE_DEPRECATED__ -#include +#define __need_NULL +#include #include #ifdef __UCLIBC_HAS_THREADS_NATIVE__ -- 1.7.3.4 From ps.m at gmx.net Wed Apr 20 10:50:38 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Wed, 20 Apr 2011 12:50:38 +0200 Subject: [git commit ldso-future] setgroups.c: move around some headers, always_inline syscall Message-ID: <20110421232918.E545882962@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=c344a3557e9de9cc0585622515b6eecf924177c6 branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/ldso-future Signed-off-by: Peter S. Mazinger --- libc/sysdeps/linux/common/setgroups.c | 16 ++++++++-------- 1 files changed, 8 insertions(+), 8 deletions(-) diff --git a/libc/sysdeps/linux/common/setgroups.c b/libc/sysdeps/linux/common/setgroups.c index 72c9878..d97859f 100644 --- a/libc/sysdeps/linux/common/setgroups.c +++ b/libc/sysdeps/linux/common/setgroups.c @@ -8,12 +8,9 @@ */ #include -#include -#include -#include #ifdef __USE_BSD - +#include #if defined(__NR_setgroups32) # undef __NR_setgroups @@ -24,11 +21,14 @@ _syscall2(int, setgroups, size_t, size, const gid_t *, list) _syscall2(int, setgroups, size_t, size, const gid_t *, list) #else +# include +# include +# include +# include - -#define __NR___syscall_setgroups __NR_setgroups -static __inline__ _syscall2(int, __syscall_setgroups, - size_t, size, const __kernel_gid_t *, list) +# define __NR___syscall_setgroups __NR_setgroups +static __always_inline _syscall2(int, __syscall_setgroups, + size_t, size, const __kernel_gid_t *, list) int setgroups(size_t size, const gid_t *groups) { -- 1.7.3.4 From rep.dot.nop at gmail.com Wed Apr 20 10:50:38 2011 From: rep.dot.nop at gmail.com (Bernhard Reutner-Fischer) Date: Wed, 20 Apr 2011 12:50:38 +0200 Subject: [git commit ldso-future] buildsys: do_rm ARCH_HEADERS Message-ID: <20110421232913.7348E827CF@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=f6450b67cc92027352367be299cc28dd29cd8486 branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/ldso-future Signed-off-by: Bernhard Reutner-Fischer Patch is too large, so refusing to show it From ps.m at gmx.net Wed Apr 20 10:50:38 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Wed, 20 Apr 2011 12:50:38 +0200 Subject: [git commit ldso-future] add simplified __sigemptyset for internal use Message-ID: <20110421232914.E100A827CF@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=beb625c54e041be004019979218af09eca9cfd55 branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/ldso-future Use __sigemptyset instead of sigemptyset. Remove hidden sigemptyset. Signed-off-by: Peter S. Mazinger --- include/signal.h | 7 ++++++- libc/signal/sigempty.c | 2 -- .../nptl/sysdeps/unix/sysv/linux/timer_routines.c | 4 ++-- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/include/signal.h b/include/signal.h index a95ad15..2924c7e 100644 --- a/include/signal.h +++ b/include/signal.h @@ -255,7 +255,6 @@ typedef __sighandler_t sig_t; /* Clear all signals from SET. */ extern int sigemptyset (sigset_t *__set) __THROW __nonnull ((1)); -libc_hidden_proto(sigemptyset) /* Set all signals in SET. */ extern int sigfillset (sigset_t *__set) __THROW __nonnull ((1)); @@ -483,6 +482,12 @@ extern int __libc_current_sigrtmin (void) __THROW; /* Return number of available real-time signal with lowest priority. */ extern int __libc_current_sigrtmax (void) __THROW; +#ifdef _LIBC +/* simplified version without parameter checking */ +# include +# undef __sigemptyset +# define __sigemptyset(ss) (memset(ss, '\0', sizeof(sigset_t)), 0) +#endif #endif /* signal.h */ __END_DECLS diff --git a/libc/signal/sigempty.c b/libc/signal/sigempty.c index b4f180b..2622c08 100644 --- a/libc/signal/sigempty.c +++ b/libc/signal/sigempty.c @@ -20,7 +20,6 @@ #include #include - /* Clear all signals from SET. */ int sigemptyset (sigset_t *set) { @@ -36,4 +35,3 @@ int sigemptyset (sigset_t *set) return 0; } -libc_hidden_def(sigemptyset) diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/timer_routines.c b/libpthread/nptl/sysdeps/unix/sysv/linux/timer_routines.c index 1664af5..2f33e99 100644 --- a/libpthread/nptl/sysdeps/unix/sysv/linux/timer_routines.c +++ b/libpthread/nptl/sysdeps/unix/sysv/linux/timer_routines.c @@ -49,7 +49,7 @@ timer_sigev_thread (void *arg) surprising for user code, although valid. We unblock all signals. */ sigset_t ss; - sigemptyset (&ss); + __sigemptyset (&ss); INTERNAL_SYSCALL_DECL (err); INTERNAL_SYSCALL (rt_sigprocmask, err, 4, SIG_SETMASK, &ss, NULL, _NSIG / 8); @@ -75,7 +75,7 @@ timer_helper_thread (void *arg) /* Wait for the SIGTIMER signal, allowing the setXid signal, and none else. */ sigset_t ss; - sigemptyset (&ss); + __sigemptyset (&ss); __sigaddset (&ss, SIGTIMER); /* Endless loop of waiting for signals. The loop is only ended when -- 1.7.3.4 From ps.m at gmx.net Wed Apr 20 10:50:38 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Wed, 20 Apr 2011 12:50:38 +0200 Subject: [git commit ldso-future] handle the type mismatch of ftell[o] and fseek[o] if long int != off_t Message-ID: <20110421232915.3CD6B827CF@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=0c6c71e3733f39be7820d99216dfbdde68d33dd8 branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/ldso-future Signed-off-by: Peter S. Mazinger --- libc/stdio/fseeko.c | 2 +- libc/stdio/ftello.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/libc/stdio/fseeko.c b/libc/stdio/fseeko.c index 3caf1ac..16b0c04 100644 --- a/libc/stdio/fseeko.c +++ b/libc/stdio/fseeko.c @@ -77,5 +77,5 @@ int FSEEK(register FILE *stream, OFFSET_TYPE offset, int whence) libc_hidden_def(fseeko64) #else libc_hidden_def(fseek) -strong_alias(fseek,fseeko) +strong_alias_untyped(fseek,fseeko) #endif diff --git a/libc/stdio/ftello.c b/libc/stdio/ftello.c index e8ff365..219b699 100644 --- a/libc/stdio/ftello.c +++ b/libc/stdio/ftello.c @@ -53,5 +53,5 @@ OFFSET_TYPE FTELL(register FILE *stream) libc_hidden_def(ftello64) #else libc_hidden_def(ftell) -strong_alias(ftell,ftello) +strong_alias_untyped(ftell,ftello) #endif -- 1.7.3.4 From ps.m at gmx.net Wed Apr 20 10:50:38 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Wed, 20 Apr 2011 12:50:38 +0200 Subject: [git commit ldso-future] avoid circular dependency in lseek and llseek, providing a stub lseek Message-ID: <20110421232915.BB27B827CF@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=084cf94bfd399d6f66aaa625bfe9831cba4c7359 branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/ldso-future Signed-off-by: Peter S. Mazinger --- libc/sysdeps/linux/common/llseek.c | 15 +++++---------- libc/sysdeps/linux/common/lseek.c | 25 +++++++++++++++++++++++-- 2 files changed, 28 insertions(+), 12 deletions(-) diff --git a/libc/sysdeps/linux/common/llseek.c b/libc/sysdeps/linux/common/llseek.c index cd150ad..2181464 100644 --- a/libc/sysdeps/linux/common/llseek.c +++ b/libc/sysdeps/linux/common/llseek.c @@ -7,28 +7,23 @@ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. */ +#include <_lfs_64.h> #include -#include #include -#if defined __NR__llseek && defined __UCLIBC_HAS_LFS__ - +#ifdef __NR__llseek loff_t lseek64(int fd, loff_t offset, int whence) { loff_t result; - return (loff_t)(INLINE_SYSCALL(_llseek, 5, fd, (off_t) (offset >> 32), - (off_t) (offset & 0xffffffff), &result, whence) ?: result); + return (loff_t)INLINE_SYSCALL(_llseek, 5, fd, (off_t) (offset >> 32), + (off_t) (offset & 0xffffffff), &result, whence) ?: result; } - #else - loff_t lseek64(int fd, loff_t offset, int whence) { - return (loff_t)(lseek(fd, (off_t) (offset), whence)); + return (loff_t)lseek(fd, (off_t) (offset), whence); } - #endif - #ifndef __LINUXTHREADS_OLD__ libc_hidden_def(lseek64) #else diff --git a/libc/sysdeps/linux/common/lseek.c b/libc/sysdeps/linux/common/lseek.c index 9ff4240..1ed956e 100644 --- a/libc/sysdeps/linux/common/lseek.c +++ b/libc/sysdeps/linux/common/lseek.c @@ -12,12 +12,33 @@ #ifdef __NR_lseek _syscall3(__off_t, lseek, int, fildes, __off_t, offset, int, whence) -#else - +#elif defined __UCLIBC_HAS_LFS__ && defined __NR__llseek /* avoid circular dependency */ __off_t lseek(int fildes, __off_t offset, int whence) { return lseek64(fildes, offset, whence); } +#else +# include +__off_t lseek(int fildes, __off_t offset attribute_unused, int whence) +{ + if (fildes < 0) { + __set_errno(EBADF); + return -1; + } + + switch(whence) { + case SEEK_SET: + case SEEK_CUR: + case SEEK_END: + break; + default: + __set_errno(EINVAL); + return -1; + } + + __set_errno(ENOSYS); + return -1; +} #endif #ifndef __LINUXTHREADS_OLD__ libc_hidden_def(lseek) -- 1.7.3.4 From ps.m at gmx.net Wed Apr 20 10:50:38 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Wed, 20 Apr 2011 12:50:38 +0200 Subject: [git commit ldso-future] pivot_root.c: move prototype into guard Message-ID: <20110421232917.C47AE827CF@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=f157b90b579db6153e77e60ecb81292240f54eca branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/ldso-future Signed-off-by: Peter S. Mazinger --- libc/sysdeps/linux/common/pivot_root.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/libc/sysdeps/linux/common/pivot_root.c b/libc/sysdeps/linux/common/pivot_root.c index 0e738d5..78f71ef 100644 --- a/libc/sysdeps/linux/common/pivot_root.c +++ b/libc/sysdeps/linux/common/pivot_root.c @@ -9,7 +9,7 @@ #include -int pivot_root(const char *new_root, const char *put_old); #ifdef __NR_pivot_root +int pivot_root(const char *new_root, const char *put_old); _syscall2(int, pivot_root, const char *, new_root, const char *, put_old) #endif -- 1.7.3.4 From ps.m at gmx.net Wed Apr 20 10:50:38 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Wed, 20 Apr 2011 12:50:38 +0200 Subject: [git commit ldso-future] prctl.c: no need to include stdarg.h and extern Message-ID: <20110421232918.86436827CF@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=f93ebe521c927723f052baade0b7519aee9d2643 branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/ldso-future Signed-off-by: Peter S. Mazinger --- libc/sysdeps/linux/common/prctl.c | 3 +-- 1 files changed, 1 insertions(+), 2 deletions(-) diff --git a/libc/sysdeps/linux/common/prctl.c b/libc/sysdeps/linux/common/prctl.c index 39c0d4f..67732bb 100644 --- a/libc/sysdeps/linux/common/prctl.c +++ b/libc/sysdeps/linux/common/prctl.c @@ -8,10 +8,9 @@ */ #include -#include /* psm: including sys/prctl.h would depend on kernel headers */ #ifdef __NR_prctl -extern int prctl (int, long, long, long, long); +int prctl (int, long, long, long, long); _syscall5(int, prctl, int, option, long, _a2, long, _a3, long, _a4, long, _a5) #endif -- 1.7.3.4 From ps.m at gmx.net Wed Apr 20 10:50:38 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Wed, 20 Apr 2011 12:50:38 +0200 Subject: [git commit ldso-future] poll.c: do not inline syscall Message-ID: <20110421232917.91776827CF@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=78dbb0a651fca64a039ac0dc2edec94049cae405 branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/ldso-future While there, remove libc_hidden_protos Signed-off-by: Peter S. Mazinger --- libc/sysdeps/linux/common/poll.c | 9 ++------- 1 files changed, 2 insertions(+), 7 deletions(-) diff --git a/libc/sysdeps/linux/common/poll.c b/libc/sysdeps/linux/common/poll.c index 3895e0d..92c90da 100644 --- a/libc/sysdeps/linux/common/poll.c +++ b/libc/sysdeps/linux/common/poll.c @@ -27,13 +27,11 @@ #define SINGLE_THREAD_P 1 #endif -libc_hidden_proto(poll) - #if defined __ASSUME_POLL_SYSCALL && defined __NR_poll #define __NR___syscall_poll __NR_poll -static inline _syscall3(int, __syscall_poll, struct pollfd *, fds, - unsigned long int, nfds, int, timeout); +static _syscall3(int, __syscall_poll, struct pollfd *, fds, + unsigned long int, nfds, int, timeout); int poll(struct pollfd *fds, nfds_t nfds, int timeout) { @@ -57,9 +55,6 @@ int poll(struct pollfd *fds, nfds_t nfds, int timeout) #include #include -libc_hidden_proto(getdtablesize) -libc_hidden_proto(select) - /* uClinux 2.0 doesn't have poll, emulate it using select */ /* Poll the file descriptors described by the NFDS structures starting at -- 1.7.3.4 From ps.m at gmx.net Wed Apr 20 10:50:38 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Wed, 20 Apr 2011 12:50:38 +0200 Subject: [git commit future] i386/posix_fadvise64.S: add ret back Message-ID: <20110422002254.E996E82906@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=c3bce3df5aae1dcbea1c4eb1596827d59fb407f4 branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/future based on a patch from Timo Teraes on ml Signed-off-by: Peter S. Mazinger --- libc/sysdeps/linux/i386/posix_fadvise64.S | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) diff --git a/libc/sysdeps/linux/i386/posix_fadvise64.S b/libc/sysdeps/linux/i386/posix_fadvise64.S index 4b171c0..5470404 100644 --- a/libc/sysdeps/linux/i386/posix_fadvise64.S +++ b/libc/sysdeps/linux/i386/posix_fadvise64.S @@ -52,5 +52,8 @@ posix_fadvise64: /* Returns 0 on success, else an error code. */ negl %eax + + /* Successful; return the syscall's value. */ + ret .size posix_fadvise64,.-posix_fadvise64 #endif -- 1.7.3.4 From ps.m at gmx.net Wed Apr 20 10:50:38 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Wed, 20 Apr 2011 12:50:38 +0200 Subject: [git commit future] pread_write.c: make all archs use common code Message-ID: <20110422002255.2911482906@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=a18a6153a0c29fb4a418dc80a975b3cdd9ed450a branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/future c6x does not need own version at all Signed-off-by: Peter S. Mazinger --- libc/sysdeps/linux/c6x/Makefile.arch | 2 +- libc/sysdeps/linux/c6x/pread_write.c | 103 ---------------- libc/sysdeps/linux/mips/pread_write.c | 122 +++++-------------- libc/sysdeps/linux/powerpc/pread_write.c | 187 ++++-------------------------- libc/sysdeps/linux/sh/pread_write.c | 115 +++---------------- libc/sysdeps/linux/xtensa/pread_write.c | 189 +++-------------------------- 6 files changed, 91 insertions(+), 627 deletions(-) delete mode 100644 libc/sysdeps/linux/c6x/pread_write.c diff --git a/libc/sysdeps/linux/c6x/Makefile.arch b/libc/sysdeps/linux/c6x/Makefile.arch index 3e8dace..a7b44a7 100644 --- a/libc/sysdeps/linux/c6x/Makefile.arch +++ b/libc/sysdeps/linux/c6x/Makefile.arch @@ -5,7 +5,7 @@ # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. # -CSRC := brk.c pread_write.c syscall.c prctl.c +CSRC := brk.c syscall.c prctl.c #CSRC := SSRC := __longjmp.S bsd-_setjmp.S bsd-setjmp.S clone.S setjmp.S _vfork.S diff --git a/libc/sysdeps/linux/c6x/pread_write.c b/libc/sysdeps/linux/c6x/pread_write.c deleted file mode 100644 index f985b43..0000000 --- a/libc/sysdeps/linux/c6x/pread_write.c +++ /dev/null @@ -1,103 +0,0 @@ -/* vi: set sw=4 ts=4: - * - * Copyright (C) 2002 by Erik Andersen - * Based in part on the files - * ./sysdeps/unix/sysv/linux/pwrite.c, - * ./sysdeps/unix/sysv/linux/pread.c, - * sysdeps/posix/pread.c - * sysdeps/posix/pwrite.c - * from GNU libc 2.2.5, but reworked considerably... - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU Library General Public License as published by - * the Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License - * for more details. - * - * You should have received a copy of the GNU Library General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#define _LARGEFILE64_SOURCE -#include -#undef __OPTIMIZE__ -/* We absolutely do _NOT_ want interfaces silently - * * * renamed under us or very bad things will happen... */ -#ifdef __USE_FILE_OFFSET64 -# undef __USE_FILE_OFFSET64 -#endif - - -#include -#include -#include -#include -#include - -extern __typeof(pread) __libc_pread; -extern __typeof(pwrite) __libc_pwrite; -#ifdef __UCLIBC_HAS_LFS__ -extern __typeof(pread64) __libc_pread64; -extern __typeof(pwrite64) __libc_pwrite64; -#endif - -#ifdef __NR_pread64 /* Newer kernels renamed but it's the same. */ -# ifdef __NR_pread -# error "__NR_pread and __NR_pread64 both defined???" -# endif -# define __NR_pread __NR_pread64 -#endif - -#define __NR___syscall_pread __NR_pread -static inline _syscall5(ssize_t, __syscall_pread, int, fd, void *, buf, - size_t, count, off_t, offset_hi, off_t, offset_lo); - -ssize_t __libc_pread(int fd, void *buf, size_t count, off_t offset) -{ - return(__syscall_pread(fd,buf,count,offset,offset >> 31)); -} -weak_alias (__libc_pread, pread) - -#if defined __UCLIBC_HAS_LFS__ -ssize_t __libc_pread64(int fd, void *buf, size_t count, off64_t offset) -{ - uint32_t low = offset & 0xffffffff; - uint32_t high = offset >> 32; - return(__syscall_pread(fd, buf, count, low, high)); -} -weak_alias (__libc_pread64, pread64) -#endif /* __UCLIBC_HAS_LFS__ */ - - -#ifdef __NR_pwrite64 /* Newer kernels renamed but it's the same. */ -# ifdef __NR_pwrite -# error "__NR_pwrite and __NR_pwrite64 both defined???" -# endif -# define __NR_pwrite __NR_pwrite64 -#endif - -#define __NR___syscall_pwrite __NR_pwrite -static inline _syscall5(ssize_t, __syscall_pwrite, int, fd, const void *, buf, - size_t, count, off_t, offset_hi, off_t, offset_lo); - -ssize_t __libc_pwrite(int fd, const void *buf, size_t count, off_t offset) -{ - return(__syscall_pwrite(fd,buf,count,offset,offset >> 31)); -} -weak_alias (__libc_pwrite, pwrite) - -#if defined __UCLIBC_HAS_LFS__ -ssize_t __libc_pwrite64(int fd, const void *buf, size_t count, off64_t offset) -{ - uint32_t low = offset & 0xffffffff; - uint32_t high = offset >> 32; - return(__syscall_pwrite(fd, buf, count, low, high)); -} -weak_alias (__libc_pwrite64, pwrite64) -#endif /* __UCLIBC_HAS_LFS__ */ - diff --git a/libc/sysdeps/linux/mips/pread_write.c b/libc/sysdeps/linux/mips/pread_write.c index ea6b15f..4e1210f 100644 --- a/libc/sysdeps/linux/mips/pread_write.c +++ b/libc/sysdeps/linux/mips/pread_write.c @@ -4,112 +4,56 @@ * * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. */ -/* - * Based in part on the files - * ./sysdeps/unix/sysv/linux/pwrite.c, - * ./sysdeps/unix/sysv/linux/pread.c, - * sysdeps/posix/pread.c - * sysdeps/posix/pwrite.c - * from GNU libc 2.2.5, but reworked considerably... - */ #include #include -#include #include #include -#ifdef __NR_pread64 /* Newer kernels renamed but it's the same. */ -# ifdef __NR_pread -# error "__NR_pread and __NR_pread64 both defined???" -# endif +#ifdef __NR_pread64 # define __NR_pread __NR_pread64 #endif -extern __typeof(pread) __libc_pread; -extern __typeof(pwrite) __libc_pwrite; -#ifdef __UCLIBC_HAS_LFS__ -extern __typeof(pread64) __libc_pread64; -extern __typeof(pwrite64) __libc_pwrite64; -#endif - -#include - - #ifdef __NR_pread - -# if _MIPS_SIM == _MIPS_SIM_ABI64 -# define __NR___libc_pread __NR_pread -_syscall4(ssize_t, __libc_pread, int, fd, void *, buf, size_t, count, off_t, offset) -weak_alias (__libc_pread, pread) -# ifdef __UCLIBC_HAS_LFS__ -# define __NR___libc_pread64 __NR_pread -_syscall4(ssize_t, __libc_pread64, int, fd, void *, buf, size_t, count, off64_t, offset) -weak_alias (__libc_pread64, pread64) -# endif /* __UCLIBC_HAS_LFS__ */ +# if _MIPS_SIM == _MIPS_SIM_ABI64 /* glibc uses it for N32 as well */ +# define __NR___syscall_pread __NR_pread +static _syscall4(ssize_t, __syscall_pread, int, fd, void *, buf, size_t, count, off_t, offset) +# define MY_PREAD(fd, buf, count, offset) \ + __syscall_pread(fd, buf, count, offset) +# define MY_PREAD64(fd, buf, count, offset) \ + __syscall_pread(fd, buf, count, offset) # else /* O32 || N32 */ # define __NR___syscall_pread __NR_pread -static __inline__ _syscall6(ssize_t, __syscall_pread, int, fd, void *, buf, - size_t, count, int, dummy, off_t, offset_hi, off_t, offset_lo) - -ssize_t __libc_pread(int fd, void *buf, size_t count, off_t offset) -{ - return(__syscall_pread(fd,buf,count,0,__LONG_LONG_PAIR(offset>>31,offset))); -} -weak_alias(__libc_pread,pread) - -# ifdef __UCLIBC_HAS_LFS__ -ssize_t __libc_pread64(int fd, void *buf, size_t count, off64_t offset) -{ - uint32_t low = offset & 0xffffffff; - uint32_t high = offset >> 32; - return(__syscall_pread(fd, buf, count, 0, __LONG_LONG_PAIR (high, low))); -} -weak_alias(__libc_pread64,pread64) -# endif /* __UCLIBC_HAS_LFS__ */ -# endif /* O32 || N32 */ - -#endif /* __NR_pread */ - -/**********************************************************************/ - -#ifdef __NR_pwrite64 /* Newer kernels renamed but it's the same. */ -# ifdef __NR_pwrite -# error "__NR_pwrite and __NR_pwrite64 both defined???" +static _syscall6(ssize_t, __syscall_pread, int, fd, void *, buf, + size_t, count, int, dummy, off_t, offset_hi, off_t, offset_lo) +# define MY_PREAD(fd, buf, count, offset) + __syscall_pread(fd, buf, count, 0, OFF_HI_LO(offset)) +# define MY_PREAD64(fd, buf, count, offset) + __syscall_pread(fd, buf, count, 0, OFF64_HI_LO(offset)) # endif +#endif + +#ifdef __NR_pwrite64 # define __NR_pwrite __NR_pwrite64 #endif #ifdef __NR_pwrite - -# if _MIPS_SIM == _MIPS_SIM_ABI64 -# define __NR___libc_pwrite __NR_pwrite -_syscall4(ssize_t, __libc_pwrite, int, fd, const void *, buf, size_t, count, off_t, offset) -weak_alias (__libc_pwrite, pwrite) -# ifdef __UCLIBC_HAS_LFS__ -# define __NR___libc_pwrite64 __NR_pwrite -_syscall4(ssize_t, __libc_pwrite64, int, fd, const void *, buf, size_t, count, off64_t, offset) -weak_alias (__libc_pwrite64, pwrite64) -# endif /* __UCLIBC_HAS_LFS__ */ +# if _MIPS_SIM == _MIPS_SIM_ABI64 /* glibc uses it for N32 as well */ +# define __NR___syscall_pwrite __NR_pwrite +static _syscall4(ssize_t, __syscall_pwrite, int, fd, const void *, buf, size_t, count, off_t, offset) +# define MY_PWRITE(fd, buf, count, offset) \ + __syscall_pwrite(fd, buf, count, offset) +# define MY_PWRITE64(fd, buf, count, offset) \ + __syscall_pwrite(fd, buf, count, offset) # else /* O32 || N32 */ # define __NR___syscall_pwrite __NR_pwrite -static __inline__ _syscall6(ssize_t, __syscall_pwrite, int, fd, const void *, buf, - size_t, count, int, dummy, off_t, offset_hi, off_t, offset_lo) - -ssize_t __libc_pwrite(int fd, const void *buf, size_t count, off_t offset) -{ - return(__syscall_pwrite(fd,buf,count,0,__LONG_LONG_PAIR(offset>>31,offset))); -} -weak_alias(__libc_pwrite,pwrite) +static _syscall6(ssize_t, __syscall_pwrite, int, fd, const void *, buf, + size_t, count, int, dummy, off_t, offset_hi, off_t, offset_lo) +# define MY_PWRITE(fd, buf, count, offset) + __syscall_pwrite(fd, buf, count, 0, OFF_HI_LO(offset)) +# define MY_PWRITE64(fd, buf, count, offset) + __syscall_pwrite(fd, buf, count, 0, OFF64_HI_LO(offset)) +# endif +#endif -# ifdef __UCLIBC_HAS_LFS__ -ssize_t __libc_pwrite64(int fd, const void *buf, size_t count, off64_t offset) -{ - uint32_t low = offset & 0xffffffff; - uint32_t high = offset >> 32; - return(__syscall_pwrite(fd, buf, count, 0, __LONG_LONG_PAIR (high, low))); -} -weak_alias(__libc_pwrite64,pwrite64) -# endif /* __UCLIBC_HAS_LFS__ */ -# endif /* O32 || N32 */ -#endif /* __NR_pwrite */ +#include "../common/pread_write.c" diff --git a/libc/sysdeps/linux/powerpc/pread_write.c b/libc/sysdeps/linux/powerpc/pread_write.c index 7f988d3..dcc6967 100644 --- a/libc/sysdeps/linux/powerpc/pread_write.c +++ b/libc/sysdeps/linux/powerpc/pread_write.c @@ -1,183 +1,40 @@ -/* vi: set sw=4 ts=4: - * +/* vi: set sw=4 ts=4: */ +/* * Copyright (C) 2000-2006 Erik Andersen * * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. */ -/* Based in part on the files - * ./sysdeps/unix/sysv/linux/pwrite.c, - * ./sysdeps/unix/sysv/linux/pread.c, - * sysdeps/posix/pread.c - * sysdeps/posix/pwrite.c - * from GNU libc 2.2.5, but reworked considerably... - */ #include #include #include -#ifndef __UCLIBC_HAS_LFS__ -# define off64_t off_t +#ifdef __NR_pread64 +# define __NR_pread __NR_pread64 #endif #ifdef __NR_pread -extern __typeof(pread) __libc_pread; # define __NR___syscall_pread __NR_pread -static __inline__ _syscall6(ssize_t, __syscall_pread, int, fd, - void *, buf, size_t, count, int, dummy, off_t, offset_hi, off_t, offset_lo) - -ssize_t __libc_pread(int fd, void *buf, size_t count, off_t offset) -{ - return(__syscall_pread(fd, buf, count, 0, __LONG_LONG_PAIR(offset >> 31, offset))); -} -weak_alias(__libc_pread,pread) - -# ifdef __UCLIBC_HAS_LFS__ -extern __typeof(pread64) __libc_pread64; -ssize_t __libc_pread64(int fd, void *buf, size_t count, off64_t offset) -{ - return(__syscall_pread(fd, buf, count, 0, __LONG_LONG_PAIR(offset >> 32, offset))); -} -weak_alias(__libc_pread64,pread64) -# endif /* __UCLIBC_HAS_LFS__ */ -#endif /* __NR_pread */ +static _syscall6(ssize_t, __syscall_pread, int, fd, void *, buf, + size_t, count, int, dummy, off_t, offset_hi, off_t, offset_lo) +# define MY_PREAD(fd, buf, count, offset) \ + __syscall_pread(fd, buf, count, 0, OFF_HI_LO(offset)) +# define MY_PREAD64(fd, buf, count, offset) \ + __syscall_pread(fd, buf, count, 0, OFF64_HI_LO(offset)) +#endif +#ifdef __NR_pwrite64 +# define __NR_pwrite __NR_pwrite64 +#endif #ifdef __NR_pwrite -extern __typeof(pwrite) __libc_pwrite; # define __NR___syscall_pwrite __NR_pwrite -static __inline__ _syscall6(ssize_t, __syscall_pwrite, int, fd, - const void *, buf, size_t, count, int, dummy, off_t, offset_hi, off_t, offset_lo) - -ssize_t __libc_pwrite(int fd, const void *buf, size_t count, off_t offset) -{ - return(__syscall_pwrite(fd, buf, count, 0, __LONG_LONG_PAIR(offset >> 31, offset))); -} -weak_alias(__libc_pwrite,pwrite) - -# ifdef __UCLIBC_HAS_LFS__ -extern __typeof(pwrite64) __libc_pwrite64; -ssize_t __libc_pwrite64(int fd, const void *buf, size_t count, off64_t offset) -{ - return(__syscall_pwrite(fd, buf, count, 0, __LONG_LONG_PAIR(offset >> 32, offset))); -} -weak_alias(__libc_pwrite64,pwrite64) -# endif /* __UCLIBC_HAS_LFS__ */ -#endif /* __NR_pwrite */ - - - -#if ! defined __NR_pread || ! defined __NR_pwrite - -static ssize_t __fake_pread_write(int fd, void *buf, - size_t count, off_t offset, int do_pwrite) -{ - int save_errno; - ssize_t result; - off_t old_offset; - - /* Since we must not change the file pointer preserve the - * value so that we can restore it later. */ - if ((old_offset=lseek(fd, 0, SEEK_CUR)) == (off_t) -1) - return -1; - - /* Set to wanted position. */ - if (lseek (fd, offset, SEEK_SET) == (off_t) -1) - return -1; - - if (do_pwrite == 1) { - /* Write the data. */ - result = write(fd, buf, count); - } else { - /* Read the data. */ - result = read(fd, buf, count); - } - - /* Now we have to restore the position. If this fails we - * have to return this as an error. */ - save_errno = errno; - if (lseek(fd, old_offset, SEEK_SET) == (off_t) -1) - { - if (result == -1) - __set_errno(save_errno); - return -1; - } - __set_errno(save_errno); - return(result); -} - -# ifdef __UCLIBC_HAS_LFS__ - -static ssize_t __fake_pread_write64(int fd, void *buf, - size_t count, off64_t offset, int do_pwrite) -{ - int save_errno; - ssize_t result; - off64_t old_offset; - - /* Since we must not change the file pointer preserve the - * value so that we can restore it later. */ - if ((old_offset=lseek64(fd, 0, SEEK_CUR)) == (off64_t) -1) - return -1; - - /* Set to wanted position. */ - if (lseek64(fd, offset, SEEK_SET) == (off64_t) -1) - return -1; - - if (do_pwrite == 1) { - /* Write the data. */ - result = write(fd, buf, count); - } else { - /* Read the data. */ - result = read(fd, buf, count); - } - - /* Now we have to restore the position. */ - save_errno = errno; - if (lseek64 (fd, old_offset, SEEK_SET) == (off64_t) -1) { - if (result == -1) - __set_errno (save_errno); - return -1; - } - __set_errno (save_errno); - return result; -} -# endif /* __UCLIBC_HAS_LFS__ */ -#endif /* ! defined __NR_pread || ! defined __NR_pwrite */ - -#ifndef __NR_pread -ssize_t __libc_pread(int fd, void *buf, size_t count, off_t offset); -ssize_t __libc_pread(int fd, void *buf, size_t count, off_t offset) -{ - return(__fake_pread_write(fd, buf, count, offset, 0)); -} -weak_alias(__libc_pread,pread) - -# ifdef __UCLIBC_HAS_LFS__ -ssize_t __libc_pread64(int fd, void *buf, size_t count, off64_t offset); -ssize_t __libc_pread64(int fd, void *buf, size_t count, off64_t offset) -{ - return(__fake_pread_write64(fd, buf, count, offset, 0)); -} -weak_alias(__libc_pread64,pread64) -# endif /* __UCLIBC_HAS_LFS__ */ -#endif /* ! __NR_pread */ - - -#ifndef __NR_pwrite -ssize_t __libc_pwrite(int fd, const void *buf, size_t count, off_t offset); -ssize_t __libc_pwrite(int fd, const void *buf, size_t count, off_t offset) -{ - return(__fake_pread_write(fd, (void*)buf, count, offset, 1)); -} -weak_alias(__libc_pwrite,pwrite) +static _syscall6(ssize_t, __syscall_pwrite, int, fd, const void *, buf, + size_t, count, int, dummy, off_t, offset_hi, off_t, offset_lo) +# define MY_PWRITE(fd, buf, count, offset) \ + __syscall_pwrite(fd, buf, count, 0, OFF_HI_LO(offset)) +# define MY_PWRITE64(fd, buf, count, offset) \ + __syscall_pwrite(fd, buf, count, 0, OFF64_HI_LO(offset)) +#endif -# ifdef __UCLIBC_HAS_LFS__ -ssize_t __libc_pwrite64(int fd, const void *buf, size_t count, off64_t offset); -ssize_t __libc_pwrite64(int fd, const void *buf, size_t count, off64_t offset) -{ - return(__fake_pread_write64(fd, (void*)buf, count, offset, 1)); -} -weak_alias(__libc_pwrite64,pwrite64) -# endif /* __UCLIBC_HAS_LFS__ */ -#endif /* ! __NR_pwrite */ +#include "../common/pread_write.c" diff --git a/libc/sysdeps/linux/sh/pread_write.c b/libc/sysdeps/linux/sh/pread_write.c index 86feb9c..dcc6967 100644 --- a/libc/sysdeps/linux/sh/pread_write.c +++ b/libc/sysdeps/linux/sh/pread_write.c @@ -4,122 +4,37 @@ * * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. */ -/* - * Based in part on the files - * ./sysdeps/unix/sysv/linux/pwrite.c, - * ./sysdeps/unix/sysv/linux/pread.c, - * sysdeps/posix/pread.c - * sysdeps/posix/pwrite.c - * from GNU libc 2.2.5, but reworked considerably... - */ #include #include -#include #include -#ifdef __UCLIBC_HAS_THREADS_NATIVE__ -#include -#else -#define SINGLE_THREAD_P 1 -#endif - - -#ifdef __NR_pread64 /* Newer kernels renamed but it's the same. */ -# ifdef __NR_pread -# error "__NR_pread and __NR_pread64 both defined???" -# endif +#ifdef __NR_pread64 # define __NR_pread __NR_pread64 #endif #ifdef __NR_pread -extern __typeof(pread) __libc_pread; # define __NR___syscall_pread __NR_pread -static __inline__ _syscall6(ssize_t, __syscall_pread, int, fd, void *, buf, - size_t, count, int, dummy, off_t, offset_hi, off_t, offset_lo) - -ssize_t __libc_pread(int fd, void *buf, size_t count, off_t offset) -{ - if (SINGLE_THREAD_P) - return(__syscall_pread(fd,buf,count,0,__LONG_LONG_PAIR(offset >> 31,offset))); - -#ifdef __UCLIBC_HAS_THREADS_NATIVE__ - int oldtype = LIBC_CANCEL_ASYNC (); - ssize_t result = __syscall_pread(fd,buf,count,0,__LONG_LONG_PAIR(offset >> 31,offset)); - LIBC_CANCEL_RESET (oldtype); - return result; -#endif -} -weak_alias(__libc_pread,pread) - -# ifdef __UCLIBC_HAS_LFS__ -extern __typeof(pread64) __libc_pread64; -ssize_t __libc_pread64(int fd, void *buf, size_t count, off64_t offset) -{ - uint32_t low = offset & 0xffffffff; - uint32_t high = offset >> 32; - - if (SINGLE_THREAD_P) - return __syscall_pread(fd, buf, count, 0, __LONG_LONG_PAIR (high, low)); - -#ifdef __UCLIBC_HAS_THREADS_NATIVE__ - int oldtype = LIBC_CANCEL_ASYNC (); - ssize_t result = __syscall_pread(fd, buf, count, 0, __LONG_LONG_PAIR (high, low)); - LIBC_CANCEL_RESET (oldtype); - return result; +static _syscall6(ssize_t, __syscall_pread, int, fd, void *, buf, + size_t, count, int, dummy, off_t, offset_hi, off_t, offset_lo) +# define MY_PREAD(fd, buf, count, offset) \ + __syscall_pread(fd, buf, count, 0, OFF_HI_LO(offset)) +# define MY_PREAD64(fd, buf, count, offset) \ + __syscall_pread(fd, buf, count, 0, OFF64_HI_LO(offset)) #endif -} -weak_alias(__libc_pread64,pread64) -# endif /* __UCLIBC_HAS_LFS__ */ -#endif /* __NR_pread */ - -/**********************************************************************/ -#ifdef __NR_pwrite64 /* Newer kernels renamed but it's the same. */ -# ifdef __NR_pwrite -# error "__NR_pwrite and __NR_pwrite64 both defined???" -# endif +#ifdef __NR_pwrite64 # define __NR_pwrite __NR_pwrite64 #endif #ifdef __NR_pwrite -extern __typeof(pwrite) __libc_pwrite; # define __NR___syscall_pwrite __NR_pwrite -static __inline__ _syscall6(ssize_t, __syscall_pwrite, int, fd, const void *, buf, - size_t, count, int, dummy, off_t, offset_hi, off_t, offset_lo) - -ssize_t __libc_pwrite(int fd, const void *buf, size_t count, off_t offset) -{ - if (SINGLE_THREAD_P) - return __syscall_pwrite(fd,buf,count,0,__LONG_LONG_PAIR(offset >> 31,offset)); - -#ifdef __UCLIBC_HAS_THREADS_NATIVE__ - int oldtype = LIBC_CANCEL_ASYNC (); - ssize_t result = __syscall_pwrite(fd,buf,count,0,__LONG_LONG_PAIR(offset >> 31,offset)); - LIBC_CANCEL_RESET (oldtype); - return result; +static _syscall6(ssize_t, __syscall_pwrite, int, fd, const void *, buf, + size_t, count, int, dummy, off_t, offset_hi, off_t, offset_lo) +# define MY_PWRITE(fd, buf, count, offset) \ + __syscall_pwrite(fd, buf, count, 0, OFF_HI_LO(offset)) +# define MY_PWRITE64(fd, buf, count, offset) \ + __syscall_pwrite(fd, buf, count, 0, OFF64_HI_LO(offset)) #endif -} -weak_alias(__libc_pwrite,pwrite) - -# ifdef __UCLIBC_HAS_LFS__ -extern __typeof(pwrite64) __libc_pwrite64; -ssize_t __libc_pwrite64(int fd, const void *buf, size_t count, off64_t offset) -{ - uint32_t low = offset & 0xffffffff; - uint32_t high = offset >> 32; - - if (SINGLE_THREAD_P) - return __syscall_pwrite(fd, buf, count, 0, __LONG_LONG_PAIR (high, low)); - -#ifdef __UCLIBC_HAS_THREADS_NATIVE__ - int oldtype = LIBC_CANCEL_ASYNC (); - ssize_t result = __syscall_pwrite(fd, buf, count, 0, __LONG_LONG_PAIR (high, low)); - LIBC_CANCEL_RESET (oldtype); - return result; -#endif -} -weak_alias(__libc_pwrite64,pwrite64) -# endif /* __UCLIBC_HAS_LFS__ */ -#endif /* __NR_pwrite */ +#include "../common/pread_write.c" diff --git a/libc/sysdeps/linux/xtensa/pread_write.c b/libc/sysdeps/linux/xtensa/pread_write.c index 71ba22b..dcc6967 100644 --- a/libc/sysdeps/linux/xtensa/pread_write.c +++ b/libc/sysdeps/linux/xtensa/pread_write.c @@ -4,186 +4,37 @@ * * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. */ -/* - * Based in part on the files - * ./sysdeps/unix/sysv/linux/pwrite.c, - * ./sysdeps/unix/sysv/linux/pread.c, - * sysdeps/posix/pread.c - * sysdeps/posix/pwrite.c - * from GNU libc 2.2.5, but reworked considerably... - */ #include #include -#include #include -extern __typeof(pread) __libc_pread; -extern __typeof(pwrite) __libc_pwrite; -#ifdef __UCLIBC_HAS_LFS__ -extern __typeof(pread64) __libc_pread64; -extern __typeof(pwrite64) __libc_pwrite64; +#ifdef __NR_pread64 +# define __NR_pread __NR_pread64 #endif -#include - #ifdef __NR_pread - # define __NR___syscall_pread __NR_pread -/* On Xtensa, 64-bit values are aligned in even/odd register pairs. */ -static __inline__ _syscall6(ssize_t, __syscall_pread, int, fd, void *, buf, - size_t, count, int, pad, off_t, offset_hi, off_t, offset_lo) - -ssize_t __libc_pread(int fd, void *buf, size_t count, off_t offset) -{ - return __syscall_pread(fd, buf, count, 0, __LONG_LONG_PAIR(offset >> 31, offset)); -} -weak_alias(__libc_pread,pread) - -# ifdef __UCLIBC_HAS_LFS__ -ssize_t __libc_pread64(int fd, void *buf, size_t count, off64_t offset) -{ - uint32_t low = offset & 0xffffffff; - uint32_t high = offset >> 32; - return __syscall_pread(fd, buf, count, 0, __LONG_LONG_PAIR(high, low)); -} -weak_alias(__libc_pread64,pread64) -# endif /* __UCLIBC_HAS_LFS__ */ +static _syscall6(ssize_t, __syscall_pread, int, fd, void *, buf, + size_t, count, int, dummy, off_t, offset_hi, off_t, offset_lo) +# define MY_PREAD(fd, buf, count, offset) \ + __syscall_pread(fd, buf, count, 0, OFF_HI_LO(offset)) +# define MY_PREAD64(fd, buf, count, offset) \ + __syscall_pread(fd, buf, count, 0, OFF64_HI_LO(offset)) +#endif -#endif /* __NR_pread */ +#ifdef __NR_pwrite64 +# define __NR_pwrite __NR_pwrite64 +#endif #ifdef __NR_pwrite - # define __NR___syscall_pwrite __NR_pwrite -/* On Xtensa, 64-bit values are aligned in even/odd register pairs. */ -static __inline__ _syscall6(ssize_t, __syscall_pwrite, int, fd, const void *, buf, - size_t, count, int, pad, off_t, offset_hi, off_t, offset_lo) - -ssize_t __libc_pwrite(int fd, const void *buf, size_t count, off_t offset) -{ - return __syscall_pwrite(fd, buf, count, 0, __LONG_LONG_PAIR(offset >> 31, offset)); -} -weak_alias(__libc_pwrite,pwrite) - -# ifdef __UCLIBC_HAS_LFS__ -ssize_t __libc_pwrite64(int fd, const void *buf, size_t count, off64_t offset) -{ - uint32_t low = offset & 0xffffffff; - uint32_t high = offset >> 32; - return __syscall_pwrite(fd, buf, count, 0, __LONG_LONG_PAIR(high, low)); -} -weak_alias(__libc_pwrite64,pwrite64) -# endif /* __UCLIBC_HAS_LFS__ */ -#endif /* __NR_pwrite */ - -#if ! defined __NR_pread || ! defined __NR_pwrite - -static ssize_t __fake_pread_write(int fd, void *buf, - size_t count, off_t offset, int do_pwrite) -{ - int save_errno; - ssize_t result; - off_t old_offset; - - /* Since we must not change the file pointer preserve the - * value so that we can restore it later. */ - if ((old_offset=lseek(fd, 0, SEEK_CUR)) == (off_t) -1) - return -1; - - /* Set to wanted position. */ - if (lseek(fd, offset, SEEK_SET) == (off_t) -1) - return -1; - - if (do_pwrite == 1) { - /* Write the data. */ - result = write(fd, buf, count); - } else { - /* Read the data. */ - result = read(fd, buf, count); - } - - /* Now we have to restore the position. If this fails we - * have to return this as an error. */ - save_errno = errno; - if (lseek(fd, old_offset, SEEK_SET) == (off_t) -1) - { - if (result == -1) - __set_errno(save_errno); - return -1; - } - __set_errno(save_errno); - return(result); -} - -# ifdef __UCLIBC_HAS_LFS__ - -static ssize_t __fake_pread_write64(int fd, void *buf, - size_t count, off64_t offset, int do_pwrite) -{ - int save_errno; - ssize_t result; - off64_t old_offset; - - /* Since we must not change the file pointer preserve the - * value so that we can restore it later. */ - if ((old_offset=lseek64(fd, 0, SEEK_CUR)) == (off64_t) -1) - return -1; - - /* Set to wanted position. */ - if (lseek64(fd, offset, SEEK_SET) == (off64_t) -1) - return -1; - - if (do_pwrite == 1) { - /* Write the data. */ - result = write(fd, buf, count); - } else { - /* Read the data. */ - result = read(fd, buf, count); - } - - /* Now we have to restore the position. */ - save_errno = errno; - if (lseek64(fd, old_offset, SEEK_SET) == (off64_t) -1) { - if (result == -1) - __set_errno (save_errno); - return -1; - } - __set_errno (save_errno); - return result; -} -# endif /* __UCLIBC_HAS_LFS__ */ -#endif /* ! defined __NR_pread || ! defined __NR_pwrite */ - -#ifndef __NR_pread -ssize_t __libc_pread(int fd, void *buf, size_t count, off_t offset) -{ - return __fake_pread_write(fd, buf, count, offset, 0); -} -weak_alias(__libc_pread,pread) - -# ifdef __UCLIBC_HAS_LFS__ -ssize_t __libc_pread64(int fd, void *buf, size_t count, off64_t offset) -{ - return __fake_pread_write64(fd, buf, count, offset, 0); -} -weak_alias(__libc_pread64,pread64) -# endif /* __UCLIBC_HAS_LFS__ */ -#endif /* ! __NR_pread */ - -#ifndef __NR_pwrite -ssize_t __libc_pwrite(int fd, const void *buf, size_t count, off_t offset) -{ - /* we won't actually be modifying the buffer, - *just cast it to get rid of warnings */ - return __fake_pread_write(fd, (void*)buf, count, offset, 1); -} -weak_alias(__libc_pwrite,pwrite) +static _syscall6(ssize_t, __syscall_pwrite, int, fd, const void *, buf, + size_t, count, int, dummy, off_t, offset_hi, off_t, offset_lo) +# define MY_PWRITE(fd, buf, count, offset) \ + __syscall_pwrite(fd, buf, count, 0, OFF_HI_LO(offset)) +# define MY_PWRITE64(fd, buf, count, offset) \ + __syscall_pwrite(fd, buf, count, 0, OFF64_HI_LO(offset)) +#endif -# ifdef __UCLIBC_HAS_LFS__ -ssize_t __libc_pwrite64(int fd, const void *buf, size_t count, off64_t offset) -{ - return __fake_pread_write64(fd, (void*)buf, count, offset, 1); -} -weak_alias(__libc_pwrite64,pwrite64) -# endif /* __UCLIBC_HAS_LFS__ */ -#endif /* ! __NR_pwrite */ +#include "../common/pread_write.c" -- 1.7.3.4 From bugzilla at busybox.net Fri Apr 22 09:43:59 2011 From: bugzilla at busybox.net (bugzilla at busybox.net) Date: Fri, 22 Apr 2011 09:43:59 +0000 (UTC) Subject: [Bug 193] main thread dies after daemon() && pthread_create() In-Reply-To: References: Message-ID: <20110422094359.B609C82972@busybox.osuosl.org> https://bugs.busybox.net/show_bug.cgi?id=193 --- Comment #19 from Oliver Metz --- The problem still occurs with uClibc-0.9.31. And I assume it will never be fixed for linuxthreads.old? -- Configure bugmail: https://bugs.busybox.net/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug. From carmelo.amoroso at st.com Fri Apr 22 10:55:43 2011 From: carmelo.amoroso at st.com (Carmelo Amoroso) Date: Fri, 22 Apr 2011 12:55:43 +0200 Subject: [git commit] libubacktrace: generic implementation based dwarf Message-ID: <20110422110504.964AD829F4@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=7b5b79f09f0bffe1fccda00d4c5cdf7a7be45413 branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/master Use the initial implementation for SH4 based on dwarf for all archs. Indeed there are not obvious reason for which it should not work in general. Signed-off-by: Carmelo Amoroso --- libubacktrace/Makefile.in | 21 ++------ libubacktrace/backtrace.c | 75 ++++++++++++++++++++++++++-- libubacktrace/sysdeps/sh/Makefile.arch | 12 ----- libubacktrace/sysdeps/sh/backtrace.c | 84 -------------------------------- 4 files changed, 74 insertions(+), 118 deletions(-) delete mode 100644 libubacktrace/sysdeps/sh/Makefile.arch delete mode 100644 libubacktrace/sysdeps/sh/backtrace.c diff --git a/libubacktrace/Makefile.in b/libubacktrace/Makefile.in index c1dd5d7..fac684e 100644 --- a/libubacktrace/Makefile.in +++ b/libubacktrace/Makefile.in @@ -18,29 +18,16 @@ libubacktrace_FULL_NAME := libubacktrace-$(VERSION).so libubacktrace_DIR := $(top_srcdir)libubacktrace libubacktrace_OUT := $(top_builddir)libubacktrace -libubacktrace_ARCH_DIR := $(libubacktrace_DIR)/sysdeps/$(TARGET_ARCH) -libubacktrace_ARCH_OUT := $(libubacktrace_OUT)/sysdeps/$(TARGET_ARCH) - --include $(libubacktrace_ARCH_DIR)/Makefile.arch libubacktrace_SRC-y := libubacktrace_SRC-$(UCLIBC_HAS_BACKTRACE) := backtrace.c backtracesyms.c backtracesymsfd.c -CFLAGS-libubacktrace/sysdeps/$(TARGET_ARCH)/ := $(CFLAGS-libubacktrace) - -# remove generic sources, if arch specific version is present -ifneq ($(strip $(libubacktrace_ARCH_SRC-y)),) -libubacktrace_SRC-y := $(filter-out $(notdir $(libubacktrace_ARCH_SRC-y)),$(libubacktrace_SRC-y)) -libubacktrace_ARCH_SRC := $(addprefix $(libubacktrace_ARCH_DIR)/,$(libubacktrace_ARCH_SRC-y)) -libubacktrace_ARCH_OBJ := $(patsubst $(libubacktrace_ARCH_DIR)/%.c,$(libubacktrace_ARCH_OUT)/%.o,$(libubacktrace_ARCH_SRC)) -endif - +# -fexections is required for backtrace to work using dwarf2 +CFLAGS-backtrace.c := -fexceptions -libubacktrace_SRC := $(addprefix $(libubacktrace_DIR)/,$(libubacktrace_SRC-y)) -libubacktrace_OBJ := $(patsubst $(libubacktrace_DIR)/%.c,$(libubacktrace_OUT)/%.o,$(libubacktrace_SRC)) -libubacktrace_SRCS := $(libubacktrace_SRC) $(libubacktrace_ARCH_SRC) -libubacktrace_OBJS := $(libubacktrace_OBJ) $(libubacktrace_ARCH_OBJ) +libubacktrace_SRCS := $(addprefix $(libubacktrace_DIR)/,$(libubacktrace_SRC-y)) +libubacktrace_OBJS := $(patsubst $(libubacktrace_DIR)/%.c,$(libubacktrace_OUT)/%.o,$(libubacktrace_SRCS)) ifeq ($(DOPIC),y) libubacktrace-a-y := $(libubacktrace_OBJS:.o=.os) diff --git a/libubacktrace/backtrace.c b/libubacktrace/backtrace.c index 8721800..18b91b1 100644 --- a/libubacktrace/backtrace.c +++ b/libubacktrace/backtrace.c @@ -4,16 +4,81 @@ * User application that wants to use backtrace needs to be * compiled with -fexceptions option and -rdynamic to get full * symbols printed. - - * Copyright (C) 2010 STMicroelectronics Ltd + * + * Copyright (C) 2009, 2010 STMicroelectronics Ltd. + * + * Author(s): Giuseppe Cavallaro + * - Initial implementation for glibc + * * Author(s): Carmelo Amoroso + * - Reworked for uClibc + * - use dlsym/dlopen from libdl + * - rewrite initialisation to not use libc_once + * - make it available in static link too * * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. * */ -#error "Arch specific implementation must be provided to properly work" -int backtrace (void **array, int size) + +#include +#include +#include +#include +#include +#include + +struct trace_arg { - return -1; + void **array; + int cnt, size; +}; + +static _Unwind_Reason_Code (*unwind_backtrace) (_Unwind_Trace_Fn, void *); +static _Unwind_Ptr (*unwind_getip) (struct _Unwind_Context *); + +static void backtrace_init (void) +{ + void *handle = dlopen ("libgcc_s.so.1", RTLD_LAZY); + + if (handle == NULL + || ((unwind_backtrace = dlsym (handle, "_Unwind_Backtrace")) == NULL) + || ((unwind_getip = dlsym (handle, "_Unwind_GetIP")) == NULL)) { + printf("libgcc_s.so.1 must be installed for backtrace to work\n"); + abort(); + } } +static _Unwind_Reason_Code +backtrace_helper (struct _Unwind_Context *ctx, void *a) +{ + struct trace_arg *arg = a; + + assert (unwind_getip != NULL); + + /* We are first called with address in the __backtrace function. Skip it. */ + if (arg->cnt != -1) + arg->array[arg->cnt] = (void *) unwind_getip (ctx); + if (++arg->cnt == arg->size) + return _URC_END_OF_STACK; + return _URC_NO_REASON; +} + +/* + * Perform stack unwinding by using the _Unwind_Backtrace. + * + * User application that wants to use backtrace needs to be + * compiled with -fexceptions option and -rdynamic to get full + * symbols printed. + */ +int backtrace (void **array, int size) +{ + struct trace_arg arg = { .array = array, .size = size, .cnt = -1 }; + + if (unwind_backtrace == NULL) + backtrace_init(); + + if (size >= 1) + unwind_backtrace (backtrace_helper, &arg); + + return arg.cnt != -1 ? arg.cnt : 0; +} diff --git a/libubacktrace/sysdeps/sh/Makefile.arch b/libubacktrace/sysdeps/sh/Makefile.arch deleted file mode 100644 index 9b0de38..0000000 --- a/libubacktrace/sysdeps/sh/Makefile.arch +++ /dev/null @@ -1,12 +0,0 @@ -# Makefile for uClibc (sh/libubacktrace) -# -# Copyright (C) 2010 STMicroelectronics Ltd -# Author: Carmelo Amoroso - -# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. -# - -libubacktrace_ARCH_SRC-y := backtrace.c - -# -fexections is required for backtrace to work using dwarf2 -CFLAGS-backtrace.c := -fexceptions diff --git a/libubacktrace/sysdeps/sh/backtrace.c b/libubacktrace/sysdeps/sh/backtrace.c deleted file mode 100644 index 18b91b1..0000000 --- a/libubacktrace/sysdeps/sh/backtrace.c +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Perform stack unwinding by using the _Unwind_Backtrace. - * - * User application that wants to use backtrace needs to be - * compiled with -fexceptions option and -rdynamic to get full - * symbols printed. - * - * Copyright (C) 2009, 2010 STMicroelectronics Ltd. - * - * Author(s): Giuseppe Cavallaro - * - Initial implementation for glibc - * - * Author(s): Carmelo Amoroso - * - Reworked for uClibc - * - use dlsym/dlopen from libdl - * - rewrite initialisation to not use libc_once - * - make it available in static link too - * - * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. - * - */ - -#include -#include -#include -#include -#include -#include - -struct trace_arg -{ - void **array; - int cnt, size; -}; - -static _Unwind_Reason_Code (*unwind_backtrace) (_Unwind_Trace_Fn, void *); -static _Unwind_Ptr (*unwind_getip) (struct _Unwind_Context *); - -static void backtrace_init (void) -{ - void *handle = dlopen ("libgcc_s.so.1", RTLD_LAZY); - - if (handle == NULL - || ((unwind_backtrace = dlsym (handle, "_Unwind_Backtrace")) == NULL) - || ((unwind_getip = dlsym (handle, "_Unwind_GetIP")) == NULL)) { - printf("libgcc_s.so.1 must be installed for backtrace to work\n"); - abort(); - } -} - -static _Unwind_Reason_Code -backtrace_helper (struct _Unwind_Context *ctx, void *a) -{ - struct trace_arg *arg = a; - - assert (unwind_getip != NULL); - - /* We are first called with address in the __backtrace function. Skip it. */ - if (arg->cnt != -1) - arg->array[arg->cnt] = (void *) unwind_getip (ctx); - if (++arg->cnt == arg->size) - return _URC_END_OF_STACK; - return _URC_NO_REASON; -} - -/* - * Perform stack unwinding by using the _Unwind_Backtrace. - * - * User application that wants to use backtrace needs to be - * compiled with -fexceptions option and -rdynamic to get full - * symbols printed. - */ -int backtrace (void **array, int size) -{ - struct trace_arg arg = { .array = array, .size = size, .cnt = -1 }; - - if (unwind_backtrace == NULL) - backtrace_init(); - - if (size >= 1) - unwind_backtrace (backtrace_helper, &arg); - - return arg.cnt != -1 ? arg.cnt : 0; -} -- 1.7.3.4 From austinf at cetoncorp.com Fri Apr 22 23:21:30 2011 From: austinf at cetoncorp.com (Austin Foxley) Date: Fri, 22 Apr 2011 16:21:30 -0700 Subject: [git commit future] nptl: remove sigaction, sigprocmask, and sigfillset from libpthread Message-ID: <20110422232253.3064D82982@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=8ab3145f396eb35d15466b0666270ba8dad69da5 branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/future Having them defined in both places was causing errors with static linking Signed-off-by: Austin Foxley --- libpthread/nptl/sysdeps/pthread/Makefile.in | 29 +------------------------- 1 files changed, 2 insertions(+), 27 deletions(-) diff --git a/libpthread/nptl/sysdeps/pthread/Makefile.in b/libpthread/nptl/sysdeps/pthread/Makefile.in index fc0c6ac..119ebd6 100644 --- a/libpthread/nptl/sysdeps/pthread/Makefile.in +++ b/libpthread/nptl/sysdeps/pthread/Makefile.in @@ -33,19 +33,12 @@ libpthread_pthread_CSRC = \ pthread_spin_init.c \ pthread_spin_unlock.c \ pt-longjmp.c \ - pt-sigaction.c \ - pt-sigfillset.c \ - pt-sigprocmask.c \ tpp.c CFLAGS-pthread = $(SSP_ALL_CFLAGS) -DNOT_IN_libc -DIS_IN_libpthread CFLAGS-pthread_barrier_wait.c = -D_GNU_SOURCE CFLAGS-pthread_spin_destroy.c = -D_GNU_SOURCE CFLAGS-pthread_spin_init.c = -D_GNU_SOURCE CFLAGS-pthread_spin_unlock.c = -D_GNU_SOURCE -CFLAGS-pt-sigaction.c = -I$(top_srcdir)libc/sysdeps/linux/$(TARGET_ARCH) \ - -I$(top_srcdir)libc/signal -CFLAGS-pt-sigfillset.c = -I$(top_srcdir)libc/signal -CFLAGS-pt-sigprocmask.c = -I$(top_srcdir)libc/sysdeps/linux/common CFLAGS-unwind-forcedunwind.c = -fexceptions -fasynchronous-unwind-tables CFLAGS-OMIT-librt-cancellation.c = -DIS_IN_libpthread @@ -55,8 +48,7 @@ CFLAGS-librt-cancellation.c = -DIS_IN_librt \ CFLAGS-rt-unwind-resume.c = -DIS_IN_librt \ -fexceptions -fasynchronous-unwind-tables -libpthread-so-y += $(patsubst %,$(libpthread_pthread_OUT)/%.oS, \ - pt-sigaction pt-sigprocmask unwind-forcedunwind) +libpthread-so-y += $(patsubst %,$(libpthread_pthread_OUT)/%.oS, unwind-forcedunwind) CFLAGS-OMIT-sigaction.c = $(CFLAGS-pthread) CFLAGS-sigaction.c = -I$(top_srcdir)libc/signal @@ -84,26 +76,9 @@ $(libpthread_pthread_OUT)/crti.S $(libpthread_pthread_OUT)/crtn.S: $(libpthread_ -e '/@_.*_PROLOG_BEGINS/,/@_.*_PROLOG_ENDS/p' \ -e '/@TRAILER_BEGINS/,$$p' $< > $@ endif -# It would have been easier to just add dummy files that include the real -# impl, but ok. -# Special rules needed since we do objdir->objdir compilation for these 3. -# First symlink them, then build them. Rob would freak out on these. Sheesh! ;) -pthread-lc-fwd = sigaction sigfillset sigprocmask -$(patsubst %,$(libpthread_pthread_OUT)/pt-%.c,$(pthread-lc-fwd)): | $(libpthread_pthread_OUT) - $(do_ln) $(call rel_srcdir)$(patsubst pt-%,$(libpthread_pthread_DIR)/%,$(@F)) $@ -$(patsubst %,$(libpthread_pthread_OUT)/pt-%.oS,$(pthread-lc-fwd)): $(libpthread_pthread_OUT)/pt-%.oS: $(libpthread_pthread_OUT)/pt-%.c - $(compile.c) -$(patsubst %,$(libpthread_pthread_OUT)/pt-%.o,$(pthread-lc-fwd)): $(libpthread_pthread_OUT)/pt-%.o: $(libpthread_pthread_OUT)/pt-%.c - $(compile.c) -ifeq ($(DOPIC),y) -$(patsubst %,$(libpthread_pthread_OUT)/pt-%.os,$(pthread-lc-fwd)): $(libpthread_pthread_OUT)/pt-%.os: $(libpthread_pthread_OUT)/pt-%.c - $(compile.c) -endif objclean-y += CLEAN_libpthread/nptl/sysdeps/pthread CLEAN_libpthread/nptl/sysdeps/pthread: $(do_rm) $(addprefix $(libpthread_pthread_OUT)/*., o os oS s S) \ - $(libpthread_pthread_OUT)/defs.h \ - $(addprefix $(libpthread_pthread_DIR)/,pt-sigaction.c \ - pt-sigfillset.c pt-sigprocmask.c) + $(libpthread_pthread_OUT)/defs.h -- 1.7.3.4 From austinf at cetoncorp.com Fri Apr 22 23:21:30 2011 From: austinf at cetoncorp.com (Austin Foxley) Date: Fri, 22 Apr 2011 16:21:30 -0700 Subject: [git commit] sparc: don't access fp registers when configured for no fpu Message-ID: <20110422232253.E6E5782982@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=542c67dd8e8b742b5dff8f8a509e5f0752ec9b25 branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/master Signed-off-by: Austin Foxley --- libc/sysdeps/linux/sparc/soft-fp/sfp-machine.h | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/libc/sysdeps/linux/sparc/soft-fp/sfp-machine.h b/libc/sysdeps/linux/sparc/soft-fp/sfp-machine.h index f121170..ecf9506 100644 --- a/libc/sysdeps/linux/sparc/soft-fp/sfp-machine.h +++ b/libc/sysdeps/linux/sparc/soft-fp/sfp-machine.h @@ -187,6 +187,7 @@ #define _FP_DECL_EX fpu_control_t _fcw +#ifdef __UCLIBC_HAS_FPU__ #define FP_INIT_ROUNDMODE \ do { \ _FPU_GETCW(_fcw); \ @@ -211,3 +212,4 @@ do { \ else \ ___Q_simulate_exceptions (_fex); \ } while (0) +#endif -- 1.7.3.4 From ps.m at gmx.net Fri Apr 22 23:21:30 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Fri, 22 Apr 2011 16:21:30 -0700 Subject: [git commit future] mips/pread_write.c: fix typo Message-ID: <20110423121957.883E682A0D@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=944ae666f4262e99ad1d98537a73f2417ec78750 branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/future Reported-by: Tony Wu Signed-off-by: Peter S. Mazinger --- libc/sysdeps/linux/mips/pread_write.c | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-) diff --git a/libc/sysdeps/linux/mips/pread_write.c b/libc/sysdeps/linux/mips/pread_write.c index 4e1210f..1174c99 100644 --- a/libc/sysdeps/linux/mips/pread_write.c +++ b/libc/sysdeps/linux/mips/pread_write.c @@ -26,9 +26,9 @@ static _syscall4(ssize_t, __syscall_pread, int, fd, void *, buf, size_t, count, # define __NR___syscall_pread __NR_pread static _syscall6(ssize_t, __syscall_pread, int, fd, void *, buf, size_t, count, int, dummy, off_t, offset_hi, off_t, offset_lo) -# define MY_PREAD(fd, buf, count, offset) +# define MY_PREAD(fd, buf, count, offset) \ __syscall_pread(fd, buf, count, 0, OFF_HI_LO(offset)) -# define MY_PREAD64(fd, buf, count, offset) +# define MY_PREAD64(fd, buf, count, offset) \ __syscall_pread(fd, buf, count, 0, OFF64_HI_LO(offset)) # endif #endif @@ -49,9 +49,9 @@ static _syscall4(ssize_t, __syscall_pwrite, int, fd, const void *, buf, size_t, # define __NR___syscall_pwrite __NR_pwrite static _syscall6(ssize_t, __syscall_pwrite, int, fd, const void *, buf, size_t, count, int, dummy, off_t, offset_hi, off_t, offset_lo) -# define MY_PWRITE(fd, buf, count, offset) +# define MY_PWRITE(fd, buf, count, offset) \ __syscall_pwrite(fd, buf, count, 0, OFF_HI_LO(offset)) -# define MY_PWRITE64(fd, buf, count, offset) +# define MY_PWRITE64(fd, buf, count, offset) \ __syscall_pwrite(fd, buf, count, 0, OFF64_HI_LO(offset)) # endif #endif -- 1.7.3.4 From ps.m at gmx.net Fri Apr 22 23:21:30 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Fri, 22 Apr 2011 16:21:30 -0700 Subject: [git commit future] close.c: fix typo s|syscall1_noerr|syscall_noerr1| Message-ID: <20110423121957.E7AF482A0D@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=7851b93550a862f4922b33c43dc9edc328319cbf branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/future Reported-by: Tony Wu Signed-off-by: Peter S. Mazinger --- libc/sysdeps/linux/common/close.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/libc/sysdeps/linux/common/close.c b/libc/sysdeps/linux/common/close.c index 2e05bd0..c26525c 100644 --- a/libc/sysdeps/linux/common/close.c +++ b/libc/sysdeps/linux/common/close.c @@ -15,7 +15,7 @@ _syscall1(int, __NC(close), int, fd) #define __NR___close_nocancel_no_status __NR_close -_syscall1_noerr(void, __close_nocancel_no_status, int, fd) +_syscall_noerr1(void, __close_nocancel_no_status, int, fd) CANCELLABLE_SYSCALL(int, close, (int fd), (fd)) lt_libc_hidden(close) -- 1.7.3.4 From ps.m at gmx.net Fri Apr 22 23:21:30 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Fri, 22 Apr 2011 16:21:30 -0700 Subject: [git commit future] lseek.c: missed to define __NR___lseek_nocancel Message-ID: <20110423121957.BA8BB82A0D@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=5eb086a0fd544f04b696f140039908653cca63c2 branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/future Reported-by: Tony Wu Signed-off-by: Peter S. Mazinger --- libc/sysdeps/linux/common/lseek.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/libc/sysdeps/linux/common/lseek.c b/libc/sysdeps/linux/common/lseek.c index ce769d3..688f2d0 100644 --- a/libc/sysdeps/linux/common/lseek.c +++ b/libc/sysdeps/linux/common/lseek.c @@ -12,6 +12,7 @@ #include #ifdef __NR_lseek +# define __NR___lseek_nocancel __NR_lseek _syscall3(off_t, __NC(lseek), int, fd, off_t, offset, int, whence) #else # include -- 1.7.3.4 From ps.m at gmx.net Fri Apr 22 23:21:30 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Fri, 22 Apr 2011 16:21:30 -0700 Subject: [git commit future] signal.h: fix typo s|libc_hidden_def|libc_hidden_proto| Message-ID: <20110423121958.22F6E82A0D@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=7b0135f776c817e1cbd3fc810491ad058a3f7180 branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/future Reported-by: Tony Wu Signed-off-by: Peter S. Mazinger --- include/signal.h | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/include/signal.h b/include/signal.h index 8c7b3cd..035d786 100644 --- a/include/signal.h +++ b/include/signal.h @@ -372,7 +372,7 @@ extern int sigtimedwait (__const sigset_t *__restrict __set, __nonnull ((1)); #ifdef _LIBC extern __typeof(sigtimedwait) __sigtimedwait_nocancel attribute_hidden; -libc_hidden_def(sigtimedwait) +libc_hidden_proto(sigtimedwait) #endif /* Send signal SIG to the process PID. Associate data in VAL with the -- 1.7.3.4 From carmelo.amoroso at st.com Fri Apr 22 23:21:30 2011 From: carmelo.amoroso at st.com (Carmelo Amoroso) Date: Fri, 22 Apr 2011 16:21:30 -0700 Subject: [git commit future] libubacktrace: generic implementation based dwarf Message-ID: <20110423225847.7E65482A12@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=7b5b79f09f0bffe1fccda00d4c5cdf7a7be45413 branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/future Use the initial implementation for SH4 based on dwarf for all archs. Indeed there are not obvious reason for which it should not work in general. Signed-off-by: Carmelo Amoroso Patch is too large, so refusing to show it From austinf at cetoncorp.com Fri Apr 22 23:21:30 2011 From: austinf at cetoncorp.com (Austin Foxley) Date: Fri, 22 Apr 2011 16:21:30 -0700 Subject: [git commit future] sparc: don't access fp registers when configured for no fpu Message-ID: <20110423225847.A16C782A12@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=542c67dd8e8b742b5dff8f8a509e5f0752ec9b25 branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/future Signed-off-by: Austin Foxley --- libc/sysdeps/linux/sparc/soft-fp/sfp-machine.h | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/libc/sysdeps/linux/sparc/soft-fp/sfp-machine.h b/libc/sysdeps/linux/sparc/soft-fp/sfp-machine.h index f121170..ecf9506 100644 --- a/libc/sysdeps/linux/sparc/soft-fp/sfp-machine.h +++ b/libc/sysdeps/linux/sparc/soft-fp/sfp-machine.h @@ -187,6 +187,7 @@ #define _FP_DECL_EX fpu_control_t _fcw +#ifdef __UCLIBC_HAS_FPU__ #define FP_INIT_ROUNDMODE \ do { \ _FPU_GETCW(_fcw); \ @@ -211,3 +212,4 @@ do { \ else \ ___Q_simulate_exceptions (_fex); \ } while (0) +#endif -- 1.7.3.4 From ps.m at gmx.net Fri Apr 22 23:21:30 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Fri, 22 Apr 2011 16:21:30 -0700 Subject: [git commit future] pselect.c: include for TIMESPEC_TO_TIMEVAL Message-ID: <20110423225848.45C6082A12@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=5b35e8d0004483ed3f0d03ee24b1caf2843d4e71 branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/future Signed-off-by: Peter S. Mazinger Patch is too large, so refusing to show it From ps.m at gmx.net Fri Apr 22 23:21:30 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Fri, 22 Apr 2011 16:21:30 -0700 Subject: [git commit future] wrapsyscall.c: add cancellable fcntl64 Message-ID: <20110423225848.962A182A21@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=a38dc722734b37a57f94cc9dc58c93c9b310bad1 branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/future Signed-off-by: Peter S. Mazinger --- libpthread/linuxthreads.old/wrapsyscall.c | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-) diff --git a/libpthread/linuxthreads.old/wrapsyscall.c b/libpthread/linuxthreads.old/wrapsyscall.c index 4e5d149..239bfe6 100644 --- a/libpthread/linuxthreads.old/wrapsyscall.c +++ b/libpthread/linuxthreads.old/wrapsyscall.c @@ -80,6 +80,12 @@ CANCELABLE_SYSCALL (int, close, (int fd), (fd)) CANCELABLE_SYSCALL_VA (int, fcntl, (int fd, int cmd, ...), (fd, cmd, va_arg (ap, long int)), cmd) +#ifdef __UCLIBC_HAS_LFS__ +/* fcntl64(2). */ +CANCELABLE_SYSCALL_VA (int, fcntl64, (int fd, int cmd, ...), + (fd, cmd, va_arg (ap, long int)), cmd) +#endif + /* fsync(2). */ CANCELABLE_SYSCALL (int, fsync, (int fd), (fd)) -- 1.7.3.4 From ps.m at gmx.net Fri Apr 22 23:21:30 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Fri, 22 Apr 2011 16:21:30 -0700 Subject: [git commit future] pause.c: add back usage of pause syscall Message-ID: <20110423225848.E7E8F82A12@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=47a9242f125fb54e0c0647381a9b54f675ea9a9d branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/future No idea why it was removed when NPTL was added, but glibc uses it as well. Signed-off-by: Peter S. Mazinger --- libc/sysdeps/linux/common/pause.c | 19 ++++++++++++++----- 1 files changed, 14 insertions(+), 5 deletions(-) diff --git a/libc/sysdeps/linux/common/pause.c b/libc/sysdeps/linux/common/pause.c index 8a4d821..32fe839 100644 --- a/libc/sysdeps/linux/common/pause.c +++ b/libc/sysdeps/linux/common/pause.c @@ -7,16 +7,24 @@ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. */ -#define __need_NULL -#include +#include #include -#include #include +#ifdef __NR_pause +/* even if it is not obvious, glibc uses the pause syscall, see syscalls.list */ +# define __NR___pause_nocancel __NR_pause +static _syscall0(int, __NC(pause)) +CANCELLABLE_SYSCALL(int, pause, (void), ()) +#else +# define __need_NULL +# include +# include + int -#ifdef __LINUXTHREADS_OLD__ +# ifdef __LINUXTHREADS_OLD__ weak_function -#endif +# endif pause(void) { sigset_t set; @@ -30,3 +38,4 @@ pause(void) } lt_strong_alias(pause) LIBC_CANCEL_HANDLED (); /* sigsuspend handles our cancellation. */ +#endif -- 1.7.3.4 From ps.m at gmx.net Fri Apr 22 23:21:30 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Fri, 22 Apr 2011 16:21:30 -0700 Subject: [git commit future] not-cancel.h: use the non-cancellable functions in libc instead of inlining code Message-ID: <20110423225848.BF75882A12@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=16f9c75a81dfdcb12ee29b51605e240526caf27b branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/future text data bss dec hex filename 272224 2298 17576 292098 47502 lib/libuClibc-0.9.32-rc3-git.so.old 271806 2298 17576 291680 47360 lib/libuClibc-0.9.32-rc3-git.so Signed-off-by: Peter S. Mazinger --- libc/sysdeps/linux/common/not-cancel.h | 29 +++++++++++++++++++++++++++++ 1 files changed, 29 insertions(+), 0 deletions(-) diff --git a/libc/sysdeps/linux/common/not-cancel.h b/libc/sysdeps/linux/common/not-cancel.h index 9418417..b3484de 100644 --- a/libc/sysdeps/linux/common/not-cancel.h +++ b/libc/sysdeps/linux/common/not-cancel.h @@ -20,6 +20,8 @@ #include +#ifdef NOT_IN_libc + /* Uncancelable open. */ #define open_not_cancel(name, flags, mode) \ INLINE_SYSCALL (open, 3, (const char *) (name), (flags), (mode)) @@ -58,3 +60,30 @@ # define waitpid_not_cancel(pid, stat_loc, options) \ INLINE_SYSCALL (wait4, 4, pid, stat_loc, options, NULL) #endif + +#else + +#include +#include +#include + +#define open_not_cancel(name, flags, mode) \ + __NC(open)(name, flags, mode) +#define open_not_cancel_2(name, flags) \ + __NC(open2)(name, flags) + +#define close_not_cancel(fd) \ + __NC(close)(fd) +#define close_not_cancel_no_status(fd) \ + __close_nocancel_no_status(fd) + +#define read_not_cancel(fd, buf, n) \ + __NC(read)(fd, buf, n) + +#define write_not_cancel(fd, buf, n) \ + __NC(write)(fd, buf, n) + +#define fcntl_not_cancel(fd, cmd, val) \ + __NC(fcntl)(fd, cmd, val) + +#endif -- 1.7.3.4 From ps.m at gmx.net Fri Apr 22 23:21:30 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Fri, 22 Apr 2011 16:21:30 -0700 Subject: [git commit future] fcntl[64]: change third argument type to long in the non-cancellable version Message-ID: <20110423225848.6EFC982A12@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=37bce80ab26018f470e98c6b58d81450d70301f0 branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/future Signed-off-by: Peter S. Mazinger --- include/fcntl.h | 4 ++-- libc/sysdeps/linux/common/__syscall_fcntl.c | 6 +++--- libc/sysdeps/linux/common/__syscall_fcntl64.c | 6 +++--- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/include/fcntl.h b/include/fcntl.h index 38b28bb..f56423d 100644 --- a/include/fcntl.h +++ b/include/fcntl.h @@ -76,7 +76,7 @@ __BEGIN_DECLS #if !defined(__USE_FILE_OFFSET64) || defined(__LP64__) extern int fcntl (int __fd, int __cmd, ...); # ifdef _LIBC -extern int __fcntl_nocancel(int, int, void *) attribute_hidden; +extern int __fcntl_nocancel(int, int, long) attribute_hidden; libc_hidden_proto(fcntl) # endif #else @@ -89,7 +89,7 @@ extern int __REDIRECT (fcntl, (int __fd, int __cmd, ...), fcntl64); #if defined(__USE_LARGEFILE64) && !defined(__LP64__) extern int fcntl64 (int __fd, int __cmd, ...); # ifdef _LIBC -extern int __fcntl64_nocancel(int, int, void *) attribute_hidden; +extern int __fcntl64_nocancel(int, int, long) attribute_hidden; libc_hidden_proto(fcntl64) # endif #endif diff --git a/libc/sysdeps/linux/common/__syscall_fcntl.c b/libc/sysdeps/linux/common/__syscall_fcntl.c index 5ae6122..77a2c37 100644 --- a/libc/sysdeps/linux/common/__syscall_fcntl.c +++ b/libc/sysdeps/linux/common/__syscall_fcntl.c @@ -14,7 +14,7 @@ #include #include -int __NC(fcntl)(int fd, int cmd, void *arg) +int __NC(fcntl)(int fd, int cmd, long arg) { #if __WORDSIZE == 32 if (cmd == F_GETLK64 || cmd == F_SETLK64 || cmd == F_SETLKW64) { @@ -32,10 +32,10 @@ int __NC(fcntl)(int fd, int cmd, void *arg) int fcntl(int fd, int cmd, ...) { va_list ap; - void *arg; + long arg; va_start (ap, cmd); - arg = va_arg (ap, void *); + arg = va_arg (ap, long); va_end (ap); if (SINGLE_THREAD_P || (cmd != F_SETLKW && cmd != F_SETLKW64)) diff --git a/libc/sysdeps/linux/common/__syscall_fcntl64.c b/libc/sysdeps/linux/common/__syscall_fcntl64.c index f84cc57..5174d8a 100644 --- a/libc/sysdeps/linux/common/__syscall_fcntl64.c +++ b/libc/sysdeps/linux/common/__syscall_fcntl64.c @@ -17,15 +17,15 @@ # include # define __NR___fcntl64_nocancel __NR_fcntl64 -_syscall3(int, __NC(fcntl64), int, fd, int, cmd, void *, arg) +_syscall3(int, __NC(fcntl64), int, fd, int, cmd, long, arg) int fcntl64(int fd, int cmd, ...) { - void *arg; + long arg; va_list list; va_start(list, cmd); - arg = va_arg(list, void *); + arg = va_arg(list, long); va_end(list); if (SINGLE_THREAD_P || (cmd != F_SETLKW64)) -- 1.7.3.4 From ps.m at gmx.net Fri Apr 22 23:21:30 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Fri, 22 Apr 2011 16:21:30 -0700 Subject: [git commit future] use open_not_cancel_2 instead of open_not_cancel Message-ID: <20110423225849.5236482A12@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=dcc400f7d839decacd25e14b21bbdaea09bf987a branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/future Signed-off-by: Peter S. Mazinger --- libc/misc/utmp/wtent.c | 2 +- libc/unistd/daemon.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/libc/misc/utmp/wtent.c b/libc/misc/utmp/wtent.c index 9725426..9b3ad50 100644 --- a/libc/misc/utmp/wtent.c +++ b/libc/misc/utmp/wtent.c @@ -40,7 +40,7 @@ static void __updwtmp(const char *wtmp_file, const struct utmp *lutmp) { int fd; - fd = open_not_cancel(wtmp_file, O_APPEND | O_WRONLY, 0); + fd = open_not_cancel_2(wtmp_file, O_APPEND | O_WRONLY); if (fd >= 0) { if (lockf(fd, F_LOCK, 0) == 0) { write_not_cancel(fd, lutmp, sizeof(struct utmp)); diff --git a/libc/unistd/daemon.c b/libc/unistd/daemon.c index 628df51..435d4f1 100644 --- a/libc/unistd/daemon.c +++ b/libc/unistd/daemon.c @@ -118,7 +118,7 @@ int daemon(int nochdir, int noclose) { struct STAT st; - if ((fd = open_not_cancel(_PATH_DEVNULL, O_RDWR, 0)) != -1 + if ((fd = open_not_cancel_2(_PATH_DEVNULL, O_RDWR)) != -1 && (__builtin_expect (FSTAT (fd, &st), 0) == 0)) { if (__builtin_expect (S_ISCHR (st.st_mode), 1) != 0) { -- 1.7.3.4 From ps.m at gmx.net Fri Apr 22 23:21:30 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Fri, 22 Apr 2011 16:21:30 -0700 Subject: [git commit future] waitpid.c: be more specific in comment about the use of wait4 syscall Message-ID: <20110423225849.82ABB82A12@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=8fdca71bf89d53b03022e07c8ede7af7a2a7fb53 branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/future Signed-off-by: Peter S. Mazinger --- libc/sysdeps/linux/common/waitpid.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/libc/sysdeps/linux/common/waitpid.c b/libc/sysdeps/linux/common/waitpid.c index b5a9b18..2309d5b 100644 --- a/libc/sysdeps/linux/common/waitpid.c +++ b/libc/sysdeps/linux/common/waitpid.c @@ -11,7 +11,7 @@ pid_t __NC(waitpid)(pid_t pid, int *wait_stat, int options) { -#if 1 /* kernel says to avoid waitpid syscall */ +#if 1 /* kernel/exit.c says to avoid waitpid syscall */ return __wait4_nocancel(pid, wait_stat, options, NULL); #else return INLINE_SYSCALL(waitpid, 3, pid, wait_stat, options); -- 1.7.3.4 From ps.m at gmx.net Fri Apr 22 23:21:30 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Fri, 22 Apr 2011 16:21:30 -0700 Subject: [git commit future] waitid.c: use __waitpid_nocancel in fallback code Message-ID: <20110423225849.B46A682A12@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=472fedc00727c954cc1de83435e66a4472d4773e branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/future Signed-off-by: Peter S. Mazinger --- libc/sysdeps/linux/common/waitid.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/libc/sysdeps/linux/common/waitid.c b/libc/sysdeps/linux/common/waitid.c index c36e63a..58f4673 100644 --- a/libc/sysdeps/linux/common/waitid.c +++ b/libc/sysdeps/linux/common/waitid.c @@ -41,7 +41,7 @@ static int __NC(waitid)(idtype_t idtype, id_t id, siginfo_t *infop, int options) } memset(infop, 0, sizeof *infop); - infop->si_pid = waitpid(id, &infop->si_status, options + infop->si_pid = __NC(waitpid)(id, &infop->si_status, options # ifdef WEXITED &~ WEXITED # endif -- 1.7.3.4 From ps.m at gmx.net Fri Apr 22 23:21:30 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Fri, 22 Apr 2011 16:21:30 -0700 Subject: [git commit future] not-cancel.h: update common version and make sure we use this one Message-ID: <20110423225849.1EECE82A12@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=affa14869750a1c5dd6791bde40c874b28af8a5b branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/future Update file (same as in NPTL). Disable unused parts, the remaining inlines will be fixed later. Copy it to include to be sure that we use this one independently of chosen threads. Signed-off-by: Peter S. Mazinger --- Makefile.in | 6 ++- libc/sysdeps/linux/common/not-cancel.h | 57 ++++++++++++++++++++++++++++++- 2 files changed, 59 insertions(+), 4 deletions(-) diff --git a/Makefile.in b/Makefile.in index 5d9ff59..5ca5fe3 100644 --- a/Makefile.in +++ b/Makefile.in @@ -99,7 +99,8 @@ ALL_HEADERS_COMMON := $(top_builddir)include/fpu_control.h \ $(top_builddir)include/jmpbuf-offsets.h \ $(top_builddir)include/jmpbuf-unwind.h \ $(top_builddir)include/dl-osinfo.h \ - $(top_builddir)include/hp-timing.h + $(top_builddir)include/hp-timing.h \ + $(top_builddir)include/not-cancel.h ALL_HEADERS_BITS_COMMON := $(addprefix $(top_builddir)include/bits/,$(HEADERS_BITS_COMMON)) ALL_HEADERS_BITS_ARCH := $(addprefix $(top_builddir)include/bits/,$(HEADERS_BITS_ARCH)) ifneq ($(TARGET_SUBARCH),) @@ -125,7 +126,7 @@ $(top_builddir)include/fpu_control.h $(top_builddir)include/jmpbuf-offsets.h $(t $(LN) -fs $(call rel_srcdir)libc/sysdeps/linux/$(TARGET_ARCH)/$(@F) $@ || \ $(LN) -fs $(call rel_srcdir)libc/sysdeps/linux/common/$(@F) $@ -$(top_builddir)include/dl-osinfo.h $(top_builddir)include/hp-timing.h: +$(top_builddir)include/dl-osinfo.h $(top_builddir)include/hp-timing.h $(top_builddir)include/not-cancel.h: $(do_ln) $(call rel_srcdir)libc/sysdeps/linux/common/$(@F) $@ $(ALL_HEADERS_BITS_COMMON): @@ -214,6 +215,7 @@ HEADERS_RM- := \ jmpbuf-offsets.h \ jmpbuf-unwind.h \ hp-timing.h \ + not-cancel.h \ _lfs_64.h \ bits/uClibc_arch_features.h \ bits/kernel_sigaction.h \ diff --git a/libc/sysdeps/linux/common/not-cancel.h b/libc/sysdeps/linux/common/not-cancel.h index b3484de..5b53eac 100644 --- a/libc/sysdeps/linux/common/not-cancel.h +++ b/libc/sysdeps/linux/common/not-cancel.h @@ -1,5 +1,5 @@ /* Uncancelable versions of cancelable interfaces. Linux version. - Copyright (C) 2003 Free Software Foundation, Inc. + Copyright (C) 2003, 2006 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper , 2003. @@ -18,19 +18,46 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ +#include #include #ifdef NOT_IN_libc /* Uncancelable open. */ +#if 0 #define open_not_cancel(name, flags, mode) \ INLINE_SYSCALL (open, 3, (const char *) (name), (flags), (mode)) +#endif #define open_not_cancel_2(name, flags) \ INLINE_SYSCALL (open, 2, (const char *) (name), (flags)) +#if 0 +/* Uncancelable openat. */ +#if !defined NOT_IN_libc || defined IS_IN_libpthread || defined IS_IN_librt +extern int __openat_nocancel (int fd, const char *fname, int oflag, + mode_t mode) attribute_hidden; +extern int __openat64_nocancel (int fd, const char *fname, int oflag, + mode_t mode) attribute_hidden; +#else +# define __openat_nocancel(fd, fname, oflag, mode) \ + openat (fd, fname, oflag, mode) +# define __openat64_nocancel(fd, fname, oflag, mode) \ + openat64 (fd, fname, oflag, mode) +#endif + +#define openat_not_cancel(fd, fname, oflag, mode) \ + __openat_nocancel (fd, fname, oflag, mode) +#define openat_not_cancel_3(fd, fname, oflag) \ + __openat_nocancel (fd, fname, oflag, 0) +#define openat64_not_cancel(fd, fname, oflag, mode) \ + __openat64_nocancel (fd, fname, oflag, mode) +#define openat64_not_cancel_3(fd, fname, oflag) \ + __openat64_nocancel (fd, fname, oflag, 0) + /* Uncancelable close. */ #define close_not_cancel(fd) \ INLINE_SYSCALL (close, 1, fd) +#endif #define close_not_cancel_no_status(fd) \ (void) ({ INTERNAL_SYSCALL_DECL (err); \ INTERNAL_SYSCALL (close, err, 1, (fd)); }) @@ -39,6 +66,7 @@ #define read_not_cancel(fd, buf, n) \ INLINE_SYSCALL (read, 3, (fd), (buf), (n)) +#if 0 /* Uncancelable write. */ #define write_not_cancel(fd, buf, n) \ INLINE_SYSCALL (write, 3, (fd), (buf), (n)) @@ -60,8 +88,33 @@ # define waitpid_not_cancel(pid, stat_loc, options) \ INLINE_SYSCALL (wait4, 4, pid, stat_loc, options, NULL) #endif +#endif -#else +/* Uncancelable pause. */ +#ifdef __NR_pause +# define pause_not_cancel() \ + INLINE_SYSCALL (pause, 0) +/*#else +# define pause_not_cancel() \ + __pause_nocancel ()*/ +#endif + +/* Uncancelable nanosleep. */ +#ifdef __NR_nanosleep +# define nanosleep_not_cancel(requested_time, remaining) \ + INLINE_SYSCALL (nanosleep, 2, requested_time, remaining) +/*#else +# define nanosleep_not_cancel(requested_time, remaining) \ + __nanosleep_nocancel (requested_time, remaining)*/ +#endif + +#if 0 +/* Uncancelable sigsuspend. */ +#define sigsuspend_not_cancel(set) \ + __sigsuspend_nocancel (set) +#endif + +#elif !defined NOT_IN_libc #include #include -- 1.7.3.4 From ps.m at gmx.net Fri Apr 22 23:21:30 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Fri, 22 Apr 2011 16:21:30 -0700 Subject: [git commit future] xstatconv.c: remove unneeded header Message-ID: <20110423225849.E04A882A12@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=fad99c421d6071fabe06037889e05b1de958c4fd branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/future Signed-off-by: Peter S. Mazinger --- libc/sysdeps/linux/common/xstatconv.c | 1 - 1 files changed, 0 insertions(+), 1 deletions(-) diff --git a/libc/sysdeps/linux/common/xstatconv.c b/libc/sysdeps/linux/common/xstatconv.c index deef392..bb4a61b 100644 --- a/libc/sysdeps/linux/common/xstatconv.c +++ b/libc/sysdeps/linux/common/xstatconv.c @@ -20,7 +20,6 @@ Modified for uClibc by Erik Andersen */ -#include #include #include #include "xstatconv.h" -- 1.7.3.4 From ps.m at gmx.net Fri Apr 22 23:21:30 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Fri, 22 Apr 2011 16:21:30 -0700 Subject: [git commit future] e1/bits/unistd.h: remove unneeded bits Message-ID: <20110423225850.4D44682A12@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=8800dfe6a880054c20a23ae00192c52932e7c5dd branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/future If an arch does not support some option, that has to be coded in Config.in Signed-off-by: Peter S. Mazinger --- libc/sysdeps/linux/e1/bits/unistd.h | 7 ------- 1 files changed, 0 insertions(+), 7 deletions(-) diff --git a/libc/sysdeps/linux/e1/bits/unistd.h b/libc/sysdeps/linux/e1/bits/unistd.h index f492b8b..9288a3a 100644 --- a/libc/sysdeps/linux/e1/bits/unistd.h +++ b/libc/sysdeps/linux/e1/bits/unistd.h @@ -378,13 +378,6 @@ type name(atype a, btype b, ctype c,dtype d, etype e, ftype f, ...) return (type)(par1); \ } -#include -/* Taken from */ -#ifndef _LIBC -/* We don't support pthreads for the moment*/ -#define __set_errno(val) ((errno) = (val)) -#endif - #if 0 #define _syscall3(type, name,atype, a , btype, b, ctype, c) \ type name(atype a, btype b, ctype c,) \ -- 1.7.3.4 From ps.m at gmx.net Fri Apr 22 23:21:30 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Fri, 22 Apr 2011 16:21:30 -0700 Subject: [git commit future] xstatconv.h: include features.h to really "see" config options Message-ID: <20110423225850.232AB82A12@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=e6e1bb0314f99d7fc3c82764da1a0472c22ebe4c branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/future Signed-off-by: Peter S. Mazinger --- libc/sysdeps/linux/common/xstatconv.h | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/libc/sysdeps/linux/common/xstatconv.h b/libc/sysdeps/linux/common/xstatconv.h index 7568da8..1522e71 100644 --- a/libc/sysdeps/linux/common/xstatconv.h +++ b/libc/sysdeps/linux/common/xstatconv.h @@ -23,6 +23,7 @@ /* Pull in whatever this particular arch's kernel thinks the kernel version of * struct stat should look like. It turns out that each arch has a different * opinion on the subject, and different kernel revs use different names... */ +#include #include extern void __xstat_conv(struct kernel_stat *kbuf, struct stat *buf) attribute_hidden; -- 1.7.3.4 From ps.m at gmx.net Fri Apr 22 23:21:30 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Fri, 22 Apr 2011 16:21:30 -0700 Subject: [git commit future] vax/statfs.h: common one is good for vax Message-ID: <20110423225850.DCCBC82A12@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=8620dff59334e4a2a7a4b5f3a3f510157a2f79b7 branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/future Signed-off-by: Peter S. Mazinger --- libc/sysdeps/linux/vax/bits/statfs.h | 61 ---------------------------------- 1 files changed, 0 insertions(+), 61 deletions(-) delete mode 100644 libc/sysdeps/linux/vax/bits/statfs.h diff --git a/libc/sysdeps/linux/vax/bits/statfs.h b/libc/sysdeps/linux/vax/bits/statfs.h deleted file mode 100644 index 31ae564..0000000 --- a/libc/sysdeps/linux/vax/bits/statfs.h +++ /dev/null @@ -1,61 +0,0 @@ -/* Copyright (C) 1997, 1998 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 of the - License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#ifndef _SYS_STATFS_H -# error "Never include directly; use instead." -#endif - -#include /* for __fsid_t and __fsblkcnt_t*/ - -struct statfs - { - int f_type; - int f_bsize; -#ifndef __USE_FILE_OFFSET64 - __fsblkcnt_t f_blocks; - __fsblkcnt_t f_bfree; - __fsblkcnt_t f_bavail; - __fsfilcnt_t f_files; - __fsfilcnt_t f_ffree; -#else - __fsblkcnt64_t f_blocks; - __fsblkcnt64_t f_bfree; - __fsblkcnt64_t f_bavail; - __fsfilcnt64_t f_files; - __fsfilcnt64_t f_ffree; -#endif - __fsid_t f_fsid; - int f_namelen; - int f_spare[6]; - }; - -#ifdef __USE_LARGEFILE64 -struct statfs64 - { - int f_type; - int f_bsize; - __fsblkcnt64_t f_blocks; - __fsblkcnt64_t f_bfree; - __fsblkcnt64_t f_bavail; - __fsfilcnt64_t f_files; - __fsfilcnt64_t f_ffree; - __fsid_t f_fsid; - int f_namelen; - int f_spare[6]; - }; -#endif -- 1.7.3.4 From ps.m at gmx.net Fri Apr 22 23:21:30 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Fri, 22 Apr 2011 16:21:30 -0700 Subject: [git commit future] vax/machine-gmon.h: remove, unneeded Message-ID: <20110423225850.AB34C82A12@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=042e0b4644f4477e7017937a40ea5570a734be50 branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/future Signed-off-by: Peter S. Mazinger --- libc/sysdeps/linux/vax/bits/machine-gmon.h | 41 ---------------------------- 1 files changed, 0 insertions(+), 41 deletions(-) delete mode 100644 libc/sysdeps/linux/vax/bits/machine-gmon.h diff --git a/libc/sysdeps/linux/vax/bits/machine-gmon.h b/libc/sysdeps/linux/vax/bits/machine-gmon.h deleted file mode 100644 index 841518f..0000000 --- a/libc/sysdeps/linux/vax/bits/machine-gmon.h +++ /dev/null @@ -1,41 +0,0 @@ -/* i386-specific implementation of profiling support. - Copyright (C) 1997, 2002 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#include - -/* We need a special version of the `mcount' function since for ix86 it - must not clobber any register. This has several reasons: - - there is a bug in gcc as of version 2.7.2.2 which prohibits the - use of profiling together with nested functions - - the ELF `fixup' function uses GCC's regparm feature - - some (future) systems might want to pass parameters in registers. */ - -/* We must not pollute the global namespace. */ -#define mcount_internal __mcount_internal - -extern void mcount_internal (u_long frompc, u_long selfpc); - -#define _MCOUNT_DECL(frompc, selfpc) \ -void __attribute__ (( regparm (2) )) mcount_internal (u_long frompc, u_long selfpc) - - -/* Define MCOUNT as empty since we have the implementation in another - file. */ -#define MCOUNT -- 1.7.3.4 From ps.m at gmx.net Fri Apr 22 23:21:30 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Fri, 22 Apr 2011 16:21:30 -0700 Subject: [git commit future] dlfcn.h: sync mips version with common one Message-ID: <20110423225850.81EEE82A12@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=f7fb991e4ec55af673475c883e3665eebe50b866 branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/future Signed-off-by: Peter S. Mazinger --- libc/sysdeps/linux/common/bits/dlfcn.h | 2 +- libc/sysdeps/linux/mips/bits/dlfcn.h | 2 ++ 2 files changed, 3 insertions(+), 1 deletions(-) diff --git a/libc/sysdeps/linux/common/bits/dlfcn.h b/libc/sysdeps/linux/common/bits/dlfcn.h index 4bfbbff..e1465f9 100644 --- a/libc/sysdeps/linux/common/bits/dlfcn.h +++ b/libc/sysdeps/linux/common/bits/dlfcn.h @@ -24,7 +24,7 @@ /* The MODE argument to `dlopen' contains one of the following: */ #define RTLD_LAZY 0x00001 /* Lazy function call binding. */ #define RTLD_NOW 0x00002 /* Immediate function call binding. */ -#if 0 /* uClibc doesnt support these */ +#if 0 /* uClibc does not support these */ #define RTLD_BINDING_MASK 0x3 /* Mask of binding time value. */ #define RTLD_NOLOAD 0x00004 /* Do not load the object. */ #define RTLD_DEEPBIND 0x00008 /* Use deep binding. */ diff --git a/libc/sysdeps/linux/mips/bits/dlfcn.h b/libc/sysdeps/linux/mips/bits/dlfcn.h index 1f054f9..7ff884c 100644 --- a/libc/sysdeps/linux/mips/bits/dlfcn.h +++ b/libc/sysdeps/linux/mips/bits/dlfcn.h @@ -25,9 +25,11 @@ /* The MODE argument to `dlopen' contains one of the following: */ #define RTLD_LAZY 0x0001 /* Lazy function call binding. */ #define RTLD_NOW 0x0002 /* Immediate function call binding. */ +#if 0 /* uClibc does not support these */ #define RTLD_BINDING_MASK 0x3 /* Mask of binding time value. */ #define RTLD_NOLOAD 0x00008 /* Do not load the object. */ #define RTLD_DEEPBIND 0x00010 /* Use deep binding. */ +#endif /* If the following bit is set in the MODE argument to `dlopen', the symbols of the loaded object and its dependencies are made -- 1.7.3.4 From ps.m at gmx.net Fri Apr 22 23:21:30 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Fri, 22 Apr 2011 16:21:30 -0700 Subject: [git commit future] exec.c: remove duplicate attribute_hidden Message-ID: <20110423225851.165C382A12@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=0f538c0f58c547c4b500f8da8700040573c7baf2 branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/future Signed-off-by: Peter S. Mazinger --- libc/unistd/exec.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/libc/unistd/exec.c b/libc/unistd/exec.c index 7d24072..6066db9 100644 --- a/libc/unistd/exec.c +++ b/libc/unistd/exec.c @@ -68,7 +68,7 @@ extern void *__exec_alloc(size_t size, int func) attribute_hidden; # ifdef L___exec_alloc -void attribute_hidden *__exec_alloc(size_t size, int func) +void *__exec_alloc(size_t size, int func) { static void *common_cache, *execvp_cache; static size_t common_size, execvp_size; -- 1.7.3.4 From ps.m at gmx.net Fri Apr 22 23:21:30 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Fri, 22 Apr 2011 16:21:30 -0700 Subject: [git commit future] sigqueue.c: do not use __libc_X name internally Message-ID: <20110423225851.A980082A12@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=cc035a5df84a1223ab7ef465884814ab021928d4 branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/future __libc_X names are intended to be used in other uClibc provided libs, but not in libc. Mark the syscall __always_inline. Signed-off-by: Peter S. Mazinger --- libc/sysdeps/linux/common/sigqueue.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/libc/sysdeps/linux/common/sigqueue.c b/libc/sysdeps/linux/common/sigqueue.c index e55d3b3..c407539 100644 --- a/libc/sysdeps/linux/common/sigqueue.c +++ b/libc/sysdeps/linux/common/sigqueue.c @@ -27,8 +27,8 @@ #ifdef __NR_rt_sigqueueinfo -# define __NR___libc_rt_sigqueueinfo __NR_rt_sigqueueinfo -static __inline__ _syscall3(int, __libc_rt_sigqueueinfo, pid_t, pid, int, sig, void*, value) +# define __NR___syscall_rt_sigqueueinfo __NR_rt_sigqueueinfo +static __always_inline _syscall3(int, __syscall_rt_sigqueueinfo, pid_t, pid, int, sig, void*, value) /* Return any pending signal or wait for one for the given time. */ int sigqueue (pid_t pid, int sig, const union sigval val) @@ -45,7 +45,7 @@ int sigqueue (pid_t pid, int sig, const union sigval val) info.si_uid = getuid (); info.si_value = val; - return __libc_rt_sigqueueinfo(pid, sig, &info); + return __syscall_rt_sigqueueinfo(pid, sig, &info); } #endif -- 1.7.3.4 From ps.m at gmx.net Fri Apr 22 23:21:30 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Fri, 22 Apr 2011 16:21:30 -0700 Subject: [git commit future] shm.c: do not use __libc_X internally Message-ID: <20110423225851.D1B6C82A12@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=9d307662ab5ebb11b4d879691877960f3a1d4740 branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/future Signed-off-by: Peter S. Mazinger --- libc/misc/sysvipc/shm.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/libc/misc/sysvipc/shm.c b/libc/misc/sysvipc/shm.c index 27e871f..ddbf839 100644 --- a/libc/misc/sysvipc/shm.c +++ b/libc/misc/sysvipc/shm.c @@ -54,13 +54,13 @@ void * shmat (int shmid, const void *shmaddr, int shmflg) #ifdef L_shmctl /* Provide operations to control over shared memory segments. */ #ifdef __NR_shmctl -#define __NR___libc_shmctl __NR_shmctl -static __inline__ _syscall3(int, __libc_shmctl, int, shmid, int, cmd, struct shmid_ds *, buf) +#define __NR___syscall_shmctl __NR_shmctl +static __always_inline _syscall3(int, __syscall_shmctl, int, shmid, int, cmd, struct shmid_ds *, buf) #endif int shmctl(int shmid, int cmd, struct shmid_ds *buf) { #ifdef __NR_shmctl - return __libc_shmctl(shmid, cmd | __IPC_64, buf); + return __syscall_shmctl(shmid, cmd | __IPC_64, buf); #else return __syscall_ipc(IPCOP_shmctl, shmid, cmd | __IPC_64, 0, buf, 0); #endif -- 1.7.3.4 From ps.m at gmx.net Fri Apr 22 23:21:30 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Fri, 22 Apr 2011 16:21:30 -0700 Subject: [git commit future] sigpause.c: provide the X/Open variant, since the BSD version is deprecated Message-ID: <20110423225851.76C4482A21@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=a03fe41a298245b0451a12eb87e74606f87b06fe branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/future Do not export __sigpause. Provide __bsd_sigpause (unprototyped) if anyone may need it. Adapt cancellation to use cancel.h. Signed-off-by: Peter S. Mazinger --- include/signal.h | 11 +++++++---- libc/signal/sigpause.c | 38 ++++++++++++-------------------------- 2 files changed, 19 insertions(+), 30 deletions(-) diff --git a/include/signal.h b/include/signal.h index 035d786..8c4a0b7 100644 --- a/include/signal.h +++ b/include/signal.h @@ -194,17 +194,20 @@ extern void psiginfo (__const siginfo_t *__pinfo, __const char *__s); This function is a cancellation point and therefore not marked with __THROW. */ -extern int __sigpause (int __sig_or_mask, int __is_sig); +/*extern int __sigpause (int __sig_or_mask, int __is_sig);*/ #ifdef __FAVOR_BSD /* Set the mask of blocked signals to MASK, wait for a signal to arrive, and then restore the mask. */ -extern int sigpause (int __mask) __THROW __attribute_deprecated__; -# define sigpause(mask) __sigpause ((mask), 0) +/*extern int sigpause (int __mask) __THROW __attribute_deprecated__; +# define sigpause(mask) __sigpause ((mask), 0)*/ +/* uClibc note: BSD sigpause is available as __bsd_sigpause. + * It is intentionally not prototyped */ #else # ifdef __USE_XOPEN /* Remove a signal from the signal mask and suspend the process. */ -# define sigpause(sig) __sigpause ((sig), 1) +extern int sigpause(int __sig); +/*# define sigpause(sig) __sigpause ((sig), 1)*/ # endif #endif diff --git a/libc/signal/sigpause.c b/libc/signal/sigpause.c index ebd7af3..63afeea 100644 --- a/libc/signal/sigpause.c +++ b/libc/signal/sigpause.c @@ -17,22 +17,16 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -#define __UCLIBC_HIDE_DEPRECATED__ -/* psm: need the BSD version of sigpause here */ -#include -#define __FAVOR_BSD #include #define __need_NULL #include -#ifdef __UCLIBC_HAS_THREADS_NATIVE__ -#include -#endif +#include #include "sigset-cvt-mask.h" /* Set the mask of blocked signals to MASK, wait for a signal to arrive, and then restore the mask. */ -static int __internal_sigpause (int sig_or_mask, int is_sig) +static int __sigpause (int sig_or_mask, int is_sig) { sigset_t set; @@ -50,29 +44,21 @@ static int __internal_sigpause (int sig_or_mask, int is_sig) /* Note the sigpause() is a cancellation point. But since we call sigsuspend() which itself is a cancellation point we do not have to do anything here. */ - return sigsuspend (&set); + /* uClibc note: not true on uClibc, we call the non-cancellable version */ + return __NC(sigsuspend)(&set); } -strong_alias(__internal_sigpause,__sigpause) -#undef sigpause +int __bsd_sigpause(int mask); +int __bsd_sigpause(int mask) +{ + return __sigpause(mask, 0); +} /* We have to provide a default version of this function since the standards demand it. The version which is a bit more reasonable is the BSD version. So make this the default. */ -int sigpause (int mask) +static int __NC(sigpause)(int sig) { -#ifdef __UCLIBC_HAS_THREADS_NATIVE__ - if (SINGLE_THREAD_P) - return __internal_sigpause (mask, 0); - - int oldtype = LIBC_CANCEL_ASYNC (); - - int result = __internal_sigpause (mask, 0); - - LIBC_CANCEL_RESET (oldtype); - - return result; -#else - return __internal_sigpause (mask, 0); -#endif + return __sigpause(sig, 1); } +CANCELLABLE_SYSCALL(int, sigpause, (int sig), (sig)) -- 1.7.3.4 From ps.m at gmx.net Fri Apr 22 23:21:30 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Fri, 22 Apr 2011 16:21:30 -0700 Subject: [git commit future] socketcalls.c: rewrite to use cancel.h Message-ID: <20110423225851.452D382A12@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=db97b8bb3859fb28e2b36934e48de90a17c06222 branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/future __socketcall.c: remove guard, we definitely need this syscall Signed-off-by: Peter S. Mazinger --- include/sys/socket.h | 10 + libc/inet/socketcalls.c | 459 ++++++++---------------------- libc/sysdeps/linux/common/__socketcall.c | 5 +- 3 files changed, 138 insertions(+), 336 deletions(-) diff --git a/include/sys/socket.h b/include/sys/socket.h index 0824fc8..dca3f0f 100644 --- a/include/sys/socket.h +++ b/include/sys/socket.h @@ -161,7 +161,10 @@ libc_hidden_proto(recv) extern ssize_t sendto (int __fd, __const void *__buf, size_t __n, int __flags, __CONST_SOCKADDR_ARG __addr, socklen_t __addr_len); +#ifdef _LIBC +extern __typeof(sendto) __sendto_nocancel attribute_hidden; libc_hidden_proto(sendto) +#endif /* Read N bytes into BUF through socket FD. If ADDR is not NULL, fill in *ADDR_LEN bytes of it with tha address of @@ -173,7 +176,10 @@ libc_hidden_proto(sendto) extern ssize_t recvfrom (int __fd, void *__restrict __buf, size_t __n, int __flags, __SOCKADDR_ARG __addr, socklen_t *__restrict __addr_len); +#ifdef _LIBC +extern __typeof(recvfrom) __recvfrom_nocancel attribute_hidden; libc_hidden_proto(recvfrom) +#endif /* Send a message described MESSAGE on socket FD. @@ -251,4 +257,8 @@ extern int isfdtype (int __fd, int __fdtype) __THROW; __END_DECLS +#ifdef _LIBC +extern int __socketcall(int, unsigned long *) attribute_hidden; +#endif + #endif /* sys/socket.h */ diff --git a/libc/inet/socketcalls.c b/libc/inet/socketcalls.c index 9f46130..4786bdc 100644 --- a/libc/inet/socketcalls.c +++ b/libc/inet/socketcalls.c @@ -4,13 +4,11 @@ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. */ -#include -#include +#include #include +#include #ifdef __NR_socketcall -extern int __socketcall(int call, unsigned long *args) attribute_hidden; - /* Various socketcall numbers */ #define SYS_SOCKET 1 #define SYS_BIND 2 @@ -31,154 +29,102 @@ extern int __socketcall(int call, unsigned long *args) attribute_hidden; #define SYS_RECVMSG 17 #endif -#ifdef __UCLIBC_HAS_THREADS_NATIVE__ -#include -#include -#else -#define SINGLE_THREAD_P 1 -#endif - #ifdef L_accept -extern __typeof(accept) __libc_accept; -#ifdef __NR_accept -#define __NR___sys_accept __NR_accept -static -_syscall3(int, __sys_accept, int, call, struct sockaddr *, addr, socklen_t *,addrlen) -int __libc_accept(int s, struct sockaddr *addr, socklen_t * addrlen) -{ - if (SINGLE_THREAD_P) - return __sys_accept(s, addr, addrlen); - -#ifdef __UCLIBC_HAS_THREADS_NATIVE__ - int oldtype = LIBC_CANCEL_ASYNC (); - int result = __sys_accept(s, addr, addrlen); - LIBC_CANCEL_RESET (oldtype); - return result; -#endif -} -#elif defined(__NR_socketcall) -int __libc_accept(int s, struct sockaddr *addr, socklen_t * addrlen) +static int __NC(accept)(int sockfd, struct sockaddr *addr, socklen_t *addrlen) { +# ifdef __NR_accept + return INLINE_SYSCALL(accept, 3, sockfd, addr, addrlen); +# else unsigned long args[3]; - args[0] = s; + args[0] = sockfd; args[1] = (unsigned long) addr; args[2] = (unsigned long) addrlen; - if (SINGLE_THREAD_P) - return __socketcall(SYS_ACCEPT, args); - -#ifdef __UCLIBC_HAS_THREADS_NATIVE__ - int oldtype = LIBC_CANCEL_ASYNC (); - int result = __socketcall(SYS_ACCEPT, args); - LIBC_CANCEL_RESET (oldtype); - return result; -#endif + return __socketcall(SYS_ACCEPT, args); +# endif } -#endif -weak_alias(__libc_accept,accept) -libc_hidden_weak(accept) +CANCELLABLE_SYSCALL(int, accept, (int sockfd, struct sockaddr *addr, socklen_t *addrlen), + (sockfd, addr, addrlen)) +lt_libc_hidden(accept) #endif #ifdef L_bind -#ifdef __NR_bind -_syscall3(int, bind, int, sockfd, const struct sockaddr *, myaddr, socklen_t, addrlen) -#elif defined(__NR_socketcall) int bind(int sockfd, const struct sockaddr *myaddr, socklen_t addrlen) { +# ifdef __NR_bind + return INLINE_SYSCALL(bind, 3, sockfd, myaddr, addrlen); +# else unsigned long args[3]; args[0] = sockfd; args[1] = (unsigned long) myaddr; args[2] = addrlen; return __socketcall(SYS_BIND, args); +# endif } -#endif libc_hidden_def(bind) #endif #ifdef L_connect -extern __typeof(connect) __libc_connect; -#ifdef __NR_connect -#define __NR___sys_connect __NR_connect -static -_syscall3(int, __sys_connect, int, sockfd, const struct sockaddr *, saddr, socklen_t, addrlen) -int __libc_connect(int sockfd, const struct sockaddr *saddr, socklen_t addrlen) -{ - if (SINGLE_THREAD_P) - return __sys_connect(sockfd, saddr, addrlen); - -#ifdef __UCLIBC_HAS_THREADS_NATIVE__ - int oldtype = LIBC_CANCEL_ASYNC (); - int result = __sys_connect(sockfd, saddr, addrlen); - LIBC_CANCEL_RESET (oldtype); - return result; -#endif -} -#elif defined(__NR_socketcall) -int __libc_connect(int sockfd, const struct sockaddr *saddr, socklen_t addrlen) +static int __NC(connect)(int sockfd, const struct sockaddr *saddr, socklen_t addrlen) { +# ifdef __NR_connect + return INLINE_SYSCALL(connect, 3, sockfd, saddr, addrlen); +# else unsigned long args[3]; args[0] = sockfd; args[1] = (unsigned long) saddr; args[2] = addrlen; - - if (SINGLE_THREAD_P) - return __socketcall(SYS_CONNECT, args); - -#ifdef __UCLIBC_HAS_THREADS_NATIVE__ - int oldtype = LIBC_CANCEL_ASYNC (); - int result = __socketcall(SYS_CONNECT, args); - LIBC_CANCEL_RESET (oldtype); - return result; -#endif + return __socketcall(SYS_CONNECT, args); +# endif } -#endif -weak_alias(__libc_connect,connect) -libc_hidden_weak(connect) +CANCELLABLE_SYSCALL(int, connect, (int sockfd, const struct sockaddr *saddr, socklen_t addrlen), + (sockfd, saddr, addrlen)) +lt_libc_hidden(connect) #endif #ifdef L_getpeername -#ifdef __NR_getpeername -_syscall3(int, getpeername, int, sockfd, struct sockaddr *, addr, socklen_t *,paddrlen) -#elif defined(__NR_socketcall) -int getpeername(int sockfd, struct sockaddr *addr, socklen_t * paddrlen) +int getpeername(int sockfd, struct sockaddr *addr, socklen_t *paddrlen) { +# ifdef __NR_getpeername + return INLINE_SYSCALL(getpeername, 3, sockfd, addr, paddrlen); +# else unsigned long args[3]; args[0] = sockfd; args[1] = (unsigned long) addr; args[2] = (unsigned long) paddrlen; return __socketcall(SYS_GETPEERNAME, args); +# endif } #endif -#endif #ifdef L_getsockname -#ifdef __NR_getsockname -_syscall3(int, getsockname, int, sockfd, struct sockaddr *, addr, socklen_t *,paddrlen) -#elif defined(__NR_socketcall) int getsockname(int sockfd, struct sockaddr *addr, socklen_t * paddrlen) { +# ifdef __NR_getsockname + return INLINE_SYSCALL(getsockname, 3, sockfd, addr, paddrlen); +# else unsigned long args[3]; args[0] = sockfd; args[1] = (unsigned long) addr; args[2] = (unsigned long) paddrlen; return __socketcall(SYS_GETSOCKNAME, args); +# endif } -#endif libc_hidden_def(getsockname) #endif #ifdef L_getsockopt -#ifdef __NR_getsockopt -_syscall5(int, getsockopt, int, fd, int, level, int, optname, __ptr_t, optval, socklen_t *, optlen) -#elif defined(__NR_socketcall) -int getsockopt(int fd, int level, int optname, __ptr_t optval, - socklen_t * optlen) +int getsockopt(int fd, int level, int optname, void *optval, + socklen_t *optlen) { +# ifdef __NR_getsockopt + return INLINE_SYSCALL(getsockopt, 5, fd, level, optname, optval, optlen); +# else unsigned long args[5]; args[0] = fd; @@ -187,101 +133,56 @@ int getsockopt(int fd, int level, int optname, __ptr_t optval, args[3] = (unsigned long) optval; args[4] = (unsigned long) optlen; return (__socketcall(SYS_GETSOCKOPT, args)); +# endif } #endif -#endif #ifdef L_listen -#ifdef __NR_listen -_syscall2(int, listen, int, sockfd, int, backlog) -#elif defined(__NR_socketcall) int listen(int sockfd, int backlog) { +# ifdef __NR_listen + return INLINE_SYSCALL(listen, 2, sockfd, backlog); +# else unsigned long args[2]; args[0] = sockfd; args[1] = backlog; return __socketcall(SYS_LISTEN, args); +# endif } -#endif libc_hidden_def(listen) #endif #ifdef L_recv -extern __typeof(recv) __libc_recv; -#ifdef __NR_recv -#define __NR___sys_recv __NR_recv -static -_syscall4(ssize_t, __sys_recv, int, sockfd, __ptr_t, buffer, size_t, len, - int, flags) -ssize_t __libc_recv(int sockfd, __ptr_t buffer, size_t len, int flags) -{ - if (SINGLE_THREAD_P) - return __sys_recv(sockfd, buffer, len, flags); - -#ifdef __UCLIBC_HAS_THREADS_NATIVE__ - int oldtype = LIBC_CANCEL_ASYNC (); - int result = __sys_recv(sockfd, buffer, len, flags); - LIBC_CANCEL_RESET (oldtype); - return result; -#endif -} -#elif defined(__NR_recvfrom) -ssize_t __libc_recv(int sockfd, __ptr_t buffer, size_t len, int flags) -{ - return (recvfrom(sockfd, buffer, len, flags, NULL, NULL)); -} -#elif defined(__NR_socketcall) -/* recv, recvfrom added by bir7 at leland.stanford.edu */ -ssize_t __libc_recv(int sockfd, __ptr_t buffer, size_t len, int flags) +static ssize_t __NC(recv)(int sockfd, void *buffer, size_t len, int flags) { +# ifdef __NR_recv + return (ssize_t)INLINE_SYSCALL(recv, 4, sockfd, buffer, len, flags); +# elif defined __NR_recvfrom && defined _syscall6 + return __NC(recvfrom)(sockfd, buffer, len, flags, NULL, NULL); +# else unsigned long args[4]; args[0] = sockfd; args[1] = (unsigned long) buffer; args[2] = len; args[3] = flags; - - if (SINGLE_THREAD_P) - return (__socketcall(SYS_RECV, args)); - -#ifdef __UCLIBC_HAS_THREADS_NATIVE__ - int oldtype = LIBC_CANCEL_ASYNC (); - int result = __socketcall(SYS_RECV, args); - LIBC_CANCEL_RESET (oldtype); - return result; -#endif + return (ssize_t)__socketcall(SYS_RECV, args); +# endif } -#endif -weak_alias(__libc_recv,recv) -libc_hidden_weak(recv) +CANCELLABLE_SYSCALL(ssize_t, recv, (int sockfd, void *buffer, size_t len, int flags), + (sockfd, buffer, len, flags)) +lt_libc_hidden(recv) #endif #ifdef L_recvfrom -extern __typeof(recvfrom) __libc_recvfrom; -#ifdef __NR_recvfrom -#define __NR___sys_recvfrom __NR_recvfrom -static -_syscall6(ssize_t, __sys_recvfrom, int, sockfd, __ptr_t, buffer, size_t, len, - int, flags, struct sockaddr *, to, socklen_t *, tolen) -ssize_t __libc_recvfrom(int sockfd, __ptr_t buffer, size_t len, int flags, - struct sockaddr *to, socklen_t * tolen) -{ - if (SINGLE_THREAD_P) - return __sys_recvfrom(sockfd, buffer, len, flags, to, tolen); - -#ifdef __UCLIBC_HAS_THREADS_NATIVE__ - int oldtype = LIBC_CANCEL_ASYNC (); - int result = __sys_recvfrom(sockfd, buffer, len, flags, to, tolen); - LIBC_CANCEL_RESET (oldtype); - return result; -#endif -} -#elif defined(__NR_socketcall) -/* recv, recvfrom added by bir7 at leland.stanford.edu */ -ssize_t __libc_recvfrom(int sockfd, __ptr_t buffer, size_t len, int flags, - struct sockaddr *to, socklen_t * tolen) +ssize_t __NC(recvfrom)(int sockfd, void *buffer, size_t len, int flags, + struct sockaddr *to, socklen_t *tolen) { +# if defined __NR_recvfrom && defined _syscall6 + return (ssize_t)INLINE_SYSCALL(recvfrom, 6, sockfd, buffer, len, + flags, to, tolen); +# else unsigned long args[6]; args[0] = sockfd; @@ -290,180 +191,82 @@ ssize_t __libc_recvfrom(int sockfd, __ptr_t buffer, size_t len, int flags, args[3] = flags; args[4] = (unsigned long) to; args[5] = (unsigned long) tolen; - - if (SINGLE_THREAD_P) - return (__socketcall(SYS_RECVFROM, args)); - -#ifdef __UCLIBC_HAS_THREADS_NATIVE__ - int oldtype = LIBC_CANCEL_ASYNC (); - int result = __socketcall(SYS_RECVFROM, args); - LIBC_CANCEL_RESET (oldtype); - return result; -#endif + return (ssize_t)__socketcall(SYS_RECVFROM, args); +# endif } -#endif -weak_alias(__libc_recvfrom,recvfrom) -libc_hidden_weak(recvfrom) +CANCELLABLE_SYSCALL(ssize_t, recvfrom, (int sockfd, void *buffer, size_t len, + int flags, struct sockaddr *to, socklen_t *tolen), + (sockfd, buffer, len, flags, to, tolen)) +lt_libc_hidden(recvfrom) #endif #ifdef L_recvmsg -extern __typeof(recvmsg) __libc_recvmsg; -#ifdef __NR_recvmsg -#define __NR___sys_recvmsg __NR_recvmsg -static -_syscall3(ssize_t, __sys_recvmsg, int, sockfd, struct msghdr *, msg, int, flags) -ssize_t __libc_recvmsg(int sockfd, struct msghdr *msg, int flags) -{ - if (SINGLE_THREAD_P) - return __sys_recvmsg(sockfd, msg, flags); - -#ifdef __UCLIBC_HAS_THREADS_NATIVE__ - int oldtype = LIBC_CANCEL_ASYNC (); - int result = __sys_recvmsg(sockfd, msg, flags); - LIBC_CANCEL_RESET (oldtype); - return result; -#endif -} -#elif defined(__NR_socketcall) -ssize_t __libc_recvmsg(int sockfd, struct msghdr *msg, int flags) +static ssize_t __NC(recvmsg)(int sockfd, struct msghdr *msg, int flags) { +# ifdef __NR_recvmsg + return (ssize_t)INLINE_SYSCALL(recvmsg, 3, sockfd, msg, flags); +# else unsigned long args[3]; args[0] = sockfd; args[1] = (unsigned long) msg; args[2] = flags; - - if (SINGLE_THREAD_P) - return (__socketcall(SYS_RECVMSG, args)); - -#ifdef __UCLIBC_HAS_THREADS_NATIVE__ - int oldtype = LIBC_CANCEL_ASYNC (); - int result = __socketcall(SYS_RECVMSG, args); - LIBC_CANCEL_RESET (oldtype); - return result; -#endif + return (ssize_t)__socketcall(SYS_RECVMSG, args); +# endif } -#endif -weak_alias(__libc_recvmsg,recvmsg) -libc_hidden_weak(recvmsg) +CANCELLABLE_SYSCALL(ssize_t, recvmsg, (int sockfd, struct msghdr *msg, int flags), + (sockfd, msg, flags)) +lt_libc_hidden(recvmsg) #endif #ifdef L_send -extern __typeof(send) __libc_send; -#ifdef __NR_send -#define __NR___sys_send __NR_send -static -_syscall4(ssize_t, __sys_send, int, sockfd, const void *, buffer, size_t, len, int, flags) -ssize_t __libc_send(int sockfd, const void *buffer, size_t len, int flags) -{ - if (SINGLE_THREAD_P) - return __sys_send(sockfd, buffer, len, flags); - -#ifdef __UCLIBC_HAS_THREADS_NATIVE__ - int oldtype = LIBC_CANCEL_ASYNC (); - int result = __sys_send(sockfd, buffer, len, flags); - LIBC_CANCEL_RESET (oldtype); - return result; -#endif -} -#elif defined(__NR_sendto) -ssize_t __libc_send(int sockfd, const void *buffer, size_t len, int flags) -{ - return (sendto(sockfd, buffer, len, flags, NULL, 0)); -} -#elif defined(__NR_socketcall) -/* send, sendto added by bir7 at leland.stanford.edu */ -ssize_t __libc_send(int sockfd, const void *buffer, size_t len, int flags) +static ssize_t __NC(send)(int sockfd, const void *buffer, size_t len, int flags) { +# ifdef __NR_send + return (ssize_t)INLINE_SYSCALL(send, 4, sockfd, buffer, len, flags); +# elif defined __NR_sendto && defined _syscall6 + return __NC(sendto)(sockfd, buffer, len, flags, NULL, 0); +# else unsigned long args[4]; args[0] = sockfd; args[1] = (unsigned long) buffer; args[2] = len; args[3] = flags; - - if (SINGLE_THREAD_P) - return (__socketcall(SYS_SEND, args)); - -#ifdef __UCLIBC_HAS_THREADS_NATIVE__ - int oldtype = LIBC_CANCEL_ASYNC (); - int result = __socketcall(SYS_SEND, args); - LIBC_CANCEL_RESET (oldtype); - return result; -#endif + return (ssize_t)__socketcall(SYS_SEND, args); +# endif } - -#endif -weak_alias(__libc_send,send) -libc_hidden_weak(send) +CANCELLABLE_SYSCALL(ssize_t, send, (int sockfd, const void *buffer, size_t len, int flags), + (sockfd, buffer, len, flags)) +lt_libc_hidden(send) #endif #ifdef L_sendmsg -extern __typeof(sendmsg) __libc_sendmsg; -#ifdef __NR_sendmsg -#define __NR___sys_sendmsg __NR_sendmsg -static -_syscall3(ssize_t, __sys_sendmsg, int, sockfd, const struct msghdr *, msg, int, flags) -ssize_t __libc_sendmsg(int sockfd, const struct msghdr *msg, int flags) -{ - if (SINGLE_THREAD_P) - return __sys_sendmsg(sockfd, msg, flags); - -#ifdef __UCLIBC_HAS_THREADS_NATIVE__ - int oldtype = LIBC_CANCEL_ASYNC (); - int result = __sys_sendmsg(sockfd, msg, flags); - LIBC_CANCEL_RESET (oldtype); - return result; -#endif -} -#elif defined(__NR_socketcall) -ssize_t __libc_sendmsg(int sockfd, const struct msghdr *msg, int flags) +static ssize_t __NC(sendmsg)(int sockfd, const struct msghdr *msg, int flags) { +# ifdef __NR_sendmsg + return (ssize_t)INLINE_SYSCALL(sendmsg, 3, sockfd, msg, flags); +# else unsigned long args[3]; args[0] = sockfd; args[1] = (unsigned long) msg; args[2] = flags; - - if (SINGLE_THREAD_P) - return (__socketcall(SYS_SENDMSG, args)); - -#ifdef __UCLIBC_HAS_THREADS_NATIVE__ - int oldtype = LIBC_CANCEL_ASYNC (); - int result = __socketcall(SYS_SENDMSG, args); - LIBC_CANCEL_RESET (oldtype); - return result; -#endif + return (ssize_t)__socketcall(SYS_SENDMSG, args); +# endif } -#endif -weak_alias(__libc_sendmsg,sendmsg) -libc_hidden_weak(sendmsg) +CANCELLABLE_SYSCALL(ssize_t, sendmsg, (int sockfd, const struct msghdr *msg, int flags), + (sockfd, msg, flags)) +lt_libc_hidden(sendmsg) #endif #ifdef L_sendto -extern __typeof(sendto) __libc_sendto; -#ifdef __NR_sendto -#define __NR___sys_sendto __NR_sendto -static -_syscall6(ssize_t, __sys_sendto, int, sockfd, const void *, buffer, - size_t, len, int, flags, const struct sockaddr *, to, socklen_t, tolen) -ssize_t __libc_sendto(int sockfd, const void *buffer, size_t len, int flags,const struct sockaddr *to, socklen_t tolen) -{ - if (SINGLE_THREAD_P) - return __sys_sendto(sockfd, buffer, len, flags, to, tolen); - -#ifdef __UCLIBC_HAS_THREADS_NATIVE__ - int oldtype = LIBC_CANCEL_ASYNC (); - int result = __sys_sendto(sockfd, buffer, len, flags, to, tolen); - LIBC_CANCEL_RESET (oldtype); - return result; -#endif -} -#elif defined(__NR_socketcall) -/* send, sendto added by bir7 at leland.stanford.edu */ -ssize_t __libc_sendto(int sockfd, const void *buffer, size_t len, int flags, - const struct sockaddr *to, socklen_t tolen) +ssize_t __NC(sendto)(int sockfd, const void *buffer, size_t len, int flags, + const struct sockaddr *to, socklen_t tolen) { +# if defined __NR_sendto && defined _syscall6 + return (ssize_t)INLINE_SYSCALL(sendto, 6, sockfd, buffer, len, flags, to, tolen); +# else unsigned long args[6]; args[0] = sockfd; @@ -472,30 +275,21 @@ ssize_t __libc_sendto(int sockfd, const void *buffer, size_t len, int flags, args[3] = flags; args[4] = (unsigned long) to; args[5] = tolen; - - if (SINGLE_THREAD_P) - return (__socketcall(SYS_SENDTO, args)); - -#ifdef __UCLIBC_HAS_THREADS_NATIVE__ - int oldtype = LIBC_CANCEL_ASYNC (); - int result = __socketcall(SYS_SENDTO, args); - LIBC_CANCEL_RESET (oldtype); - return result; -#endif + return (ssize_t)__socketcall(SYS_SENDTO, args); +# endif } -#endif -weak_alias(__libc_sendto,sendto) -libc_hidden_weak(sendto) +CANCELLABLE_SYSCALL(ssize_t, sendto, (int sockfd, const void *buffer, size_t len, + int flags, const struct sockaddr *to, socklen_t tolen), + (sockfd, buffer, len, flags, to, tolen)) +lt_libc_hidden(sendto) #endif #ifdef L_setsockopt -#ifdef __NR_setsockopt -_syscall5(int, setsockopt, int, fd, int, level, int, optname, const void *, optval, socklen_t, optlen) -#elif defined(__NR_socketcall) -/* [sg]etsockoptions by bir7 at leland.stanford.edu */ -int setsockopt(int fd, int level, int optname, const void *optval, - socklen_t optlen) +int setsockopt(int fd, int level, int optname, const void *optval, socklen_t optlen) { +# ifdef __NR_setsockopt + return INLINE_SYSCALL(setsockopt, 5, fd, level, optname, optval, optlen); +# else unsigned long args[5]; args[0] = fd; @@ -503,51 +297,50 @@ int setsockopt(int fd, int level, int optname, const void *optval, args[2] = optname; args[3] = (unsigned long) optval; args[4] = optlen; - return (__socketcall(SYS_SETSOCKOPT, args)); + return __socketcall(SYS_SETSOCKOPT, args); +# endif } -#endif libc_hidden_def(setsockopt) #endif #ifdef L_shutdown -#ifdef __NR_shutdown -_syscall2(int, shutdown, int, sockfd, int, how) -#elif defined(__NR_socketcall) -/* shutdown by bir7 at leland.stanford.edu */ int shutdown(int sockfd, int how) { +# ifdef __NR_shutdown + return INLINE_SYSCALL(shutdown, 2, sockfd, how); +# else unsigned long args[2]; args[0] = sockfd; args[1] = how; - return (__socketcall(SYS_SHUTDOWN, args)); + return __socketcall(SYS_SHUTDOWN, args); +# endif } #endif -#endif #ifdef L_socket -#ifdef __NR_socket -_syscall3(int, socket, int, family, int, type, int, protocol) -#elif defined(__NR_socketcall) int socket(int family, int type, int protocol) { +# ifdef __NR_socket + return INLINE_SYSCALL(socket, 3, family, type, protocol); +# else unsigned long args[3]; args[0] = family; args[1] = type; args[2] = (unsigned long) protocol; return __socketcall(SYS_SOCKET, args); +# endif } -#endif libc_hidden_def(socket) #endif #ifdef L_socketpair -#ifdef __NR_socketpair -_syscall4(int, socketpair, int, family, int, type, int, protocol, int *, sockvec) -#elif defined(__NR_socketcall) int socketpair(int family, int type, int protocol, int sockvec[2]) { +# ifdef __NR_socketpair + return INLINE_SYSCALL(socketpair, 4, family, type, protocol, sockvec); +# else unsigned long args[4]; args[0] = family; @@ -555,6 +348,6 @@ int socketpair(int family, int type, int protocol, int sockvec[2]) args[2] = protocol; args[3] = (unsigned long) sockvec; return __socketcall(SYS_SOCKETPAIR, args); +# endif } #endif -#endif diff --git a/libc/sysdeps/linux/common/__socketcall.c b/libc/sysdeps/linux/common/__socketcall.c index e49fb21..4104c45 100644 --- a/libc/sysdeps/linux/common/__socketcall.c +++ b/libc/sysdeps/linux/common/__socketcall.c @@ -8,8 +8,7 @@ */ #include -#ifdef __NR_socketcall +#include + #define __NR___socketcall __NR_socketcall -int __socketcall(int __call, unsigned long *__args) attribute_hidden; _syscall2(int, __socketcall, int, call, unsigned long *, args) -#endif -- 1.7.3.4 From bugzilla at busybox.net Mon Apr 25 13:15:10 2011 From: bugzilla at busybox.net (bugzilla at busybox.net) Date: Mon, 25 Apr 2011 13:15:10 +0000 (UTC) Subject: [Bug 2089] errno not threadsafe In-Reply-To: References: Message-ID: <20110425131510.CA4C582A25@busybox.osuosl.org> https://bugs.busybox.net/show_bug.cgi?id=2089 --- Comment #16 from Steve Stetak --- This bug was also causing stunnel to randomly drop SSL connections in the middle of the SSL handshake with the message "SSL_accept: Peer suddenly disconnected" The patch above seems to have fixed the issue. -- Configure bugmail: https://bugs.busybox.net/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug. From carmelo.amoroso at st.com Tue Apr 26 12:12:55 2011 From: carmelo.amoroso at st.com (Carmelo Amoroso) Date: Tue, 26 Apr 2011 14:12:55 +0200 Subject: [git commit] libubacktrace: enabled for all archs indeed. Message-ID: <20110426121346.1C9E782A51@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=e798b95d133c2707d8b0d6a3386e5e1564b5f459 branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/master Signed-off-by: Carmelo Amoroso --- extra/Configs/Config.in | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/extra/Configs/Config.in b/extra/Configs/Config.in index ca51aa0..147a316 100644 --- a/extra/Configs/Config.in +++ b/extra/Configs/Config.in @@ -2334,7 +2334,7 @@ config UCLIBC_MALLOC_DEBUGGING config UCLIBC_HAS_BACKTRACE bool "Add support for application self-debugging" - depends on HAVE_SHARED && TARGET_sh + depends on HAVE_SHARED default n help Answer Y here to compile support for application self-debugging, by adding -- 1.7.3.4 From ps.m at gmx.net Tue Apr 26 12:12:55 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Tue, 26 Apr 2011 14:12:55 +0200 Subject: [git commit future] cacheflush.c: use strong_alias_untyped Message-ID: <20110426195651.D6F8782A1F@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=be12c37bf69aec337b2672712cf0417956179722 branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/future strong_alias fails due to char * != void * Reported-by: Maksim Rayskiy Signed-off-by: Peter S. Mazinger --- libc/sysdeps/linux/mips/cacheflush.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/libc/sysdeps/linux/mips/cacheflush.c b/libc/sysdeps/linux/mips/cacheflush.c index 56472a0..15a3442 100644 --- a/libc/sysdeps/linux/mips/cacheflush.c +++ b/libc/sysdeps/linux/mips/cacheflush.c @@ -21,7 +21,7 @@ #ifdef __NR_cacheflush # include _syscall3(int, cacheflush, void *, addr, const int, nbytes, const int, op) -strong_alias(cacheflush, _flush_cache) +strong_alias_untyped(cacheflush, _flush_cache) #endif #ifdef __NR_cachectl -- 1.7.3.4 From carmelo.amoroso at st.com Tue Apr 26 12:12:55 2011 From: carmelo.amoroso at st.com (Carmelo Amoroso) Date: Tue, 26 Apr 2011 14:12:55 +0200 Subject: [git commit future] libubacktrace: enabled for all archs indeed. Message-ID: <20110426200025.CF3AF82A32@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=e798b95d133c2707d8b0d6a3386e5e1564b5f459 branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/future Signed-off-by: Carmelo Amoroso Patch is too large, so refusing to show it From carmelo.amoroso at st.com Wed Apr 27 07:29:44 2011 From: carmelo.amoroso at st.com (Carmelo Amoroso) Date: Wed, 27 Apr 2011 09:29:44 +0200 Subject: [git commit] buildsys: minor fixes in Makefile.arch for microblaze Message-ID: <20110427073904.A0F9A82AB9@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=4698e59ab3a0f3a92c04bc7942054c943b201706 branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/master Do not include Makefile.commonarch directly from within arch specific Makefile, as it is already done in parent Maefile.in. Signed-off-by: Carmelo Amoroso --- libc/sysdeps/linux/microblaze/Makefile.arch | 2 -- 1 files changed, 0 insertions(+), 2 deletions(-) diff --git a/libc/sysdeps/linux/microblaze/Makefile.arch b/libc/sysdeps/linux/microblaze/Makefile.arch index ecbd801..c80c650 100644 --- a/libc/sysdeps/linux/microblaze/Makefile.arch +++ b/libc/sysdeps/linux/microblaze/Makefile.arch @@ -10,5 +10,3 @@ CSRC := mmap.c clone.c fixdfsi.c SSRC := setjmp.S __longjmp.S vfork.S ARCH_HEADERS := floatlib.h - -include $(top_srcdir)libc/sysdeps/linux/Makefile.commonarch -- 1.7.3.4 From carmelo.amoroso at st.com Wed Apr 27 07:29:44 2011 From: carmelo.amoroso at st.com (Carmelo Amoroso) Date: Wed, 27 Apr 2011 09:29:44 +0200 Subject: [git commit] buildsys: minor fixes in Makefile.arch for C6X Message-ID: <20110427073904.D549282AA3@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=04dc3d139266d582f64db811013100e283ae189a branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/master Just a tidy-up by removing commented-out lines. Signed-off-by: Carmelo Amoroso --- libc/sysdeps/linux/c6x/Makefile.arch | 5 ----- 1 files changed, 0 insertions(+), 5 deletions(-) diff --git a/libc/sysdeps/linux/c6x/Makefile.arch b/libc/sysdeps/linux/c6x/Makefile.arch index 3e8dace..6bb44f2 100644 --- a/libc/sysdeps/linux/c6x/Makefile.arch +++ b/libc/sysdeps/linux/c6x/Makefile.arch @@ -6,10 +6,5 @@ # CSRC := brk.c pread_write.c syscall.c prctl.c -#CSRC := SSRC := __longjmp.S bsd-_setjmp.S bsd-setjmp.S clone.S setjmp.S _vfork.S -#SSRC := - -# libc-nonshared-y += $(ARCH_OUT)/_syscall.os - -- 1.7.3.4 From ps.m at gmx.net Wed Apr 27 07:29:44 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Wed, 27 Apr 2011 09:29:44 +0200 Subject: [git commit future] change _NSIG / 8 to __SYSCALL_SIGSET_T_SIZE in common code Message-ID: <20110427153630.514DB826DE@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=cd31fe32a07ef7f79e7369c7518a1db640914815 branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/future Since mips has different kernel sigset_t, use the new macro in common code that is used by mips as well. Signed-off-by: Peter S. Mazinger --- libc/sysdeps/linux/common/signalfd.c | 4 ++-- libc/sysdeps/linux/common/sigpending.c | 2 +- libc/sysdeps/linux/common/sigprocmask.c | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/libc/sysdeps/linux/common/signalfd.c b/libc/sysdeps/linux/common/signalfd.c index a0c995a..c9584f0 100644 --- a/libc/sysdeps/linux/common/signalfd.c +++ b/libc/sysdeps/linux/common/signalfd.c @@ -25,13 +25,13 @@ static __inline__ _syscall3(int, __syscall_signalfd, int, fd, int signalfd (int fd, const sigset_t *mask, int flags) { #if defined __NR___syscall_signalfd4 - return __syscall_signalfd4(fd, mask, _NSIG / 8, flags); + return __syscall_signalfd4(fd, mask, __SYSCALL_SIGSET_T_SIZE, flags); #elif defined __NR___syscall_signalfd if (flags != 0) { __set_errno(EINVAL); return -1; } - return __syscall_signalfd(fd, mask, _NSIG / 8); + return __syscall_signalfd(fd, mask, __SYSCALL_SIGSET_T_SIZE); #endif } #endif diff --git a/libc/sysdeps/linux/common/sigpending.c b/libc/sysdeps/linux/common/sigpending.c index 8fa2a51..78a0d84 100644 --- a/libc/sysdeps/linux/common/sigpending.c +++ b/libc/sysdeps/linux/common/sigpending.c @@ -19,7 +19,7 @@ static __inline__ _syscall2(int, __rt_sigpending, sigset_t *, set, size_t, size) int sigpending(sigset_t * set) { - return __rt_sigpending(set, _NSIG / 8); + return __rt_sigpending(set, __SYSCALL_SIGSET_T_SIZE); } #else _syscall1(int, sigpending, sigset_t *, set) diff --git a/libc/sysdeps/linux/common/sigprocmask.c b/libc/sysdeps/linux/common/sigprocmask.c index 011d7b3..6230033 100644 --- a/libc/sysdeps/linux/common/sigprocmask.c +++ b/libc/sysdeps/linux/common/sigprocmask.c @@ -47,7 +47,7 @@ int sigprocmask(int how, const sigset_t * set, sigset_t * oldset) } #endif - return __rt_sigprocmask(how, set, oldset, _NSIG / 8); + return __rt_sigprocmask(how, set, oldset, __SYSCALL_SIGSET_T_SIZE); } -- 1.7.3.4 From ps.m at gmx.net Wed Apr 27 07:29:44 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Wed, 27 Apr 2011 09:29:44 +0200 Subject: [git commit future] make arch specific cacheflush, readahead and sysmips LINUX_SPECIFIC dependent Message-ID: <20110427153630.2680B82AC4@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=794e81663ec24fa7a224dbd71d1518611381ed6e branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/future Remove the related headers. Adapt sh's type to the one used everywhere and add prototype for it. Signed-off-by: Peter S. Mazinger --- Makefile.in | 4 +++- libc/sysdeps/linux/bfin/Makefile.arch | 6 +++++- libc/sysdeps/linux/bfin/cacheflush.c | 2 +- libc/sysdeps/linux/mips/Makefile.arch | 7 +++++-- libc/sysdeps/linux/sh/Makefile.arch | 6 +++++- libc/sysdeps/linux/sh/cacheflush.c | 5 ++--- 6 files changed, 21 insertions(+), 9 deletions(-) diff --git a/Makefile.in b/Makefile.in index 5ca5fe3..7b4717e 100644 --- a/Makefile.in +++ b/Makefile.in @@ -278,7 +278,8 @@ HEADERS_RM-$(UCLIBC_HAS_WCHAR) += wchar.h wctype.h HEADERS_RM-$(UCLIBC_HAS_WORDEXP) += wordexp.h HEADERS_RM-$(UCLIBC_HAS_XATTR) += sys/xattr.h HEADERS_RM-$(UCLIBC_HAS_XLOCALE) += xlocale.h -HEADERS_RM-$(UCLIBC_LINUX_SPECIFIC) += sys/fsuid.h sys/inotify.h sys/perm.h \ +HEADERS_RM-$(UCLIBC_LINUX_SPECIFIC) += sys/cachectl.h sys/fsuid.h sys/inotify.h \ + sys/perm.h \ sys/personality.h \ sys/prctl.h \ sys/reboot.h \ @@ -289,6 +290,7 @@ HEADERS_RM-$(UCLIBC_LINUX_SPECIFIC) += sys/fsuid.h sys/inotify.h sys/pe sys/swap.h \ sys/sysctl.h \ sys/sysinfo.h \ + sys/sysmips.h \ sys/vfs.h HEADERS_RM-$(UCLIBC_SUPPORT_AI_ADDRCONFIG) += ifaddrs.h HEADERS_RM-$(UCLIBC_SV4_DEPRECATED) += ustat.h sys/ustat.h bits/ustat.h diff --git a/libc/sysdeps/linux/bfin/Makefile.arch b/libc/sysdeps/linux/bfin/Makefile.arch index 425a688..15ecfd8 100644 --- a/libc/sysdeps/linux/bfin/Makefile.arch +++ b/libc/sysdeps/linux/bfin/Makefile.arch @@ -6,7 +6,11 @@ # CSRC := bsdsetjmp.c clone.c \ - sram-alloc.c sram-free.c dma-memcpy.c cacheflush.c + sram-alloc.c sram-free.c dma-memcpy.c + +ifeq ($(UCLIBC_LINUX_SPECIFIC),y) +CSRC += cacheflush.c +endif SSRC := __longjmp.S setjmp.S bsd-_setjmp.S diff --git a/libc/sysdeps/linux/bfin/cacheflush.c b/libc/sysdeps/linux/bfin/cacheflush.c index 6ff3ad5..a4b9f4a 100644 --- a/libc/sysdeps/linux/bfin/cacheflush.c +++ b/libc/sysdeps/linux/bfin/cacheflush.c @@ -11,5 +11,5 @@ #ifdef __NR_cacheflush # include -_syscall3 (int, cacheflush, void *, start, const int, nbytes, const int, flags) +_syscall3 (int, cacheflush, void *, addr, const int, nbytes, const int, flags) #endif diff --git a/libc/sysdeps/linux/mips/Makefile.arch b/libc/sysdeps/linux/mips/Makefile.arch index 998e1f1..3672532 100644 --- a/libc/sysdeps/linux/mips/Makefile.arch +++ b/libc/sysdeps/linux/mips/Makefile.arch @@ -7,8 +7,11 @@ CSRC := \ __longjmp.c brk.c setjmp_aux.c \ - cacheflush.c pread_write.c sysmips.c _test_and_set.c \ - readahead.c + pread_write.c _test_and_set.c + +ifeq ($(UCLIBC_LINUX_SPECIFIC),y) +CSRC += cacheflush.c readahead.c sysmips.c +endif SSRC := bsd-_setjmp.S bsd-setjmp.S setjmp.S syscall.S pipe.S syscall_error.S diff --git a/libc/sysdeps/linux/sh/Makefile.arch b/libc/sysdeps/linux/sh/Makefile.arch index 5ebf42b..3ec8cbd 100644 --- a/libc/sysdeps/linux/sh/Makefile.arch +++ b/libc/sysdeps/linux/sh/Makefile.arch @@ -7,7 +7,11 @@ # CSRC := \ - pipe.c __init_brk.c brk.c sbrk.c pread_write.c cacheflush.c + pipe.c __init_brk.c brk.c sbrk.c pread_write.c + +ifeq ($(UCLIBC_LINUX_SPECIFIC),y) +CSRC += cacheflush.c +endif SSRC := setjmp.S __longjmp.S ___fpscr_values.S diff --git a/libc/sysdeps/linux/sh/cacheflush.c b/libc/sysdeps/linux/sh/cacheflush.c index 5822918..619b96b 100644 --- a/libc/sysdeps/linux/sh/cacheflush.c +++ b/libc/sysdeps/linux/sh/cacheflush.c @@ -6,10 +6,9 @@ * * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. */ -#include -#include #include #ifdef __NR_cacheflush -_syscall3(int, cacheflush, char *, addr, int, nbytes, int, op) +int cacheflush(void *addr, const int nbytes, int op); +_syscall3(int, cacheflush, void *, addr, const int, nbytes, const int, op) #endif -- 1.7.3.4 From ps.m at gmx.net Wed Apr 27 07:29:44 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Wed, 27 Apr 2011 09:29:44 +0200 Subject: [git commit future] sigqueue.c: rewrite a bit Message-ID: <20110427153630.BB4A082AC4@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=caba0b9c622d5afa44c509cd361532b1fa1a83a2 branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/future Use sizeof(info) instead of sizeof(siginfo_t). stubs.c: add sigqueue stub. Signed-off-by: Peter S. Mazinger --- libc/sysdeps/linux/common/sigqueue.c | 39 ++++++++++++++------------------- libc/sysdeps/linux/common/stubs.c | 4 +++ 2 files changed, 21 insertions(+), 22 deletions(-) diff --git a/libc/sysdeps/linux/common/sigqueue.c b/libc/sysdeps/linux/common/sigqueue.c index c407539..8c8b0db 100644 --- a/libc/sysdeps/linux/common/sigqueue.c +++ b/libc/sysdeps/linux/common/sigqueue.c @@ -16,16 +16,12 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -#include -#include -#include -#include - #include -#if defined __USE_POSIX199309 - -#ifdef __NR_rt_sigqueueinfo +#if defined __NR_rt_sigqueueinfo && defined __USE_POSIX199309 +# include +# include +# include # define __NR___syscall_rt_sigqueueinfo __NR_rt_sigqueueinfo static __always_inline _syscall3(int, __syscall_rt_sigqueueinfo, pid_t, pid, int, sig, void*, value) @@ -33,20 +29,19 @@ static __always_inline _syscall3(int, __syscall_rt_sigqueueinfo, pid_t, pid, int /* Return any pending signal or wait for one for the given time. */ int sigqueue (pid_t pid, int sig, const union sigval val) { - siginfo_t info; - - /* First, clear the siginfo_t structure, so that we don't pass our - stack content to other tasks. */ - memset (&info, 0, sizeof (siginfo_t)); - /* We must pass the information about the data in a siginfo_t value. */ - info.si_signo = sig; - info.si_code = SI_QUEUE; - info.si_pid = getpid (); - info.si_uid = getuid (); - info.si_value = val; - - return __syscall_rt_sigqueueinfo(pid, sig, &info); + siginfo_t info; + + /* First, clear the siginfo_t structure, so that we don't pass our + stack content to other tasks. */ + memset(&info, 0, sizeof(info)); + /* We must pass the information about the data in a siginfo_t value. */ + info.si_signo = sig; + info.si_code = SI_QUEUE; + info.si_pid = getpid (); + info.si_uid = getuid (); + info.si_value = val; + + return __syscall_rt_sigqueueinfo(pid, sig, &info); } #endif -#endif diff --git a/libc/sysdeps/linux/common/stubs.c b/libc/sysdeps/linux/common/stubs.c index eed1875..7da2278 100644 --- a/libc/sysdeps/linux/common/stubs.c +++ b/libc/sysdeps/linux/common/stubs.c @@ -183,6 +183,10 @@ make_stub(sigtimedwait) make_stub(sigwaitinfo) #endif +#ifndef __NR_rt_sigqueueinfo +make_stub(sigqueue) +#endif + #ifndef __NR_readahead make_stub(readahead) #endif -- 1.7.3.4 From ps.m at gmx.net Wed Apr 27 07:29:44 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Wed, 27 Apr 2011 09:29:44 +0200 Subject: [git commit future] add posix_madvise.c Message-ID: <20110427153630.8784682AC4@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=acb6d27b82aa8b38cb7222d454c8c203a055e1d5 branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/future Signed-off-by: Peter S. Mazinger --- libc/sysdeps/linux/common/Makefile.in | 2 +- libc/sysdeps/linux/common/posix_madvise.c | 25 +++++++++++++++++++++++++ libc/sysdeps/linux/common/stubs.c | 4 ++++ 3 files changed, 30 insertions(+), 1 deletions(-) create mode 100644 libc/sysdeps/linux/common/posix_madvise.c diff --git a/libc/sysdeps/linux/common/Makefile.in b/libc/sysdeps/linux/common/Makefile.in index 8cbffc2..d8b4af1 100644 --- a/libc/sysdeps/linux/common/Makefile.in +++ b/libc/sysdeps/linux/common/Makefile.in @@ -49,7 +49,7 @@ CSRC-$(UCLIBC_HAS_REALTIME) += clock_getres.c clock_gettime.c clock_settime.c \ sched_get_priority_max.c sched_get_priority_min.c sched_getscheduler.c \ sched_rr_get_interval.c sched_setparam.c sched_setscheduler.c sigqueue.c # clock_getcpuclockid|clock_nanosleep|mq_timedreceive|mq_timedsend|posix_fadvise|posix_fallocate|posix_madvise|posix_memalign|posix_mem_offset|posix_spawnattr_destroy|posix_spawnattr_init|posix_spawnattr_getflags|posix_spawnattr_setflags|posix_spawnattr_getpgroup|posix_spawnattr_setpgroup|posix_spawnattr_getschedparam|posix_spawnattr_setschedparam|posix_spawnattr_getschedpolicy|posix_spawnattr_setschedpolicy|posix_spawnattr_getsigdefault|posix_spawnattr_setsigdefault|posix_spawnattr_getsigmask|posix_spawnattr_setsigmask|posix_spawnattr_init|posix_spawnattr_setflags|posix_spawnattr_setpgroup|posix_spawnattr_setschedparam|posix_spawnattr_setschedpolicy|posix_spawnattr_setsigdefault|posix_spawnattr_setsigmask|posix_spawn_file_actions_addclose|posix_spawn_file_actions_addopen|posix_spawn_file_actions_adddup2|posix_spawn_file_actions_addopen|posix_spawn_file_actions_destroy|posix_spawn_file_actions_init|posix_spawn_file_actions_init|posix_spawn|posix_spawnp|posix_spawnp|posix_typ ed_mem_get_info|pthread_mutex_timedlock|sem_timedwait -CSRC-$(UCLIBC_HAS_ADVANCED_REALTIME) += posix_fadvise64.c posix_fadvise.c +CSRC-$(UCLIBC_HAS_ADVANCED_REALTIME) += posix_fadvise64.c posix_fadvise.c posix_madvise.c CSRC-$(UCLIBC_SUSV4_LEGACY) += utime.c CSRC-$(UCLIBC_HAS_EPOLL) += epoll.c CSRC-$(UCLIBC_HAS_XATTR) += xattr.c diff --git a/libc/sysdeps/linux/common/posix_madvise.c b/libc/sysdeps/linux/common/posix_madvise.c new file mode 100644 index 0000000..2f95bcb --- /dev/null +++ b/libc/sysdeps/linux/common/posix_madvise.c @@ -0,0 +1,25 @@ +/* vi: set sw=4 ts=4: */ +/* Licensed under the LGPL v2.1, see the file LICENSE in this tarball. */ + +#include +#include + +#if defined __NR_madvise && defined __USE_XOPEN2K && defined __UCLIBC_HAS_ADVANCED_REALTIME__ +int posix_madvise(void *addr, size_t len, int advice) +{ + int result; + /* We have one problem: the kernel's MADV_DONTNEED does not + * correspond to POSIX's POSIX_MADV_DONTNEED. The former simply + * discards changes made to the memory without writing it back to + * disk, if this would be necessary. The POSIX behaviour does not + * allow this. There is no functionality mapping for the POSIX + * behaviour so far so we ignore that advice for now. */ + if (advice == POSIX_MADV_DONTNEED) + return 0; + + /* this part might use madvise function */ + INTERNAL_SYSCALL_DECL (err); + result = INTERNAL_SYSCALL (madvise, err, 3, addr, len, advice); + return INTERNAL_SYSCALL_ERRNO (result, err); +} +#endif diff --git a/libc/sysdeps/linux/common/stubs.c b/libc/sysdeps/linux/common/stubs.c index 6c3bc79..eed1875 100644 --- a/libc/sysdeps/linux/common/stubs.c +++ b/libc/sysdeps/linux/common/stubs.c @@ -264,4 +264,8 @@ make_ret_stub(posix_fadvise) make_ret_stub(posix_fadvise64) #endif +#ifndef __NR_madvise +make_ret_stub(posix_madvise) +#endif + #endif -- 1.7.3.4 From ps.m at gmx.net Wed Apr 27 07:29:44 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Wed, 27 Apr 2011 09:29:44 +0200 Subject: [git commit future] linuxthreads.old: remove __old_sem_* and rename __new_sem_* to sem_* Message-ID: <20110427153630.F3D0182AC4@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=89ac8bc794a5953844bf579a259bb1639c9b6cb0 branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/future Signed-off-by: Peter S. Mazinger --- libpthread/linuxthreads.old/Makefile.in | 2 +- libpthread/linuxthreads.old/internals.h | 2 +- libpthread/linuxthreads.old/manager.c | 2 +- libpthread/linuxthreads.old/oldsemaphore.c | 241 ---------------------------- libpthread/linuxthreads.old/semaphore.c | 29 +--- 5 files changed, 10 insertions(+), 266 deletions(-) delete mode 100644 libpthread/linuxthreads.old/oldsemaphore.c diff --git a/libpthread/linuxthreads.old/Makefile.in b/libpthread/linuxthreads.old/Makefile.in index f599b16..7ef6218 100644 --- a/libpthread/linuxthreads.old/Makefile.in +++ b/libpthread/linuxthreads.old/Makefile.in @@ -34,7 +34,7 @@ libpthread_OUT := $(top_builddir)libpthread/linuxthreads.old libpthread_SRC := \ attr.c cancel.c condvar.c errno.c events.c join.c lockfile.c manager.c \ - mutex.c oldsemaphore.c pt-machine.c ptfork.c ptlongjmp.c \ + mutex.c pt-machine.c ptfork.c ptlongjmp.c \ rwlock.c semaphore.c signals.c specific.c spinlock.c wrapsyscall.c ifeq ($(UCLIBC_HAS_XLOCALE),y) libpthread_SRC += locale.c diff --git a/libpthread/linuxthreads.old/internals.h b/libpthread/linuxthreads.old/internals.h index 4d6bb86..3b94969 100644 --- a/libpthread/linuxthreads.old/internals.h +++ b/libpthread/linuxthreads.old/internals.h @@ -509,7 +509,7 @@ extern __typeof(pthread_mutex_trylock) __pthread_mutex_trylock attribute_hidden; extern __typeof(pthread_mutex_unlock) __pthread_mutex_unlock attribute_hidden; /* Prototypes for some of the new semaphore functions. */ -extern int __new_sem_post (sem_t * sem); +/*extern int __new_sem_post (sem_t * sem);*/ /* TSD. */ extern int __pthread_internal_tsd_set (int key, const void * pointer); diff --git a/libpthread/linuxthreads.old/manager.c b/libpthread/linuxthreads.old/manager.c index 85fee5e..6050387 100644 --- a/libpthread/linuxthreads.old/manager.c +++ b/libpthread/linuxthreads.old/manager.c @@ -232,7 +232,7 @@ int attribute_noreturn __pthread_manager(void *arg) break; case REQ_POST: PDEBUG("got REQ_POST\n"); - __new_sem_post(request.req_args.post); + sem_post(request.req_args.post); break; case REQ_DEBUG: PDEBUG("got REQ_DEBUG\n"); diff --git a/libpthread/linuxthreads.old/oldsemaphore.c b/libpthread/linuxthreads.old/oldsemaphore.c deleted file mode 100644 index 2a7b40a..0000000 --- a/libpthread/linuxthreads.old/oldsemaphore.c +++ /dev/null @@ -1,241 +0,0 @@ -/* - * This file contains the old semaphore code that we need to - * preserve for glibc-2.0 backwards compatibility. Port to glibc 2.1 - * done by Cristian Gafton. - */ - -/* Linuxthreads - a simple clone()-based implementation of Posix */ -/* threads for Linux. */ -/* Copyright (C) 1996 Xavier Leroy (Xavier.Leroy at inria.fr) */ -/* */ -/* This program is free software; you can redistribute it and/or */ -/* modify it under the terms of the GNU Library General Public License */ -/* as published by the Free Software Foundation; either version 2 */ -/* of the License, or (at your option) any later version. */ -/* */ -/* This program is distributed in the hope that it will be useful, */ -/* but WITHOUT ANY WARRANTY; without even the implied warranty of */ -/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */ -/* GNU Library General Public License for more details. */ - -/* Semaphores a la POSIX 1003.1b */ - -#include -#include "pthread.h" -#include "internals.h" -#include "spinlock.h" -#include "restart.h" -#include "queue.h" - -typedef struct { - long int sem_status; - int sem_spinlock; -} old_sem_t; - -/* Maximum value the semaphore can have. */ -#define SEM_VALUE_MAX ((int) ((~0u) >> 1)) - -static __inline__ int sem_compare_and_swap(old_sem_t *sem, long oldval, long newval) -{ - return compare_and_swap(&sem->sem_status, oldval, newval, &sem->sem_spinlock); -} - -/* The state of a semaphore is represented by a long int encoding - either the semaphore count if >= 0 and no thread is waiting on it, - or the head of the list of threads waiting for the semaphore. - To distinguish the two cases, we encode the semaphore count N - as 2N+1, so that it has the lowest bit set. - - A sequence of sem_wait operations on a semaphore initialized to N - result in the following successive states: - 2N+1, 2N-1, ..., 3, 1, &first_waiting_thread, &second_waiting_thread, ... -*/ - -static void sem_restart_list(pthread_descr waiting); - -int __old_sem_init(old_sem_t *sem, int pshared, unsigned int value); -int __old_sem_init(old_sem_t *sem, int pshared, unsigned int value) -{ - if (value > SEM_VALUE_MAX) { - errno = EINVAL; - return -1; - } - if (pshared) { - errno = ENOSYS; - return -1; - } - sem->sem_spinlock = 0; - sem->sem_status = ((long)value << 1) + 1; - return 0; -} - -/* Function called by pthread_cancel to remove the thread from - waiting inside __old_sem_wait. Here we simply unconditionally - indicate that the thread is to be woken, by returning 1. */ - -static int old_sem_extricate_func(void *obj attribute_unused, pthread_descr th attribute_unused) -{ - return 1; -} - -int __old_sem_wait(old_sem_t * sem); -int __old_sem_wait(old_sem_t * sem) -{ - long oldstatus, newstatus; - volatile pthread_descr self = thread_self(); - pthread_descr * th; - pthread_extricate_if extr; - - /* Set up extrication interface */ - extr.pu_object = 0; - extr.pu_extricate_func = old_sem_extricate_func; - - while (1) { - /* Register extrication interface */ - __pthread_set_own_extricate_if(self, &extr); - do { - oldstatus = sem->sem_status; - if ((oldstatus & 1) && (oldstatus != 1)) - newstatus = oldstatus - 2; - else { - newstatus = (long) self; - self->p_nextwaiting = (pthread_descr) oldstatus; - } - } - while (! sem_compare_and_swap(sem, oldstatus, newstatus)); - if (newstatus & 1) { - /* We got the semaphore. */ - __pthread_set_own_extricate_if(self, 0); - return 0; - } - /* Wait for sem_post or cancellation */ - suspend(self); - __pthread_set_own_extricate_if(self, 0); - - /* This is a cancellation point */ - if (self->p_canceled && self->p_cancelstate == PTHREAD_CANCEL_ENABLE) { - /* Remove ourselves from the waiting list if we're still on it */ - /* First check if we're at the head of the list. */ - do { - oldstatus = sem->sem_status; - if (oldstatus != (long) self) break; - newstatus = (long) self->p_nextwaiting; - } - while (! sem_compare_and_swap(sem, oldstatus, newstatus)); - /* Now, check if we're somewhere in the list. - There's a race condition with sem_post here, but it does not matter: - the net result is that at the time pthread_exit is called, - self is no longer reachable from sem->sem_status. */ - if (oldstatus != (long) self && (oldstatus & 1) == 0) { - for (th = &(((pthread_descr) oldstatus)->p_nextwaiting); - *th != NULL && *th != (pthread_descr) 1; - th = &((*th)->p_nextwaiting)) { - if (*th == self) { - *th = self->p_nextwaiting; - break; - } - } - } - __pthread_do_exit(PTHREAD_CANCELED, CURRENT_STACK_FRAME); - } - } -} - -int __old_sem_trywait(old_sem_t * sem); -int __old_sem_trywait(old_sem_t * sem) -{ - long oldstatus, newstatus; - - do { - oldstatus = sem->sem_status; - if ((oldstatus & 1) == 0 || (oldstatus == 1)) { - errno = EAGAIN; - return -1; - } - newstatus = oldstatus - 2; - } - while (! sem_compare_and_swap(sem, oldstatus, newstatus)); - return 0; -} - -int __old_sem_post(old_sem_t * sem); -int __old_sem_post(old_sem_t * sem) -{ - long oldstatus, newstatus; - - do { - oldstatus = sem->sem_status; - if ((oldstatus & 1) == 0) - newstatus = 3; - else { - if (oldstatus >= SEM_VALUE_MAX) { - /* Overflow */ - errno = ERANGE; - return -1; - } - newstatus = oldstatus + 2; - } - } - while (! sem_compare_and_swap(sem, oldstatus, newstatus)); - if ((oldstatus & 1) == 0) - sem_restart_list((pthread_descr) oldstatus); - return 0; -} - -int __old_sem_getvalue(old_sem_t * sem, int * sval); -int __old_sem_getvalue(old_sem_t * sem, int * sval) -{ - long status = sem->sem_status; - if (status & 1) - *sval = (int)((unsigned long) status >> 1); - else - *sval = 0; - return 0; -} - -int __old_sem_destroy(old_sem_t * sem); -int __old_sem_destroy(old_sem_t * sem) -{ - if ((sem->sem_status & 1) == 0) { - errno = EBUSY; - return -1; - } - return 0; -} - -/* Auxiliary function for restarting all threads on a waiting list, - in priority order. */ - -static void sem_restart_list(pthread_descr waiting) -{ - pthread_descr th, towake, *p; - - /* Sort list of waiting threads by decreasing priority (insertion sort) */ - towake = NULL; - while (waiting != (pthread_descr) 1) { - th = waiting; - waiting = waiting->p_nextwaiting; - p = &towake; - while (*p != NULL && th->p_priority < (*p)->p_priority) - p = &((*p)->p_nextwaiting); - th->p_nextwaiting = *p; - *p = th; - } - /* Wake up threads in priority order */ - while (towake != NULL) { - th = towake; - towake = towake->p_nextwaiting; - th->p_nextwaiting = NULL; - restart(th); - } -} - -#if defined __PIC__ && defined DO_VERSIONING -symbol_version (__old_sem_init, sem_init, GLIBC_2.0); -symbol_version (__old_sem_wait, sem_wait, GLIBC_2.0); -symbol_version (__old_sem_trywait, sem_trywait, GLIBC_2.0); -symbol_version (__old_sem_post, sem_post, GLIBC_2.0); -symbol_version (__old_sem_getvalue, sem_getvalue, GLIBC_2.0); -symbol_version (__old_sem_destroy, sem_destroy, GLIBC_2.0); -#endif - diff --git a/libpthread/linuxthreads.old/semaphore.c b/libpthread/linuxthreads.old/semaphore.c index 0811e17..9025dfe 100644 --- a/libpthread/linuxthreads.old/semaphore.c +++ b/libpthread/linuxthreads.old/semaphore.c @@ -24,8 +24,7 @@ #include "restart.h" #include "queue.h" -int __new_sem_init(sem_t *sem, int pshared, unsigned int value); -int __new_sem_init(sem_t *sem, int pshared, unsigned int value) +int sem_init(sem_t *sem, int pshared, unsigned int value) { if (value > SEM_VALUE_MAX) { errno = EINVAL; @@ -42,7 +41,7 @@ int __new_sem_init(sem_t *sem, int pshared, unsigned int value) } /* Function called by pthread_cancel to remove the thread from - waiting inside __new_sem_wait. */ + waiting inside sem_wait. */ static int new_sem_extricate_func(void *obj, pthread_descr th) { @@ -57,8 +56,7 @@ static int new_sem_extricate_func(void *obj, pthread_descr th) return did_remove; } -int __new_sem_wait(sem_t * sem); -int __new_sem_wait(sem_t * sem) +int sem_wait(sem_t * sem) { volatile pthread_descr self = thread_self(); pthread_extricate_if extr; @@ -120,8 +118,7 @@ int __new_sem_wait(sem_t * sem) return 0; } -int __new_sem_trywait(sem_t * sem); -int __new_sem_trywait(sem_t * sem) +int sem_trywait(sem_t * sem) { int retval; @@ -137,8 +134,7 @@ int __new_sem_trywait(sem_t * sem) return retval; } -int __new_sem_post(sem_t * sem); -int __new_sem_post(sem_t * sem) +int sem_post(sem_t * sem) { pthread_descr self = thread_self(); pthread_descr th; @@ -179,15 +175,13 @@ int __new_sem_post(sem_t * sem) return 0; } -int __new_sem_getvalue(sem_t * sem, int * sval); -int __new_sem_getvalue(sem_t * sem, int * sval) +int sem_getvalue(sem_t * sem, int * sval) { *sval = sem->__sem_value; return 0; } -int __new_sem_destroy(sem_t * sem); -int __new_sem_destroy(sem_t * sem) +int sem_destroy(sem_t * sem) { if (sem->__sem_waiting != NULL) { __set_errno (EBUSY); @@ -303,12 +297,3 @@ int sem_timedwait(sem_t *sem, const struct timespec *abstime) /* We got the semaphore */ return 0; } - - -weak_alias (__new_sem_init, sem_init) -weak_alias (__new_sem_wait, sem_wait) -weak_alias (__new_sem_trywait, sem_trywait) -weak_alias (__new_sem_post, sem_post) -weak_alias (__new_sem_getvalue, sem_getvalue) -weak_alias (__new_sem_destroy, sem_destroy) - -- 1.7.3.4 From carmelo.amoroso at st.com Wed Apr 27 07:29:44 2011 From: carmelo.amoroso at st.com (Carmelo Amoroso) Date: Wed, 27 Apr 2011 09:29:44 +0200 Subject: [git commit future] buildsys: minor fixes in Makefile.arch for microblaze Message-ID: <20110427153631.EB11C82AC4@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=4698e59ab3a0f3a92c04bc7942054c943b201706 branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/future Do not include Makefile.commonarch directly from within arch specific Makefile, as it is already done in parent Maefile.in. Signed-off-by: Carmelo Amoroso Patch is too large, so refusing to show it From ps.m at gmx.net Wed Apr 27 07:29:44 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Wed, 27 Apr 2011 09:29:44 +0200 Subject: [git commit future] NPTL: rename __new_sem_* to sem_* Message-ID: <20110427153631.3AC5C82AC4@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=5ad4370443959bb61704540db6e5e3b72a0ade46 branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/future Signed-off-by: Peter S. Mazinger --- libpthread/nptl/sem_destroy.c | 3 +-- libpthread/nptl/sem_getvalue.c | 3 +-- libpthread/nptl/sem_init.c | 3 +-- libpthread/nptl/semaphoreP.h | 11 ----------- .../sysdeps/unix/sysv/linux/i386/i486/sem_post.S | 10 ++++------ .../unix/sysv/linux/i386/i486/sem_trywait.S | 10 ++++------ .../sysdeps/unix/sysv/linux/i386/i486/sem_wait.S | 9 ++++----- .../sysdeps/unix/sysv/linux/powerpc/sem_post.c | 3 +-- libpthread/nptl/sysdeps/unix/sysv/linux/sem_post.c | 3 +-- .../nptl/sysdeps/unix/sysv/linux/sem_trywait.c | 3 +-- libpthread/nptl/sysdeps/unix/sysv/linux/sem_wait.c | 3 +-- .../nptl/sysdeps/unix/sysv/linux/sh/sem_post.S | 9 ++++----- .../nptl/sysdeps/unix/sysv/linux/sh/sem_trywait.S | 9 ++++----- .../nptl/sysdeps/unix/sysv/linux/sh/sem_wait.S | 9 ++++----- .../nptl/sysdeps/unix/sysv/linux/sparc/sem_init.c | 4 +--- .../unix/sysv/linux/sparc/sparc32/sem_post.c | 4 +--- .../unix/sysv/linux/sparc/sparc32/sem_trywait.c | 4 +--- .../unix/sysv/linux/sparc/sparc32/sem_wait.c | 4 +--- 18 files changed, 35 insertions(+), 69 deletions(-) diff --git a/libpthread/nptl/sem_destroy.c b/libpthread/nptl/sem_destroy.c index 6362c0e..05d9ae0 100644 --- a/libpthread/nptl/sem_destroy.c +++ b/libpthread/nptl/sem_destroy.c @@ -22,7 +22,7 @@ int -__new_sem_destroy ( +sem_destroy ( sem_t *sem) { /* XXX Check for valid parameter. */ @@ -30,4 +30,3 @@ __new_sem_destroy ( /* Nothing to do. */ return 0; } -weak_alias(__new_sem_destroy, sem_destroy) diff --git a/libpthread/nptl/sem_getvalue.c b/libpthread/nptl/sem_getvalue.c index 928026f..5ce2103 100644 --- a/libpthread/nptl/sem_getvalue.c +++ b/libpthread/nptl/sem_getvalue.c @@ -22,7 +22,7 @@ int -__new_sem_getvalue ( +sem_getvalue ( sem_t *sem, int *sval) { @@ -34,4 +34,3 @@ __new_sem_getvalue ( return 0; } -weak_alias(__new_sem_getvalue, sem_getvalue) diff --git a/libpthread/nptl/sem_init.c b/libpthread/nptl/sem_init.c index 0a224f3..e8d1b94 100644 --- a/libpthread/nptl/sem_init.c +++ b/libpthread/nptl/sem_init.c @@ -25,7 +25,7 @@ int -__new_sem_init ( +sem_init ( sem_t *sem, int pshared, unsigned int value) @@ -53,4 +53,3 @@ __new_sem_init ( return 0; } -weak_alias(__new_sem_init, sem_init) diff --git a/libpthread/nptl/semaphoreP.h b/libpthread/nptl/semaphoreP.h index 7d6fd25..2605f65 100644 --- a/libpthread/nptl/semaphoreP.h +++ b/libpthread/nptl/semaphoreP.h @@ -56,14 +56,3 @@ extern void __where_is_shmfs (void) attribute_hidden; /* Comparison function for search in tree with existing mappings. */ extern int __sem_search (const void *a, const void *b) attribute_hidden; - - -/* Prototypes of functions with multiple interfaces. */ -extern int __new_sem_init (sem_t *sem, int pshared, unsigned int value); -extern int __old_sem_init (sem_t *sem, int pshared, unsigned int value); -extern int __new_sem_destroy (sem_t *sem); -extern int __new_sem_post (sem_t *sem); -extern int __new_sem_wait (sem_t *sem); -extern int __old_sem_wait (sem_t *sem); -extern int __new_sem_trywait (sem_t *sem); -extern int __new_sem_getvalue (sem_t *sem, int *sval); diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/i386/i486/sem_post.S b/libpthread/nptl/sysdeps/unix/sysv/linux/i386/i486/sem_post.S index b077a20..e548bd1 100644 --- a/libpthread/nptl/sysdeps/unix/sysv/linux/i386/i486/sem_post.S +++ b/libpthread/nptl/sysdeps/unix/sysv/linux/i386/i486/sem_post.S @@ -25,10 +25,10 @@ .text - .globl __new_sem_post - .type __new_sem_post, at function + .globl sem_post + .type sem_post, at function .align 16 -__new_sem_post: +sem_post: cfi_startproc pushl %ebx cfi_adjust_cfa_offset(4) @@ -126,9 +126,7 @@ __new_sem_post: cfi_restore(%ebx) ret cfi_endproc - .size __new_sem_post,.-__new_sem_post -weak_alias(__new_sem_post, sem_post) - + .size sem_post,.-sem_post #ifdef __PIC__ .section .gnu.linkonce.t.__x86.get_pc_thunk.bx,"ax", at progbits diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/i386/i486/sem_trywait.S b/libpthread/nptl/sysdeps/unix/sysv/linux/i386/i486/sem_trywait.S index dad9685..6016658 100644 --- a/libpthread/nptl/sysdeps/unix/sysv/linux/i386/i486/sem_trywait.S +++ b/libpthread/nptl/sysdeps/unix/sysv/linux/i386/i486/sem_trywait.S @@ -23,10 +23,10 @@ .text - .globl __new_sem_trywait - .type __new_sem_trywait, at function + .globl sem_trywait + .type sem_trywait, at function .align 16 -__new_sem_trywait: +sem_trywait: movl 4(%esp), %ecx movl (%ecx), %eax @@ -63,9 +63,7 @@ __new_sem_trywait: #endif orl $-1, %eax ret - .size __new_sem_trywait,.-__new_sem_trywait -weak_alias(__new_sem_trywait, sem_trywait) - + .size sem_trywait,.-sem_trywait #ifdef __PIC__ .section .gnu.linkonce.t.__x86.get_pc_thunk.cx,"ax", at progbits diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/i386/i486/sem_wait.S b/libpthread/nptl/sysdeps/unix/sysv/linux/i386/i486/sem_wait.S index b1c32ee..d9ea601 100644 --- a/libpthread/nptl/sysdeps/unix/sysv/linux/i386/i486/sem_wait.S +++ b/libpthread/nptl/sysdeps/unix/sysv/linux/i386/i486/sem_wait.S @@ -29,10 +29,10 @@ .text - .globl __new_sem_wait - .type __new_sem_wait, at function + .globl sem_wait + .type sem_wait, at function .align 16 -__new_sem_wait: +sem_wait: .LSTARTCODE: pushl %ebx .Lpush_ebx: @@ -129,8 +129,7 @@ __new_sem_wait: orl $-1, %eax jmp 9b - .size __new_sem_wait,.-__new_sem_wait -weak_alias(__new_sem_wait, sem_wait) + .size sem_wait,.-sem_wait .type sem_wait_cleanup, at function diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/powerpc/sem_post.c b/libpthread/nptl/sysdeps/unix/sysv/linux/powerpc/sem_post.c index cdc8be7..cae9742 100644 --- a/libpthread/nptl/sysdeps/unix/sysv/linux/powerpc/sem_post.c +++ b/libpthread/nptl/sysdeps/unix/sysv/linux/powerpc/sem_post.c @@ -25,7 +25,7 @@ #include int -__new_sem_post (sem_t *sem) +sem_post (sem_t *sem) { struct new_sem *isem = (struct new_sem *) sem; @@ -44,4 +44,3 @@ __new_sem_post (sem_t *sem) } return 0; } -weak_alias(__new_sem_post, sem_post) diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/sem_post.c b/libpthread/nptl/sysdeps/unix/sysv/linux/sem_post.c index edb97c4..f0e8e35 100644 --- a/libpthread/nptl/sysdeps/unix/sysv/linux/sem_post.c +++ b/libpthread/nptl/sysdeps/unix/sysv/linux/sem_post.c @@ -26,7 +26,7 @@ #include int -__new_sem_post (sem_t *sem) +sem_post (sem_t *sem) { struct new_sem *isem = (struct new_sem *) sem; @@ -55,4 +55,3 @@ __new_sem_post (sem_t *sem) } return 0; } -weak_alias(__new_sem_post, sem_post) diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/sem_trywait.c b/libpthread/nptl/sysdeps/unix/sysv/linux/sem_trywait.c index 3cf1d9a..dede93e 100644 --- a/libpthread/nptl/sysdeps/unix/sysv/linux/sem_trywait.c +++ b/libpthread/nptl/sysdeps/unix/sysv/linux/sem_trywait.c @@ -26,7 +26,7 @@ int -__new_sem_trywait (sem_t *sem) +sem_trywait (sem_t *sem) { int *futex = (int *) sem; int val; @@ -41,4 +41,3 @@ __new_sem_trywait (sem_t *sem) __set_errno (EAGAIN); return -1; } -weak_alias(__new_sem_trywait, sem_trywait) diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/sem_wait.c b/libpthread/nptl/sysdeps/unix/sysv/linux/sem_wait.c index e661e09..1c5008f 100644 --- a/libpthread/nptl/sysdeps/unix/sysv/linux/sem_wait.c +++ b/libpthread/nptl/sysdeps/unix/sysv/linux/sem_wait.c @@ -38,7 +38,7 @@ __sem_wait_cleanup (void *arg) int -__new_sem_wait (sem_t *sem) +sem_wait (sem_t *sem) { struct new_sem *isem = (struct new_sem *) sem; int err; @@ -81,4 +81,3 @@ __new_sem_wait (sem_t *sem) return err; } -weak_alias(__new_sem_wait, sem_wait) diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/sh/sem_post.S b/libpthread/nptl/sysdeps/unix/sysv/linux/sh/sem_post.S index f71cd93..09326e4 100644 --- a/libpthread/nptl/sysdeps/unix/sysv/linux/sh/sem_post.S +++ b/libpthread/nptl/sysdeps/unix/sysv/linux/sh/sem_post.S @@ -25,10 +25,10 @@ .text - .globl __new_sem_post - .type __new_sem_post, at function + .globl sem_post + .type sem_post, at function .align 5 -__new_sem_post: +sem_post: mov.l @(VALUE,r4), r2 0: mov.l .Lmax, r1 @@ -106,5 +106,4 @@ __new_sem_post: .Lerrloc3: .long __errno_location at PLT-(.Lerrloc3b-.) #endif - .size __new_sem_post,.-__new_sem_post - weak_alias(__new_sem_post, sem_post) + .size sem_post,.-sem_post diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/sh/sem_trywait.S b/libpthread/nptl/sysdeps/unix/sysv/linux/sh/sem_trywait.S index b46eb1a..d3f8bfc 100644 --- a/libpthread/nptl/sysdeps/unix/sysv/linux/sh/sem_trywait.S +++ b/libpthread/nptl/sysdeps/unix/sysv/linux/sh/sem_trywait.S @@ -24,10 +24,10 @@ .text - .globl __new_sem_trywait - .type __new_sem_trywait, at function + .globl sem_trywait + .type sem_trywait, at function .align 5 -__new_sem_trywait: +sem_trywait: mov.l r12, @-r15 mov.l r8, @-r15 sts.l pr, @-r15 @@ -86,5 +86,4 @@ __new_sem_trywait: .Lerrloc1: .long __errno_location at PLT-(.Lerrloc1b-.) #endif - .size __new_sem_trywait,.-__new_sem_trywait - weak_alias(__new_sem_trywait, sem_trywait) + .size sem_trywait,.-sem_trywait diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/sh/sem_wait.S b/libpthread/nptl/sysdeps/unix/sysv/linux/sh/sem_wait.S index 00a125b..af46c9d 100644 --- a/libpthread/nptl/sysdeps/unix/sysv/linux/sh/sem_wait.S +++ b/libpthread/nptl/sysdeps/unix/sysv/linux/sh/sem_wait.S @@ -30,10 +30,10 @@ .text - .globl __new_sem_wait - .type __new_sem_wait, at function + .globl sem_wait + .type sem_wait, at function .align 5 -__new_sem_wait: +sem_wait: .LSTARTCODE: mov.l r8, @-r15 .Lpush_r8: @@ -161,8 +161,7 @@ __new_sem_wait: .long __pthread_enable_asynccancel-.Lenable0b .Ldisable0: .long __pthread_disable_asynccancel-.Ldisable0b - .size __new_sem_wait,.-__new_sem_wait - weak_alias(__new_sem_wait, sem_wait) + .size sem_wait,.-sem_wait .type sem_wait_cleanup, at function diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/sparc/sem_init.c b/libpthread/nptl/sysdeps/unix/sysv/linux/sparc/sem_init.c index f694b5e..90986b4 100644 --- a/libpthread/nptl/sysdeps/unix/sysv/linux/sparc/sem_init.c +++ b/libpthread/nptl/sysdeps/unix/sysv/linux/sparc/sem_init.c @@ -26,7 +26,7 @@ int -__new_sem_init (sem, pshared, value) +sem_init (sem, pshared, value) sem_t *sem; int pshared; unsigned int value; @@ -53,5 +53,3 @@ __new_sem_init (sem, pshared, value) return 0; } -weak_alias(__new_sem_init, sem_init) - diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/sparc/sparc32/sem_post.c b/libpthread/nptl/sysdeps/unix/sysv/linux/sparc/sparc32/sem_post.c index 940728e..dc9bbca 100644 --- a/libpthread/nptl/sysdeps/unix/sysv/linux/sparc/sparc32/sem_post.c +++ b/libpthread/nptl/sysdeps/unix/sysv/linux/sparc/sparc32/sem_post.c @@ -25,7 +25,7 @@ #include int -__new_sem_post (sem_t *sem) +sem_post (sem_t *sem) { struct sparc_new_sem *isem = (struct sparc_new_sem *) sem; int nr; @@ -51,5 +51,3 @@ __new_sem_post (sem_t *sem) } return 0; } -weak_alias(__new_sem_post, sem_post) - diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/sparc/sparc32/sem_trywait.c b/libpthread/nptl/sysdeps/unix/sysv/linux/sparc/sparc32/sem_trywait.c index d4e8938..6bbf9b2 100644 --- a/libpthread/nptl/sysdeps/unix/sysv/linux/sparc/sparc32/sem_trywait.c +++ b/libpthread/nptl/sysdeps/unix/sysv/linux/sparc/sparc32/sem_trywait.c @@ -26,7 +26,7 @@ int -__new_sem_trywait (sem_t *sem) +sem_trywait (sem_t *sem) { struct sparc_old_sem *isem = (struct sparc_old_sem *) sem; int val; @@ -50,5 +50,3 @@ __new_sem_trywait (sem_t *sem) __set_errno (EAGAIN); return -1; } -weak_alias(__new_sem_trywait, sem_trywait) - diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/sparc/sparc32/sem_wait.c b/libpthread/nptl/sysdeps/unix/sysv/linux/sparc/sparc32/sem_wait.c index cfe04a8..a2ec1d4 100644 --- a/libpthread/nptl/sysdeps/unix/sysv/linux/sparc/sparc32/sem_wait.c +++ b/libpthread/nptl/sysdeps/unix/sysv/linux/sparc/sparc32/sem_wait.c @@ -45,7 +45,7 @@ __sem_wait_cleanup (void *arg) int -__new_sem_wait (sem_t *sem) +sem_wait (sem_t *sem) { struct sparc_new_sem *isem = (struct sparc_new_sem *) sem; int err; @@ -123,5 +123,3 @@ __new_sem_wait (sem_t *sem) return err; } -weak_alias(__new_sem_wait, sem_wait) - -- 1.7.3.4 From carmelo.amoroso at st.com Wed Apr 27 07:29:44 2011 From: carmelo.amoroso at st.com (Carmelo Amoroso) Date: Wed, 27 Apr 2011 09:29:44 +0200 Subject: [git commit future] buildsys: minor fixes in Makefile.arch for C6X Message-ID: <20110427153632.3685F82AC4@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=04dc3d139266d582f64db811013100e283ae189a branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/future Just a tidy-up by removing commented-out lines. Signed-off-by: Carmelo Amoroso --- libc/sysdeps/linux/c6x/Makefile.arch | 5 ----- 1 files changed, 0 insertions(+), 5 deletions(-) diff --git a/libc/sysdeps/linux/c6x/Makefile.arch b/libc/sysdeps/linux/c6x/Makefile.arch index 3e8dace..6bb44f2 100644 --- a/libc/sysdeps/linux/c6x/Makefile.arch +++ b/libc/sysdeps/linux/c6x/Makefile.arch @@ -6,10 +6,5 @@ # CSRC := brk.c pread_write.c syscall.c prctl.c -#CSRC := SSRC := __longjmp.S bsd-_setjmp.S bsd-setjmp.S clone.S setjmp.S _vfork.S -#SSRC := - -# libc-nonshared-y += $(ARCH_OUT)/_syscall.os - -- 1.7.3.4 From ps.m at gmx.net Wed Apr 27 07:29:44 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Wed, 27 Apr 2011 09:29:44 +0200 Subject: [git commit future] linuxthreads.old_db: style update Message-ID: <20110427153632.EC2A782AC4@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=58ee7dc0f2770584da7959b8ca4c0132c5d0feeb branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/future Signed-off-by: Peter S. Mazinger Patch is too large, so refusing to show it From ps.m at gmx.net Wed Apr 27 07:29:44 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Wed, 27 Apr 2011 09:29:44 +0200 Subject: [git commit future] fts.c: add a comment about wrong usage of _lfs_64.h Message-ID: <20110427153633.2E8BC82AC4@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=990d040c68307315473a2278a2b54a4a03abe5f4 branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/future This file needs anyway some massage (style update), I'll leave the fix to the committer. Signed-off-by: Peter S. Mazinger --- libc/misc/fts/fts.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/libc/misc/fts/fts.c b/libc/misc/fts/fts.c index ce5d158..c7921a4 100644 --- a/libc/misc/fts/fts.c +++ b/libc/misc/fts/fts.c @@ -38,6 +38,7 @@ #include #ifdef __UCLIBC_HAS_LFS__ +/* this is wrong, either you include this header as first, or not at all */ # include <_lfs_64.h> #else # define stat64 stat -- 1.7.3.4 From ps.m at gmx.net Wed Apr 27 07:29:44 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Wed, 27 Apr 2011 09:29:44 +0200 Subject: [git commit future] linuxthreads.old: cleanup a bit Message-ID: <20110427153633.6501E817D7@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=3f29a998c91ebac3a2d0a8f5628fec646690c331 branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/future Use __UCLIBC_HAS_TLS__ instead of USE___THREADS (although this LT implementation will never support TLS). Disable unused/unneeded members of the pthread_functions structure. No redirect/forward for _pthread_cleanup_push/pop, it would have not worked anyway due to the fact, that the structure member was not initialized. Disable it's possible internal use in libc-lock.h. Avoid using internals.h in libc_pthread_init.c (moving a prototype to pthread-functions.h). Signed-off-by: Peter S. Mazinger --- libpthread/linuxthreads.old/forward.c | 4 ++++ libpthread/linuxthreads.old/internals.h | 2 -- libpthread/linuxthreads.old/libc_pthread_init.c | 5 ++--- libpthread/linuxthreads.old/pthread.c | 8 ++++---- libpthread/linuxthreads.old/specific.c | 2 +- .../sysdeps/pthread/bits/libc-lock.h | 2 ++ .../sysdeps/pthread/pthread-functions.h | 16 ++++++++++++++++ 7 files changed, 29 insertions(+), 10 deletions(-) diff --git a/libpthread/linuxthreads.old/forward.c b/libpthread/linuxthreads.old/forward.c index 402b155..e35da69 100644 --- a/libpthread/linuxthreads.old/forward.c +++ b/libpthread/linuxthreads.old/forward.c @@ -163,8 +163,12 @@ FORWARD (pthread_setcancelstate, (int state, int *oldstate), (state, oldstate), FORWARD (pthread_setcanceltype, (int type, int *oldtype), (type, oldtype), 0) +#if 0 FORWARD2 (_pthread_cleanup_push, void, (struct _pthread_cleanup_buffer * buffer, void (*routine)(void *), void * arg), (buffer, routine, arg), return) +#endif FORWARD2 (_pthread_cleanup_push_defer, void, (struct _pthread_cleanup_buffer * buffer, void (*routine)(void *), void * arg), (buffer, routine, arg), return) +#if 0 FORWARD2 (_pthread_cleanup_pop, void, (struct _pthread_cleanup_buffer * buffer, int execute), (buffer, execute), return) +#endif FORWARD2 (_pthread_cleanup_pop_restore, void, (struct _pthread_cleanup_buffer * buffer, int execute), (buffer, execute), return) diff --git a/libpthread/linuxthreads.old/internals.h b/libpthread/linuxthreads.old/internals.h index 3b94969..6da7e45 100644 --- a/libpthread/linuxthreads.old/internals.h +++ b/libpthread/linuxthreads.old/internals.h @@ -524,6 +524,4 @@ extern void __linuxthreads_reap_event (void); #include -extern int * __libc_pthread_init (const struct pthread_functions *functions); - #endif /* internals.h */ diff --git a/libpthread/linuxthreads.old/libc_pthread_init.c b/libpthread/linuxthreads.old/libc_pthread_init.c index b54162d..a459cf3 100644 --- a/libpthread/linuxthreads.old/libc_pthread_init.c +++ b/libpthread/linuxthreads.old/libc_pthread_init.c @@ -32,8 +32,7 @@ # include #endif -#include "internals.h" -#include "sysdeps/pthread/pthread-functions.h" +#include int __libc_multiple_threads attribute_hidden __attribute__((nocommon)); @@ -48,7 +47,7 @@ int * __libc_pthread_init (const struct pthread_functions *functions) sizeof (__libc_pthread_functions)); #endif -#if ! defined USE___THREAD && defined __UCLIBC_HAS_XLOCALE__ +#if !defined __UCLIBC_HAS_TLS__ && defined __UCLIBC_HAS_XLOCALE__ /* Initialize thread-locale current locale to point to the global one. With __thread support, the variable's initializer takes care of this. */ uselocale (LC_GLOBAL_LOCALE); diff --git a/libpthread/linuxthreads.old/pthread.c b/libpthread/linuxthreads.old/pthread.c index 652a389..054a4ae 100644 --- a/libpthread/linuxthreads.old/pthread.c +++ b/libpthread/linuxthreads.old/pthread.c @@ -317,7 +317,7 @@ libpthread_hidden_proto(pthread_condattr_init) struct pthread_functions __pthread_functions = { -#ifndef USE___THREAD +#if !defined __UCLIBC_HAS_TLS__ && defined __UCLIBC_HAS_RPC__ .ptr_pthread_internal_tsd_set = __pthread_internal_tsd_set, .ptr_pthread_internal_tsd_get = __pthread_internal_tsd_get, .ptr_pthread_internal_tsd_address = __pthread_internal_tsd_address, @@ -365,10 +365,10 @@ struct pthread_functions __pthread_functions = .ptr_pthread_sigwait = pthread_sigwait, .ptr_pthread_raise = pthread_raise, .ptr__pthread_cleanup_push = _pthread_cleanup_push, - .ptr__pthread_cleanup_pop = _pthread_cleanup_pop + .ptr__pthread_cleanup_pop = _pthread_cleanup_pop, */ .ptr__pthread_cleanup_push_defer = __pthread_cleanup_push_defer, - .ptr__pthread_cleanup_pop_restore = __pthread_cleanup_pop_restore, + .ptr__pthread_cleanup_pop_restore = __pthread_cleanup_pop_restore }; #ifdef SHARED # define ptr_pthread_functions &__pthread_functions @@ -526,7 +526,7 @@ int __pthread_initialize_manager(void) /* On non-MMU systems we make sure that the initial thread bounds don't overlap * with the manager stack frame */ NOMMU_INITIAL_THREAD_BOUNDS(__pthread_manager_thread_tos,__pthread_manager_thread_bos); - PDEBUG("manager stack: size=%d, bos=%p, tos=%p\n", THREAD_MANAGER_STACK_SIZE, + PDEBUG("manager stack: size=%ld, bos=%p, tos=%p\n", THREAD_MANAGER_STACK_SIZE, __pthread_manager_thread_bos, __pthread_manager_thread_tos); #if 0 PDEBUG("initial stack: estimate bos=%p, tos=%p\n", diff --git a/libpthread/linuxthreads.old/specific.c b/libpthread/linuxthreads.old/specific.c index 8e08aa4..c4bcfbf 100644 --- a/libpthread/linuxthreads.old/specific.c +++ b/libpthread/linuxthreads.old/specific.c @@ -167,7 +167,7 @@ void __pthread_destroy_specifics(void) __pthread_unlock(THREAD_GETMEM(self, p_lock)); } -#ifndef USE___THREAD +#if !defined __UCLIBC_HAS_TLS__ && defined __UCLIBC_HAS_RPC__ /* Thread-specific data for libc. */ diff --git a/libpthread/linuxthreads.old/sysdeps/pthread/bits/libc-lock.h b/libpthread/linuxthreads.old/sysdeps/pthread/bits/libc-lock.h index 78593ac..de85f99 100644 --- a/libpthread/linuxthreads.old/sysdeps/pthread/bits/libc-lock.h +++ b/libpthread/linuxthreads.old/sysdeps/pthread/bits/libc-lock.h @@ -271,6 +271,7 @@ typedef pthread_key_t __libc_key_t; _pthread_cleanup_pop_restore (&_buffer, (DOIT)); \ } +#if 0 #define __libc_cleanup_push(fct, arg) \ { struct _pthread_cleanup_buffer _buffer; \ __libc_maybe_call (_pthread_cleanup_push, (&_buffer, (fct), (arg)), 0) @@ -278,6 +279,7 @@ typedef pthread_key_t __libc_key_t; #define __libc_cleanup_pop(execute) \ __libc_maybe_call (_pthread_cleanup_pop, (&_buffer, execute), 0); \ } +#endif /* Create thread-specific key. */ #define __libc_key_create(KEY, DESTRUCTOR) \ diff --git a/libpthread/linuxthreads.old/sysdeps/pthread/pthread-functions.h b/libpthread/linuxthreads.old/sysdeps/pthread/pthread-functions.h index ce6d10f..ab5f767 100644 --- a/libpthread/linuxthreads.old/sysdeps/pthread/pthread-functions.h +++ b/libpthread/linuxthreads.old/sysdeps/pthread/pthread-functions.h @@ -21,17 +21,21 @@ #define _PTHREAD_FUNCTIONS_H 1 #include +#if 0 #include #include struct fork_block; +#endif /* Data type shared with libc. The libc uses it to pass on calls to the thread functions. Wine pokes directly into this structure, so if possible avoid breaking it and append new hooks to the end. */ struct pthread_functions { +#if 0 pid_t (*ptr_pthread_fork) (struct fork_block *); +#endif int (*ptr_pthread_attr_destroy) (pthread_attr_t *); int (*ptr_pthread_attr_init) (pthread_attr_t *); int (*ptr_pthread_attr_getdetachstate) (const pthread_attr_t *, int *); @@ -68,26 +72,36 @@ struct pthread_functions pthread_t (*ptr_pthread_self) (void); int (*ptr_pthread_setcancelstate) (int, int *); int (*ptr_pthread_setcanceltype) (int, int *); +#if 0 void (*ptr_pthread_do_exit) (void *retval, char *currentframe); void (*ptr_pthread_cleanup_upto) (__jmp_buf target, char *targetframe); pthread_descr (*ptr_pthread_thread_self) (void); +#endif +#if !defined __UCLIBC_HAS_TLS__ && defined __UCLIBC_HAS_RPC__ int (*ptr_pthread_internal_tsd_set) (int key, const void *pointer); void * (*ptr_pthread_internal_tsd_get) (int key); void ** __attribute__ ((__const__)) (*ptr_pthread_internal_tsd_address) (int key); +#endif +#if 0 int (*ptr_pthread_sigaction) (int sig, const struct sigaction * act, struct sigaction *oact); int (*ptr_pthread_sigwait) (const sigset_t *set, int *sig); int (*ptr_pthread_raise) (int sig); +#endif int (*ptr_pthread_cond_timedwait) (pthread_cond_t *, pthread_mutex_t *, const struct timespec *); +#if 0 void (*ptr__pthread_cleanup_push) (struct _pthread_cleanup_buffer * buffer, void (*routine)(void *), void * arg); +#endif void (*ptr__pthread_cleanup_push_defer) (struct _pthread_cleanup_buffer * buffer, void (*routine)(void *), void * arg); +#if 0 void (*ptr__pthread_cleanup_pop) (struct _pthread_cleanup_buffer * buffer, int execute); +#endif void (*ptr__pthread_cleanup_pop_restore) (struct _pthread_cleanup_buffer * buffer, int execute); }; @@ -95,4 +109,6 @@ struct pthread_functions /* Variable in libc.so. */ extern struct pthread_functions __libc_pthread_functions attribute_hidden; +extern int * __libc_pthread_init (const struct pthread_functions *functions); + #endif /* pthread-functions.h */ -- 1.7.3.4 From ps.m at gmx.net Wed Apr 27 07:29:44 2011 From: ps.m at gmx.net (Peter S. Mazinger) Date: Wed, 27 Apr 2011 09:29:44 +0200 Subject: [git commit future] hide locking related pthread functions in libc.so. Message-ID: <20110427222023.2BFED82ACC@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=85b7344ab62f463a173dfcfa4a2766e05d3cc814 branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/future Make these functions hidden in libc.so, but keep them visible in libc.a. Use a hidden version of _pthread_cleanup_push_defer/pop_restore for locking. No need for a visible __pthread_exit function in libc, adapt forward.c for this. Cleanup forward.c removing all unneeded headers (LT versions). Signed-off-by: Peter S. Mazinger --- include/libc-symbols.h | 6 ++ libc/misc/internals/__uClibc_main.c | 4 +- libc/sysdeps/linux/common/bits/uClibc_mutex.h | 4 +- libc/sysdeps/linux/common/bits/uClibc_pthread.h | 16 +++--- libpthread/linuxthreads.old/Makefile.in | 4 +- libpthread/linuxthreads.old/forward.c | 55 +++++++------------ libpthread/linuxthreads.old/internals.h | 2 + libpthread/linuxthreads.old/pthread.c | 2 +- .../sysdeps/pthread/pthread-functions.h | 2 +- .../linuxthreads.old/sysdeps/pthread/pthread.h | 5 -- libpthread/linuxthreads/cancel.c | 2 + libpthread/linuxthreads/forward.c | 28 +++++++--- libpthread/linuxthreads/pthread.c | 6 +- .../sysdeps/pthread/pthread-functions.h | 2 +- libpthread/nptl/forward.c | 17 +++++- libpthread/nptl/init.c | 6 +- libpthread/nptl/pthreadP.h | 6 +- .../nptl/sysdeps/pthread/pthread-functions.h | 2 +- 18 files changed, 91 insertions(+), 78 deletions(-) diff --git a/include/libc-symbols.h b/include/libc-symbols.h index da9445f..64fb14d 100644 --- a/include/libc-symbols.h +++ b/include/libc-symbols.h @@ -480,6 +480,12 @@ FIXME! - ? # define __hidden_proto_hiddenattr(attrs...) #endif +#ifdef SHARED +# define attribute_shared_hidden attribute_hidden +#else +# define attribute_shared_hidden +#endif + #if /*!defined STATIC &&*/ !defined __BCC__ # ifndef __ASSEMBLER__ diff --git a/libc/misc/internals/__uClibc_main.c b/libc/misc/internals/__uClibc_main.c index fbb25ab..3c254bb 100644 --- a/libc/misc/internals/__uClibc_main.c +++ b/libc/misc/internals/__uClibc_main.c @@ -84,7 +84,7 @@ __pthread_mutex_init(pthread_mutex_t *mutex, const pthread_mutexattr_t *attr) } void weak_function -_pthread_cleanup_push_defer(struct _pthread_cleanup_buffer *__buffer, +__pthread_cleanup_push_defer(struct _pthread_cleanup_buffer *__buffer, void (*__routine) (void *), void *__arg) { __buffer->__routine = __routine; @@ -92,7 +92,7 @@ _pthread_cleanup_push_defer(struct _pthread_cleanup_buffer *__buffer, } void weak_function -_pthread_cleanup_pop_restore(struct _pthread_cleanup_buffer *__buffer, +__pthread_cleanup_pop_restore(struct _pthread_cleanup_buffer *__buffer, int __execute) { if (__execute) diff --git a/libc/sysdeps/linux/common/bits/uClibc_mutex.h b/libc/sysdeps/linux/common/bits/uClibc_mutex.h index 94597e8..946dcd0 100644 --- a/libc/sysdeps/linux/common/bits/uClibc_mutex.h +++ b/libc/sysdeps/linux/common/bits/uClibc_mutex.h @@ -41,7 +41,7 @@ struct _pthread_cleanup_buffer __infunc_pthread_cleanup_buffer; \ int __infunc_need_locking = (C); \ if (__infunc_need_locking) { \ - _pthread_cleanup_push_defer(&__infunc_pthread_cleanup_buffer, \ + __pthread_cleanup_push_defer(&__infunc_pthread_cleanup_buffer, \ (void (*) (void *))__pthread_mutex_unlock, \ &(M)); \ __pthread_mutex_lock(&(M)); \ @@ -50,7 +50,7 @@ #define __UCLIBC_MUTEX_CONDITIONAL_UNLOCK(M,C) \ if (__infunc_need_locking) { \ - _pthread_cleanup_pop_restore(&__infunc_pthread_cleanup_buffer,1); \ + __pthread_cleanup_pop_restore(&__infunc_pthread_cleanup_buffer,1); \ } \ } while (0) diff --git a/libc/sysdeps/linux/common/bits/uClibc_pthread.h b/libc/sysdeps/linux/common/bits/uClibc_pthread.h index c8750c8..f35b8f1 100644 --- a/libc/sysdeps/linux/common/bits/uClibc_pthread.h +++ b/libc/sysdeps/linux/common/bits/uClibc_pthread.h @@ -32,15 +32,15 @@ struct _pthread_cleanup_buffer; /* Threading functions internal to uClibc. Make these thread functions * weak so that we can elide them from single-threaded processes. */ extern int weak_function __pthread_mutex_init (pthread_mutex_t *__mutex, - __const pthread_mutexattr_t *__mutex_attr); -extern int weak_function __pthread_mutex_lock (pthread_mutex_t *__mutex); -extern int weak_function __pthread_mutex_unlock (pthread_mutex_t *__mutex); -extern int weak_function __pthread_mutex_trylock (pthread_mutex_t *__mutex); -extern void weak_function _pthread_cleanup_push_defer ( + __const pthread_mutexattr_t *__mutex_attr) attribute_shared_hidden; +extern int weak_function __pthread_mutex_lock (pthread_mutex_t *__mutex) attribute_shared_hidden; +extern int weak_function __pthread_mutex_unlock (pthread_mutex_t *__mutex) attribute_shared_hidden; +extern int weak_function __pthread_mutex_trylock (pthread_mutex_t *__mutex) attribute_shared_hidden; +extern void weak_function __pthread_cleanup_push_defer ( struct _pthread_cleanup_buffer *__buffer, - void (*__routine) (void *), void *__arg); -extern void weak_function _pthread_cleanup_pop_restore ( + void (*__routine) (void *), void *__arg) attribute_shared_hidden; +extern void weak_function __pthread_cleanup_pop_restore ( struct _pthread_cleanup_buffer *__buffer, - int __execute); + int __execute) attribute_shared_hidden; #endif diff --git a/libpthread/linuxthreads.old/Makefile.in b/libpthread/linuxthreads.old/Makefile.in index 7ef6218..ffb26ea 100644 --- a/libpthread/linuxthreads.old/Makefile.in +++ b/libpthread/linuxthreads.old/Makefile.in @@ -33,14 +33,14 @@ libpthread_OUT := $(top_builddir)libpthread/linuxthreads.old -include $(libpthread_DIR)/sysdeps/$(TARGET_ARCH)/Makefile.arch libpthread_SRC := \ - attr.c cancel.c condvar.c errno.c events.c join.c lockfile.c manager.c \ + attr.c condvar.c errno.c events.c join.c lockfile.c manager.c \ mutex.c pt-machine.c ptfork.c ptlongjmp.c \ rwlock.c semaphore.c signals.c specific.c spinlock.c wrapsyscall.c ifeq ($(UCLIBC_HAS_XLOCALE),y) libpthread_SRC += locale.c endif -libpthread_SPEC_SRC := pthread.c +libpthread_SPEC_SRC := pthread.c cancel.c libpthread_SPEC_SRC := $(patsubst %.c,$(libpthread_DIR)/%.c,$(libpthread_SPEC_SRC)) # remove generic sources, if arch specific version is present diff --git a/libpthread/linuxthreads.old/forward.c b/libpthread/linuxthreads.old/forward.c index e35da69..903d859 100644 --- a/libpthread/linuxthreads.old/forward.c +++ b/libpthread/linuxthreads.old/forward.c @@ -17,41 +17,14 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -#include -#include -#include - -/* psm: keep this before internals.h */ -#if 0 -vda: here is why: -headers contain libc_hidden_proto(foo). -In libpthread/linuxthreads.old/sysdeps/pthread/bits/libc-lock.h -adding libc_hidden_proto(foo) just before weak_extern (__pthread_initialize) -will not warn: - /* libc_hidden_proto(foo) */ - weak_extern (__pthread_initialize) - /* libc_hidden_proto(foo) */ -but adding after will! Which is extremely strange - -weak_extern expands into just "#pragma weak __pthread_initialize". -TODO: determine whether it is a gcc bug or what -(see gcc.gnu.org/PR36282). -For now, just include all headers before internals.h -(they are again included in internals.h - maybe remove them there later) -#endif - -#include -#include -#include -#include -#include -#include -#include -#include - -#include "internals.h" +#include +#include /* EXIT_SUCCESS */ +#include +/* for hidden __pthread_mutex_X */ +#include /* Pointers to the libc functions. */ -struct pthread_functions __libc_pthread_functions attribute_hidden; +struct pthread_functions __libc_pthread_functions; # define FORWARD2(name, rettype, decl, params, defaction) \ @@ -64,6 +37,16 @@ name decl \ return __libc_pthread_functions.ptr_##name params; \ } +# define FORWARD3(name, rettype, decl, params, defaction) \ +rettype \ +name decl \ +{ \ + if (__libc_pthread_functions.ptr_##name == NULL) \ + defaction; \ + while(1) \ + __libc_pthread_functions.ptr_##name params; \ +} + # define FORWARD(name, decl, params, defretval) \ FORWARD2 (name, int, decl, params, return defretval) @@ -127,8 +110,8 @@ FORWARD (pthread_equal, (pthread_t thread1, pthread_t thread2), /* Use an alias to avoid warning, as pthread_exit is declared noreturn. */ -FORWARD2 (__pthread_exit, void, (void *retval), (retval), exit (EXIT_SUCCESS)) -strong_alias (__pthread_exit, pthread_exit) +/* Comment not valid on uClibc, FORWARD3 added to handle this */ +FORWARD3 (pthread_exit, void, (void *retval), (retval), exit (EXIT_SUCCESS)) FORWARD (pthread_getschedparam, @@ -167,8 +150,10 @@ FORWARD (pthread_setcanceltype, (int type, int *oldtype), (type, oldtype), 0) FORWARD2 (_pthread_cleanup_push, void, (struct _pthread_cleanup_buffer * buffer, void (*routine)(void *), void * arg), (buffer, routine, arg), return) #endif FORWARD2 (_pthread_cleanup_push_defer, void, (struct _pthread_cleanup_buffer * buffer, void (*routine)(void *), void * arg), (buffer, routine, arg), return) +strong_alias(_pthread_cleanup_push_defer,__pthread_cleanup_push_defer) #if 0 FORWARD2 (_pthread_cleanup_pop, void, (struct _pthread_cleanup_buffer * buffer, int execute), (buffer, execute), return) #endif FORWARD2 (_pthread_cleanup_pop_restore, void, (struct _pthread_cleanup_buffer * buffer, int execute), (buffer, execute), return) +strong_alias(_pthread_cleanup_pop_restore,__pthread_cleanup_pop_restore) diff --git a/libpthread/linuxthreads.old/internals.h b/libpthread/linuxthreads.old/internals.h index 6da7e45..0e4f75c 100644 --- a/libpthread/linuxthreads.old/internals.h +++ b/libpthread/linuxthreads.old/internals.h @@ -465,11 +465,13 @@ void __fresetlockfiles(void); void __pthread_manager_adjust_prio(int thread_prio); void __pthread_initialize_minimal (void); +#if 0 extern void __pthread_exit (void *retval) #if defined NOT_IN_libc && defined IS_IN_libpthread attribute_noreturn #endif ; +#endif extern int __pthread_attr_setguardsize __P ((pthread_attr_t *__attr, size_t __guardsize)); diff --git a/libpthread/linuxthreads.old/pthread.c b/libpthread/linuxthreads.old/pthread.c index 054a4ae..232716b 100644 --- a/libpthread/linuxthreads.old/pthread.c +++ b/libpthread/linuxthreads.old/pthread.c @@ -346,7 +346,7 @@ struct pthread_functions __pthread_functions = .ptr_pthread_cond_wait = pthread_cond_wait, .ptr_pthread_cond_timedwait = pthread_cond_timedwait, .ptr_pthread_equal = pthread_equal, - .ptr___pthread_exit = pthread_exit, + .ptr_pthread_exit = pthread_exit, .ptr_pthread_getschedparam = pthread_getschedparam, .ptr_pthread_setschedparam = pthread_setschedparam, .ptr_pthread_mutex_destroy = __pthread_mutex_destroy, diff --git a/libpthread/linuxthreads.old/sysdeps/pthread/pthread-functions.h b/libpthread/linuxthreads.old/sysdeps/pthread/pthread-functions.h index ab5f767..9ee6b6d 100644 --- a/libpthread/linuxthreads.old/sysdeps/pthread/pthread-functions.h +++ b/libpthread/linuxthreads.old/sysdeps/pthread/pthread-functions.h @@ -59,7 +59,7 @@ struct pthread_functions int (*ptr_pthread_cond_signal) (pthread_cond_t *); int (*ptr_pthread_cond_wait) (pthread_cond_t *, pthread_mutex_t *); int (*ptr_pthread_equal) (pthread_t, pthread_t); - void (*ptr___pthread_exit) (void *); + void (*ptr_pthread_exit) (void *); int (*ptr_pthread_getschedparam) (pthread_t, int *, struct sched_param *); int (*ptr_pthread_setschedparam) (pthread_t, int, const struct sched_param *); diff --git a/libpthread/linuxthreads.old/sysdeps/pthread/pthread.h b/libpthread/linuxthreads.old/sysdeps/pthread/pthread.h index 38d5667..61000ed 100644 --- a/libpthread/linuxthreads.old/sysdeps/pthread/pthread.h +++ b/libpthread/linuxthreads.old/sysdeps/pthread/pthread.h @@ -642,9 +642,6 @@ extern void _pthread_cleanup_pop (struct _pthread_cleanup_buffer *__buffer, extern void _pthread_cleanup_push_defer (struct _pthread_cleanup_buffer *__buffer, void (*__routine) (void *), void *__arg) __THROW; -extern void __pthread_cleanup_push_defer (struct _pthread_cleanup_buffer *__buffer, - void (*__routine) (void *), - void *__arg) __THROW; /* Remove a cleanup handler as pthread_cleanup_pop does, but also restores the cancellation type that was in effect when the matching @@ -655,8 +652,6 @@ extern void __pthread_cleanup_push_defer (struct _pthread_cleanup_buffer *__buff extern void _pthread_cleanup_pop_restore (struct _pthread_cleanup_buffer *__buffer, int __execute) __THROW; -extern void __pthread_cleanup_pop_restore (struct _pthread_cleanup_buffer *__buffer, - int __execute) __THROW; #endif diff --git a/libpthread/linuxthreads/cancel.c b/libpthread/linuxthreads/cancel.c index 21b8d90..70a4af6 100644 --- a/libpthread/linuxthreads/cancel.c +++ b/libpthread/linuxthreads/cancel.c @@ -184,6 +184,7 @@ void _pthread_cleanup_push_defer(struct _pthread_cleanup_buffer * buffer, THREAD_SETMEM(self, p_canceltype, PTHREAD_CANCEL_DEFERRED); THREAD_SETMEM(self, p_cleanup, buffer); } +strong_alias(_pthread_cleanup_push_defer,__pthread_cleanup_push_defer) void _pthread_cleanup_pop_restore(struct _pthread_cleanup_buffer * buffer, int execute) @@ -197,6 +198,7 @@ void _pthread_cleanup_pop_restore(struct _pthread_cleanup_buffer * buffer, THREAD_GETMEM(self, p_canceltype) == PTHREAD_CANCEL_ASYNCHRONOUS) __pthread_do_exit(PTHREAD_CANCELED, CURRENT_STACK_FRAME); } +strong_alias(_pthread_cleanup_pop_restore,__pthread_cleanup_pop_restore) extern void __rpc_thread_destroy(void); void __pthread_perform_cleanup(char *currentframe) diff --git a/libpthread/linuxthreads/forward.c b/libpthread/linuxthreads/forward.c index 9d25d9a..0ecd0e6 100644 --- a/libpthread/linuxthreads/forward.c +++ b/libpthread/linuxthreads/forward.c @@ -17,13 +17,11 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -#include -#include -#include - -/* psm: keep this before internals.h */ - -#include "internals.h" +#include +#include /* EXIT_SUCCESS */ +#include +/* for hidden __pthread_mutex_X */ +#include /* Pointers to the libc functions. */ struct pthread_functions __libc_pthread_functions attribute_hidden; @@ -39,6 +37,16 @@ name decl \ return __libc_pthread_functions.ptr_##name params; \ } +# define FORWARD3(name, rettype, decl, params, defaction) \ +rettype \ +name decl \ +{ \ + if (__libc_pthread_functions.ptr_##name == NULL) \ + defaction; \ + while(1) \ + __libc_pthread_functions.ptr_##name params; \ +} + # define FORWARD(name, decl, params, defretval) \ FORWARD2 (name, int, decl, params, return defretval) @@ -102,8 +110,8 @@ FORWARD (pthread_equal, (pthread_t thread1, pthread_t thread2), /* Use an alias to avoid warning, as pthread_exit is declared noreturn. */ -FORWARD2 (__pthread_exit, void, (void *retval), (retval), exit (EXIT_SUCCESS)) -strong_alias (__pthread_exit, pthread_exit) +/* Comment does not apply on uClibc, added FORWARD3 to handle this */ +FORWARD3 (pthread_exit, void, (void *retval), (retval), exit (EXIT_SUCCESS)) FORWARD (pthread_getschedparam, @@ -140,6 +148,8 @@ FORWARD (pthread_setcanceltype, (int type, int *oldtype), (type, oldtype), 0) FORWARD2 (_pthread_cleanup_push, void, (struct _pthread_cleanup_buffer * buffer, void (*routine)(void *), void * arg), (buffer, routine, arg), return) FORWARD2 (_pthread_cleanup_push_defer, void, (struct _pthread_cleanup_buffer * buffer, void (*routine)(void *), void * arg), (buffer, routine, arg), return) +strong_alias(_pthread_cleanup_push_defer,__pthread_cleanup_push_defer) FORWARD2 (_pthread_cleanup_pop, void, (struct _pthread_cleanup_buffer * buffer, int execute), (buffer, execute), return) FORWARD2 (_pthread_cleanup_pop_restore, void, (struct _pthread_cleanup_buffer * buffer, int execute), (buffer, execute), return) +strong_alias(_pthread_cleanup_pop_restore,__pthread_cleanup_pop_restore) diff --git a/libpthread/linuxthreads/pthread.c b/libpthread/linuxthreads/pthread.c index 0c50760..d8daa17 100644 --- a/libpthread/linuxthreads/pthread.c +++ b/libpthread/linuxthreads/pthread.c @@ -257,7 +257,7 @@ struct pthread_functions __pthread_functions = .ptr_pthread_cond_wait = __pthread_cond_wait, .ptr_pthread_cond_timedwait = __pthread_cond_timedwait, .ptr_pthread_equal = __pthread_equal, - .ptr___pthread_exit = __pthread_exit, + .ptr_pthread_exit = __pthread_exit, .ptr_pthread_getschedparam = __pthread_getschedparam, .ptr_pthread_setschedparam = __pthread_setschedparam, .ptr_pthread_mutex_destroy = __pthread_mutex_destroy, @@ -275,9 +275,9 @@ struct pthread_functions __pthread_functions = .ptr_pthread_sigwait = __pthread_sigwait, .ptr_pthread_raise = __pthread_raise, .ptr__pthread_cleanup_push = _pthread_cleanup_push, - .ptr__pthread_cleanup_push_defer = _pthread_cleanup_push_defer, + .ptr__pthread_cleanup_push_defer = __pthread_cleanup_push_defer, .ptr__pthread_cleanup_pop = _pthread_cleanup_pop, - .ptr__pthread_cleanup_pop_restore = _pthread_cleanup_pop_restore, + .ptr__pthread_cleanup_pop_restore = __pthread_cleanup_pop_restore, }; #ifdef SHARED # define ptr_pthread_functions &__pthread_functions diff --git a/libpthread/linuxthreads/sysdeps/pthread/pthread-functions.h b/libpthread/linuxthreads/sysdeps/pthread/pthread-functions.h index 258e1fc..9984877 100644 --- a/libpthread/linuxthreads/sysdeps/pthread/pthread-functions.h +++ b/libpthread/linuxthreads/sysdeps/pthread/pthread-functions.h @@ -55,7 +55,7 @@ struct pthread_functions int (*ptr_pthread_cond_signal) (pthread_cond_t *); int (*ptr_pthread_cond_wait) (pthread_cond_t *, pthread_mutex_t *); int (*ptr_pthread_equal) (pthread_t, pthread_t); - void (*ptr___pthread_exit) (void *); + void (*ptr_pthread_exit) (void *); int (*ptr_pthread_getschedparam) (pthread_t, int *, struct sched_param *); int (*ptr_pthread_setschedparam) (pthread_t, int, const struct sched_param *); diff --git a/libpthread/nptl/forward.c b/libpthread/nptl/forward.c index 7878334..7926e1d 100644 --- a/libpthread/nptl/forward.c +++ b/libpthread/nptl/forward.c @@ -42,6 +42,18 @@ name decl \ } \ } +#define FORWARD3(name, rettype, decl, params, defaction) \ +rettype \ +name decl \ +{ \ + if (!__libc_pthread_functions_init) { \ + defaction; \ + } else { \ + while(1) \ + PTHFCT_CALL (ptr_##name, params); \ + } \ +} + #define FORWARD(name, decl, params, defretval) \ FORWARD2 (name, int, decl, params, return defretval) @@ -112,8 +124,7 @@ FORWARD (pthread_equal, (pthread_t thread1, pthread_t thread2), /* Use an alias to avoid warning, as pthread_exit is declared noreturn. */ -FORWARD2 (__pthread_exit, void, (void *retval), (retval), exit (EXIT_SUCCESS)) -strong_alias (__pthread_exit, pthread_exit); +FORWARD3 (pthread_exit, void, (void *retval), (retval), exit (EXIT_SUCCESS)) FORWARD (pthread_getschedparam, @@ -149,11 +160,13 @@ FORWARD2(_pthread_cleanup_push_defer, void, (struct _pthread_cleanup_buffer *buffer, void (*routine)(void *), void *arg), (buffer, routine, arg), { buffer->__routine = routine; buffer->__arg = arg; }); +strong_alias(_pthread_cleanup_push_defer,__pthread_cleanup_push_defer) FORWARD2(_pthread_cleanup_pop_restore, void, (struct _pthread_cleanup_buffer *buffer, int execute), (buffer, execute), if (execute) { buffer->__routine(buffer->__arg); }); +strong_alias(_pthread_cleanup_pop_restore,__pthread_cleanup_pop_restore) FORWARD2(__pthread_unwind, void attribute_hidden __attribute ((noreturn)) __cleanup_fct_attribute, diff --git a/libpthread/nptl/init.c b/libpthread/nptl/init.c index 379c4bb..8da86e3 100644 --- a/libpthread/nptl/init.c +++ b/libpthread/nptl/init.c @@ -93,7 +93,7 @@ static const struct pthread_functions pthread_functions = .ptr___pthread_cond_wait = __pthread_cond_wait, .ptr___pthread_cond_timedwait = __pthread_cond_timedwait, .ptr_pthread_equal = __pthread_equal, - .ptr___pthread_exit = __pthread_exit, + .ptr_pthread_exit = __pthread_exit, .ptr_pthread_getschedparam = __pthread_getschedparam, .ptr_pthread_setschedparam = __pthread_setschedparam, .ptr_pthread_mutex_destroy = INTUSE(__pthread_mutex_destroy), @@ -111,8 +111,8 @@ static const struct pthread_functions pthread_functions = .ptr___pthread_key_create = __pthread_key_create_internal, .ptr___pthread_getspecific = __pthread_getspecific_internal, .ptr___pthread_setspecific = __pthread_setspecific_internal, - .ptr__pthread_cleanup_push_defer = _pthread_cleanup_push_defer, - .ptr__pthread_cleanup_pop_restore = _pthread_cleanup_pop_restore, + .ptr__pthread_cleanup_push_defer = __pthread_cleanup_push_defer, + .ptr__pthread_cleanup_pop_restore = __pthread_cleanup_pop_restore, .ptr_nthreads = &__nptl_nthreads, .ptr___pthread_unwind = &__pthread_unwind, .ptr__nptl_deallocate_tsd = __nptl_deallocate_tsd, diff --git a/libpthread/nptl/pthreadP.h b/libpthread/nptl/pthreadP.h index e740486..97a645a 100644 --- a/libpthread/nptl/pthreadP.h +++ b/libpthread/nptl/pthreadP.h @@ -552,12 +552,12 @@ extern void __pthread_cleanup_pop (struct _pthread_cleanup_buffer *buffer, # undef pthread_cleanup_pop # define pthread_cleanup_pop(execute) \ __pthread_cleanup_pop (&_buffer, (execute)); } -#endif extern void __pthread_cleanup_push_defer (struct _pthread_cleanup_buffer *buffer, - void (*routine) (void *), void *arg); + void (*routine) (void *), void *arg) attribute_hidden; extern void __pthread_cleanup_pop_restore (struct _pthread_cleanup_buffer *buffer, - int execute); + int execute) attribute_hidden; +#endif /* Old cleanup interfaces, still used in libc.so. */ extern void _pthread_cleanup_push (struct _pthread_cleanup_buffer *buffer, diff --git a/libpthread/nptl/sysdeps/pthread/pthread-functions.h b/libpthread/nptl/sysdeps/pthread/pthread-functions.h index 0ee39e0..f36ab63 100644 --- a/libpthread/nptl/sysdeps/pthread/pthread-functions.h +++ b/libpthread/nptl/sysdeps/pthread/pthread-functions.h @@ -66,7 +66,7 @@ struct pthread_functions pthread_mutex_t *, const struct timespec *); int (*ptr_pthread_equal) (pthread_t, pthread_t); - void (*ptr___pthread_exit) (void *); + void (*ptr_pthread_exit) (void *); int (*ptr_pthread_getschedparam) (pthread_t, int *, struct sched_param *); int (*ptr_pthread_setschedparam) (pthread_t, int, const struct sched_param *); -- 1.7.3.4 From bugzilla at busybox.net Fri Apr 29 11:43:24 2011 From: bugzilla at busybox.net (bugzilla at busybox.net) Date: Fri, 29 Apr 2011 11:43:24 +0000 (UTC) Subject: [Bug 329] linuxthreads.old: Issues with pthread_mutex_lock() In-Reply-To: References: Message-ID: <20110429114324.8C30282B32@busybox.osuosl.org> https://bugs.busybox.net/show_bug.cgi?id=329 Bernhard Reutner-Fischer changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |FIXED --- Comment #7 from Bernhard Reutner-Fischer --- Works with NPTL -- Configure bugmail: https://bugs.busybox.net/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug. From bugzilla at busybox.net Fri Apr 29 12:10:24 2011 From: bugzilla at busybox.net (bugzilla at busybox.net) Date: Fri, 29 Apr 2011 12:10:24 +0000 (UTC) Subject: [Bug 3673] New: Backtrace support on arm eabi needs libgcc_eh Message-ID: https://bugs.busybox.net/show_bug.cgi?id=3673 Summary: Backtrace support on arm eabi needs libgcc_eh Product: uClibc Version: 0.9.32 Platform: PC OS/Version: Linux Status: NEW Severity: minor Priority: P5 Component: Other AssignedTo: unassigned at uclibc.org ReportedBy: heinold at inf.fu-berlin.de CC: uclibc-cvs at uclibc.org Estimated Hours: 0.0 While compiling firefox with openemebedded, I stumbled over the backtrace support and gave it try. Unfornatly linking with libgcc.a on arm eabi and gcc 4.5 needs libgcc_eh.a as well. Attached is a simple fix in git mbox format. -- Configure bugmail: https://bugs.busybox.net/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug. From rep.dot.nop at gmail.com Fri Apr 29 12:19:24 2011 From: rep.dot.nop at gmail.com (Bernhard Reutner-Fischer) Date: Fri, 29 Apr 2011 14:19:24 +0200 Subject: [git commit] sysconf: clock_getres depends on HAS_REALTIME Message-ID: <20110429122133.4963B82B2C@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=221464c9c4227810de9f027c3ace63805480d723 branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/master Bug was introduced in revision a202cf6f. Signed-off-by: Bernhard Reutner-Fischer --- libc/unistd/sysconf.c | 5 ++--- 1 files changed, 2 insertions(+), 3 deletions(-) diff --git a/libc/unistd/sysconf.c b/libc/unistd/sysconf.c index be58f11..c1b3c86 100644 --- a/libc/unistd/sysconf.c +++ b/libc/unistd/sysconf.c @@ -993,13 +993,12 @@ long int sysconf(int name) r = INTERNAL_SYSCALL (clock_getres, err, 2, CLOCK_MONOTONIC, &ts); return INTERNAL_SYSCALL_ERROR_P (r, err) ? -1 : _POSIX_VERSION; } -# else +# elif defined __UCLIBC_HAS_REALTIME__ if (clock_getres(CLOCK_MONOTONIC, NULL) >= 0) return _POSIX_VERSION; - - RETURN_NEG_1; # endif #endif + RETURN_NEG_1; #ifdef __UCLIBC_HAS_THREADS_NATIVE__ case _SC_THREAD_CPUTIME: -- 1.7.3.4 From rep.dot.nop at gmail.com Fri Apr 29 12:19:24 2011 From: rep.dot.nop at gmail.com (Bernhard Reutner-Fischer) Date: Fri, 29 Apr 2011 14:19:24 +0200 Subject: [git commit] __rt_sigwaitinfo: depends on HAS_REALTIME Message-ID: <20110429122133.2277382B2C@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=3818c3a0b6465dcc4952a13fde83d22716a82ffc branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/master Signed-off-by: Bernhard Reutner-Fischer --- libc/sysdeps/linux/common/Makefile.in | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/libc/sysdeps/linux/common/Makefile.in b/libc/sysdeps/linux/common/Makefile.in index b0754df..c4036b3 100644 --- a/libc/sysdeps/linux/common/Makefile.in +++ b/libc/sysdeps/linux/common/Makefile.in @@ -44,7 +44,7 @@ CSRC-$(UCLIBC_NTP_LEGACY) += ntp_gettime.c # aio_cancel|aio_error|aio_fsync|aio_read|aio_return|aio_suspend|aio_write|clock_getres|clock_gettime|clock_settime|clock_settime|fdatasync|lio_listio|mlockall|munlockall|mlock|munlock|mq_close|mq_getattr|mq_notify|mq_open|mq_receive|mq_timedreceive|mq_send|mq_timedsend|mq_setattr|mq_unlink|nanosleep|sched_getparam|sched_get_priority_max|sched_get_priority_min|sched_getscheduler|sched_rr_get_interval|sched_setparam|sched_setscheduler|sem_close|sem_destroy|sem_getvalue|sem_init|sem_open|sem_post|sem_trywait|sem_wait|sem_unlink|sem_wait|shm_open|shm_unlink|sigqueue|sigtimedwait|sigwaitinfo|sigwaitinfo|timer_create|timer_delete|timer_getoverrun|timer_gettime|timer_settime CSRC-$(UCLIBC_HAS_REALTIME) += clock_getres.c clock_gettime.c clock_settime.c \ fdatasync.c mlockall.c mlock.c munlockall.c munlock.c \ - nanosleep.c __rt_sigtimedwait.c sched_getparam.c \ + nanosleep.c __rt_sigtimedwait.c __rt_sigwaitinfo.c sched_getparam.c \ sched_get_priority_max.c sched_get_priority_min.c sched_getscheduler.c \ sched_rr_get_interval.c sched_setparam.c sched_setscheduler.c sigqueue.c # clock_getcpuclockid|clock_nanosleep|mq_timedreceive|mq_timedsend|posix_fadvise|posix_fallocate|posix_madvise|posix_memalign|posix_mem_offset|posix_spawnattr_destroy|posix_spawnattr_init|posix_spawnattr_getflags|posix_spawnattr_setflags|posix_spawnattr_getpgroup|posix_spawnattr_setpgroup|posix_spawnattr_getschedparam|posix_spawnattr_setschedparam|posix_spawnattr_getschedpolicy|posix_spawnattr_setschedpolicy|posix_spawnattr_getsigdefault|posix_spawnattr_setsigdefault|posix_spawnattr_getsigmask|posix_spawnattr_setsigmask|posix_spawnattr_init|posix_spawnattr_setflags|posix_spawnattr_setpgroup|posix_spawnattr_setschedparam|posix_spawnattr_setschedpolicy|posix_spawnattr_setsigdefault|posix_spawnattr_setsigmask|posix_spawn_file_actions_addclose|posix_spawn_file_actions_addopen|posix_spawn_file_actions_adddup2|posix_spawn_file_actions_addopen|posix_spawn_file_actions_destroy|posix_spawn_file_actions_init|posix_spawn_file_actions_init|posix_spawn|posix_spawnp|posix_spawnp|posix_typ ed_mem_get_info|pthread_mutex_timedlock|sem_timedwait -- 1.7.3.4 From bugzilla at busybox.net Fri Apr 29 12:23:27 2011 From: bugzilla at busybox.net (bugzilla at busybox.net) Date: Fri, 29 Apr 2011 12:23:27 +0000 (UTC) Subject: [Bug 3517] Compilation error for uClibc 0.9.32-rc3 In-Reply-To: References: Message-ID: <20110429122327.1EEF182B2C@busybox.osuosl.org> https://bugs.busybox.net/show_bug.cgi?id=3517 Bernhard Reutner-Fischer changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |FIXED --- Comment #1 from Bernhard Reutner-Fischer --- Hi, Fixes in 3818c3a0b6465dcc4952a13fde83d22716a82ffc and 221464c9c4227810de9f027c3ace63805480d723 on current master. Thanks for the report! -- Configure bugmail: https://bugs.busybox.net/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug. From bugzilla at busybox.net Fri Apr 29 18:36:57 2011 From: bugzilla at busybox.net (bugzilla at busybox.net) Date: Fri, 29 Apr 2011 18:36:57 +0000 (UTC) Subject: [Bug 3673] Backtrace support on arm eabi needs libgcc_eh In-Reply-To: References: Message-ID: <20110429183657.8E01482B47@busybox.osuosl.org> https://bugs.busybox.net/show_bug.cgi?id=3673 --- Comment #1 from Henning Heinold --- Created attachment 3259 --> https://bugs.busybox.net/attachment.cgi?id=3259 patch -- Configure bugmail: https://bugs.busybox.net/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug. From cernekee at gmail.com Wed Apr 6 13:19:34 2011 From: cernekee at gmail.com (Kevin Cernekee) Date: Wed, 06 Apr 2011 13:19:34 -0000 Subject: [git commit prelink] Fix GNU make v3.80 compatibility Message-ID: <20110406131934.35F7982228@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=32814a2b15829df3a144391f5b8bd46e755f85f5 branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/prelink Commits 1f6601a and 094d82d introduced the "else ifeq" construct, which requires GNU make v3.81 or higher. This breaks the build on RHEL4 hosts. Signed-off-by: Kevin Cernekee Signed-off-by: Bernhard Reutner-Fischer --- libc/sysdeps/linux/common/Makefile.in | 8 ++++++-- 1 files changed, 6 insertions(+), 2 deletions(-) diff --git a/libc/sysdeps/linux/common/Makefile.in b/libc/sysdeps/linux/common/Makefile.in index cf4cf87..bd45d94 100644 --- a/libc/sysdeps/linux/common/Makefile.in +++ b/libc/sysdeps/linux/common/Makefile.in @@ -42,9 +42,11 @@ ifeq ($(UCLIBC_HAS_THREADS_NATIVE),y) CSRC := $(filter-out fork.c getpid.c raise.c open.c close.c read.c write.c, $(CSRC)) ifeq ($(TARGET_ARCH),arm) CSRC := $(filter-out vfork.c, $(CSRC)) -else ifeq ($(TARGET_ARCH),x86_64) +else +ifeq ($(TARGET_ARCH),x86_64) CSRC := $(filter-out vfork.c, $(CSRC)) -else ifeq ($(TARGET_ARCH),mips) +else +ifeq ($(TARGET_ARCH),mips) ifeq ($(CONFIG_MIPS_O32_ABI),y) CSRC := $(filter-out waitpid.c, $(CSRC)) endif @@ -52,6 +54,8 @@ else CSRC := $(filter-out waitpid.c, $(CSRC)) endif endif +endif +endif ifneq ($(ARCH_USE_MMU),y) # stubbed out in mman.h -- 1.7.3.4 From BerndSchmidtbernds_cb1 at t-online.de Wed Apr 6 13:19:48 2011 From: BerndSchmidtbernds_cb1 at t-online.de (BerndSchmidtbernds_cb1 at t-online.de) Date: Wed, 06 Apr 2011 13:19:48 -0000 Subject: [git commit prelink] Add Makefile support for DSBT ELF. Message-ID: <20110406131946.5B56880774@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=f4eebb6146ea3f6917481d5d24f3d99e97236399 branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/prelink This adds support for a new binary format, DSBT ELF, to the Makefiles. Every shared library is assigned a DSBT index, and the link.so macro is adjusted to ensure the correct linker argument is passed. Configuration and ldso support will follow in separate commits. Signed-off-by: Bernd Schmidt Signed-off-by: Bernhard Reutner-Fischer --- Makerules | 3 ++- ldso/ldso/Makefile.in | 1 + ldso/libdl/Makefile.in | 1 + libc/Makefile.in | 1 + libcrypt/Makefile.in | 1 + libm/Makefile.in | 1 + libnsl/Makefile.in | 1 + libpthread/linuxthreads.old/Makefile.in | 1 + libresolv/Makefile.in | 1 + librt/Makefile.in | 1 + libutil/Makefile.in | 1 + 11 files changed, 12 insertions(+), 1 deletions(-) diff --git a/Makerules b/Makerules index 84eeaea..3a4d566 100644 --- a/Makerules +++ b/Makerules @@ -297,7 +297,8 @@ cmd_hcompile.o = $(HOSTCC) $(filter-out $(PHONY),$<) $(DEPS-$(notdir $@)) -c -o define link.so $(Q)$(RM) $@ $@.$(2) $(dir $@)$(1) @$(disp_ld) - $(Q)$(CC) $(LDFLAGS-$(notdir $@)) -Wl,-soname=$(notdir $@).$(2) \ + $(Q)$(CC) $(LDFLAGS-$(notdir $@)) $(LDFLAGS-y-$(@F)) \ + -Wl,-soname=$(notdir $@).$(2) \ $(NOSTDLIB_CFLAGS) -o $(dir $@)$(1) $(START_FILE-$(notdir $@)) \ -Wl,--whole-archive $(firstword $^) -Wl,--no-whole-archive \ $(LIBS-$(notdir $@)) $(LIBGCC) $(END_FILE-$(notdir $@)) diff --git a/ldso/ldso/Makefile.in b/ldso/ldso/Makefile.in index e71ae15..7a9ffa6 100644 --- a/ldso/ldso/Makefile.in +++ b/ldso/ldso/Makefile.in @@ -30,6 +30,7 @@ CFLAGS-ldso/ldso/$(TARGET_ARCH)/ := $(CFLAGS-ldso) CFLAGS-ldso.c := -DLDSO_ELFINTERP=\"$(TARGET_ARCH)/elfinterp.c\" $(CFLAGS-ldso) +LDFLAGS-$(UCLIBC_FORMAT_DSBT_ELF)-$(UCLIBC_LDSO_NAME).so := -Wl,--dsbt-index=1 ifneq ($(SUPPORT_LD_DEBUG),y) LDFLAGS-$(UCLIBC_LDSO_NAME).so := $(LDFLAGS) else diff --git a/ldso/libdl/Makefile.in b/ldso/libdl/Makefile.in index 39db7a8..152185e 100644 --- a/ldso/libdl/Makefile.in +++ b/ldso/libdl/Makefile.in @@ -19,6 +19,7 @@ endif CFLAGS-libdl.c := -DLDSO_ELFINTERP=\"$(TARGET_ARCH)/elfinterp.c\" +LDFLAGS-$(UCLIBC_FORMAT_DSBT_ELF)-libdl.so := -Wl,--dsbt-index=3 LDFLAGS-libdl.so := $(LDFLAGS) -Wl,-fini,dl_cleanup LIBS-libdl.so := $(LIBS) $(ldso) diff --git a/libc/Makefile.in b/libc/Makefile.in index dd666ac..3b6a17b 100644 --- a/libc/Makefile.in +++ b/libc/Makefile.in @@ -15,6 +15,7 @@ ifneq ($(VERSION_SCRIPT),) VERSION_SCRIPT := -Wl,--version-script,$(VERSION_SCRIPT) endif +LDFLAGS-$(UCLIBC_FORMAT_DSBT_ELF)-libc.so := -Wl,--dsbt-index=2 LDFLAGS-libc.so := $(LDFLAGS) $(VERSION_SCRIPT) -Wl,-init,$(SYMBOL_PREFIX)__uClibc_init ifeq ($(UCLIBC_HAS_STDIO_FUTEXES),y) CFLAGS += -D__USE_STDIO_FUTEXES__ diff --git a/libcrypt/Makefile.in b/libcrypt/Makefile.in index 3cbf9d0..1d1fb55 100644 --- a/libcrypt/Makefile.in +++ b/libcrypt/Makefile.in @@ -9,6 +9,7 @@ subdirs += libcrypt CFLAGS-libcrypt := -DNOT_IN_libc -DIS_IN_libcrypt $(SSP_ALL_CFLAGS) +LDFLAGS-$(UCLIBC_FORMAT_DSBT_ELF)-libcrypt.so := -Wl,--dsbt-index=4 LDFLAGS-libcrypt.so := $(LDFLAGS) LIBS-libcrypt.so := $(LIBS) diff --git a/libm/Makefile.in b/libm/Makefile.in index 384365c..2235933 100644 --- a/libm/Makefile.in +++ b/libm/Makefile.in @@ -25,6 +25,7 @@ subdirs += libm CFLAGS-libm := -DNOT_IN_libc -DIS_IN_libm $(SSP_ALL_CFLAGS) CFLAGS-libm += -D_IEEE_LIBM +LDFLAGS-$(UCLIBC_FORMAT_DSBT_ELF)-libm.so := -Wl,--dsbt-index=5 LDFLAGS-libm.so := $(LDFLAGS) LIBS-libm.so := $(LIBS) diff --git a/libnsl/Makefile.in b/libnsl/Makefile.in index 3aa05a0..333c490 100644 --- a/libnsl/Makefile.in +++ b/libnsl/Makefile.in @@ -9,6 +9,7 @@ subdirs += libnsl CFLAGS-libnsl := -DNOT_IN_libc -DIS_IN_libnsl $(SSP_ALL_CFLAGS) +LDFLAGS-$(UCLIBC_FORMAT_DSBT_ELF)-libnsl.so := -Wl,--dsbt-index=6 LDFLAGS-libnsl.so := $(LDFLAGS) $(call link.asneeded,-lc) LIBS-libnsl.so := $(LIBS) diff --git a/libpthread/linuxthreads.old/Makefile.in b/libpthread/linuxthreads.old/Makefile.in index d2e29c7..f599b16 100644 --- a/libpthread/linuxthreads.old/Makefile.in +++ b/libpthread/linuxthreads.old/Makefile.in @@ -18,6 +18,7 @@ LDFLAGS-libpthread.so := $(LDFLAGS_NOSTRIP) -Wl,-z,defs else LDFLAGS-libpthread.so := $(LDFLAGS) endif +LDFLAGS-$(UCLIBC_FORMAT_DSBT_ELF)-libpthread.so := -Wl,--dsbt-index=10 LIBS-libpthread.so := $(LIBS) $(ldso) diff --git a/libresolv/Makefile.in b/libresolv/Makefile.in index fb71b42..fa3c341 100644 --- a/libresolv/Makefile.in +++ b/libresolv/Makefile.in @@ -9,6 +9,7 @@ subdirs += libresolv CFLAGS-libresolv := -DNOT_IN_libc -DIS_IN_libresolv $(SSP_ALL_CFLAGS) +LDFLAGS-$(UCLIBC_FORMAT_DSBT_ELF)-libresolv.so := -Wl,--dsbt-index=7 LDFLAGS-libresolv.so := $(LDFLAGS) $(call link.asneeded,-lc) LIBS-libresolv.so := $(LIBS) diff --git a/librt/Makefile.in b/librt/Makefile.in index 6eb508c..7d295d4 100644 --- a/librt/Makefile.in +++ b/librt/Makefile.in @@ -9,6 +9,7 @@ subdirs += librt CFLAGS-librt := -DNOT_IN_libc -DIS_IN_librt $(SSP_ALL_CFLAGS) +LDFLAGS-$(UCLIBC_FORMAT_DSBT_ELF)-librt.so := -Wl,--dsbt-index=9 LDFLAGS-librt.so := $(LDFLAGS) LIBS-librt.so := $(LIBS) ifeq ($(UCLIBC_HAS_THREADS_NATIVE),y) diff --git a/libutil/Makefile.in b/libutil/Makefile.in index 057d02d..f904fc7 100644 --- a/libutil/Makefile.in +++ b/libutil/Makefile.in @@ -9,6 +9,7 @@ subdirs += libutil CFLAGS-libutil := -DNOT_IN_libc -DIS_IN_libutil $(SSP_ALL_CFLAGS) +LDFLAGS-$(UCLIBC_FORMAT_DSBT_ELF)-libutil.so := -Wl,--dsbt-index=8 LDFLAGS-libutil.so := $(LDFLAGS) LIBS-libutil.so := $(LIBS) -- 1.7.3.4 From a-jacquiot at ti.com Wed Apr 6 13:19:48 2011 From: a-jacquiot at ti.com (Aurelien Jacquiot) Date: Wed, 06 Apr 2011 13:19:48 -0000 Subject: [git commit prelink] The C6X port Message-ID: <20110406131947.19E3B80774@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=46d6a24872b7fa2717f8f71b5e0598a14d38e1f6 branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/prelink This adds support for the TI C6X family of processors. Signed-off-by: Mark Salter Signed-off-by: Aurelien Jacquiot Signed-off-by: Bernd Schmidt Patch is too large, so refusing to show it From bernds at codesourcery.com Wed Apr 6 13:19:48 2011 From: bernds at codesourcery.com (Bernd Schmidt) Date: Wed, 06 Apr 2011 13:19:48 -0000 Subject: [git commit prelink] Allow ABIs where SP points below the stack frame. Message-ID: <20110406131946.C458880774@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=817f685f4c65ed1af6eef79749b1f158eedd5bfc branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/prelink On C6X, the stack pointer points to a word that is not part of the current function's stack frame. It may be overwritten by callees. Take this into account when creating the stack for a cloned thread. Signed-off-by: Bernd Schmidt --- libpthread/linuxthreads.old/manager.c | 18 +++++++++++------- 1 files changed, 11 insertions(+), 7 deletions(-) diff --git a/libpthread/linuxthreads.old/manager.c b/libpthread/linuxthreads.old/manager.c index 52c1ea9..85fee5e 100644 --- a/libpthread/linuxthreads.old/manager.c +++ b/libpthread/linuxthreads.old/manager.c @@ -35,6 +35,9 @@ #include "semaphore.h" #include "debug.h" /* PDEBUG, added by StS */ +#ifndef THREAD_STACK_OFFSET +#define THREAD_STACK_OFFSET 0 +#endif /* poll() is not supported in kernel <= 2.0, therefore is __NR_poll is * not available, we assume an old Linux kernel is in use and we will @@ -476,6 +479,7 @@ static int pthread_handle_create(pthread_t *thread, const pthread_attr_t *attr, int pid; pthread_descr new_thread; char * new_thread_bottom; + char * new_thread_top; pthread_t new_thread_id; char *guardaddr = NULL; size_t guardsize = 0; @@ -561,7 +565,7 @@ static int pthread_handle_create(pthread_t *thread, const pthread_attr_t *attr, /* Do the cloning. We have to use two different functions depending on whether we are debugging or not. */ pid = 0; /* Note that the thread never can have PID zero. */ - + new_thread_top = ((char *)new_thread - THREAD_STACK_OFFSET); /* ******************************************************** */ /* This code was moved from below to cope with running threads @@ -588,12 +592,12 @@ static int pthread_handle_create(pthread_t *thread, const pthread_attr_t *attr, /* We have to report this event. */ #ifdef __ia64__ - pid = __clone2(pthread_start_thread_event, (void **) new_thread, - (char *)new_thread - new_thread_bottom, + pid = __clone2(pthread_start_thread_event, new_thread_top, + new_thread_top - new_thread_bottom, CLONE_VM | CLONE_FS | CLONE_FILES | CLONE_SIGHAND | __pthread_sig_cancel, new_thread); #else - pid = clone(pthread_start_thread_event, (void **) new_thread, + pid = clone(pthread_start_thread_event, new_thread_top, CLONE_VM | CLONE_FS | CLONE_FILES | CLONE_SIGHAND | __pthread_sig_cancel, new_thread); #endif @@ -626,12 +630,12 @@ static int pthread_handle_create(pthread_t *thread, const pthread_attr_t *attr, { PDEBUG("cloning new_thread = %p\n", new_thread); #ifdef __ia64__ - pid = __clone2(pthread_start_thread, (void **) new_thread, - (char *)new_thread - new_thread_bottom, + pid = __clone2(pthread_start_thread, new_thread_top, + new_thread_top - new_thread_bottom, CLONE_VM | CLONE_FS | CLONE_FILES | CLONE_SIGHAND | __pthread_sig_cancel, new_thread); #else - pid = clone(pthread_start_thread, (void **) new_thread, + pid = clone(pthread_start_thread, new_thread_top, CLONE_VM | CLONE_FS | CLONE_FILES | CLONE_SIGHAND | __pthread_sig_cancel, new_thread); #endif -- 1.7.3.4 From bernds at codesourcery.com Wed Apr 6 13:19:48 2011 From: bernds at codesourcery.com (Bernd Schmidt) Date: Wed, 06 Apr 2011 13:19:48 -0000 Subject: [git commit prelink] Implement ffsl and ffsll. Message-ID: <20110406131947.882DB80774@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=2a19c1339d6bf46fe0f90fbd4e8dca6646d111ed branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/prelink This imports and adapts ffsll.c from glibc. The same mechanism as in glibc is used to choose between ffs and ffsll to implement ffsl. The single user in libc is changed to use the hidden version __libc_ffs. Signed-off-by: Bernd Schmidt Acked-by: Bernhard Reutner-Fischer --- include/string.h | 10 ++++++++-- libc/inet/rpc/svc.c | 2 +- libc/string/ffs.c | 16 ++++++++++------ libc/string/ffsll.c | 40 ++++++++++++++++++++++++++++++++++++++++ 4 files changed, 59 insertions(+), 9 deletions(-) create mode 100644 libc/string/ffsll.c diff --git a/include/string.h b/include/string.h index ca22055..66f64e7 100644 --- a/include/string.h +++ b/include/string.h @@ -374,11 +374,10 @@ extern char *rindex (__const char *__s, int __c) /* Return the position of the first bit set in I, or 0 if none are set. The least-significant bit is position 1, the most-significant 32. */ extern int ffs (int __i) __THROW __attribute__ ((__const__)); -libc_hidden_proto(ffs) /* The following two functions are non-standard but necessary for non-32 bit platforms. */ -# if 0 /*#ifdef __USE_GNU*/ +#ifdef __USE_GNU extern int ffsl (long int __l) __THROW __attribute__ ((__const__)); # ifdef __GNUC__ __extension__ extern int ffsll (long long int __ll) @@ -386,6 +385,13 @@ __extension__ extern int ffsll (long long int __ll) # endif # endif +#ifdef _LIBC +extern __typeof(ffs) __libc_ffs; +libc_hidden_proto(__libc_ffs); +extern __typeof(ffsll) __libc_ffsll; +libc_hidden_proto(__libc_ffsll) +#endif + /* Compare S1 and S2, ignoring case. */ extern int strcasecmp (__const char *__s1, __const char *__s2) __THROW __attribute_pure__ __nonnull ((1, 2)); diff --git a/libc/inet/rpc/svc.c b/libc/inet/rpc/svc.c index 0f5300c..03b4062 100644 --- a/libc/inet/rpc/svc.c +++ b/libc/inet/rpc/svc.c @@ -452,7 +452,7 @@ svc_getreqset (fd_set *readfds) setsize = _rpc_dtablesize (); maskp = (u_int32_t *) readfds->fds_bits; for (sock = 0; sock < setsize; sock += 32) - for (mask = *maskp++; (bit = ffs (mask)); mask ^= (1 << (bit - 1))) + for (mask = *maskp++; (bit = __libc_ffs (mask)); mask ^= (1 << (bit - 1))) svc_getreq_common (sock + bit - 1); } libc_hidden_def(svc_getreqset) diff --git a/libc/string/ffs.c b/libc/string/ffs.c index 22efe4a..4a5336d 100644 --- a/libc/string/ffs.c +++ b/libc/string/ffs.c @@ -5,12 +5,12 @@ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. */ -/* ffsl,ffsll */ - +#include +#define ffsl __something_else #include "_string.h" - - -int ffs(int i) +#undef ffsl + +int __libc_ffs(int i) { #if 1 /* inlined binary search method */ @@ -51,4 +51,8 @@ int ffs(int i) return n; #endif } -libc_hidden_def(ffs) +libc_hidden_def(__libc_ffs) +weak_alias(__libc_ffs,ffs) +#if ULONG_MAX == UINT_MAX +weak_alias (__libc_ffs, ffsl) +#endif diff --git a/libc/string/ffsll.c b/libc/string/ffsll.c new file mode 100644 index 0000000..29e9ba9 --- /dev/null +++ b/libc/string/ffsll.c @@ -0,0 +1,40 @@ +/* Copyright (C) 1991, 1992, 1997, 1998 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Torbjorn Granlund (tege at sics.se). + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include +#define ffsl __something_else +#include "_string.h" +#undef ffsl + +/* Find the first bit set in I. */ +int __libc_ffsll (long long int i) +{ + unsigned long long int x = i & -i; + + if (x <= 0xffffffff) + return __libc_ffs (i); + else + return 32 + __libc_ffs (i >> 32); +} +libc_hidden_def(__libc_ffsll) + +weak_alias (__libc_ffsll, ffsll) +#if ULONG_MAX != UINT_MAX +weak_alias (__libc_ffsll, ffsl) +#endif -- 1.7.3.4 From bernds at codesourcery.com Wed Apr 6 13:19:55 2011 From: bernds at codesourcery.com (Bernd Schmidt) Date: Wed, 06 Apr 2011 13:19:55 -0000 Subject: [git commit prelink] Add C6X-specific sys/ptrace.h Message-ID: <20110406131954.3DFC080774@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=3ae11e90f822a766cc0b97d7f5eb12556685e8f0 branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/prelink The debugger needs some C6X-specific ptrace operations to get information about the DSBT binaries; similar to what's done on FD-PIC targets. Signed-off-by: Bernd Schmidt --- libc/sysdeps/linux/c6x/sys/ptrace.h | 176 +++++++++++++++++++++++++++++++++++ 1 files changed, 176 insertions(+), 0 deletions(-) create mode 100644 libc/sysdeps/linux/c6x/sys/ptrace.h diff --git a/libc/sysdeps/linux/c6x/sys/ptrace.h b/libc/sysdeps/linux/c6x/sys/ptrace.h new file mode 100644 index 0000000..b8a7a49 --- /dev/null +++ b/libc/sysdeps/linux/c6x/sys/ptrace.h @@ -0,0 +1,176 @@ +/* `ptrace' debugger support interface. Linux version. + Copyright (C) 1996-1999,2000,2006,2007 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _SYS_PTRACE_H +#define _SYS_PTRACE_H 1 + +#include + +__BEGIN_DECLS + +/* Type of the REQUEST argument to `ptrace.' */ +enum __ptrace_request +{ + /* Indicate that the process making this request should be traced. + All signals received by this process can be intercepted by its + parent, and its parent can use the other `ptrace' requests. */ + PTRACE_TRACEME = 0, +#define PT_TRACE_ME PTRACE_TRACEME + + /* Return the word in the process's text space at address ADDR. */ + PTRACE_PEEKTEXT = 1, +#define PT_READ_I PTRACE_PEEKTEXT + + /* Return the word in the process's data space at address ADDR. */ + PTRACE_PEEKDATA = 2, +#define PT_READ_D PTRACE_PEEKDATA + + /* Return the word in the process's user area at offset ADDR. */ + PTRACE_PEEKUSER = 3, +#define PT_READ_U PTRACE_PEEKUSER + + /* Write the word DATA into the process's text space at address ADDR. */ + PTRACE_POKETEXT = 4, +#define PT_WRITE_I PTRACE_POKETEXT + + /* Write the word DATA into the process's data space at address ADDR. */ + PTRACE_POKEDATA = 5, +#define PT_WRITE_D PTRACE_POKEDATA + + /* Write the word DATA into the process's user area at offset ADDR. */ + PTRACE_POKEUSER = 6, +#define PT_WRITE_U PTRACE_POKEUSER + + /* Continue the process. */ + PTRACE_CONT = 7, +#define PT_CONTINUE PTRACE_CONT + + /* Kill the process. */ + PTRACE_KILL = 8, +#define PT_KILL PTRACE_KILL + + /* Single step the process. + This is not supported on all machines. */ + PTRACE_SINGLESTEP = 9, +#define PT_STEP PTRACE_SINGLESTEP + + /* Get all general purpose registers used by a processes. + This is not supported on all machines. */ + PTRACE_GETREGS = 12, +#define PT_GETREGS PTRACE_GETREGS + + /* Set all general purpose registers used by a processes. + This is not supported on all machines. */ + PTRACE_SETREGS = 13, +#define PT_SETREGS PTRACE_SETREGS + + /* Get all floating point registers used by a processes. + This is not supported on all machines. */ + PTRACE_GETFPREGS = 14, +#define PT_GETFPREGS PTRACE_GETFPREGS + + /* Set all floating point registers used by a processes. + This is not supported on all machines. */ + PTRACE_SETFPREGS = 15, +#define PT_SETFPREGS PTRACE_SETFPREGS + + /* Attach to a process that is already running. */ + PTRACE_ATTACH = 16, +#define PT_ATTACH PTRACE_ATTACH + + /* Detach from a process attached to with PTRACE_ATTACH. */ + PTRACE_DETACH = 17, +#define PT_DETACH PTRACE_DETACH + + /* Get all extended floating point registers used by a processes. + This is not supported on all machines. */ + PTRACE_GETFPXREGS = 18, +#define PT_GETFPXREGS PTRACE_GETFPXREGS + + /* Set all extended floating point registers used by a processes. + This is not supported on all machines. */ + PTRACE_SETFPXREGS = 19, +#define PT_SETFPXREGS PTRACE_SETFPXREGS + + /* Continue and stop at the next (return from) syscall. */ + PTRACE_SYSCALL = 24, +#define PT_SYSCALL PTRACE_SYSCALL + + /* Obtain the load map of the main program or the interpreter of the + ptraced process, depending on whether the addr argument is + (void*)0 or (void*)1, respectively. */ + PTRACE_GETDSBT = 31, +#define PT_GETDSBT PTRACE_GETDSBT + + /* Set ptrace filter options. */ + PTRACE_SETOPTIONS = 0x4200, +#define PT_SETOPTIONS PTRACE_SETOPTIONS + + /* Get last ptrace message. */ + PTRACE_GETEVENTMSG = 0x4201, +#define PT_GETEVENTMSG PTRACE_GETEVENTMSG + + /* Get siginfo for process. */ + PTRACE_GETSIGINFO = 0x4202, +#define PT_GETSIGINFO PTRACE_GETSIGINFO + + /* Set new siginfo for process. */ + PTRACE_SETSIGINFO = 0x4203 +#define PT_SETSIGINFO PTRACE_SETSIGINFO +}; + +#define PTRACE_GETDSBT_EXEC ((void*)0) /* [addr] request the executable loadmap */ +#define PTRACE_GETDSBT_INTERP ((void*)1) /* [addr] request the interpreter loadmap */ + +/* Options set using PTRACE_SETOPTIONS. */ +enum __ptrace_setoptions { + PTRACE_O_TRACESYSGOOD = 0x00000001, + PTRACE_O_TRACEFORK = 0x00000002, + PTRACE_O_TRACEVFORK = 0x00000004, + PTRACE_O_TRACECLONE = 0x00000008, + PTRACE_O_TRACEEXEC = 0x00000010, + PTRACE_O_TRACEVFORKDONE = 0x00000020, + PTRACE_O_TRACEEXIT = 0x00000040, + PTRACE_O_MASK = 0x0000007f +}; + +/* Wait extended result codes for the above trace options. */ +enum __ptrace_eventcodes { + PTRACE_EVENT_FORK = 1, + PTRACE_EVENT_VFORK = 2, + PTRACE_EVENT_CLONE = 3, + PTRACE_EVENT_EXEC = 4, + PTRACE_EVENT_VFORK_DONE = 5, + PTRACE_EVENT_EXIT = 6 +}; + +/* Perform process tracing functions. REQUEST is one of the values + above, and determines the action to be taken. + For all requests except PTRACE_TRACEME, PID specifies the process to be + traced. + + PID and the other arguments described above for the various requests should + appear (those that are used for the particular request) as: + pid_t PID, void *ADDR, int DATA, void *ADDR2 + after REQUEST. */ +extern long int ptrace (enum __ptrace_request __request, ...) __THROW; + +__END_DECLS + +#endif /* _SYS_PTRACE_H */ -- 1.7.3.4 From bernds at codesourcery.com Wed Apr 6 13:19:56 2011 From: bernds at codesourcery.com (Bernd Schmidt) Date: Wed, 06 Apr 2011 13:19:56 -0000 Subject: [git commit prelink] Select ARCH_HAS_NO_MMU for C6X. Message-ID: <20110406131955.CF58B80774@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=935151992d9385c54a44033d5bf8102ff10fb50f branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/prelink Signed-off-by: Bernd Schmidt --- extra/Configs/Config.c6x | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/extra/Configs/Config.c6x b/extra/Configs/Config.c6x index 7b5b005..96adfb3 100644 --- a/extra/Configs/Config.c6x +++ b/extra/Configs/Config.c6x @@ -10,6 +10,7 @@ config FORCE_OPTIONS_FOR_ARCH bool default y select ARCH_ANY_ENDIAN + select ARCH_HAS_NO_MMU choice prompt "Target Processor Type" -- 1.7.3.4 From bernds at codesourcery.com Wed Apr 6 13:20:07 2011 From: bernds at codesourcery.com (Bernd Schmidt) Date: Wed, 06 Apr 2011 13:20:07 -0000 Subject: [git commit prelink] Add a missing macro to C6X syscalls.h. Message-ID: <20110406131955.9F2A480774@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=3b5e53eaf0c94051969974aab6c0e89bdb424f9c branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/prelink We need _syscall_noerr0 to fix compilation of getuid.c. Signed-off-by: Bernd Schmidt --- libc/sysdeps/linux/c6x/bits/syscalls.h | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/libc/sysdeps/linux/c6x/bits/syscalls.h b/libc/sysdeps/linux/c6x/bits/syscalls.h index 382ec51..56a1667 100644 --- a/libc/sysdeps/linux/c6x/bits/syscalls.h +++ b/libc/sysdeps/linux/c6x/bits/syscalls.h @@ -167,6 +167,7 @@ type name(C_DECL_ARGS_##nargs(args)) { \ } #define _syscall0(args...) SYSCALL_FUNC(0, args) +#define _syscall_noerr0(args...) SYSCALL_NOERR_FUNC(0, args) #define _syscall1(args...) SYSCALL_FUNC(1, args) #define _syscall_noerr1(args...) SYSCALL_NOERR_FUNC(1, args) #define _syscall2(args...) SYSCALL_FUNC(2, args) -- 1.7.3.4 From bernds at codesourcery.com Mon Apr 11 11:29:08 2011 From: bernds at codesourcery.com (Bernd Schmidt) Date: Mon, 11 Apr 2011 11:29:08 -0000 Subject: [git commit] Support dynamic assignment of DSBT_INDEX Message-ID: <20110411112907.7301582544@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=feb7ce46ef24f74ebf0235f10127bd49f0c7e675 branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/master For DSBT targets (C6X only at this point), we'd like to support the case where the user did not specify --dsbt-index at link time when building a shared library. The dynamic linker can still assign an index at runtime and fix up the DSBT_INDEX relocs, at the cost of startup time and memory space. Signed-off-by: Bernd Schmidt --- ldso/ldso/c6x/elfinterp.c | 6 +++++- ldso/ldso/dl-elf.c | 34 +++++++++++++++++++++++++++++----- 2 files changed, 34 insertions(+), 6 deletions(-) diff --git a/ldso/ldso/c6x/elfinterp.c b/ldso/ldso/c6x/elfinterp.c index 7c79171..f5d3ad4 100644 --- a/ldso/ldso/c6x/elfinterp.c +++ b/ldso/ldso/c6x/elfinterp.c @@ -198,6 +198,10 @@ _dl_do_reloc (struct elf_resolve *tpnt,struct dyn_elf *scope, new_val = sym_val; *reloc_addr = sym_val; break; + case R_C6000_DSBT_INDEX: + new_val = (old_val & ~0x007fff00) | ((tpnt->loadaddr.map->dsbt_index & 0x7fff) << 8); + *reloc_addr = new_val; + break; case R_C6000_ABS_L16: new_val = (old_val & ~0x007fff80) | ((sym_val & 0xffff) << 7); *reloc_addr = new_val; @@ -224,7 +228,7 @@ _dl_do_reloc (struct elf_resolve *tpnt,struct dyn_elf *scope, (char *)symbol_addr, symtab[symtab_index].st_size); } - break; + return 0; default: return -1; /*call _dl_exit(1) */ } diff --git a/ldso/ldso/dl-elf.c b/ldso/ldso/dl-elf.c index 91e8a97..7b5d751 100644 --- a/ldso/ldso/dl-elf.c +++ b/ldso/ldso/dl-elf.c @@ -811,20 +811,44 @@ struct elf_resolve *_dl_load_elf_shared_library(int secure, #ifdef __DSBT__ /* Handle DSBT initialization */ { - struct elf_resolve *t, *ref = NULL; + struct elf_resolve *t, *ref; int idx = tpnt->loadaddr.map->dsbt_index; unsigned *dsbt = tpnt->loadaddr.map->dsbt_table; if (idx == 0) { - /* This DSO has not been assigned an index */ - _dl_dprintf(2, "%s: '%s' is missing a dsbt index assignment!\n", - _dl_progname, libname); - _dl_exit(1); + if (!dynamic_info[DT_TEXTREL]) { + /* This DSO has not been assigned an index. */ + _dl_dprintf(2, "%s: '%s' is missing a dsbt index assignment!\n", + _dl_progname, libname); + _dl_exit(1); + } + /* Find a dsbt table from another module. */ + ref = NULL; + for (t = _dl_loaded_modules; t; t = t->next) { + if (ref == NULL && t != tpnt) { + ref = t; + break; + } + } + idx = tpnt->loadaddr.map->dsbt_size; + while (idx-- > 0) + if (!ref || ref->loadaddr.map->dsbt_table[idx] == NULL) + break; + if (idx <= 0) { + _dl_dprintf(2, "%s: '%s' caused DSBT table overflow!\n", + _dl_progname, libname); + _dl_exit(1); + } + _dl_if_debug_dprint("\n\tfile='%s'; assigned index %d\n", + libname, idx); + tpnt->loadaddr.map->dsbt_index = idx; + } /* * Setup dsbt slot for this module in dsbt of all modules. */ + ref = NULL; for (t = _dl_loaded_modules; t; t = t->next) { /* find a dsbt table from another module */ if (ref == NULL && t != tpnt) { -- 1.7.3.4 From cernekee at gmail.com Wed Apr 13 08:29:22 2011 From: cernekee at gmail.com (Kevin Cernekee) Date: Wed, 13 Apr 2011 08:29:22 -0000 Subject: [git commit] buildsys: fix GNU make v3.80 compatibility again Message-ID: <20110413082920.6F5D4825CF@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=a4a4912b180c03e5f0ca7d6f05be97492b6983e1 branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/master GNU make 3.80 cannot handle "$(and)" or "$(or)" from commit 18e7136e (buildsys: use kbuild style). Replace them with ifeq/ifneq. Signed-off-by: Kevin Cernekee Signed-off-by: Bernhard Reutner-Fischer --- libc/sysdeps/linux/common/Makefile.in | 8 ++++++-- 1 files changed, 6 insertions(+), 2 deletions(-) diff --git a/libc/sysdeps/linux/common/Makefile.in b/libc/sysdeps/linux/common/Makefile.in index 3f97911..b0754df 100644 --- a/libc/sysdeps/linux/common/Makefile.in +++ b/libc/sysdeps/linux/common/Makefile.in @@ -15,7 +15,9 @@ CSRC_LFS := $(notdir $(wildcard $(COMMON_DIR)/*64.c)) CSRC-y := $(filter-out llseek.c $(CSRC_LFS),$(CSRC-y)) CSRC-$(UCLIBC_HAS_LFS) += llseek.c $(CSRC_LFS) -CSRC-$(if $(or $(UCLIBC_HAS_SSP),$(UCLIBC_HAS_FORTIFY)),y) += ssp.c +ifneq ($(UCLIBC_HAS_SSP)$(UCLIBC_HAS_FORTIFY),) +CSRC-y += ssp.c +endif CSRC-$(UCLIBC_LINUX_MODULE_24) += create_module.c query_module.c \ get_kernel_syms.c # we need these internally: fstatfs.c statfs.c @@ -25,7 +27,9 @@ CSRC-$(UCLIBC_LINUX_SPECIFIC) += capget.c capset.c inotify.c ioperm.c iopl.c \ sendfile64.c sendfile.c setfsgid.c setfsuid.c setresuid.c \ splice.c vmsplice.c tee.c signalfd.c swapoff.c swapon.c \ sync_file_range.c sysctl.c sysinfo.c timerfd.c uselib.c vhangup.c -CSRC-$(if $(and $(UCLIBC_LINUX_SPECIFIC),$(UCLIBC_HAS_THREADS_NATIVE)),y) += madvise.c +ifeq ($(UCLIBC_LINUX_SPECIFIC)$(UCLIBC_HAS_THREADS_NATIVE),yy) +CSRC-y += madvise.c +endif ifeq ($(UCLIBC_HAS_THREADS_NATIVE),y) CSRC- += fork.c getpid.c raise.c open.c close.c read.c write.c CSRC- += $(if $(findstring =arm=,=$(TARGET_ARCH)=),vfork.c) -- 1.7.3.4 From cernekee at gmail.com Thu Apr 14 22:42:08 2011 From: cernekee at gmail.com (Kevin Cernekee) Date: Thu, 14 Apr 2011 22:42:08 -0000 Subject: [git commit future] buildsys: fix GNU make v3.80 compatibility again Message-ID: <20110414224208.2D7DD825B6@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=a4a4912b180c03e5f0ca7d6f05be97492b6983e1 branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/future GNU make 3.80 cannot handle "$(and)" or "$(or)" from commit 18e7136e (buildsys: use kbuild style). Replace them with ifeq/ifneq. Signed-off-by: Kevin Cernekee Signed-off-by: Bernhard Reutner-Fischer --- libc/sysdeps/linux/common/Makefile.in | 8 ++++++-- 1 files changed, 6 insertions(+), 2 deletions(-) diff --git a/libc/sysdeps/linux/common/Makefile.in b/libc/sysdeps/linux/common/Makefile.in index 3f97911..b0754df 100644 --- a/libc/sysdeps/linux/common/Makefile.in +++ b/libc/sysdeps/linux/common/Makefile.in @@ -15,7 +15,9 @@ CSRC_LFS := $(notdir $(wildcard $(COMMON_DIR)/*64.c)) CSRC-y := $(filter-out llseek.c $(CSRC_LFS),$(CSRC-y)) CSRC-$(UCLIBC_HAS_LFS) += llseek.c $(CSRC_LFS) -CSRC-$(if $(or $(UCLIBC_HAS_SSP),$(UCLIBC_HAS_FORTIFY)),y) += ssp.c +ifneq ($(UCLIBC_HAS_SSP)$(UCLIBC_HAS_FORTIFY),) +CSRC-y += ssp.c +endif CSRC-$(UCLIBC_LINUX_MODULE_24) += create_module.c query_module.c \ get_kernel_syms.c # we need these internally: fstatfs.c statfs.c @@ -25,7 +27,9 @@ CSRC-$(UCLIBC_LINUX_SPECIFIC) += capget.c capset.c inotify.c ioperm.c iopl.c \ sendfile64.c sendfile.c setfsgid.c setfsuid.c setresuid.c \ splice.c vmsplice.c tee.c signalfd.c swapoff.c swapon.c \ sync_file_range.c sysctl.c sysinfo.c timerfd.c uselib.c vhangup.c -CSRC-$(if $(and $(UCLIBC_LINUX_SPECIFIC),$(UCLIBC_HAS_THREADS_NATIVE)),y) += madvise.c +ifeq ($(UCLIBC_LINUX_SPECIFIC)$(UCLIBC_HAS_THREADS_NATIVE),yy) +CSRC-y += madvise.c +endif ifeq ($(UCLIBC_HAS_THREADS_NATIVE),y) CSRC- += fork.c getpid.c raise.c open.c close.c read.c write.c CSRC- += $(if $(findstring =arm=,=$(TARGET_ARCH)=),vfork.c) -- 1.7.3.4 From cernekee at gmail.com Sat Apr 16 00:54:31 2011 From: cernekee at gmail.com (Kevin Cernekee) Date: Sat, 16 Apr 2011 00:54:31 -0000 Subject: [git commit ldso-future] buildsys: fix GNU make v3.80 compatibility again Message-ID: <20110416005430.C13AA826D0@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=a4a4912b180c03e5f0ca7d6f05be97492b6983e1 branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/ldso-future GNU make 3.80 cannot handle "$(and)" or "$(or)" from commit 18e7136e (buildsys: use kbuild style). Replace them with ifeq/ifneq. Signed-off-by: Kevin Cernekee Signed-off-by: Bernhard Reutner-Fischer --- libc/sysdeps/linux/common/Makefile.in | 8 ++++++-- 1 files changed, 6 insertions(+), 2 deletions(-) diff --git a/libc/sysdeps/linux/common/Makefile.in b/libc/sysdeps/linux/common/Makefile.in index 3f97911..b0754df 100644 --- a/libc/sysdeps/linux/common/Makefile.in +++ b/libc/sysdeps/linux/common/Makefile.in @@ -15,7 +15,9 @@ CSRC_LFS := $(notdir $(wildcard $(COMMON_DIR)/*64.c)) CSRC-y := $(filter-out llseek.c $(CSRC_LFS),$(CSRC-y)) CSRC-$(UCLIBC_HAS_LFS) += llseek.c $(CSRC_LFS) -CSRC-$(if $(or $(UCLIBC_HAS_SSP),$(UCLIBC_HAS_FORTIFY)),y) += ssp.c +ifneq ($(UCLIBC_HAS_SSP)$(UCLIBC_HAS_FORTIFY),) +CSRC-y += ssp.c +endif CSRC-$(UCLIBC_LINUX_MODULE_24) += create_module.c query_module.c \ get_kernel_syms.c # we need these internally: fstatfs.c statfs.c @@ -25,7 +27,9 @@ CSRC-$(UCLIBC_LINUX_SPECIFIC) += capget.c capset.c inotify.c ioperm.c iopl.c \ sendfile64.c sendfile.c setfsgid.c setfsuid.c setresuid.c \ splice.c vmsplice.c tee.c signalfd.c swapoff.c swapon.c \ sync_file_range.c sysctl.c sysinfo.c timerfd.c uselib.c vhangup.c -CSRC-$(if $(and $(UCLIBC_LINUX_SPECIFIC),$(UCLIBC_HAS_THREADS_NATIVE)),y) += madvise.c +ifeq ($(UCLIBC_LINUX_SPECIFIC)$(UCLIBC_HAS_THREADS_NATIVE),yy) +CSRC-y += madvise.c +endif ifeq ($(UCLIBC_HAS_THREADS_NATIVE),y) CSRC- += fork.c getpid.c raise.c open.c close.c read.c write.c CSRC- += $(if $(findstring =arm=,=$(TARGET_ARCH)=),vfork.c) -- 1.7.3.4 From cernekee at gmail.com Thu Apr 21 23:28:44 2011 From: cernekee at gmail.com (Kevin Cernekee) Date: Thu, 21 Apr 2011 23:28:44 -0000 Subject: [git commit future] dl-startup: fix typos in block comment Message-ID: <20110421232843.C69718216E@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=4580f142b4b1ce176320fe5c2c5bee09871a01e7 branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/future Signed-off-by: Kevin Cernekee Signed-off-by: Carmelo Amoroso --- ldso/ldso/dl-startup.c | 16 ++++++++-------- 1 files changed, 8 insertions(+), 8 deletions(-) diff --git a/ldso/ldso/dl-startup.c b/ldso/ldso/dl-startup.c index a51b583..4492660 100644 --- a/ldso/ldso/dl-startup.c +++ b/ldso/ldso/dl-startup.c @@ -32,8 +32,8 @@ /* * The main trick with this program is that initially, we ourselves are not - * dynamicly linked. This means that we cannot access any global variables or - * call any functions. No globals initially, since the Global Offset Table + * dynamically linked. This means that we cannot access any global variables + * or call any functions. No globals initially, since the Global Offset Table * (GOT) is initialized by the linker assuming a virtual address of 0, and no * function calls initially since the Procedure Linkage Table (PLT) is not yet * initialized. @@ -55,12 +55,12 @@ * * Fortunately, the linker itself leaves a few clues lying around, and when the * kernel starts the image, there are a few further clues. First of all, there - * is Auxiliary Vector Table information sitting on which is provided to us by - * the kernel, and which includes information about the load address that the - * program interpreter was loaded at, the number of sections, the address the - * application was loaded at and so forth. Here this information is stored in - * the array auxvt. For details see linux/fs/binfmt_elf.c where it calls - * NEW_AUX_ENT() a bunch of time.... + * is Auxiliary Vector Table information sitting on the stack which is provided + * to us by the kernel, and which includes information about the address + * that the program interpreter was loaded at, the number of sections, the + * address the application was loaded at, and so forth. Here this information + * is stored in the array auxvt. For details see linux/fs/binfmt_elf.c where + * it calls NEW_AUX_ENT() a bunch of times.... * * Next, we need to find the GOT. On most arches there is a register pointing * to the GOT, but just in case (and for new ports) I've added some (slow) C -- 1.7.3.4 From bernds at codesourcery.com Mon Apr 11 11:29:08 2011 From: bernds at codesourcery.com (Bernd Schmidt) Date: Mon, 11 Apr 2011 11:29:08 -0000 Subject: [git commit] Fix malloc alignment Message-ID: <20110411112907.40DC582544@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=eff2d0ba5890b517ef5bc9d0269d6149556c12c8 branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/master In commit 3e0a1f388, Richard tried to fix malloc alignments by using alignof (double __attribute_aligned__(sizeof (size_t))). This doesn't work, since attribute_aligned overrides the alignment rather than providing a minimum. On C6X, malloc returns four-byte aligned values rather than the necessary eight-byte alignment. It's simpler to use a comparison and pick the bigger of the two values, so that's what I've done. Signed-off-by: Bernd Schmidt --- libc/stdlib/malloc/heap.h | 6 ++++-- libc/stdlib/malloc/malloc.h | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/libc/stdlib/malloc/heap.h b/libc/stdlib/malloc/heap.h index 3038079..2f06ab1 100644 --- a/libc/stdlib/malloc/heap.h +++ b/libc/stdlib/malloc/heap.h @@ -29,8 +29,10 @@ /* The heap allocates in multiples of, and aligned to, HEAP_GRANULARITY. HEAP_GRANULARITY must be a power of 2. Malloc depends on this being the same as MALLOC_ALIGNMENT. */ -#define HEAP_GRANULARITY_TYPE double __attribute_aligned__ (sizeof (size_t)) -#define HEAP_GRANULARITY (__alignof__ (HEAP_GRANULARITY_TYPE)) +#define HEAP_GRANULARITY_TYPE double __attribute_aligned__ (HEAP_GRANULARITY) +#define HEAP_GRANULARITY \ + (__alignof__ (double) > sizeof (size_t) ? __alignof__ (double) : sizeof (size_t)) + /* The HEAP_INIT macro can be used as a static initializer for a heap diff --git a/libc/stdlib/malloc/malloc.h b/libc/stdlib/malloc/malloc.h index 0a4b43b..25f7409 100644 --- a/libc/stdlib/malloc/malloc.h +++ b/libc/stdlib/malloc/malloc.h @@ -17,7 +17,7 @@ alignment can be a significant win on targets like m68k and Coldfire, where __alignof__(double) == 2. */ #define MALLOC_ALIGNMENT \ - __alignof__ (double __attribute_aligned__ (sizeof (size_t))) + (__alignof__ (double) > sizeof (size_t) ? __alignof__ (double) : sizeof (size_t)) /* The system pagesize... */ extern size_t __pagesize; -- 1.7.3.4 From bernds at codesourcery.com Mon Apr 11 11:29:09 2011 From: bernds at codesourcery.com (Bernd Schmidt) Date: Mon, 11 Apr 2011 11:29:09 -0000 Subject: [git commit] Fix nommu handling of DT_TEXTREL Message-ID: <20110411112907.0A68A82544@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=56ea76b6bf190bffdc07aba90e4b25dfc096027b branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/master We have a problem with DT_TEXTREL shared libraries on nommu machines. The dynamic linker's strategy is to map the text segment read-only first, then look for DT_TEXTREL, and use mprotect to change protections if necessary. This fails on nommu, since a nommu kernel can decide to share the memory for private read-only file mappings, and mprotect doesn't (can't) do anything about this sharing. Existing nommu targets apparently have no need for this, but on C6X, we may need to assign library indices at run-time if no --dsbt-index option was passed to the linker at build time. Hence, the following patch, which instead of using mprotect, redoes the mapping with PF_W set. Signed-off-by: Bernd Schmidt --- ldso/include/dl-elf.h | 2 +- ldso/include/ldso.h | 2 + ldso/ldso/bfin/dl-inlines.h | 41 +++++-- ldso/ldso/bfin/dl-sysdep.h | 2 + ldso/ldso/c6x/dl-inlines.h | 29 +++++ ldso/ldso/c6x/dl-sysdep.h | 3 + ldso/ldso/dl-elf.c | 284 ++++++++++++++++++++++--------------------- ldso/ldso/frv/dl-inlines.h | 41 +++++-- ldso/ldso/frv/dl-sysdep.h | 2 + 9 files changed, 248 insertions(+), 158 deletions(-) diff --git a/ldso/include/dl-elf.h b/ldso/include/dl-elf.h index 7fbb373..e7203fd 100644 --- a/ldso/include/dl-elf.h +++ b/ldso/include/dl-elf.h @@ -184,7 +184,7 @@ unsigned int __dl_parse_dynamic_info(ElfW(Dyn) *dpnt, unsigned long dynamic_info ADJUST_DYN_INFO(DT_DSBT_BASE_IDX, load_off); /* Initialize loadmap dsbt info. */ - load_off.map->dsbt_table = dynamic_info[DT_DSBT_BASE_IDX]; + load_off.map->dsbt_table = (void *)dynamic_info[DT_DSBT_BASE_IDX]; load_off.map->dsbt_size = dynamic_info[DT_DSBT_SIZE_IDX]; load_off.map->dsbt_index = dynamic_info[DT_DSBT_INDEX_IDX]; #endif diff --git a/ldso/include/ldso.h b/ldso/include/ldso.h index 69b5dd7..95bcd14 100644 --- a/ldso/include/ldso.h +++ b/ldso/include/ldso.h @@ -34,6 +34,8 @@ #include /* Pull in the arch specific page size */ #include +/* Pull in the MIN macro */ +#include /* Pull in the ldso syscalls and string functions */ #ifndef __ARCH_HAS_NO_SHARED__ #include diff --git a/ldso/ldso/bfin/dl-inlines.h b/ldso/ldso/bfin/dl-inlines.h index 6524f5e..9699862 100644 --- a/ldso/ldso/bfin/dl-inlines.h +++ b/ldso/ldso/bfin/dl-inlines.h @@ -88,14 +88,39 @@ __dl_init_loadaddr_hdr (struct elf32_fdpic_loadaddr loadaddr, void *addr, segdata->p_memsz = phdr->p_memsz; #if defined (__SUPPORT_LD_DEBUG__) - { - extern char *_dl_debug; - extern int _dl_debug_file; - if (_dl_debug) - _dl_dprintf(_dl_debug_file, "%i: mapped %x at %x, size %x\n", - loadaddr.map->nsegs-1, - segdata->p_vaddr, segdata->addr, segdata->p_memsz); - } + if (_dl_debug) + _dl_dprintf(_dl_debug_file, "%i: mapped %x at %x, size %x\n", + loadaddr.map->nsegs-1, + segdata->p_vaddr, segdata->addr, segdata->p_memsz); +#endif +} + +/* Replace an existing entry in the load map. */ +static __always_inline void +__dl_update_loadaddr_hdr (struct elf32_fdpic_loadaddr loadaddr, void *addr, + Elf32_Phdr *phdr) +{ + struct elf32_fdpic_loadseg *segdata; + void *oldaddr; + int i; + + for (i = 0; i < loadaddr.map->nsegs; i++) + if (loadaddr.map->segs[i].p_vaddr == phdr->p_vaddr + && loadaddr.map->segs[i].p_memsz == phdr->p_memsz) + break; + if (i == loadaddr.map->nsegs) + _dl_exit (-1); + + segdata = loadaddr.map->segs + i; + oldaddr = (void *)segdata->addr; + _dl_munmap (oldaddr, segdata->p_memsz); + segdata->addr = (Elf32_Addr) addr; + +#if defined (__SUPPORT_LD_DEBUG__) + if (_dl_debug) + _dl_dprintf(_dl_debug_file, "%i: changed mapping %x at %x (old %x), size %x\n", + loadaddr.map->nsegs-1, + segdata->p_vaddr, segdata->addr, oldaddr, segdata->p_memsz); #endif } diff --git a/ldso/ldso/bfin/dl-sysdep.h b/ldso/ldso/bfin/dl-sysdep.h index 50c7509..168e5c8 100644 --- a/ldso/ldso/bfin/dl-sysdep.h +++ b/ldso/ldso/bfin/dl-sysdep.h @@ -120,6 +120,8 @@ struct funcdesc_ht; #define DL_INIT_LOADADDR_HDR(LOADADDR, ADDR, PHDR) \ (__dl_init_loadaddr_hdr ((LOADADDR), (ADDR), (PHDR), \ dl_init_loadaddr_load_count)) +#define DL_UPDATE_LOADADDR_HDR(LOADADDR, ADDR, PHDR) \ + (__dl_update_loadaddr_hdr ((LOADADDR), (ADDR), (PHDR))) #define DL_LOADADDR_UNMAP(LOADADDR, LEN) \ (__dl_loadaddr_unmap ((LOADADDR), (NULL))) #define DL_LIB_UNMAP(LIB, LEN) \ diff --git a/ldso/ldso/c6x/dl-inlines.h b/ldso/ldso/c6x/dl-inlines.h index d8fb42c..62e1cc9 100644 --- a/ldso/ldso/c6x/dl-inlines.h +++ b/ldso/ldso/c6x/dl-inlines.h @@ -74,6 +74,35 @@ __dl_init_loadaddr_hdr (struct elf32_dsbt_loadaddr loadaddr, void *addr, #endif } +/* Replace an existing entry in the load map. */ +static __always_inline void +__dl_update_loadaddr_hdr (struct elf32_dsbt_loadaddr loadaddr, void *addr, + Elf32_Phdr *phdr) +{ + struct elf32_dsbt_loadseg *segdata; + void *oldaddr; + int i; + + for (i = 0; i < loadaddr.map->nsegs; i++) + if (loadaddr.map->segs[i].p_vaddr == phdr->p_vaddr + && loadaddr.map->segs[i].p_memsz == phdr->p_memsz) + break; + if (i == loadaddr.map->nsegs) + _dl_exit (-1); + + segdata = loadaddr.map->segs + i; + oldaddr = (void *)segdata->addr; + _dl_munmap (oldaddr, segdata->p_memsz); + segdata->addr = (Elf32_Addr) addr; + +#if defined (__SUPPORT_LD_DEBUG__) + if (_dl_debug) + _dl_dprintf(_dl_debug_file, "%i: changed mapping %x at %x (old %x), size %x\n", + loadaddr.map->nsegs-1, + segdata->p_vaddr, segdata->addr, oldaddr, segdata->p_memsz); +#endif +} + static __always_inline void __dl_loadaddr_unmap (struct elf32_dsbt_loadaddr loadaddr) { diff --git a/ldso/ldso/c6x/dl-sysdep.h b/ldso/ldso/c6x/dl-sysdep.h index 8f1b122..ff7accd 100644 --- a/ldso/ldso/c6x/dl-sysdep.h +++ b/ldso/ldso/c6x/dl-sysdep.h @@ -104,6 +104,9 @@ struct elf32_dsbt_loadaddr; (__dl_init_loadaddr_hdr ((LOADADDR), (ADDR), (PHDR), \ dl_init_loadaddr_load_count)) +#define DL_UPDATE_LOADADDR_HDR(LOADADDR, ADDR, PHDR) \ + (__dl_update_loadaddr_hdr ((LOADADDR), (ADDR), (PHDR))) + #define DL_LOADADDR_UNMAP(LOADADDR, LEN) \ (__dl_loadaddr_unmap ((LOADADDR))) diff --git a/ldso/ldso/dl-elf.c b/ldso/ldso/dl-elf.c index 505247e..91e8a97 100644 --- a/ldso/ldso/dl-elf.c +++ b/ldso/ldso/dl-elf.c @@ -314,6 +314,121 @@ goof: return NULL; } +/* + * Make a writeable mapping of a segment, regardless of whether PF_W is + * set or not. + */ +static void * +map_writeable (int infile, ElfW(Phdr) *ppnt, int piclib, int flags, + unsigned long libaddr) +{ + int prot_flags = ppnt->p_flags | PF_W; + char *status, *retval; + char *tryaddr; + ssize_t size; + unsigned long map_size; + char *cpnt; + char *piclib2map = NULL; + + if (piclib == 2 && + /* We might be able to avoid this call if memsz doesn't + require an additional page, but this would require mmap + to always return page-aligned addresses and a whole + number of pages allocated. Unfortunately on uClinux + may return misaligned addresses and may allocate + partial pages, so we may end up doing unnecessary mmap + calls. + + This is what we could do if we knew mmap would always + return aligned pages: + + ((ppnt->p_vaddr + ppnt->p_filesz + ADDR_ALIGN) & + PAGE_ALIGN) < ppnt->p_vaddr + ppnt->p_memsz) + + Instead, we have to do this: */ + ppnt->p_filesz < ppnt->p_memsz) + { + piclib2map = (char *) + _dl_mmap(0, (ppnt->p_vaddr & ADDR_ALIGN) + ppnt->p_memsz, + LXFLAGS(prot_flags), flags | MAP_ANONYMOUS, -1, 0); + if (_dl_mmap_check_error(piclib2map)) + return 0; + } + + tryaddr = piclib == 2 ? piclib2map + : ((char*) (piclib ? libaddr : 0) + + (ppnt->p_vaddr & PAGE_ALIGN)); + + size = (ppnt->p_vaddr & ADDR_ALIGN) + ppnt->p_filesz; + + /* For !MMU, mmap to fixed address will fail. + So instead of desperately call mmap and fail, + we set status to MAP_FAILED to save a call + to mmap (). */ +#ifndef __ARCH_USE_MMU__ + if (piclib2map == 0) +#endif + status = (char *) _dl_mmap + (tryaddr, size, LXFLAGS(prot_flags), + flags | (piclib2map ? MAP_FIXED : 0), + infile, ppnt->p_offset & OFFS_ALIGN); +#ifndef __ARCH_USE_MMU__ + else + status = MAP_FAILED; +#endif +#ifdef _DL_PREAD + if (_dl_mmap_check_error(status) && piclib2map + && (_DL_PREAD (infile, tryaddr, size, + ppnt->p_offset & OFFS_ALIGN) == size)) + status = tryaddr; +#endif + if (_dl_mmap_check_error(status) || (tryaddr && tryaddr != status)) + return 0; + + if (piclib2map) + retval = piclib2map; + else + retval = status; + + /* Now we want to allocate and zero-out any data from the end + of the region we mapped in from the file (filesz) to the + end of the loadable segment (memsz). We may need + additional pages for memsz, that we map in below, and we + can count on the kernel to zero them out, but we have to + zero out stuff in the last page that we mapped in from the + file. However, we can't assume to have actually obtained + full pages from the kernel, since we didn't ask for them, + and uClibc may not give us full pages for small + allocations. So only zero out up to memsz or the end of + the page, whichever comes first. */ + + /* CPNT is the beginning of the memsz portion not backed by + filesz. */ + cpnt = (char *) (status + size); + + /* MAP_SIZE is the address of the + beginning of the next page. */ + map_size = (ppnt->p_vaddr + ppnt->p_filesz + + ADDR_ALIGN) & PAGE_ALIGN; + + _dl_memset (cpnt, 0, + MIN (map_size + - (ppnt->p_vaddr + + ppnt->p_filesz), + ppnt->p_memsz + - ppnt->p_filesz)); + + if (map_size < ppnt->p_vaddr + ppnt->p_memsz && !piclib2map) { + tryaddr = map_size + (char*)(piclib ? libaddr : 0); + status = (char *) _dl_mmap(tryaddr, + ppnt->p_vaddr + ppnt->p_memsz - map_size, + LXFLAGS(prot_flags), + flags | MAP_ANONYMOUS | MAP_FIXED, -1, 0); + if (_dl_mmap_check_error(status) || tryaddr != status) + return NULL; + } + return retval; +} /* * Read one ELF library into memory, mmap it into the correct locations and @@ -475,6 +590,7 @@ struct elf_resolve *_dl_load_elf_shared_library(int secure, status = (char *) _dl_mmap((char *) (piclib ? 0 : minvma), maxvma - minvma, PROT_NONE, flags | MAP_ANONYMOUS, -1, 0); if (_dl_mmap_check_error(status)) { + cant_map: _dl_dprintf(2, "%s:%i: can't map '%s'\n", _dl_progname, __LINE__, libname); _dl_internal_error_number = LD_ERROR_MMAP_FAILED; _dl_close(infile); @@ -495,8 +611,11 @@ struct elf_resolve *_dl_load_elf_shared_library(int secure, char *addr; addr = DL_MAP_SEGMENT (epnt, ppnt, infile, flags); - if (addr == NULL) + if (addr == NULL) { + cant_map1: + DL_LOADADDR_UNMAP (lib_loadaddr, maxvma - minvma); goto cant_map; + } DL_INIT_LOADADDR_HDR (lib_loadaddr, addr, ppnt); ppnt++; @@ -517,141 +636,9 @@ struct elf_resolve *_dl_load_elf_shared_library(int secure, } if (ppnt->p_flags & PF_W) { - unsigned long map_size; - char *cpnt; - char *piclib2map = 0; - - if (piclib == 2 && - /* We might be able to avoid this - call if memsz doesn't require - an additional page, but this - would require mmap to always - return page-aligned addresses - and a whole number of pages - allocated. Unfortunately on - uClinux may return misaligned - addresses and may allocate - partial pages, so we may end up - doing unnecessary mmap calls. - - This is what we could do if we - knew mmap would always return - aligned pages: - - ((ppnt->p_vaddr + ppnt->p_filesz - + ADDR_ALIGN) - & PAGE_ALIGN) - < ppnt->p_vaddr + ppnt->p_memsz) - - Instead, we have to do this: */ - ppnt->p_filesz < ppnt->p_memsz) - { - piclib2map = (char *) - _dl_mmap(0, (ppnt->p_vaddr & ADDR_ALIGN) - + ppnt->p_memsz, - LXFLAGS(ppnt->p_flags), - flags | MAP_ANONYMOUS, -1, 0); - if (_dl_mmap_check_error(piclib2map)) - goto cant_map; - DL_INIT_LOADADDR_HDR - (lib_loadaddr, piclib2map - + (ppnt->p_vaddr & ADDR_ALIGN), ppnt); - } - - tryaddr = piclib == 2 ? piclib2map - : ((char*) (piclib ? libaddr : 0) + - (ppnt->p_vaddr & PAGE_ALIGN)); - - size = (ppnt->p_vaddr & ADDR_ALIGN) - + ppnt->p_filesz; - - /* For !MMU, mmap to fixed address will fail. - So instead of desperately call mmap and fail, - we set status to MAP_FAILED to save a call - to mmap (). */ -#ifndef __ARCH_USE_MMU__ - if (piclib2map == 0) -#endif - status = (char *) _dl_mmap - (tryaddr, size, LXFLAGS(ppnt->p_flags), - flags | (piclib2map ? MAP_FIXED : 0), - infile, ppnt->p_offset & OFFS_ALIGN); -#ifndef __ARCH_USE_MMU__ - else - status = MAP_FAILED; -#endif -#ifdef _DL_PREAD - if (_dl_mmap_check_error(status) && piclib2map - && (_DL_PREAD (infile, tryaddr, size, - ppnt->p_offset & OFFS_ALIGN) - == size)) - status = tryaddr; -#endif - if (_dl_mmap_check_error(status) - || (tryaddr && tryaddr != status)) { - cant_map: - _dl_dprintf(2, "%s:%i: can't map '%s'\n", - _dl_progname, __LINE__, libname); - _dl_internal_error_number = LD_ERROR_MMAP_FAILED; - DL_LOADADDR_UNMAP (lib_loadaddr, maxvma - minvma); - _dl_close(infile); - _dl_munmap(header, _dl_pagesize); - return NULL; - } - - if (! piclib2map) { - DL_INIT_LOADADDR_HDR - (lib_loadaddr, status - + (ppnt->p_vaddr & ADDR_ALIGN), ppnt); - } - /* Now we want to allocate and - zero-out any data from the end of - the region we mapped in from the - file (filesz) to the end of the - loadable segment (memsz). We may - need additional pages for memsz, - that we map in below, and we can - count on the kernel to zero them - out, but we have to zero out stuff - in the last page that we mapped in - from the file. However, we can't - assume to have actually obtained - full pages from the kernel, since - we didn't ask for them, and uClibc - may not give us full pages for - small allocations. So only zero - out up to memsz or the end of the - page, whichever comes first. */ - - /* CPNT is the beginning of the memsz - portion not backed by filesz. */ - cpnt = (char *) (status + size); - - /* MAP_SIZE is the address of the - beginning of the next page. */ - map_size = (ppnt->p_vaddr + ppnt->p_filesz - + ADDR_ALIGN) & PAGE_ALIGN; - -#ifndef MIN -# define MIN(a,b) ((a) < (b) ? (a) : (b)) -#endif - _dl_memset (cpnt, 0, - MIN (map_size - - (ppnt->p_vaddr - + ppnt->p_filesz), - ppnt->p_memsz - - ppnt->p_filesz)); - - if (map_size < ppnt->p_vaddr + ppnt->p_memsz - && !piclib2map) { - tryaddr = map_size + (char*)(piclib ? libaddr : 0); - status = (char *) _dl_mmap(tryaddr, - ppnt->p_vaddr + ppnt->p_memsz - map_size, - LXFLAGS(ppnt->p_flags), flags | MAP_ANONYMOUS | MAP_FIXED, -1, 0); - if (_dl_mmap_check_error(status) - || tryaddr != status) - goto cant_map; - } + status = map_writeable (infile, ppnt, piclib, flags, libaddr); + if (status == NULL) + goto cant_map1; } else { tryaddr = (piclib == 2 ? 0 : (char *) (ppnt->p_vaddr & PAGE_ALIGN) @@ -664,11 +651,11 @@ struct elf_resolve *_dl_load_elf_shared_library(int secure, infile, ppnt->p_offset & OFFS_ALIGN); if (_dl_mmap_check_error(status) || (tryaddr && tryaddr != status)) - goto cant_map; - DL_INIT_LOADADDR_HDR - (lib_loadaddr, status - + (ppnt->p_vaddr & ADDR_ALIGN), ppnt); + goto cant_map1; } + DL_INIT_LOADADDR_HDR(lib_loadaddr, + status + (ppnt->p_vaddr & ADDR_ALIGN), + ppnt); /* if (libaddr == 0 && piclib) { libaddr = (unsigned long) status; @@ -677,7 +664,6 @@ struct elf_resolve *_dl_load_elf_shared_library(int secure, } ppnt++; } - _dl_close(infile); /* For a non-PIC library, the addresses are all absolute */ if (piclib) { @@ -696,6 +682,7 @@ struct elf_resolve *_dl_load_elf_shared_library(int secure, _dl_dprintf(2, "%s: '%s' is missing a dynamic section\n", _dl_progname, libname); _dl_munmap(header, _dl_pagesize); + _dl_close(infile); return NULL; } @@ -711,10 +698,23 @@ struct elf_resolve *_dl_load_elf_shared_library(int secure, ppnt = (ElfW(Phdr) *)(intptr_t) & header[epnt->e_phoff]; for (i = 0; i < epnt->e_phnum; i++, ppnt++) { if (ppnt->p_type == PT_LOAD && !(ppnt->p_flags & PF_W)) { +#ifdef __ARCH_USE_MMU__ _dl_mprotect((void *) ((piclib ? libaddr : 0) + (ppnt->p_vaddr & PAGE_ALIGN)), (ppnt->p_vaddr & ADDR_ALIGN) + (unsigned long) ppnt->p_filesz, PROT_READ | PROT_WRITE | PROT_EXEC); +#else + void *new_addr; + new_addr = map_writeable (infile, ppnt, piclib, flags, libaddr); + if (!new_addr) { + _dl_dprintf(_dl_debug_file, "Can't modify %s's text section.", + libname); + _dl_exit(1); + } + DL_UPDATE_LOADADDR_HDR(lib_loadaddr, + new_addr + (ppnt->p_vaddr & ADDR_ALIGN), + ppnt); +#endif } } #else @@ -725,6 +725,8 @@ struct elf_resolve *_dl_load_elf_shared_library(int secure, #endif } + _dl_close(infile); + tpnt = _dl_add_elf_hash_table(libname, lib_loadaddr, dynamic_info, dynamic_addr, 0); tpnt->relro_addr = relro_addr; diff --git a/ldso/ldso/frv/dl-inlines.h b/ldso/ldso/frv/dl-inlines.h index 95233a7..0395a7e 100644 --- a/ldso/ldso/frv/dl-inlines.h +++ b/ldso/ldso/frv/dl-inlines.h @@ -72,14 +72,39 @@ __dl_init_loadaddr_hdr (struct elf32_fdpic_loadaddr loadaddr, void *addr, segdata->p_memsz = phdr->p_memsz; #if defined (__SUPPORT_LD_DEBUG__) - { - extern char *_dl_debug; - extern int _dl_debug_file; - if (_dl_debug) - _dl_dprintf(_dl_debug_file, "%i: mapped %x at %x, size %x\n", - loadaddr.map->nsegs-1, - segdata->p_vaddr, segdata->addr, segdata->p_memsz); - } + if (_dl_debug) + _dl_dprintf(_dl_debug_file, "%i: mapped %x at %x, size %x\n", + loadaddr.map->nsegs-1, + segdata->p_vaddr, segdata->addr, segdata->p_memsz); +#endif +} + +/* Replace an existing entry in the load map. */ +static __always_inline void +__dl_update_loadaddr_hdr (struct elf32_fdpic_loadaddr loadaddr, void *addr, + Elf32_Phdr *phdr) +{ + struct elf32_fdpic_loadseg *segdata; + void *oldaddr; + int i; + + for (i = 0; i < loadaddr.map->nsegs; i++) + if (loadaddr.map->segs[i].p_vaddr == phdr->p_vaddr + && loadaddr.map->segs[i].p_memsz == phdr->p_memsz) + break; + if (i == loadaddr.map->nsegs) + _dl_exit (-1); + + segdata = loadaddr.map->segs + i; + oldaddr = (void *)segdata->addr; + _dl_munmap (oldaddr, segdata->p_memsz); + segdata->addr = (Elf32_Addr) addr; + +#if defined (__SUPPORT_LD_DEBUG__) + if (_dl_debug) + _dl_dprintf(_dl_debug_file, "%i: changed mapping %x at %x (old %x), size %x\n", + loadaddr.map->nsegs-1, + segdata->p_vaddr, segdata->addr, oldaddr, segdata->p_memsz); #endif } diff --git a/ldso/ldso/frv/dl-sysdep.h b/ldso/ldso/frv/dl-sysdep.h index e9c847a..206a662 100644 --- a/ldso/ldso/frv/dl-sysdep.h +++ b/ldso/ldso/frv/dl-sysdep.h @@ -95,6 +95,8 @@ struct funcdesc_ht; #define DL_INIT_LOADADDR_HDR(LOADADDR, ADDR, PHDR) \ (__dl_init_loadaddr_hdr ((LOADADDR), (ADDR), (PHDR), \ dl_init_loadaddr_load_count)) +#define DL_UPDATE_LOADADDR_HDR(LOADADDR, ADDR, PHDR) \ + (__dl_update_loadaddr_hdr ((LOADADDR), (ADDR), (PHDR))) #define DL_LOADADDR_UNMAP(LOADADDR, LEN) \ (__dl_loadaddr_unmap ((LOADADDR), (NULL))) #define DL_LIB_UNMAP(LIB, LEN) \ -- 1.7.3.4 From bernds at codesourcery.com Mon Apr 11 22:19:24 2011 From: bernds at codesourcery.com (Bernd Schmidt) Date: Mon, 11 Apr 2011 22:19:24 -0000 Subject: [git commit future] Support dynamic assignment of DSBT_INDEX Message-ID: <20110411221923.0183E8254C@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=feb7ce46ef24f74ebf0235f10127bd49f0c7e675 branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/future For DSBT targets (C6X only at this point), we'd like to support the case where the user did not specify --dsbt-index at link time when building a shared library. The dynamic linker can still assign an index at runtime and fix up the DSBT_INDEX relocs, at the cost of startup time and memory space. Signed-off-by: Bernd Schmidt --- ldso/ldso/c6x/elfinterp.c | 6 +++++- ldso/ldso/dl-elf.c | 34 +++++++++++++++++++++++++++++----- 2 files changed, 34 insertions(+), 6 deletions(-) diff --git a/ldso/ldso/c6x/elfinterp.c b/ldso/ldso/c6x/elfinterp.c index 7c79171..f5d3ad4 100644 --- a/ldso/ldso/c6x/elfinterp.c +++ b/ldso/ldso/c6x/elfinterp.c @@ -198,6 +198,10 @@ _dl_do_reloc (struct elf_resolve *tpnt,struct dyn_elf *scope, new_val = sym_val; *reloc_addr = sym_val; break; + case R_C6000_DSBT_INDEX: + new_val = (old_val & ~0x007fff00) | ((tpnt->loadaddr.map->dsbt_index & 0x7fff) << 8); + *reloc_addr = new_val; + break; case R_C6000_ABS_L16: new_val = (old_val & ~0x007fff80) | ((sym_val & 0xffff) << 7); *reloc_addr = new_val; @@ -224,7 +228,7 @@ _dl_do_reloc (struct elf_resolve *tpnt,struct dyn_elf *scope, (char *)symbol_addr, symtab[symtab_index].st_size); } - break; + return 0; default: return -1; /*call _dl_exit(1) */ } diff --git a/ldso/ldso/dl-elf.c b/ldso/ldso/dl-elf.c index 91e8a97..7b5d751 100644 --- a/ldso/ldso/dl-elf.c +++ b/ldso/ldso/dl-elf.c @@ -811,20 +811,44 @@ struct elf_resolve *_dl_load_elf_shared_library(int secure, #ifdef __DSBT__ /* Handle DSBT initialization */ { - struct elf_resolve *t, *ref = NULL; + struct elf_resolve *t, *ref; int idx = tpnt->loadaddr.map->dsbt_index; unsigned *dsbt = tpnt->loadaddr.map->dsbt_table; if (idx == 0) { - /* This DSO has not been assigned an index */ - _dl_dprintf(2, "%s: '%s' is missing a dsbt index assignment!\n", - _dl_progname, libname); - _dl_exit(1); + if (!dynamic_info[DT_TEXTREL]) { + /* This DSO has not been assigned an index. */ + _dl_dprintf(2, "%s: '%s' is missing a dsbt index assignment!\n", + _dl_progname, libname); + _dl_exit(1); + } + /* Find a dsbt table from another module. */ + ref = NULL; + for (t = _dl_loaded_modules; t; t = t->next) { + if (ref == NULL && t != tpnt) { + ref = t; + break; + } + } + idx = tpnt->loadaddr.map->dsbt_size; + while (idx-- > 0) + if (!ref || ref->loadaddr.map->dsbt_table[idx] == NULL) + break; + if (idx <= 0) { + _dl_dprintf(2, "%s: '%s' caused DSBT table overflow!\n", + _dl_progname, libname); + _dl_exit(1); + } + _dl_if_debug_dprint("\n\tfile='%s'; assigned index %d\n", + libname, idx); + tpnt->loadaddr.map->dsbt_index = idx; + } /* * Setup dsbt slot for this module in dsbt of all modules. */ + ref = NULL; for (t = _dl_loaded_modules; t; t = t->next) { /* find a dsbt table from another module */ if (ref == NULL && t != tpnt) { -- 1.7.3.4 From bernds at codesourcery.com Mon Apr 11 22:19:29 2011 From: bernds at codesourcery.com (Bernd Schmidt) Date: Mon, 11 Apr 2011 22:19:29 -0000 Subject: [git commit future] Fix nommu handling of DT_TEXTREL Message-ID: <20110411221922.83D598231F@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=56ea76b6bf190bffdc07aba90e4b25dfc096027b branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/future We have a problem with DT_TEXTREL shared libraries on nommu machines. The dynamic linker's strategy is to map the text segment read-only first, then look for DT_TEXTREL, and use mprotect to change protections if necessary. This fails on nommu, since a nommu kernel can decide to share the memory for private read-only file mappings, and mprotect doesn't (can't) do anything about this sharing. Existing nommu targets apparently have no need for this, but on C6X, we may need to assign library indices at run-time if no --dsbt-index option was passed to the linker at build time. Hence, the following patch, which instead of using mprotect, redoes the mapping with PF_W set. Signed-off-by: Bernd Schmidt Patch is too large, so refusing to show it From bernds at codesourcery.com Mon Apr 11 22:19:35 2011 From: bernds at codesourcery.com (Bernd Schmidt) Date: Mon, 11 Apr 2011 22:19:35 -0000 Subject: [git commit future] Fix malloc alignment Message-ID: <20110411221922.C014F8231F@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=eff2d0ba5890b517ef5bc9d0269d6149556c12c8 branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/future In commit 3e0a1f388, Richard tried to fix malloc alignments by using alignof (double __attribute_aligned__(sizeof (size_t))). This doesn't work, since attribute_aligned overrides the alignment rather than providing a minimum. On C6X, malloc returns four-byte aligned values rather than the necessary eight-byte alignment. It's simpler to use a comparison and pick the bigger of the two values, so that's what I've done. Signed-off-by: Bernd Schmidt --- libc/stdlib/malloc/heap.h | 6 ++++-- libc/stdlib/malloc/malloc.h | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/libc/stdlib/malloc/heap.h b/libc/stdlib/malloc/heap.h index 3038079..2f06ab1 100644 --- a/libc/stdlib/malloc/heap.h +++ b/libc/stdlib/malloc/heap.h @@ -29,8 +29,10 @@ /* The heap allocates in multiples of, and aligned to, HEAP_GRANULARITY. HEAP_GRANULARITY must be a power of 2. Malloc depends on this being the same as MALLOC_ALIGNMENT. */ -#define HEAP_GRANULARITY_TYPE double __attribute_aligned__ (sizeof (size_t)) -#define HEAP_GRANULARITY (__alignof__ (HEAP_GRANULARITY_TYPE)) +#define HEAP_GRANULARITY_TYPE double __attribute_aligned__ (HEAP_GRANULARITY) +#define HEAP_GRANULARITY \ + (__alignof__ (double) > sizeof (size_t) ? __alignof__ (double) : sizeof (size_t)) + /* The HEAP_INIT macro can be used as a static initializer for a heap diff --git a/libc/stdlib/malloc/malloc.h b/libc/stdlib/malloc/malloc.h index 0a4b43b..25f7409 100644 --- a/libc/stdlib/malloc/malloc.h +++ b/libc/stdlib/malloc/malloc.h @@ -17,7 +17,7 @@ alignment can be a significant win on targets like m68k and Coldfire, where __alignof__(double) == 2. */ #define MALLOC_ALIGNMENT \ - __alignof__ (double __attribute_aligned__ (sizeof (size_t))) + (__alignof__ (double) > sizeof (size_t) ? __alignof__ (double) : sizeof (size_t)) /* The system pagesize... */ extern size_t __pagesize; -- 1.7.3.4 From bernds at codesourcery.com Tue Apr 12 11:23:14 2011 From: bernds at codesourcery.com (Bernd Schmidt) Date: Tue, 12 Apr 2011 11:23:14 -0000 Subject: [git commit ldso-future] Fix nommu handling of DT_TEXTREL Message-ID: <20110412112312.9B1198258C@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=56ea76b6bf190bffdc07aba90e4b25dfc096027b branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/ldso-future We have a problem with DT_TEXTREL shared libraries on nommu machines. The dynamic linker's strategy is to map the text segment read-only first, then look for DT_TEXTREL, and use mprotect to change protections if necessary. This fails on nommu, since a nommu kernel can decide to share the memory for private read-only file mappings, and mprotect doesn't (can't) do anything about this sharing. Existing nommu targets apparently have no need for this, but on C6X, we may need to assign library indices at run-time if no --dsbt-index option was passed to the linker at build time. Hence, the following patch, which instead of using mprotect, redoes the mapping with PF_W set. Signed-off-by: Bernd Schmidt Patch is too large, so refusing to show it From bernds at codesourcery.com Tue Apr 12 11:23:14 2011 From: bernds at codesourcery.com (Bernd Schmidt) Date: Tue, 12 Apr 2011 11:23:14 -0000 Subject: [git commit ldso-future] Fix malloc alignment Message-ID: <20110412112312.BCE8D82590@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=eff2d0ba5890b517ef5bc9d0269d6149556c12c8 branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/ldso-future In commit 3e0a1f388, Richard tried to fix malloc alignments by using alignof (double __attribute_aligned__(sizeof (size_t))). This doesn't work, since attribute_aligned overrides the alignment rather than providing a minimum. On C6X, malloc returns four-byte aligned values rather than the necessary eight-byte alignment. It's simpler to use a comparison and pick the bigger of the two values, so that's what I've done. Signed-off-by: Bernd Schmidt --- libc/stdlib/malloc/heap.h | 6 ++++-- libc/stdlib/malloc/malloc.h | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/libc/stdlib/malloc/heap.h b/libc/stdlib/malloc/heap.h index 3038079..2f06ab1 100644 --- a/libc/stdlib/malloc/heap.h +++ b/libc/stdlib/malloc/heap.h @@ -29,8 +29,10 @@ /* The heap allocates in multiples of, and aligned to, HEAP_GRANULARITY. HEAP_GRANULARITY must be a power of 2. Malloc depends on this being the same as MALLOC_ALIGNMENT. */ -#define HEAP_GRANULARITY_TYPE double __attribute_aligned__ (sizeof (size_t)) -#define HEAP_GRANULARITY (__alignof__ (HEAP_GRANULARITY_TYPE)) +#define HEAP_GRANULARITY_TYPE double __attribute_aligned__ (HEAP_GRANULARITY) +#define HEAP_GRANULARITY \ + (__alignof__ (double) > sizeof (size_t) ? __alignof__ (double) : sizeof (size_t)) + /* The HEAP_INIT macro can be used as a static initializer for a heap diff --git a/libc/stdlib/malloc/malloc.h b/libc/stdlib/malloc/malloc.h index 0a4b43b..25f7409 100644 --- a/libc/stdlib/malloc/malloc.h +++ b/libc/stdlib/malloc/malloc.h @@ -17,7 +17,7 @@ alignment can be a significant win on targets like m68k and Coldfire, where __alignof__(double) == 2. */ #define MALLOC_ALIGNMENT \ - __alignof__ (double __attribute_aligned__ (sizeof (size_t))) + (__alignof__ (double) > sizeof (size_t) ? __alignof__ (double) : sizeof (size_t)) /* The system pagesize... */ extern size_t __pagesize; -- 1.7.3.4 From bernds at codesourcery.com Tue Apr 12 11:23:14 2011 From: bernds at codesourcery.com (Bernd Schmidt) Date: Tue, 12 Apr 2011 11:23:14 -0000 Subject: [git commit ldso-future] Support dynamic assignment of DSBT_INDEX Message-ID: <20110412112312.EB7278258C@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=feb7ce46ef24f74ebf0235f10127bd49f0c7e675 branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/ldso-future For DSBT targets (C6X only at this point), we'd like to support the case where the user did not specify --dsbt-index at link time when building a shared library. The dynamic linker can still assign an index at runtime and fix up the DSBT_INDEX relocs, at the cost of startup time and memory space. Signed-off-by: Bernd Schmidt --- ldso/ldso/c6x/elfinterp.c | 6 +++++- ldso/ldso/dl-elf.c | 34 +++++++++++++++++++++++++++++----- 2 files changed, 34 insertions(+), 6 deletions(-) diff --git a/ldso/ldso/c6x/elfinterp.c b/ldso/ldso/c6x/elfinterp.c index 7c79171..f5d3ad4 100644 --- a/ldso/ldso/c6x/elfinterp.c +++ b/ldso/ldso/c6x/elfinterp.c @@ -198,6 +198,10 @@ _dl_do_reloc (struct elf_resolve *tpnt,struct dyn_elf *scope, new_val = sym_val; *reloc_addr = sym_val; break; + case R_C6000_DSBT_INDEX: + new_val = (old_val & ~0x007fff00) | ((tpnt->loadaddr.map->dsbt_index & 0x7fff) << 8); + *reloc_addr = new_val; + break; case R_C6000_ABS_L16: new_val = (old_val & ~0x007fff80) | ((sym_val & 0xffff) << 7); *reloc_addr = new_val; @@ -224,7 +228,7 @@ _dl_do_reloc (struct elf_resolve *tpnt,struct dyn_elf *scope, (char *)symbol_addr, symtab[symtab_index].st_size); } - break; + return 0; default: return -1; /*call _dl_exit(1) */ } diff --git a/ldso/ldso/dl-elf.c b/ldso/ldso/dl-elf.c index 91e8a97..7b5d751 100644 --- a/ldso/ldso/dl-elf.c +++ b/ldso/ldso/dl-elf.c @@ -811,20 +811,44 @@ struct elf_resolve *_dl_load_elf_shared_library(int secure, #ifdef __DSBT__ /* Handle DSBT initialization */ { - struct elf_resolve *t, *ref = NULL; + struct elf_resolve *t, *ref; int idx = tpnt->loadaddr.map->dsbt_index; unsigned *dsbt = tpnt->loadaddr.map->dsbt_table; if (idx == 0) { - /* This DSO has not been assigned an index */ - _dl_dprintf(2, "%s: '%s' is missing a dsbt index assignment!\n", - _dl_progname, libname); - _dl_exit(1); + if (!dynamic_info[DT_TEXTREL]) { + /* This DSO has not been assigned an index. */ + _dl_dprintf(2, "%s: '%s' is missing a dsbt index assignment!\n", + _dl_progname, libname); + _dl_exit(1); + } + /* Find a dsbt table from another module. */ + ref = NULL; + for (t = _dl_loaded_modules; t; t = t->next) { + if (ref == NULL && t != tpnt) { + ref = t; + break; + } + } + idx = tpnt->loadaddr.map->dsbt_size; + while (idx-- > 0) + if (!ref || ref->loadaddr.map->dsbt_table[idx] == NULL) + break; + if (idx <= 0) { + _dl_dprintf(2, "%s: '%s' caused DSBT table overflow!\n", + _dl_progname, libname); + _dl_exit(1); + } + _dl_if_debug_dprint("\n\tfile='%s'; assigned index %d\n", + libname, idx); + tpnt->loadaddr.map->dsbt_index = idx; + } /* * Setup dsbt slot for this module in dsbt of all modules. */ + ref = NULL; for (t = _dl_loaded_modules; t; t = t->next) { /* find a dsbt table from another module */ if (ref == NULL && t != tpnt) { -- 1.7.3.4 From jacmet at sunsite.dk Wed Apr 6 13:19:34 2011 From: jacmet at sunsite.dk (Peter Korsgaard) Date: Wed, 06 Apr 2011 13:19:34 -0000 Subject: [git commit prelink] sync bits/socket.h PF_* / AF_* values with 2.6.38-rc3 Message-ID: <20110406131933.3276E82228@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=6f810c757e5b14a97f05652972e91f95e321a404 branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/prelink A number of new address / protocol families have been added over the years, so sync with Linux 2.6.38-rc3, adding CAN, ISDN, Phonet, Zigbee, .. which are starting to be used by applications. Signed-off-by: Peter Korsgaard Signed-off-by: Bernhard Reutner-Fischer --- libc/sysdeps/linux/common/bits/socket.h | 22 +++++++++++++++++++++- libc/sysdeps/linux/mips/bits/socket.h | 22 +++++++++++++++++++++- libc/sysdeps/linux/sparc/bits/socket.h | 22 +++++++++++++++++++++- 3 files changed, 63 insertions(+), 3 deletions(-) diff --git a/libc/sysdeps/linux/common/bits/socket.h b/libc/sysdeps/linux/common/bits/socket.h index 11f6e97..7e12733 100644 --- a/libc/sysdeps/linux/common/bits/socket.h +++ b/libc/sysdeps/linux/common/bits/socket.h @@ -98,8 +98,18 @@ enum __socket_type #define PF_IRDA 23 /* IRDA sockets. */ #define PF_PPPOX 24 /* PPPoX sockets. */ #define PF_WANPIPE 25 /* Wanpipe API sockets. */ +#define PF_LLC 26 /* Linux LLC. */ +#define PF_CAN 29 /* Controller Area Network. */ +#define PF_TIPC 30 /* TIPC sockets. */ #define PF_BLUETOOTH 31 /* Bluetooth sockets. */ -#define PF_MAX 32 /* For now.. */ +#define PF_IUCV 32 /* IUCV sockets. */ +#define PF_RXRPC 33 /* RxRPC sockets. */ +#define PF_ISDN 34 /* mISDN sockets. */ +#define PF_PHONET 35 /* Phonet sockets. */ +#define PF_IEEE802154 36 /* IEEE 802.15.4 sockets. */ +#define PF_CAIF 37 /* CAIF sockets. */ +#define PF_ALG 38 /* Algorithm sockets. */ +#define PF_MAX 39 /* For now.. */ /* Address families. */ #define AF_UNSPEC PF_UNSPEC @@ -130,7 +140,17 @@ enum __socket_type #define AF_IRDA PF_IRDA #define AF_PPPOX PF_PPPOX #define AF_WANPIPE PF_WANPIPE +#define AF_LLC PF_LLC +#define AF_CAN PF_CAN +#define AF_TIPC PF_TIPC #define AF_BLUETOOTH PF_BLUETOOTH +#define AF_IUCV PF_IUCV +#define AF_RXRPC PF_RXRPC +#define AF_ISDN PF_ISDN +#define AF_PHONET PF_PHONET +#define AF_IEEE802154 PF_IEEE802154 +#define AF_CAIF PF_CAIF +#define AF_ALG PF_ALG #define AF_MAX PF_MAX /* Socket level values. Others are defined in the appropriate headers. diff --git a/libc/sysdeps/linux/mips/bits/socket.h b/libc/sysdeps/linux/mips/bits/socket.h index b46e7be..27ceafa 100644 --- a/libc/sysdeps/linux/mips/bits/socket.h +++ b/libc/sysdeps/linux/mips/bits/socket.h @@ -100,8 +100,18 @@ enum __socket_type #define PF_IRDA 23 /* IRDA sockets. */ #define PF_PPPOX 24 /* PPPoX sockets. */ #define PF_WANPIPE 25 /* Wanpipe API sockets. */ +#define PF_LLC 26 /* Linux LLC. */ +#define PF_CAN 29 /* Controller Area Network. */ +#define PF_TIPC 30 /* TIPC sockets. */ #define PF_BLUETOOTH 31 /* Bluetooth sockets. */ -#define PF_MAX 32 /* For now.. */ +#define PF_IUCV 32 /* IUCV sockets. */ +#define PF_RXRPC 33 /* RxRPC sockets. */ +#define PF_ISDN 34 /* mISDN sockets. */ +#define PF_PHONET 35 /* Phonet sockets. */ +#define PF_IEEE802154 36 /* IEEE 802.15.4 sockets. */ +#define PF_CAIF 37 /* CAIF sockets. */ +#define PF_ALG 38 /* Algorithm sockets. */ +#define PF_MAX 39 /* For now.. */ /* Address families. */ #define AF_UNSPEC PF_UNSPEC @@ -132,7 +142,17 @@ enum __socket_type #define AF_IRDA PF_IRDA #define AF_PPPOX PF_PPPOX #define AF_WANPIPE PF_WANPIPE +#define AF_LLC PF_LLC +#define AF_CAN PF_CAN +#define AF_TIPC PF_TIPC #define AF_BLUETOOTH PF_BLUETOOTH +#define AF_IUCV PF_IUCV +#define AF_RXRPC PF_RXRPC +#define AF_ISDN PF_ISDN +#define AF_PHONET PF_PHONET +#define AF_IEEE802154 PF_IEEE802154 +#define AF_CAIF PF_CAIF +#define AF_ALG PF_ALG #define AF_MAX PF_MAX /* Socket level values. Others are defined in the appropriate headers. diff --git a/libc/sysdeps/linux/sparc/bits/socket.h b/libc/sysdeps/linux/sparc/bits/socket.h index e41527f..64973e2 100644 --- a/libc/sysdeps/linux/sparc/bits/socket.h +++ b/libc/sysdeps/linux/sparc/bits/socket.h @@ -88,8 +88,18 @@ enum __socket_type #define PF_IRDA 23 /* IRDA sockets. */ #define PF_PPPOX 24 /* PPPoX sockets. */ #define PF_WANPIPE 25 /* Wanpipe API sockets. */ +#define PF_LLC 26 /* Linux LLC. */ +#define PF_CAN 29 /* Controller Area Network. */ +#define PF_TIPC 30 /* TIPC sockets. */ #define PF_BLUETOOTH 31 /* Bluetooth sockets. */ -#define PF_MAX 32 /* For now.. */ +#define PF_IUCV 32 /* IUCV sockets. */ +#define PF_RXRPC 33 /* RxRPC sockets. */ +#define PF_ISDN 34 /* mISDN sockets. */ +#define PF_PHONET 35 /* Phonet sockets. */ +#define PF_IEEE802154 36 /* IEEE 802.15.4 sockets. */ +#define PF_CAIF 37 /* CAIF sockets. */ +#define PF_ALG 38 /* Algorithm sockets. */ +#define PF_MAX 39 /* For now.. */ /* Address families. */ #define AF_UNSPEC PF_UNSPEC @@ -120,7 +130,17 @@ enum __socket_type #define AF_IRDA PF_IRDA #define AF_PPPOX PF_PPPOX #define AF_WANPIPE PF_WANPIPE +#define AF_LLC PF_LLC +#define AF_CAN PF_CAN +#define AF_TIPC PF_TIPC #define AF_BLUETOOTH PF_BLUETOOTH +#define AF_IUCV PF_IUCV +#define AF_RXRPC PF_RXRPC +#define AF_ISDN PF_ISDN +#define AF_PHONET PF_PHONET +#define AF_IEEE802154 PF_IEEE802154 +#define AF_CAIF PF_CAIF +#define AF_ALG PF_ALG #define AF_MAX PF_MAX /* Socket level values. Others are defined in the appropriate headers. -- 1.7.3.4 From philipjcraig at gmail.com Wed Apr 6 13:19:34 2011 From: philipjcraig at gmail.com (Philip Craig) Date: Wed, 06 Apr 2011 13:19:34 -0000 Subject: [git commit prelink] Fix memory leak in dlopen()/dlclose(). Message-ID: <20110406131934.60E2982228@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=bb8551685e2efc42c65a01479b9f9bb8b860da01 branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/prelink The linked list of library dependencies created by dlopen() was not being freed by dlclose(). Signed-off-by: Philip Craig Signed-off-by: Bernhard Reutner-Fischer --- ldso/libdl/libdl.c | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-) diff --git a/ldso/libdl/libdl.c b/ldso/libdl/libdl.c index b88bc48..ee5cd44 100644 --- a/ldso/libdl/libdl.c +++ b/ldso/libdl/libdl.c @@ -922,6 +922,10 @@ static int do_dlclose(void *vhandle, int need_fini) free(tpnt); } } + for (rpnt1 = handle->next; rpnt1; rpnt1 = rpnt1_tmp) { + rpnt1_tmp = rpnt1->next; + free(rpnt1); + } free(handle->init_fini.init_fini); free(handle); -- 1.7.3.4 From jones.desougi at 27m.se Wed Apr 6 13:19:36 2011 From: jones.desougi at 27m.se (Jones Desougi) Date: Wed, 06 Apr 2011 13:19:36 -0000 Subject: [git commit prelink] *printf: Violation of precision with null string Message-ID: <20110406131933.6565082228@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=9a9a6365d5c5abb0fe3ec6cc09542e9c7e1d3bec branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/prelink When a string format is processed and the argument is NULL, this yields "(null)" regardless of precision. This does not make sense, precision should not be exceeded. A simple test shows that glibc outputs nothing if precision is smaller than six and the attached patch implements this same behaviour. Consider the not uncommon case of strings implemented like this: struct string { int len; char *ptr; }; There is often no nultermination and they may be printed like this: printf("%.*s", string.len, string.ptr); If len is 0 then ptr may be anything, but NULL is a common value. Obviously the empty string would be expected, not "(null)". Signed-off-by: Jones Desougi Signed-off-by: Bernhard Reutner-Fischer --- libc/stdio/_vfprintf.c | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-) diff --git a/libc/stdio/_vfprintf.c b/libc/stdio/_vfprintf.c index 3b00708..fa5dc44 100644 --- a/libc/stdio/_vfprintf.c +++ b/libc/stdio/_vfprintf.c @@ -1670,6 +1670,9 @@ static int _do_one_spec(FILE * __restrict stream, #endif s = "(null)"; slen = 6; + /* Use an empty string rather than truncation if precision is too small. */ + if (ppfs->info.prec >= 0 && ppfs->info.prec < slen) + slen = 0; } } else { /* char */ s = buf; @@ -1726,6 +1729,9 @@ static int _do_one_spec(FILE * __restrict stream, NULL_STRING: s = "(null)"; SLEN = slen = 6; + /* Use an empty string rather than truncation if precision is too small. */ + if (ppfs->info.prec >= 0 && ppfs->info.prec < slen) + SLEN = slen = 0; } } else { /* char */ *wbuf = btowc( (unsigned char)(*((const int *) *argptr)) ); -- 1.7.3.4 From steve at whitecrow.demon.co.uk Wed Apr 6 13:19:38 2011 From: steve at whitecrow.demon.co.uk (Steve Kilbane) Date: Wed, 06 Apr 2011 13:19:38 -0000 Subject: [git commit prelink] bfin: add support for new cacheflush syscall Message-ID: <20110406131936.B2B6982228@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=128e290b1e4204ac33b4cad7fc6189447f029311 branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/prelink Newer gcc's will generate a call to cacheflush when updating jump tables, and that has to be done in kernel space (to avoid hardware anomalies). So make sure uClibc provides that symbol. Signed-off-by: Steve Kilbane Signed-off-by: Mike Frysinger --- libc/sysdeps/linux/bfin/Makefile.arch | 2 +- libc/sysdeps/linux/bfin/cacheflush.c | 14 ++++++++++++++ libc/sysdeps/linux/bfin/sys/cachectl.h | 25 +++++++++++++++++++++++++ 3 files changed, 40 insertions(+), 1 deletions(-) create mode 100644 libc/sysdeps/linux/bfin/cacheflush.c create mode 100644 libc/sysdeps/linux/bfin/sys/cachectl.h diff --git a/libc/sysdeps/linux/bfin/Makefile.arch b/libc/sysdeps/linux/bfin/Makefile.arch index 2427037..425a688 100644 --- a/libc/sysdeps/linux/bfin/Makefile.arch +++ b/libc/sysdeps/linux/bfin/Makefile.arch @@ -6,7 +6,7 @@ # CSRC := bsdsetjmp.c clone.c \ - sram-alloc.c sram-free.c dma-memcpy.c + sram-alloc.c sram-free.c dma-memcpy.c cacheflush.c SSRC := __longjmp.S setjmp.S bsd-_setjmp.S diff --git a/libc/sysdeps/linux/bfin/cacheflush.c b/libc/sysdeps/linux/bfin/cacheflush.c new file mode 100644 index 0000000..a8d81c4 --- /dev/null +++ b/libc/sysdeps/linux/bfin/cacheflush.c @@ -0,0 +1,14 @@ +/* + * cacheflush.c - Cache control functions for Blackfin. + * + * Copyright (C) 2010 Analog Devices Inc. + * + * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. + */ + +#include +#include +#include +#include + +_syscall3 (int, cacheflush, void *, start, const int, nbytes, const int, flags) diff --git a/libc/sysdeps/linux/bfin/sys/cachectl.h b/libc/sysdeps/linux/bfin/sys/cachectl.h new file mode 100644 index 0000000..ee4c031 --- /dev/null +++ b/libc/sysdeps/linux/bfin/sys/cachectl.h @@ -0,0 +1,25 @@ +/* + * cachectl.h - Functions for cache control on Blackfin. + * + * Copyright (C) 2010 Analog Devices, Inc. + * + * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. + */ + +#ifndef _SYS_CACHECTL_H +#define _SYS_CACHECTL_H 1 + +#include + +/* + * Get the kernel definition for the flag bits + */ +#include + +__BEGIN_DECLS + +extern int cacheflush (void *addr, __const int nbytes, __const int flags); + +__END_DECLS + +#endif /* sys/cachectl.h */ -- 1.7.3.4 From msalter at redhat.com Wed Apr 6 13:19:48 2011 From: msalter at redhat.com (Mark Salter) Date: Wed, 06 Apr 2011 13:19:48 -0000 Subject: [git commit prelink] Add sanity checks to ld.so DSBT support Message-ID: <20110406131947.4BD8780774@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=9b1507df250e90b74099e0d05170d7d95060b016 branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/prelink This adds some DSBT index sanity checks to the runtime linker. It catches libraries which have no index (index 0) and libraries which try to use an already used index. Signed-off-by: Mark Salter Signed-off-by: Bernd Schmidt --- ldso/ldso/dl-elf.c | 29 ++++++++++++++++++++++++++++- 1 files changed, 28 insertions(+), 1 deletions(-) diff --git a/ldso/ldso/dl-elf.c b/ldso/ldso/dl-elf.c index 4cbd338..505247e 100644 --- a/ldso/ldso/dl-elf.c +++ b/ldso/ldso/dl-elf.c @@ -813,13 +813,40 @@ struct elf_resolve *_dl_load_elf_shared_library(int secure, int idx = tpnt->loadaddr.map->dsbt_index; unsigned *dsbt = tpnt->loadaddr.map->dsbt_table; + if (idx == 0) { + /* This DSO has not been assigned an index */ + _dl_dprintf(2, "%s: '%s' is missing a dsbt index assignment!\n", + _dl_progname, libname); + _dl_exit(1); + } + /* * Setup dsbt slot for this module in dsbt of all modules. */ for (t = _dl_loaded_modules; t; t = t->next) { /* find a dsbt table from another module */ - if (ref == NULL && t != tpnt) + if (ref == NULL && t != tpnt) { ref = t; + + /* make sure index is not already used */ + if (t->loadaddr.map->dsbt_table[idx]) { + struct elf_resolve *dup; + char *dup_name; + + for (dup = _dl_loaded_modules; dup; dup = dup->next) + if (dup != tpnt && dup->loadaddr.map->dsbt_index == idx) + break; + if (dup) + dup_name = dup->libname; + else if (idx == 1) + dup_name = "runtime linker"; + else + dup_name = "unknown library"; + _dl_dprintf(2, "%s: '%s' dsbt index %d already used by %s!\n", + _dl_progname, libname, idx, dup_name); + _dl_exit(1); + } + } t->loadaddr.map->dsbt_table[idx] = (unsigned)dsbt; } if (ref) -- 1.7.3.4 From msalter at redhat.com Wed Apr 6 13:19:49 2011 From: msalter at redhat.com (Mark Salter) Date: Wed, 06 Apr 2011 13:19:49 -0000 Subject: [git commit prelink] Add support for DSBT ELF to ld.so Message-ID: <20110406131946.8592980774@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=95adc01517efce365da4e40e0d2a081ec4497928 branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/prelink This adds support for DSBT ELF to ld.so. This uses loadmaps like FD-PIC. Some code is added in ld.so to initialize the DSBT tables, and there's also a new target macro FINISH_BOOTSTRAP_RELOC. Signed-off-by: Mark Salter Signed-off-by: Aurelien Jacquiot Signed-off-by: Bernd Schmidt --- include/link.h | 13 ++++++++++++- ldso/include/dl-defs.h | 2 +- ldso/include/dl-elf.h | 11 ++++++++++- ldso/ldso/dl-elf.c | 23 ++++++++++++++++++++++- ldso/ldso/ldso.c | 11 ++++++++++- libc/misc/elf/dl-iterate-phdr.c | 4 +++- 6 files changed, 58 insertions(+), 6 deletions(-) diff --git a/include/link.h b/include/link.h index cbef616..185ee70 100644 --- a/include/link.h +++ b/include/link.h @@ -1,6 +1,6 @@ /* Data structure for communication from the run-time dynamic linker for loaded ELF shared objects. - Copyright (C) 1995-2001, 2004, 2005, 2006 Free Software Foundation, Inc. + Copyright (C) 1995-2001, 2004, 2005, 2006, 2010 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -83,6 +83,9 @@ extern ElfW(Dyn) _DYNAMIC[]; #ifdef __FDPIC__ # include #endif +#ifdef __DSBT__ +# include +#endif /* Structure describing a loaded shared object. The `l_next' and `l_prev' members form a chain of all the shared objects loaded at startup. @@ -98,8 +101,12 @@ struct link_map #ifdef __FDPIC__ struct elf32_fdpic_loadaddr l_addr; #else +#ifdef __DSBT__ + struct elf32_dsbt_loadaddr l_addr; +#else ElfW(Addr) l_addr; /* Base address shared object is loaded at. */ #endif +#endif char *l_name; /* Absolute file name object was found in. */ ElfW(Dyn) *l_ld; /* Dynamic section of the shared object. */ struct link_map *l_next, *l_prev; /* Chain of loaded objects. */ @@ -178,8 +185,12 @@ struct dl_phdr_info #ifdef __FDPIC__ struct elf32_fdpic_loadaddr dlpi_addr; #else +#ifdef __DSBT__ + struct elf32_dsbt_loadaddr dlpi_addr; +#else ElfW(Addr) dlpi_addr; #endif +#endif const char *dlpi_name; const ElfW(Phdr) *dlpi_phdr; ElfW(Half) dlpi_phnum; diff --git a/ldso/include/dl-defs.h b/ldso/include/dl-defs.h index 2d6303c..be0a81d 100644 --- a/ldso/include/dl-defs.h +++ b/ldso/include/dl-defs.h @@ -212,7 +212,7 @@ typedef struct { _dl_find_hash for this reloc TYPE. TPNT is the module in which the matching SYM was found. */ #ifndef DL_FIND_HASH_VALUE -# define DL_FIND_HASH_VALUE(TPNT, TYPE, SYM) (DL_RELOC_ADDR ((SYM)->st_value, (TPNT)->loadaddr)) +# define DL_FIND_HASH_VALUE(TPNT, TYPE, SYM) (DL_RELOC_ADDR ((TPNT)->loadaddr, (SYM)->st_value)) #endif /* Unmap all previously-mapped segments accumulated in LOADADDR. diff --git a/ldso/include/dl-elf.h b/ldso/include/dl-elf.h index 5aec64f..7fbb373 100644 --- a/ldso/include/dl-elf.h +++ b/ldso/include/dl-elf.h @@ -165,7 +165,7 @@ unsigned int __dl_parse_dynamic_info(ElfW(Dyn) *dpnt, unsigned long dynamic_info /* Don't adjust .dynamic unnecessarily. For FDPIC targets, we'd have to walk all the loadsegs to find out if it was actually unnecessary, so skip this optimization. */ -#ifndef __FDPIC__ +#if !defined __FDPIC__ && !defined __DSBT__ if (load_off != 0) #endif { @@ -179,6 +179,15 @@ unsigned int __dl_parse_dynamic_info(ElfW(Dyn) *dpnt, unsigned long dynamic_info ADJUST_DYN_INFO(DT_GNU_HASH_IDX, load_off); #endif } +#ifdef __DSBT__ + /* Get the mapped address of the DSBT base. */ + ADJUST_DYN_INFO(DT_DSBT_BASE_IDX, load_off); + + /* Initialize loadmap dsbt info. */ + load_off.map->dsbt_table = dynamic_info[DT_DSBT_BASE_IDX]; + load_off.map->dsbt_size = dynamic_info[DT_DSBT_SIZE_IDX]; + load_off.map->dsbt_index = dynamic_info[DT_DSBT_INDEX_IDX]; +#endif #undef ADJUST_DYN_INFO return rtld_flags; } diff --git a/ldso/ldso/dl-elf.c b/ldso/ldso/dl-elf.c index 61d4959..4cbd338 100644 --- a/ldso/ldso/dl-elf.c +++ b/ldso/ldso/dl-elf.c @@ -188,7 +188,7 @@ unsigned long _dl_error_number; unsigned long _dl_internal_error_number; struct elf_resolve *_dl_load_shared_library(int secure, struct dyn_elf **rpnt, - struct elf_resolve *tpnt, char *full_libname, int __attribute__((unused)) trace_loaded_objects) + struct elf_resolve *tpnt, char *full_libname, int attribute_unused trace_loaded_objects) { char *pnt; struct elf_resolve *tpnt1; @@ -806,6 +806,27 @@ struct elf_resolve *_dl_load_elf_shared_library(int secure, INIT_GOT(lpnt, tpnt); } +#ifdef __DSBT__ + /* Handle DSBT initialization */ + { + struct elf_resolve *t, *ref = NULL; + int idx = tpnt->loadaddr.map->dsbt_index; + unsigned *dsbt = tpnt->loadaddr.map->dsbt_table; + + /* + * Setup dsbt slot for this module in dsbt of all modules. + */ + for (t = _dl_loaded_modules; t; t = t->next) { + /* find a dsbt table from another module */ + if (ref == NULL && t != tpnt) + ref = t; + t->loadaddr.map->dsbt_table[idx] = (unsigned)dsbt; + } + if (ref) + _dl_memcpy(dsbt, ref->loadaddr.map->dsbt_table, + tpnt->loadaddr.map->dsbt_size * sizeof(unsigned *)); + } +#endif _dl_if_debug_dprint("\n\tfile='%s'; generating link map\n", libname); _dl_if_debug_dprint("\t\tdynamic: %x base: %x\n", dynamic_addr, DL_LOADADDR_BASE(lib_loadaddr)); _dl_if_debug_dprint("\t\t entry: %x phdr: %x phnum: %x\n\n", diff --git a/ldso/ldso/ldso.c b/ldso/ldso/ldso.c index 4d79d46..7ee9257 100644 --- a/ldso/ldso/ldso.c +++ b/ldso/ldso/ldso.c @@ -868,7 +868,16 @@ void _dl_get_ready_to_run(struct elf_resolve *tpnt, DL_LOADADDR_TYPE load_addr, ElfW(Ehdr) *epnt = (ElfW(Ehdr) *) auxvt[AT_BASE].a_un.a_val; ElfW(Phdr) *myppnt = (ElfW(Phdr) *) DL_RELOC_ADDR(load_addr, epnt->e_phoff); int j; - +#ifdef __DSBT__ + struct elf_resolve *ref = _dl_loaded_modules; + _dl_if_debug_dprint("ref is %x, dsbt %x, ref-dsbt %x size %x\n", + ref, tpnt->loadaddr.map->dsbt_table, + ref->loadaddr.map->dsbt_table, + tpnt->loadaddr.map->dsbt_size); + + _dl_memcpy(tpnt->loadaddr.map->dsbt_table, ref->loadaddr.map->dsbt_table, + tpnt->loadaddr.map->dsbt_size * sizeof(unsigned *)); +#endif tpnt = _dl_add_elf_hash_table(tpnt->libname, load_addr, tpnt->dynamic_info, (unsigned long)tpnt->dynamic_addr, diff --git a/libc/misc/elf/dl-iterate-phdr.c b/libc/misc/elf/dl-iterate-phdr.c index a7677f1..f0233ca 100644 --- a/libc/misc/elf/dl-iterate-phdr.c +++ b/libc/misc/elf/dl-iterate-phdr.c @@ -62,9 +62,11 @@ dl_iterate_phdr (int (*callback) (struct dl_phdr_info *info, /* This entry describes this statically-linked program itself. */ struct dl_phdr_info info; int ret; -#ifdef __FDPIC__ +#if defined(__FDPIC__) info.dlpi_addr.map = NULL; info.dlpi_addr.got_value = NULL; +#elif defined(__DSBT__) + info.dlpi_addr.map = NULL; #else info.dlpi_addr = 0; #endif -- 1.7.3.4 From msalter at redhat.com Wed Apr 6 13:19:55 2011 From: msalter at redhat.com (Mark Salter) Date: Wed, 06 Apr 2011 13:19:55 -0000 Subject: [git commit prelink] remove unused vfork.c Message-ID: <20110406131954.CF01980774@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=0c31aab44ec14a3c287ce766676d9a6f495a0751 branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/prelink Signed-off-by: Mark Salter Signed-off-by: Bernd Schmidt --- libc/sysdeps/linux/c6x/vfork.c | 26 -------------------------- 1 files changed, 0 insertions(+), 26 deletions(-) delete mode 100644 libc/sysdeps/linux/c6x/vfork.c diff --git a/libc/sysdeps/linux/c6x/vfork.c b/libc/sysdeps/linux/c6x/vfork.c deleted file mode 100644 index f19dcd4..0000000 --- a/libc/sysdeps/linux/c6x/vfork.c +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Port of uClibc for TMS320C6000 DSP architecture - * Copyright (C) 2005 Texas Instruments Incorporated - * Author of TMS320C6000 port: Aurelien Jacquiot - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU Library General Public License as published by - * the Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License - * for more details. - * - * You should have received a copy of the GNU Library General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - */ -#include -__asm__(" .text\n" - "vfork: \n" - " MVKL .S1 ___libc_vfork,A0\n" - " MVKH .S1 ___libc_vfork,A0\n" - " BNOP .S2X A0,5\n"); -- 1.7.3.4 From msalter at redhat.com Wed Apr 6 13:19:55 2011 From: msalter at redhat.com (Mark Salter) Date: Wed, 06 Apr 2011 13:19:55 -0000 Subject: [git commit prelink] use clone syscall for vfork Message-ID: <20110406131955.00ABB80774@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=3992402e7a00ee4f617582c09215a855fb212bf9 branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/prelink Signed-off-by: Mark Salter Signed-off-by: Bernd Schmidt --- libc/sysdeps/linux/c6x/_vfork.S | 93 ++++++++++++++++++++++----------------- 1 files changed, 52 insertions(+), 41 deletions(-) diff --git a/libc/sysdeps/linux/c6x/_vfork.S b/libc/sysdeps/linux/c6x/_vfork.S index 20cb6a5..d64dc50 100644 --- a/libc/sysdeps/linux/c6x/_vfork.S +++ b/libc/sysdeps/linux/c6x/_vfork.S @@ -1,55 +1,66 @@ - ; - ; Port of uClibc for TMS320C6000 DSP architecture - ; Copyright (C) 2004 Texas Instruments Incorporated - ; Author of TMS320C6000 port: Aurelien Jacquiot - ; - ; This program is free software; you can redistribute it and/or modify it - ; under the terms of the GNU Library General Public License as published by - ; the Free Software Foundation; either version 2 of the License, or (at your - ; option) any later version. - ; - ; This program is distributed in the hope that it will be useful, but WITHOUT - ; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - ; FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License - ; for more details. - ; - ; You should have received a copy of the GNU Library General Public License - ; along with this program; if not, write to the Free Software Foundation, - ; Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - ; +/* + * Port of uClibc for TMS320C6000 DSP architecture + * Copyright (C) 2004, 2011 Texas Instruments Incorporated + * Author of TMS320C6000 port: Aurelien Jacquiot + * + * Use clone syscall: Mark Salter + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU Library General Public License as published by + * the Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License + * for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +#define __ASSEMBLY__ -; .import __errno_location - .global __vfork +#include +#include +#include +#include +#define CLONE_FLAGS (CLONE_VFORK | CLONE_VM | SIGCHLD) + + .global __vfork __vfork: - MVK .S2 190,B0 ; __NR_vfork + MVK .S2 SYS_clone,B0 + || MVKL .S1 CLONE_FLAGS,A4 + MVKH .S1 CLONE_FLAGS,A4 + || MVK .L2 0,B4 #ifndef _TMS320C6400_PLUS - MVC .S2 CSR,B2 - CLR .S2 B2,0,0,B1 - MVC .S2 B1,CSR - MVC .S2 IFR,B1 - SET .S2 B1,6,6,B1 - MVC .S2 B1,ISR - MVC .S2 B2,CSR + MVC .S2 CSR,B2 + CLR .S2 B2,0,0,B1 + MVC .S2 B1,CSR + MVC .S2 IFR,B1 + SET .S2 B1,6,6,B1 + MVC .S2 B1,ISR + MVC .S2 B2,CSR NOP #else SWE #endif - MVK .S2 -4096,B4 - CMPGTU .L2X B4,A4,B2 ; check error - [B2] BNOP .S2 B3,5 + MVK .S2 -4096,B4 + CMPGTU .L2X B4,A4,B2 ; check error + [B2] BNOP .S2 B3,5 - NEG .S1 A4,A4 - STW .D2T1 A4,*B15--[2] - STW .D2T2 B3,*+B15[1] - CALLP .S2 __errno_location,B3 - LDW .D2T2 *+B15[1],B3 - LDW .D2T1 *++B15[2],A5 + NEG .S1 A4,A4 + STW .D2T1 A4,*B15--[2] + STW .D2T2 B3,*+B15[1] + CALLP .S2 __errno_location,B3 + LDW .D2T2 *+B15[1],B3 + LDW .D2T1 *++B15[2],A5 NOP 3 - BNOP .S2 B3,3 - STW .D1T1 A5,*A4 - MVK .L1 -1,A4 + BNOP .S2 B3,3 + STW .D1T1 A5,*A4 + MVK .L1 -1,A4 weak_alias(__vfork,vfork) libc_hidden_weak(vfork) -- 1.7.3.4 From msalter at redhat.com Wed Apr 6 13:19:56 2011 From: msalter at redhat.com (Mark Salter) Date: Wed, 06 Apr 2011 13:19:56 -0000 Subject: [git commit prelink] support generic kernel posix_types.h Message-ID: <20110406131955.22E7180774@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=5f98b70a92187756a2b76eaaf679958c36d59d00 branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/prelink Signed-off-by: Mark Salter Signed-off-by: Bernd Schmidt --- libc/sysdeps/linux/c6x/bits/kernel_types.h | 30 ++++++++++++++-------------- 1 files changed, 15 insertions(+), 15 deletions(-) diff --git a/libc/sysdeps/linux/c6x/bits/kernel_types.h b/libc/sysdeps/linux/c6x/bits/kernel_types.h index 5dbd2c2..7557309 100644 --- a/libc/sysdeps/linux/c6x/bits/kernel_types.h +++ b/libc/sysdeps/linux/c6x/bits/kernel_types.h @@ -7,33 +7,33 @@ #ifndef __ASM_GENERIC_POSIX_TYPES_H #define __ASM_GENERIC_POSIX_TYPES_H -typedef unsigned short __kernel_dev_t; +typedef unsigned int __kernel_dev_t; typedef unsigned long __kernel_ino_t; -typedef unsigned short __kernel_mode_t; -typedef unsigned short __kernel_nlink_t; -typedef long __kernel_off_t; +typedef unsigned int __kernel_mode_t; +typedef unsigned long __kernel_nlink_t; typedef int __kernel_pid_t; -typedef unsigned short __kernel_ipc_pid_t; -typedef unsigned short __kernel_uid_t; -typedef unsigned short __kernel_gid_t; +typedef int __kernel_ipc_pid_t; +typedef unsigned int __kernel_uid_t; +typedef unsigned int __kernel_gid_t; +typedef long __kernel_suseconds_t; +typedef int __kernel_daddr_t; +typedef unsigned int __kernel_uid32_t; +typedef unsigned int __kernel_gid32_t; +typedef unsigned int __kernel_old_uid_t; +typedef unsigned int __kernel_old_gid_t; +typedef unsigned int __kernel_old_dev_t; typedef unsigned int __kernel_size_t; typedef int __kernel_ssize_t; typedef int __kernel_ptrdiff_t; +typedef long __kernel_off_t; +typedef long long __kernel_loff_t; typedef long __kernel_time_t; -typedef long __kernel_suseconds_t; typedef long __kernel_clock_t; typedef int __kernel_timer_t; typedef int __kernel_clockid_t; -typedef int __kernel_daddr_t; typedef char * __kernel_caddr_t; typedef unsigned short __kernel_uid16_t; typedef unsigned short __kernel_gid16_t; -typedef unsigned int __kernel_uid32_t; -typedef unsigned int __kernel_gid32_t; -typedef unsigned short __kernel_old_uid_t; -typedef unsigned short __kernel_old_gid_t; -typedef unsigned short __kernel_old_dev_t; -typedef long long __kernel_loff_t; typedef struct { #ifdef __USE_ALL -- 1.7.3.4 From msalter at redhat.com Wed Apr 6 13:19:56 2011 From: msalter at redhat.com (Mark Salter) Date: Wed, 06 Apr 2011 13:19:56 -0000 Subject: [git commit prelink] cleanup hardcoded syscall numbers Message-ID: <20110406131955.6DF0080774@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=e5d4a571e1e8850b36bbfb246270b63dab0c2a3d branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/prelink Signed-off-by: Mark Salter Signed-off-by: Bernd Schmidt --- libc/sysdeps/linux/c6x/clone.S | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/libc/sysdeps/linux/c6x/clone.S b/libc/sysdeps/linux/c6x/clone.S index 8d9da4b..6fba5bb 100644 --- a/libc/sysdeps/linux/c6x/clone.S +++ b/libc/sysdeps/linux/c6x/clone.S @@ -17,6 +17,7 @@ ; along with this program; if not, write to the Free Software Foundation, ; Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ; +#define __ASSEMBLY__ ; int _clone(int (*fn)(void *arg), void *child_stack, int flags, void *arg); @@ -50,7 +51,7 @@ __clone: || AND .D2 ~7,B4,B4 ; do the system call -|| MVK .S2 120,B0 ; __NR_clone +|| MVK .S2 __NR_clone,B0 || MV .L2 B5,B6 0: #ifndef _TMS320C6400_PLUS -- 1.7.3.4 From msalter at redhat.com Wed Apr 6 13:19:56 2011 From: msalter at redhat.com (Mark Salter) Date: Wed, 06 Apr 2011 13:19:56 -0000 Subject: [git commit prelink] support c6x kernel using generic stat.h Message-ID: <20110406131955.467B280774@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=be36fa013e821e6fba87bfbc8bdf4f5e73b545cb branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/prelink Signed-off-by: Ken Cox Signed-off-by: Mark Salter Signed-off-by: Bernd Schmidt --- libc/sysdeps/linux/c6x/bits/kernel_stat.h | 59 +++++----- libc/sysdeps/linux/c6x/bits/stat.h | 174 ----------------------------- 2 files changed, 28 insertions(+), 205 deletions(-) delete mode 100644 libc/sysdeps/linux/c6x/bits/stat.h diff --git a/libc/sysdeps/linux/c6x/bits/kernel_stat.h b/libc/sysdeps/linux/c6x/bits/kernel_stat.h index 9c0bfa6..f8381c7 100644 --- a/libc/sysdeps/linux/c6x/bits/kernel_stat.h +++ b/libc/sysdeps/linux/c6x/bits/kernel_stat.h @@ -6,46 +6,43 @@ * different opinion on the subject... */ struct kernel_stat { - unsigned short st_dev; - unsigned short __pad1; - unsigned long st_ino; - unsigned short st_mode; - unsigned short st_nlink; - unsigned short st_uid; - unsigned short st_gid; - unsigned short st_rdev; - unsigned short __pad2; - unsigned long st_size; - unsigned long st_blksize; - unsigned long st_blocks; + unsigned long st_dev; /* Device. */ + unsigned long st_ino; /* File serial number. */ + unsigned int st_mode; /* File mode. */ + unsigned int st_nlink; /* Link count. */ + unsigned int st_uid; /* User ID of the file's owner. */ + unsigned int st_gid; /* Group ID of the file's group. */ + unsigned long st_rdev; /* Device number, if device. */ + unsigned long __pad1; + long st_size; /* Size of file, in bytes. */ + int st_blksize; /* Optimal block size for I/O. */ + int __pad2; + long st_blocks; /* Number 512-byte blocks allocated. */ struct timespec st_atim; struct timespec st_mtim; struct timespec st_ctim; - unsigned long __unused4; - unsigned long __unused5; + unsigned int __unused4; + unsigned int __unused5; }; struct kernel_stat64 { - unsigned char __pad0[6]; - unsigned short st_dev; - unsigned char __pad1[2]; -#define _HAVE_STAT64___ST_INO - unsigned long __st_ino; - unsigned int st_mode; - unsigned int st_nlink; - unsigned long st_uid; - unsigned long st_gid; - unsigned char __pad2[6]; - unsigned short st_rdev; - unsigned char __pad3[2]; - __off64_t st_size; - unsigned long st_blksize; - unsigned long __pad4; /* future possible st_blocks high bits */ - unsigned long st_blocks; /* Number 512-byte blocks allocated. */ + unsigned long long st_dev; /* Device. */ + unsigned long long st_ino; /* File serial number. */ + unsigned int st_mode; /* File mode. */ + unsigned int st_nlink; /* Link count. */ + unsigned int st_uid; /* User ID of the file's owner. */ + unsigned int st_gid; /* Group ID of the file's group. */ + unsigned long long st_rdev; /* Device number, if device. */ + unsigned long long __pad1; + long long st_size; /* Size of file, in bytes. */ + int st_blksize; /* Optimal block size for I/O. */ + int __pad2; + long long st_blocks; /* Number 512-byte blocks allocated. */ struct timespec st_atim; struct timespec st_mtim; struct timespec st_ctim; - __off64_t st_ino; + unsigned int __unused4; + unsigned int __unused5; }; #endif /* _BITS_STAT_STRUCT_H */ diff --git a/libc/sysdeps/linux/c6x/bits/stat.h b/libc/sysdeps/linux/c6x/bits/stat.h deleted file mode 100644 index eba3124..0000000 --- a/libc/sysdeps/linux/c6x/bits/stat.h +++ /dev/null @@ -1,174 +0,0 @@ -/* Copyright (C) 1992,95,96,97,98,99,2000,2001 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#ifndef _SYS_STAT_H -# error "Never include directly; use instead." -#endif - -/* Versions of the `struct stat' data structure. */ -#define _STAT_VER_LINUX_OLD 1 -#define _STAT_VER_KERNEL 1 -#define _STAT_VER_SVR4 2 -#define _STAT_VER_LINUX 3 -#define _STAT_VER _STAT_VER_LINUX /* The one defined below. */ - -/* Versions of the `xmknod' interface. */ -#define _MKNOD_VER_LINUX 1 -#define _MKNOD_VER_SVR4 2 -#define _MKNOD_VER _MKNOD_VER_LINUX /* The bits defined below. */ - - -struct stat - { - __dev_t st_dev; /* Device. */ - unsigned short int __pad1; -#ifndef __USE_FILE_OFFSET64 - __ino_t st_ino; /* File serial number. */ -#else - __ino_t __st_ino; /* 32bit file serial number. */ -#endif - __mode_t st_mode; /* File mode. */ - __nlink_t st_nlink; /* Link count. */ - __uid_t st_uid; /* User ID of the file's owner. */ - __gid_t st_gid; /* Group ID of the file's group.*/ - __dev_t st_rdev; /* Device number, if device. */ - unsigned short int __pad2; -#ifndef __USE_FILE_OFFSET64 - __off_t st_size; /* Size of file, in bytes. */ -#else - __off64_t st_size; /* Size of file, in bytes. */ -#endif - __blksize_t st_blksize; /* Optimal block size for I/O. */ - -#ifndef __USE_FILE_OFFSET64 - __blkcnt_t st_blocks; /* Number 512-byte blocks allocated. */ -#else - __blkcnt64_t st_blocks; /* Number 512-byte blocks allocated. */ -#endif -#ifdef __USE_MISC - /* Nanosecond resolution timestamps are stored in a format - equivalent to 'struct timespec'. This is the type used - whenever possible but the Unix namespace rules do not allow the - identifier 'timespec' to appear in the header. - Therefore we have to handle the use of this header in strictly - standard-compliant sources special. */ - struct timespec st_atim; /* Time of last access. */ - struct timespec st_mtim; /* Time of last modification. */ - struct timespec st_ctim; /* Time of last status change. */ -# define st_atime st_atim.tv_sec /* Backward compatibility. */ -# define st_mtime st_mtim.tv_sec -# define st_ctime st_ctim.tv_sec -#else - __time_t st_atime; /* Time of last access. */ - unsigned long int st_atimensec; /* Nscecs of last access. */ - __time_t st_mtime; /* Time of last modification. */ - unsigned long int st_mtimensec; /* Nsecs of last modification. */ - __time_t st_ctime; /* Time of last status change. */ - unsigned long int st_ctimensec; /* Nsecs of last status change. */ -#endif -#ifndef __USE_FILE_OFFSET64 - unsigned long __unused4; - unsigned long __unused5; -#else - __ino64_t st_ino; /* File serial number. */ -#endif - }; - -#ifdef __USE_LARGEFILE64 -struct stat64 - { - __dev_t st_dev; /* Device. */ - -#if __WORDSIZE == 64 - __ino64_t st_ino; /* File serial number. */ - __nlink_t st_nlink; /* Link count. */ - __mode_t st_mode; /* File mode. */ -#else - unsigned int __pad1; - __ino_t __st_ino; /* 32bit file serial number. */ - __mode_t st_mode; /* File mode. */ - __nlink_t st_nlink; /* Link count. */ -#endif - __uid_t st_uid; /* User ID of the file's owner. */ - __gid_t st_gid; /* Group ID of the file's group.*/ - __dev_t st_rdev; /* Device number, if device. */ - unsigned short int __pad2; - __off64_t st_size; /* Size of file, in bytes. */ - __blksize_t st_blksize; /* Optimal block size for I/O. */ - - __blkcnt64_t st_blocks; /* Number 512-byte blocks allocated. */ -#ifdef __USE_MISC - /* Nanosecond resolution timestamps are stored in a format - equivalent to 'struct timespec'. This is the type used - whenever possible but the Unix namespace rules do not allow the - identifier 'timespec' to appear in the header. - Therefore we have to handle the use of this header in strictly - standard-compliant sources special. */ - struct timespec st_atim; /* Time of last access. */ - struct timespec st_mtim; /* Time of last modification. */ - struct timespec st_ctim; /* Time of last status change. */ -# define st_atime st_atim.tv_sec /* Backward compatibility. */ -# define st_mtime st_mtim.tv_sec -# define st_ctime st_ctim.tv_sec -#else - __time_t st_atime; /* Time of last access. */ - unsigned long int st_atimensec; /* Nscecs of last access. */ - __time_t st_mtime; /* Time of last modification. */ - unsigned long int st_mtimensec; /* Nsecs of last modification. */ - __time_t st_ctime; /* Time of last status change. */ - unsigned long int st_ctimensec; /* Nsecs of last status change. */ -#endif -#if __WORDSIZE == 64 - long int __unused[3]; -#else - __ino64_t st_ino; /* File serial number. */ -#endif - }; -#endif - -/* Tell code we have these members. */ -#define _STATBUF_ST_BLKSIZE -#define _STATBUF_ST_RDEV - -/* Encoding of the file mode. */ - -#define __S_IFMT 0170000 /* These bits determine file type. */ - -/* File types. */ -#define __S_IFDIR 0040000 /* Directory. */ -#define __S_IFCHR 0020000 /* Character device. */ -#define __S_IFBLK 0060000 /* Block device. */ -#define __S_IFREG 0100000 /* Regular file. */ -#define __S_IFIFO 0010000 /* FIFO. */ -#define __S_IFLNK 0120000 /* Symbolic link. */ -#define __S_IFSOCK 0140000 /* Socket. */ - -/* POSIX.1b objects. Note that these macros always evaluate to zero. But - they do it by enforcing the correct use of the macros. */ -#define __S_TYPEISMQ(buf) ((buf)->st_mode - (buf)->st_mode) -#define __S_TYPEISSEM(buf) ((buf)->st_mode - (buf)->st_mode) -#define __S_TYPEISSHM(buf) ((buf)->st_mode - (buf)->st_mode) - -/* Protection bits. */ - -#define __S_ISUID 04000 /* Set user ID on execution. */ -#define __S_ISGID 02000 /* Set group ID on execution. */ -#define __S_ISVTX 01000 /* Save swapped text after use (sticky). */ -#define __S_IREAD 0400 /* Read by owner. */ -#define __S_IWRITE 0200 /* Write by owner. */ -#define __S_IEXEC 0100 /* Execute by owner. */ -- 1.7.3.4 From msalter at redhat.com Wed Apr 6 13:20:07 2011 From: msalter at redhat.com (Mark Salter) Date: Wed, 06 Apr 2011 13:20:07 -0000 Subject: [git commit prelink] sunrpc: fix spurious fall-through Message-ID: <20110406131954.6C63B80774@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=cb96f5c1b34a36864b0da389599b95408cc9b4a2 branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/prelink Fix spurious fall-through. Signed-off-by: Mark Salter Signed-off-by: Bernd Schmidt --- libc/inet/rpc/clnt_tcp.c | 1 + libc/inet/rpc/clnt_udp.c | 1 + libc/inet/rpc/clnt_unix.c | 1 + 3 files changed, 3 insertions(+), 0 deletions(-) diff --git a/libc/inet/rpc/clnt_tcp.c b/libc/inet/rpc/clnt_tcp.c index d01fc80..d8d7bb3 100644 --- a/libc/inet/rpc/clnt_tcp.c +++ b/libc/inet/rpc/clnt_tcp.c @@ -402,6 +402,7 @@ clnttcp_control (CLIENT *cl, int request, char *info) /* This will set the xid of the NEXT call */ *(u_long *)ct->ct_mcall = htonl (*(u_long *)info - 1); /* decrement by 1 as clnttcp_call() increments once */ + break; case CLGET_VERS: /* * This RELIES on the information that, in the call body, diff --git a/libc/inet/rpc/clnt_udp.c b/libc/inet/rpc/clnt_udp.c index fe8b7f8..aca3e33 100644 --- a/libc/inet/rpc/clnt_udp.c +++ b/libc/inet/rpc/clnt_udp.c @@ -554,6 +554,7 @@ clntudp_control (CLIENT *cl, int request, char *info) /* This will set the xid of the NEXT call */ *(u_long *)cu->cu_outbuf = htonl(*(u_long *)info - 1); /* decrement by 1 as clntudp_call() increments once */ + break; case CLGET_VERS: /* * This RELIES on the information that, in the call body, diff --git a/libc/inet/rpc/clnt_unix.c b/libc/inet/rpc/clnt_unix.c index c7756f7..9870149 100644 --- a/libc/inet/rpc/clnt_unix.c +++ b/libc/inet/rpc/clnt_unix.c @@ -377,6 +377,7 @@ clntunix_control (CLIENT *cl, int request, char *info) /* This will set the xid of the NEXT call */ *(u_long *) ct->ct_mcall = htonl (*(u_long *)info - 1); /* decrement by 1 as clntunix_call() increments once */ + break; case CLGET_VERS: /* * This RELIES on the information that, in the call body, -- 1.7.3.4 From nenolod at dereferenced.org Wed Apr 6 13:20:08 2011 From: nenolod at dereferenced.org (William Pitcock) Date: Wed, 06 Apr 2011 13:20:08 -0000 Subject: [git commit prelink] nptl: fix compilation on x86_64 Message-ID: <20110406131950.5F8E880774@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=526af41956be03b56e1bf33ec144e797256c1255 branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/prelink This commit gives us a fully functioning NPTL on x86-64 by using the GOTOFF macro as needed. Signed-off-by: William Pitcock Signed-off-by: Khem Raj --- .../sysdeps/unix/sysv/linux/x86_64/lowlevellock.S | 2 +- .../unix/sysv/linux/x86_64/lowlevelrobustlock.S | 2 +- .../sysv/linux/x86_64/pthread_cond_timedwait.S | 10 +--------- .../sysv/linux/x86_64/pthread_rwlock_timedrdlock.S | 2 +- .../sysv/linux/x86_64/pthread_rwlock_timedwrlock.S | 2 +- .../sysdeps/unix/sysv/linux/x86_64/sem_timedwait.S | 2 +- 6 files changed, 6 insertions(+), 14 deletions(-) diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.S b/libpthread/nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.S index f875323..e59bdda 100644 --- a/libpthread/nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.S +++ b/libpthread/nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.S @@ -163,7 +163,7 @@ __lll_timedlock_wait: cfi_startproc # ifndef __ASSUME_FUTEX_CLOCK_REALTIME # ifdef __PIC__ - cmpl $0, __have_futex_clock_realtime(%rip) + cmpl $0, __have_futex_clock_realtime at GOTOFF(%rip) # else cmpl $0, __have_futex_clock_realtime # endif diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/x86_64/lowlevelrobustlock.S b/libpthread/nptl/sysdeps/unix/sysv/linux/x86_64/lowlevelrobustlock.S index 2eb8e29..5cc4256 100644 --- a/libpthread/nptl/sysdeps/unix/sysv/linux/x86_64/lowlevelrobustlock.S +++ b/libpthread/nptl/sysdeps/unix/sysv/linux/x86_64/lowlevelrobustlock.S @@ -118,7 +118,7 @@ __lll_robust_timedlock_wait: cfi_startproc # ifndef __ASSUME_FUTEX_CLOCK_REALTIME # ifdef __PIC__ - cmpl $0, __have_futex_clock_realtime(%rip) + cmpl $0, __have_futex_clock_realtime at GOTOFF(%rip) # else cmpl $0, __have_futex_clock_realtime # endif diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S b/libpthread/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S index 3a965ad..645436f 100644 --- a/libpthread/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S +++ b/libpthread/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S @@ -98,7 +98,7 @@ __pthread_cond_timedwait: 22: #ifndef __ASSUME_FUTEX_CLOCK_REALTIME # ifdef __PIC__ - cmpl $0, __have_futex_clock_realtime(%rip) + cmpl $0, __have_futex_clock_realtime at GOTOFF(%rip) # else cmpl $0, __have_futex_clock_realtime # endif @@ -437,14 +437,6 @@ __pthread_cond_timedwait: /* Only clocks 0 and 1 are allowed so far. Both are handled in the kernel. */ leaq 32(%rsp), %rsi -# ifdef SHARED - movq __vdso_clock_gettime at GOTPCREL(%rip), %rax - movq (%rax), %rax - PTR_DEMANGLE (%rax) - jz 26f - call *%rax - jmp 27f -# endif 26: movl $__NR_clock_gettime, %eax syscall 27: diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_timedrdlock.S b/libpthread/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_timedrdlock.S index 3629ffb..15edd61 100644 --- a/libpthread/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_timedrdlock.S +++ b/libpthread/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_timedrdlock.S @@ -96,7 +96,7 @@ pthread_rwlock_timedrdlock: 11: #ifndef __ASSUME_FUTEX_CLOCK_REALTIME # ifdef __PIC__ - cmpl $0, __have_futex_clock_realtime(%rip) + cmpl $0, __have_futex_clock_realtime at GOTOFF(%rip) # else cmpl $0, __have_futex_clock_realtime # endif diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_timedwrlock.S b/libpthread/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_timedwrlock.S index 23e1ee1..3c4a279 100644 --- a/libpthread/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_timedwrlock.S +++ b/libpthread/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_timedwrlock.S @@ -93,7 +93,7 @@ pthread_rwlock_timedwrlock: 11: #ifndef __ASSUME_FUTEX_CLOCK_REALTIME # ifdef __PIC__ - cmpl $0, __have_futex_clock_realtime(%rip) + cmpl $0, __have_futex_clock_realtime at GOTOFF(%rip) # else cmpl $0, __have_futex_clock_realtime # endif diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/x86_64/sem_timedwait.S b/libpthread/nptl/sysdeps/unix/sysv/linux/x86_64/sem_timedwait.S index 704a222..3ff3412 100644 --- a/libpthread/nptl/sysdeps/unix/sysv/linux/x86_64/sem_timedwait.S +++ b/libpthread/nptl/sysdeps/unix/sysv/linux/x86_64/sem_timedwait.S @@ -61,7 +61,7 @@ sem_timedwait: #ifndef __ASSUME_FUTEX_CLOCK_REALTIME # ifdef __PIC__ - cmpl $0, __have_futex_clock_realtime(%rip) + cmpl $0, __have_futex_clock_realtime at GOTOFF(%rip) # else cmpl $0, __have_futex_clock_realtime # endif -- 1.7.3.4 From tg at mirbsd.org Wed Apr 6 13:20:12 2011 From: tg at mirbsd.org (Thorsten Glaser) Date: Wed, 06 Apr 2011 13:20:12 -0000 Subject: [git commit prelink] cris: add provide arch-specific vfork implementation Message-ID: <20110406132000.AAF1F80774@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=9b5df2295b4a3cfc63a15b6490f2b61dcf7c1be9 branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/prelink vfork must be called with nothing at all on the stack, so implementing it via syscall() does not work. Signed-off-by: Thorsten Glaser Signed-off-by: Waldemar Brodkorb Signed-off-by: Mike Frysinger --- libc/sysdeps/linux/cris/Makefile.arch | 2 +- libc/sysdeps/linux/cris/vfork.S | 30 ++++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+), 1 deletions(-) create mode 100644 libc/sysdeps/linux/cris/vfork.S diff --git a/libc/sysdeps/linux/cris/Makefile.arch b/libc/sysdeps/linux/cris/Makefile.arch index 43e1912..8a682b0 100644 --- a/libc/sysdeps/linux/cris/Makefile.arch +++ b/libc/sysdeps/linux/cris/Makefile.arch @@ -7,7 +7,7 @@ CSRC := __init_brk.c brk.c sbrk.c -SSRC := setjmp.S __longjmp.S clone.S sysdep.S syscall.S +SSRC := setjmp.S __longjmp.S clone.S sysdep.S syscall.S vfork.S ifeq ($(UNIFIED_SYSCALL),y) SSRC += __uClibc_syscall.S endif diff --git a/libc/sysdeps/linux/cris/vfork.S b/libc/sysdeps/linux/cris/vfork.S new file mode 100644 index 0000000..ea8a81d --- /dev/null +++ b/libc/sysdeps/linux/cris/vfork.S @@ -0,0 +1,30 @@ +/*- + * Copyright (c) 2011 + * Thorsten Glaser + * + * This file is available either under the terms and conditions of + * the MirOS Licence, or the same terms as klibc or uClibc. + */ + +#include "sysdep.h" + + .syntax no_register_prefix + +/* + * vfork is special, but PSEUDO() would probably work were it not broken; + * there must be nothing at all on the stack above the stack frame of the + * enclosing function + */ + +ENTRY(__vfork) + movu.w __NR_vfork,$r9 + break 13 + cmps.w -4096,$r10 + bhs 0f + nop + Ret + nop +PSEUDO_END(__vfork) + +weak_alias(__vfork,vfork) +libc_hidden_weak(vfork) -- 1.7.3.4 From steve at whitecrow.demon.co.uk Wed Apr 6 13:29:37 2011 From: steve at whitecrow.demon.co.uk (Steve Kilbane) Date: Wed, 06 Apr 2011 13:29:37 -0000 Subject: [git commit prelink] bfin: fix sram/dma syscall definitions Message-ID: <20110406131936.8831482228@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=f8355584a335a2a2dc03842f19ba9f1b587b2f5c branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/prelink Once we pull in the header, we're forced to declare the syscall with all the right types. Signed-off-by: Steve Kilbane Signed-off-by: Mike Frysinger --- libc/sysdeps/linux/bfin/dma-memcpy.c | 4 ++-- libc/sysdeps/linux/bfin/sram-alloc.c | 2 +- libc/sysdeps/linux/bfin/sram-free.c | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/libc/sysdeps/linux/bfin/dma-memcpy.c b/libc/sysdeps/linux/bfin/dma-memcpy.c index 274b99e..b715aeb 100644 --- a/libc/sysdeps/linux/bfin/dma-memcpy.c +++ b/libc/sysdeps/linux/bfin/dma-memcpy.c @@ -1,6 +1,6 @@ #include #include #include +#include -_syscall3 (__ptr_t, dma_memcpy, __ptr_t, dest, __ptr_t, src, size_t, len) - +_syscall3 (void *, dma_memcpy, void *, dest, const void *, src, size_t, len) diff --git a/libc/sysdeps/linux/bfin/sram-alloc.c b/libc/sysdeps/linux/bfin/sram-alloc.c index 6b33b26..8518119 100644 --- a/libc/sysdeps/linux/bfin/sram-alloc.c +++ b/libc/sysdeps/linux/bfin/sram-alloc.c @@ -1,6 +1,6 @@ #include #include #include +#include _syscall2 (__ptr_t, sram_alloc, size_t, len, unsigned long, flags) - diff --git a/libc/sysdeps/linux/bfin/sram-free.c b/libc/sysdeps/linux/bfin/sram-free.c index 0fba936..8260eb6 100644 --- a/libc/sysdeps/linux/bfin/sram-free.c +++ b/libc/sysdeps/linux/bfin/sram-free.c @@ -1,6 +1,6 @@ #include #include #include +#include -_syscall1 (__ptr_t, sram_free, __ptr_t, addr) - +_syscall1 (int, sram_free, const void *, addr) -- 1.7.3.4 From mrayskiy at broadcom.com Thu Apr 21 23:28:44 2011 From: mrayskiy at broadcom.com (Maksim Rayskiy) Date: Thu, 21 Apr 2011 23:28:44 -0000 Subject: [git commit future] MIPS LDSO: pass sym_ref parameter to _dl_find_hash() to support PROTECTED symbols Message-ID: <20110421232843.A53CD8216E@busybox.osuosl.org> commit: http://git.uclibc.org/uClibc/commit/?id=b228ddac5b221b7c474ed902bad124934e61a527 branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/future _dl_find_hash() relies on sym_ref parameter to check if the looked-up symbol is protected. The code fixes a case when _dl_perform_mips_global_got_relocations() was calling _dl_find_hash() without providing sym_ref parameter. The bug was causing hangs if a library exporting non-protected symbol was earlier in link order than library with the same symbol declared as protected. Signed-off-by: Maksim Rayskiy Signed-off-by: Carmelo Amoroso Patch is too large, so refusing to show it