From 6349a663038dbe7b59467c5bd06cd5f5dc91c867 Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Sun, 6 Feb 2011 23:51:23 +0100 Subject: fix a problem with hidden getutent in non-threaded builds Signed-off-by: Denys Vlasenko --- libc/misc/utmp/utent.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'libc') diff --git a/libc/misc/utmp/utent.c b/libc/misc/utmp/utent.c index bf265c2a3..11d615437 100644 --- a/libc/misc/utmp/utent.c +++ b/libc/misc/utmp/utent.c @@ -98,8 +98,8 @@ struct utmp *getutent(void) __UCLIBC_MUTEX_UNLOCK(utmplock); return ret; } -libc_hidden_def(getutent) #endif +libc_hidden_def(getutent) void endutent(void) { -- cgit v1.2.3 From 6a0aa4add30eecf76b9d14ad3f204e4017f9f22c Mon Sep 17 00:00:00 2001 From: Bernhard Reutner-Fischer Date: Wed, 9 Feb 2011 20:08:20 +0100 Subject: arm: mv nptl specific atomic impl to common place Thanks to Nitin Garg for notincing! Signed-off-by: Bernhard Reutner-Fischer --- libc/sysdeps/linux/arm/bits/atomic.h | 122 +++++++++++++++++++++++++++++++++++ 1 file changed, 122 insertions(+) create mode 100644 libc/sysdeps/linux/arm/bits/atomic.h (limited to 'libc') diff --git a/libc/sysdeps/linux/arm/bits/atomic.h b/libc/sysdeps/linux/arm/bits/atomic.h new file mode 100644 index 000000000..8f63e2510 --- /dev/null +++ b/libc/sysdeps/linux/arm/bits/atomic.h @@ -0,0 +1,122 @@ +/* Copyright (C) 2002, 2003, 2004, 2005 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. */ + +#include +#include + + +typedef int8_t atomic8_t; +typedef uint8_t uatomic8_t; +typedef int_fast8_t atomic_fast8_t; +typedef uint_fast8_t uatomic_fast8_t; + +typedef int32_t atomic32_t; +typedef uint32_t uatomic32_t; +typedef int_fast32_t atomic_fast32_t; +typedef uint_fast32_t uatomic_fast32_t; + +typedef intptr_t atomicptr_t; +typedef uintptr_t uatomicptr_t; +typedef intmax_t atomic_max_t; +typedef uintmax_t uatomic_max_t; + +void __arm_link_error (void); + +#ifdef __thumb2__ +#define atomic_full_barrier() \ + __asm__ __volatile__ \ + ("movw\tip, #0x0fa0\n\t" \ + "movt\tip, #0xffff\n\t" \ + "blx\tip" \ + : : : "ip", "lr", "cc", "memory"); +#else +#define atomic_full_barrier() \ + __asm__ __volatile__ \ + ("mov\tip, #0xffff0fff\n\t" \ + "mov\tlr, pc\n\t" \ + "add\tpc, ip, #(0xffff0fa0 - 0xffff0fff)" \ + : : : "ip", "lr", "cc", "memory"); +#endif + +/* Atomic compare and exchange. This sequence relies on the kernel to + provide a compare and exchange operation which is atomic on the + current architecture, either via cleverness on pre-ARMv6 or via + ldrex / strex on ARMv6. */ + +#define __arch_compare_and_exchange_val_8_acq(mem, newval, oldval) \ + ({ __arm_link_error (); oldval; }) + +#define __arch_compare_and_exchange_val_16_acq(mem, newval, oldval) \ + ({ __arm_link_error (); oldval; }) + +/* It doesn't matter what register is used for a_oldval2, but we must + specify one to work around GCC PR rtl-optimization/21223. Otherwise + it may cause a_oldval or a_tmp to be moved to a different register. */ + +#ifdef __thumb2__ +/* Thumb-2 has ldrex/strex. However it does not have barrier instructions, + so we still need to use the kernel helper. */ +#define __arch_compare_and_exchange_val_32_acq(mem, newval, oldval) \ + ({ register __typeof (oldval) a_oldval __asm__ ("r0"); \ + register __typeof (oldval) a_newval __asm__ ("r1") = (newval); \ + register __typeof (mem) a_ptr __asm__ ("r2") = (mem); \ + register __typeof (oldval) a_tmp __asm__ ("r3"); \ + register __typeof (oldval) a_oldval2 __asm__ ("r4") = (oldval); \ + __asm__ __volatile__ \ + ("0:\tldr\t%[tmp],[%[ptr]]\n\t" \ + "cmp\t%[tmp], %[old2]\n\t" \ + "bne\t1f\n\t" \ + "mov\t%[old], %[old2]\n\t" \ + "movw\t%[tmp], #0x0fc0\n\t" \ + "movt\t%[tmp], #0xffff\n\t" \ + "blx\t%[tmp]\n\t" \ + "bcc\t0b\n\t" \ + "mov\t%[tmp], %[old2]\n\t" \ + "1:" \ + : [old] "=&r" (a_oldval), [tmp] "=&r" (a_tmp) \ + : [new] "r" (a_newval), [ptr] "r" (a_ptr), \ + [old2] "r" (a_oldval2) \ + : "ip", "lr", "cc", "memory"); \ + a_tmp; }) +#else +#define __arch_compare_and_exchange_val_32_acq(mem, newval, oldval) \ + ({ register __typeof (oldval) a_oldval __asm__ ("r0"); \ + register __typeof (oldval) a_newval __asm__ ("r1") = (newval); \ + register __typeof (mem) a_ptr __asm__ ("r2") = (mem); \ + register __typeof (oldval) a_tmp __asm__ ("r3"); \ + register __typeof (oldval) a_oldval2 __asm__ ("r4") = (oldval); \ + __asm__ __volatile__ \ + ("0:\tldr\t%[tmp],[%[ptr]]\n\t" \ + "cmp\t%[tmp], %[old2]\n\t" \ + "bne\t1f\n\t" \ + "mov\t%[old], %[old2]\n\t" \ + "mov\t%[tmp], #0xffff0fff\n\t" \ + "mov\tlr, pc\n\t" \ + "add\tpc, %[tmp], #(0xffff0fc0 - 0xffff0fff)\n\t" \ + "bcc\t0b\n\t" \ + "mov\t%[tmp], %[old2]\n\t" \ + "1:" \ + : [old] "=&r" (a_oldval), [tmp] "=&r" (a_tmp) \ + : [new] "r" (a_newval), [ptr] "r" (a_ptr), \ + [old2] "r" (a_oldval2) \ + : "ip", "lr", "cc", "memory"); \ + a_tmp; }) +#endif + +#define __arch_compare_and_exchange_val_64_acq(mem, newval, oldval) \ + ({ __arm_link_error (); oldval; }) -- cgit v1.2.3 From 6f810c757e5b14a97f05652972e91f95e321a404 Mon Sep 17 00:00:00 2001 From: Peter Korsgaard Date: Wed, 2 Feb 2011 17:58:38 +0100 Subject: sync bits/socket.h PF_* / AF_* values with 2.6.38-rc3 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(-) (limited to 'libc') diff --git a/libc/sysdeps/linux/common/bits/socket.h b/libc/sysdeps/linux/common/bits/socket.h index 11f6e9715..7e12733ae 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 b46e7be28..27ceafafe 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 e41527fd3..64973e2cf 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. -- cgit v1.2.3 From 9a9a6365d5c5abb0fe3ec6cc09542e9c7e1d3bec Mon Sep 17 00:00:00 2001 From: Jones Desougi Date: Thu, 10 Jun 2010 15:04:51 +0200 Subject: *printf: Violation of precision with null string 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 file changed, 6 insertions(+) (limited to 'libc') diff --git a/libc/stdio/_vfprintf.c b/libc/stdio/_vfprintf.c index 3b007084d..fa5dc44fc 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)) ); -- cgit v1.2.3 From d0aa7016ee1a95849a5a448083d8f8e675d80b5b Mon Sep 17 00:00:00 2001 From: Bernhard Reutner-Fischer Date: Wed, 9 Feb 2011 20:21:12 +0100 Subject: i386: extend IMA guards to also cover LTO See GCC PR47577; TODO: Remove them. Signed-off-by: Bernhard Reutner-Fischer --- libc/sysdeps/linux/i386/bits/syscalls.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'libc') diff --git a/libc/sysdeps/linux/i386/bits/syscalls.h b/libc/sysdeps/linux/i386/bits/syscalls.h index 9184bd6c3..eeafb3a48 100644 --- a/libc/sysdeps/linux/i386/bits/syscalls.h +++ b/libc/sysdeps/linux/i386/bits/syscalls.h @@ -43,9 +43,12 @@ /* We need some help from the assembler to generate optimal code. * We define some macros here which later will be used. */ +/* gcc>=4.6 with LTO need the same guards as IMA (a.k.a --combine) did. + * See gcc.gnu.org/PR47577 */ +/* FIXME: drop these b* macros! */ __asm__ ( -#ifdef __DOMULTI__ +#if defined __DOMULTI__ || __GNUC_PREREQ (4, 6) /* Protect against asm macro redefinition (happens in __DOMULTI__ mode). * Unfortunately, it ends up visible in .o files. */ ".ifndef _BITS_SYSCALLS_ASM\n\t" @@ -92,7 +95,7 @@ __asm__ ( ".endif\n\t" ".endm\n\t" -#ifdef __DOMULTI__ +#if defined __DOMULTI__ || __GNUC_PREREQ (4, 6) ".endif\n\t" /* _BITS_SYSCALLS_ASM */ #endif ); -- cgit v1.2.3 From da2d70ed69b57d63243a7b1e05ac7d43e91778ab Mon Sep 17 00:00:00 2001 From: Bernhard Reutner-Fischer Date: Fri, 11 Feb 2011 17:26:19 +0100 Subject: arm: use CAS gcc builtin if SI-mode pattern is available Signed-off-by: Bernhard Reutner-Fischer --- libc/sysdeps/linux/arm/bits/atomic.h | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) (limited to 'libc') diff --git a/libc/sysdeps/linux/arm/bits/atomic.h b/libc/sysdeps/linux/arm/bits/atomic.h index 8f63e2510..07101fbe8 100644 --- a/libc/sysdeps/linux/arm/bits/atomic.h +++ b/libc/sysdeps/linux/arm/bits/atomic.h @@ -37,7 +37,12 @@ typedef uintmax_t uatomic_max_t; void __arm_link_error (void); -#ifdef __thumb2__ +/* Use the atomic builtins provided by GCC in case the backend provides + a pattern to do this efficiently. */ + +#ifdef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 +#define atomic_full_barrier() __sync_synchronize () +#elif defined __thumb2__ #define atomic_full_barrier() \ __asm__ __volatile__ \ ("movw\tip, #0x0fa0\n\t" \ @@ -64,17 +69,21 @@ void __arm_link_error (void); #define __arch_compare_and_exchange_val_16_acq(mem, newval, oldval) \ ({ __arm_link_error (); oldval; }) +#ifdef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 +#define __arch_compare_and_exchange_val_32_acq(mem, newval, oldval) \ + __sync_val_compare_and_swap ((mem), (oldval), (newval)) + /* It doesn't matter what register is used for a_oldval2, but we must specify one to work around GCC PR rtl-optimization/21223. Otherwise it may cause a_oldval or a_tmp to be moved to a different register. */ -#ifdef __thumb2__ +#elif defined __thumb2__ /* Thumb-2 has ldrex/strex. However it does not have barrier instructions, so we still need to use the kernel helper. */ #define __arch_compare_and_exchange_val_32_acq(mem, newval, oldval) \ - ({ register __typeof (oldval) a_oldval __asm__ ("r0"); \ - register __typeof (oldval) a_newval __asm__ ("r1") = (newval); \ - register __typeof (mem) a_ptr __asm__ ("r2") = (mem); \ + ({ register __typeof (oldval) a_oldval __asm__ ("r0"); \ + register __typeof (oldval) a_newval __asm__ ("r1") = (newval); \ + register __typeof (mem) a_ptr __asm__ ("r2") = (mem); \ register __typeof (oldval) a_tmp __asm__ ("r3"); \ register __typeof (oldval) a_oldval2 __asm__ ("r4") = (oldval); \ __asm__ __volatile__ \ @@ -95,9 +104,9 @@ void __arm_link_error (void); a_tmp; }) #else #define __arch_compare_and_exchange_val_32_acq(mem, newval, oldval) \ - ({ register __typeof (oldval) a_oldval __asm__ ("r0"); \ - register __typeof (oldval) a_newval __asm__ ("r1") = (newval); \ - register __typeof (mem) a_ptr __asm__ ("r2") = (mem); \ + ({ register __typeof (oldval) a_oldval __asm__ ("r0"); \ + register __typeof (oldval) a_newval __asm__ ("r1") = (newval); \ + register __typeof (mem) a_ptr __asm__ ("r2") = (mem); \ register __typeof (oldval) a_tmp __asm__ ("r3"); \ register __typeof (oldval) a_oldval2 __asm__ ("r4") = (oldval); \ __asm__ __volatile__ \ -- cgit v1.2.3 From 32814a2b15829df3a144391f5b8bd46e755f85f5 Mon Sep 17 00:00:00 2001 From: Kevin Cernekee Date: Thu, 10 Feb 2011 14:30:55 -0800 Subject: Fix GNU make v3.80 compatibility 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 file changed, 6 insertions(+), 2 deletions(-) (limited to 'libc') diff --git a/libc/sysdeps/linux/common/Makefile.in b/libc/sysdeps/linux/common/Makefile.in index cf4cf8708..bd45d941b 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 -- cgit v1.2.3 From cdd129dbfe1234c41c7ebee538314417a757b8e8 Mon Sep 17 00:00:00 2001 From: Bernhard Reutner-Fischer Date: Sun, 13 Feb 2011 15:56:30 +0100 Subject: nptl: fix typo in buildsys 0f85b228 used 'filter-pout' instead of 'filter-out'. Fix that. Signed-off-by: Bernhard Reutner-Fischer --- libc/sysdeps/linux/common/Makefile.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'libc') diff --git a/libc/sysdeps/linux/common/Makefile.in b/libc/sysdeps/linux/common/Makefile.in index bd45d941b..30341fd35 100644 --- a/libc/sysdeps/linux/common/Makefile.in +++ b/libc/sysdeps/linux/common/Makefile.in @@ -34,7 +34,7 @@ CSRC := $(filter-out capget.c capset.c inotify.c ioperm.c iopl.c \ sync_file_range.c sysctl.c sysinfo.c timerfd.c uselib.c vhangup.c,$(CSRC)) ifneq ($(UCLIBC_HAS_THREADS_NATIVE),y) # we need madvise.c in NPTL -CSRC := $(filter-pout madvise.c,$(CSRC)) +CSRC := $(filter-out madvise.c,$(CSRC)) endif endif -- cgit v1.2.3 From 2c1c5db993c28e96b47a77148a4635931384810d Mon Sep 17 00:00:00 2001 From: Bernhard Reutner-Fischer Date: Sun, 13 Feb 2011 16:19:12 +0100 Subject: regex: remove set but not used variable Signed-off-by: Bernhard Reutner-Fischer --- libc/misc/regex/regex_internal.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'libc') diff --git a/libc/misc/regex/regex_internal.c b/libc/misc/regex/regex_internal.c index de640e08d..c6ac8dda1 100644 --- a/libc/misc/regex/regex_internal.c +++ b/libc/misc/regex/regex_internal.c @@ -627,7 +627,7 @@ re_string_reconstruct (re_string_t *pstr, int idx, int eflags) if (pstr->is_utf8) { - const unsigned char *raw, *p, *q, *end; + const unsigned char *raw, *p, *end; /* Special case UTF-8. Multi-byte chars start with any byte other than 0x80 - 0xbf. */ @@ -654,13 +654,11 @@ re_string_reconstruct (re_string_t *pstr, int idx, int eflags) unsigned char buf[6]; size_t mbclen; - q = p; if (BE (pstr->trans != NULL, 0)) { int i = mlen < 6 ? mlen : 6; while (--i >= 0) buf[i] = pstr->trans[p[i]]; - q = buf; } /* XXX Don't use mbrtowc, we know which conversion to use (UTF-8 -> UCS4). */ -- cgit v1.2.3 From e5651d24e38e0a96f9f8ab7a44e34deb08e11084 Mon Sep 17 00:00:00 2001 From: Bernhard Reutner-Fischer Date: Sun, 13 Feb 2011 18:31:27 +0100 Subject: buildsys: remove wrong file Somehow Makefile.in ended in there, remove it. Signed-off-by: Bernhard Reutner-Fischer --- libc/sysdeps/linux/common/Makefile.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'libc') diff --git a/libc/sysdeps/linux/common/Makefile.in b/libc/sysdeps/linux/common/Makefile.in index 30341fd35..fdb06c5f4 100644 --- a/libc/sysdeps/linux/common/Makefile.in +++ b/libc/sysdeps/linux/common/Makefile.in @@ -74,7 +74,7 @@ endif ifneq ($(UCLIBC_HAS_REALTIME),y) # 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 := $(filter-out clock_getres.c clock_gettime.c clock_settime.c fdatasync.c Makefile.in mlockall.c mlock.c munlockall.c munlock.c nanosleep.c __rt_sigtimedwait.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,$(CSRC)) +CSRC := $(filter-out 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 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,$(CSRC)) endif -- cgit v1.2.3 From 18e7136e79a89ba5e978f0dc445a8fcf8d619a40 Mon Sep 17 00:00:00 2001 From: Bernhard Reutner-Fischer Date: Mon, 14 Feb 2011 20:54:57 +0100 Subject: buildsys: use kbuild style Signed-off-by: Bernhard Reutner-Fischer --- libc/sysdeps/linux/common/Makefile.in | 135 ++++++++++------------------------ 1 file changed, 39 insertions(+), 96 deletions(-) (limited to 'libc') diff --git a/libc/sysdeps/linux/common/Makefile.in b/libc/sysdeps/linux/common/Makefile.in index fdb06c5f4..229c39164 100644 --- a/libc/sysdeps/linux/common/Makefile.in +++ b/libc/sysdeps/linux/common/Makefile.in @@ -8,127 +8,70 @@ COMMON_DIR := $(top_srcdir)libc/sysdeps/linux/common COMMON_OUT := $(top_builddir)libc/sysdeps/linux/common -CSRC := $(notdir $(wildcard $(COMMON_DIR)/*.c)) +CSRC-y := $(notdir $(wildcard $(COMMON_DIR)/*.c)) +CSRC- := ssp-local.c -ifneq ($(UCLIBC_HAS_LFS),y) CSRC_LFS := $(notdir $(wildcard $(COMMON_DIR)/*64.c)) -CSRC := $(filter-out llseek.c $(CSRC_LFS),$(CSRC)) -endif - -CSRC := $(filter-out ssp-local.c,$(CSRC)) -ifneq ($(UCLIBC_HAS_SSP),y) -CSRC := $(filter-out ssp.c,$(CSRC)) -endif - -ifneq ($(UCLIBC_LINUX_MODULE_24),y) -CSRC := $(filter-out create_module.c query_module.c get_kernel_syms.c,$(CSRC)) -endif +CSRC-y := $(filter-out llseek.c $(CSRC_LFS),$(CSRC-y)) +CSRC-$(UCLIBC_HAS_LFS) += llseek.c $(CSRC_LFS) -ifneq ($(UCLIBC_LINUX_SPECIFIC),y) +CSRC-$(UCLIBC_HAS_SSP) += ssp.c +CSRC-$(UCLIBC_LINUX_MODULE_24) += create_module.c query_module.c \ + get_kernel_syms.c # we need these internally: fstatfs.c statfs.c -CSRC := $(filter-out capget.c capset.c inotify.c ioperm.c iopl.c \ +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,$(CSRC)) -ifneq ($(UCLIBC_HAS_THREADS_NATIVE),y) -# we need madvise.c in NPTL -CSRC := $(filter-out madvise.c,$(CSRC)) -endif -endif - + 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 +CSRC-$(UCLIBC_HAS_THREADS_NATIVE) += fork.c getpid.c raise.c open.c close.c \ + read.c write.c 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) -CSRC := $(filter-out vfork.c, $(CSRC)) -else -ifeq ($(TARGET_ARCH),mips) -ifeq ($(CONFIG_MIPS_O32_ABI),y) -CSRC := $(filter-out waitpid.c, $(CSRC)) -endif -else -CSRC := $(filter-out waitpid.c, $(CSRC)) -endif +CSRC- += waitpid.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) endif -endif -endif - -ifneq ($(ARCH_USE_MMU),y) # stubbed out in mman.h -CSRC := $(filter-out msync.c, $(CSRC)) -endif - -ifneq ($(UCLIBC_BSD_SPECIFIC),y) +CSRC-$(ARCH_USE_MMU) += msync.c # we need these internally: getdomainname.c -CSRC := $(filter-out mincore.c setdomainname.c,$(CSRC)) -endif - -ifneq ($(UCLIBC_NTP_LEGACY),y) -CSRC := $(filter-out ntp_gettime.c,$(CSRC)) -endif - - -ifneq ($(UCLIBC_HAS_REALTIME),y) +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 -CSRC := $(filter-out 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 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,$(CSRC)) -endif - - -ifneq ($(UCLIBC_HAS_ADVANCED_REALTIME),y) +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 \ + 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_typed_mem_get_info|pthread_mutex_timedlock|sem_timedwait -CSRC := $(filter-out posix_fadvise64.c posix_fadvise.c,$(CSRC)) -endif - -ifneq ($(UCLIBC_SUSV4_LEGACY),y) -CSRC := $(filter-out utime.c,$(CSRC)) -endif - -ifneq ($(UCLIBC_HAS_EPOLL),y) -CSRC := $(filter-out epoll.c,$(CSRC)) -endif - -ifneq ($(UCLIBC_HAS_XATTR),y) -CSRC := $(filter-out xattr.c,$(CSRC)) -endif - -ifneq ($(UCLIBC_HAS_PROFILING),y) -CSRC := $(filter-out noophooks.c pcprofile.c,$(CSRC)) -endif - -ifneq ($(UCLIBC_SV4_DEPRECATED),y) -CSRC := $(filter-out ustat.c,$(CSRC)) -endif - -ifeq ($(TARGET_ARCH),sh) -CSRC := $(filter-out longjmp.c vfork.c,$(CSRC)) -endif - -ifeq ($(TARGET_ARCH),sparc) -CSRC := $(filter-out vfork.c,$(CSRC)) -endif - -ifeq ($(TARGET_ARCH),i386) -CSRC := $(filter-out vfork.c,$(CSRC)) -endif +CSRC-$(UCLIBC_HAS_ADVANCED_REALTIME) += posix_fadvise64.c posix_fadvise.c +CSRC-$(UCLIBC_SUSV4_LEGACY) += utime.c +CSRC-$(UCLIBC_HAS_EPOLL) += epoll.c +CSRC-$(UCLIBC_HAS_XATTR) += xattr.c +CSRC-$(UCLIBC_HAS_PROFILING) += noophooks.c #pcprofile.c +CSRC-$(UCLIBC_SV4_DEPRECATED) += ustat.c +CSRC- += $(if $(findstring =sh=,=$(TARGET_ARCH)=),longjmp.c vfork.c) +CSRC- += $(if $(findstring =sparc=,=$(TARGET_ARCH)=),vfork.c) +CSRC- += $(if $(findstring =i386=,=$(TARGET_ARCH)=),vfork.c) + +CSRC-y := $(filter-out $(CSRC-),$(CSRC-y)) # provided via pthreads builddir -CSRC := $(filter-out $(libc_a_CSRC) $(notdir $(libpthread_libc_OBJS:.o=.c)),$(CSRC)) +CSRC-y := $(filter-out $(libc_a_CSRC) $(notdir $(libpthread_libc_OBJS:.o=.c)),$(CSRC-y)) SSRC := $(filter-out $(libc_a_SSRC) $(notdir $(libpthread_libc_OBJS:.o=.S)),$(SSRC)) # fails for some reason ifneq ($(strip $(ARCH_OBJS)),) -CSRC := $(filter-out $(notdir $(ARCH_OBJS:.o=.c)) $(ARCH_OBJ_FILTEROUT),$(CSRC)) +CSRC-y := $(filter-out $(notdir $(ARCH_OBJS:.o=.c)) $(ARCH_OBJ_FILTEROUT),$(CSRC-y)) endif CFLAGS-ssp.c := $(SSP_DISABLE_FLAGS) CFLAGS-ssp-local.c := $(SSP_DISABLE_FLAGS) -COMMON_SRC := $(patsubst %.c,$(COMMON_DIR)/%.c,$(CSRC)) -COMMON_OBJ := $(patsubst %.c,$(COMMON_OUT)/%.o,$(CSRC)) +COMMON_SRC := $(patsubst %.c,$(COMMON_DIR)/%.c,$(CSRC-y)) +COMMON_OBJ := $(patsubst %.c,$(COMMON_OUT)/%.o,$(CSRC-y)) libc-y += $(COMMON_OBJ) libc-static-$(UCLIBC_HAS_SSP) += $(COMMON_OUT)/ssp-local.o -- cgit v1.2.3 From 0f4516e32c3a2186e6b6f074cfc6a57bde90e9cc Mon Sep 17 00:00:00 2001 From: Bernhard Reutner-Fischer Date: Wed, 16 Feb 2011 19:31:06 +0100 Subject: buildsys: fix inverted logic with thread impls Signed-off-by: Bernhard Reutner-Fischer --- libc/sysdeps/linux/common/Makefile.in | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'libc') diff --git a/libc/sysdeps/linux/common/Makefile.in b/libc/sysdeps/linux/common/Makefile.in index 229c39164..a6d22e544 100644 --- a/libc/sysdeps/linux/common/Makefile.in +++ b/libc/sysdeps/linux/common/Makefile.in @@ -26,13 +26,12 @@ CSRC-$(UCLIBC_LINUX_SPECIFIC) += capget.c capset.c inotify.c ioperm.c iopl.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 -CSRC-$(UCLIBC_HAS_THREADS_NATIVE) += fork.c getpid.c raise.c open.c close.c \ - read.c write.c ifeq ($(UCLIBC_HAS_THREADS_NATIVE),y) +CSRC- += fork.c getpid.c raise.c open.c close.c read.c write.c CSRC- += waitpid.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 -- cgit v1.2.3 From b3144c7169fe374b74172b55dfa547290b20fa9f Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Mon, 21 Feb 2011 19:38:39 -0500 Subject: bfin: add missing GNU-stack markings to __longjmp Signed-off-by: Mike Frysinger --- libc/sysdeps/linux/bfin/__longjmp.S | 2 ++ 1 file changed, 2 insertions(+) (limited to 'libc') diff --git a/libc/sysdeps/linux/bfin/__longjmp.S b/libc/sysdeps/linux/bfin/__longjmp.S index 673cd30e8..b2fafbb25 100644 --- a/libc/sysdeps/linux/bfin/__longjmp.S +++ b/libc/sysdeps/linux/bfin/__longjmp.S @@ -105,3 +105,5 @@ ___longjmp: .size ___longjmp,.-___longjmp libc_hidden_def(__longjmp) + +.section .note.GNU-stack,"",%progbits -- cgit v1.2.3 From f8355584a335a2a2dc03842f19ba9f1b587b2f5c Mon Sep 17 00:00:00 2001 From: Steve Kilbane Date: Mon, 21 Feb 2011 19:43:32 -0500 Subject: bfin: fix sram/dma syscall definitions 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(-) (limited to 'libc') diff --git a/libc/sysdeps/linux/bfin/dma-memcpy.c b/libc/sysdeps/linux/bfin/dma-memcpy.c index 274b99e8c..b715aeba0 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 6b33b2670..8518119d7 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 0fba936c8..8260eb660 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) -- cgit v1.2.3 From 128e290b1e4204ac33b4cad7fc6189447f029311 Mon Sep 17 00:00:00 2001 From: Steve Kilbane Date: Mon, 21 Feb 2011 19:44:42 -0500 Subject: bfin: add support for new cacheflush syscall 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 deletion(-) create mode 100644 libc/sysdeps/linux/bfin/cacheflush.c create mode 100644 libc/sysdeps/linux/bfin/sys/cachectl.h (limited to 'libc') diff --git a/libc/sysdeps/linux/bfin/Makefile.arch b/libc/sysdeps/linux/bfin/Makefile.arch index 242703757..425a68898 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 000000000..a8d81c419 --- /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 000000000..ee4c03155 --- /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 */ -- cgit v1.2.3 From 9bc14fb42980b738abfcd8be8cffcca0937b5220 Mon Sep 17 00:00:00 2001 From: Bernhard Reutner-Fischer Date: Tue, 22 Feb 2011 18:12:26 +0100 Subject: nptl: imit waitpid just for MIPS O32 Signed-off-by: Bernhard Reutner-Fischer --- libc/sysdeps/linux/common/Makefile.in | 1 - 1 file changed, 1 deletion(-) (limited to 'libc') diff --git a/libc/sysdeps/linux/common/Makefile.in b/libc/sysdeps/linux/common/Makefile.in index a6d22e544..302fa6450 100644 --- a/libc/sysdeps/linux/common/Makefile.in +++ b/libc/sysdeps/linux/common/Makefile.in @@ -28,7 +28,6 @@ CSRC-$(UCLIBC_LINUX_SPECIFIC) += capget.c capset.c inotify.c ioperm.c iopl.c \ CSRC-$(if $(and $(UCLIBC_LINUX_SPECIFIC),$(UCLIBC_HAS_THREADS_NATIVE)),y) += madvise.c ifeq ($(UCLIBC_HAS_THREADS_NATIVE),y) CSRC- += fork.c getpid.c raise.c open.c close.c read.c write.c -CSRC- += waitpid.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) -- cgit v1.2.3 From 435f73337eff129943249b0d59aad50c8df5bd2e Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Mon, 21 Feb 2011 21:29:58 -0500 Subject: tempname: fix int precision warnings The printf precision takes an integer, not a size_t. Otherwise we get: libc/misc/internals/tempname.c: In function '___path_search': libc/misc/internals/tempname.c:116: warning: field precision should have type 'int', but argument 3 has type 'size_t' field precision should have type 'int', but argument 5 has type 'size_t' Signed-off-by: Mike Frysinger --- libc/misc/internals/tempname.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'libc') diff --git a/libc/misc/internals/tempname.c b/libc/misc/internals/tempname.c index 4145c9478..0db28455b 100644 --- a/libc/misc/internals/tempname.c +++ b/libc/misc/internals/tempname.c @@ -62,7 +62,10 @@ int attribute_hidden ___path_search (char *tmpl, size_t tmpl_len, const char *di const char *pfx /*, int try_tmpdir*/) { /*const char *d; */ - size_t dlen, plen; + /* dir and pfx lengths should always fit into an int, + so don't bother using size_t here. Especially since + the printf func requires an int for precision (%*s). */ + int dlen, plen; if (!pfx || !pfx[0]) { -- cgit v1.2.3 From 9112a2398ec58b32cd1a1c6feae195bd8f9a46a2 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Tue, 22 Feb 2011 16:23:23 -0500 Subject: bfin: fix fp reference in _JMPBUF_UNWINDS We want to access the frame pointer, so do so directly rather than "overflowing" the pregs array and ending up at the fp member. This fixes the Blackfin build warnings: libpthread/linuxthreads.old/ptlongjmp.c: In function 'pthread_cleanup_upto': libpthread/linuxthreads.old/ptlongjmp.c:35: warning: array subscript is above array bounds libpthread/linuxthreads.old/ptlongjmp.c:56: warning: array subscript is above array bounds Signed-off-by: Mike Frysinger --- libc/sysdeps/linux/bfin/bits/setjmp.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'libc') diff --git a/libc/sysdeps/linux/bfin/bits/setjmp.h b/libc/sysdeps/linux/bfin/bits/setjmp.h index ee3f5e787..adb9c23af 100644 --- a/libc/sysdeps/linux/bfin/bits/setjmp.h +++ b/libc/sysdeps/linux/bfin/bits/setjmp.h @@ -52,6 +52,6 @@ typedef struct /* Test if longjmp to JMPBUF would unwind the frame containing a local variable at ADDRESS. */ #define _JMPBUF_UNWINDS(jmpbuf, address) \ - ((void *) (address) < (void *) (jmpbuf)->__pregs[6]) + ((void *) (address) < (void *) (jmpbuf)->fp) #endif /* bits/setjmp.h */ -- cgit v1.2.3 From 73d59554144f429b1cf0d4d7fa7de42bdf59ad92 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Thu, 23 Jul 2009 01:11:38 -0400 Subject: unify stub logic Signed-off-by: Mike Frysinger --- libc/sysdeps/linux/arm/posix_fadvise.c | 2 +- libc/sysdeps/linux/arm/posix_fadvise64.c | 2 +- libc/sysdeps/linux/common/__rt_sigtimedwait.c | 12 +- libc/sysdeps/linux/common/__rt_sigwaitinfo.c | 11 +- libc/sysdeps/linux/common/bdflush.c | 6 - libc/sysdeps/linux/common/capget.c | 6 - libc/sysdeps/linux/common/capset.c | 7 +- libc/sysdeps/linux/common/create_module.c | 7 - libc/sysdeps/linux/common/delete_module.c | 6 - libc/sysdeps/linux/common/epoll.c | 18 --- libc/sysdeps/linux/common/fdatasync.c | 7 - libc/sysdeps/linux/common/fork.c | 12 -- libc/sysdeps/linux/common/get_kernel_syms.c | 6 - libc/sysdeps/linux/common/getpgrp.c | 6 - libc/sysdeps/linux/common/init_module.c | 6 - libc/sysdeps/linux/common/pivot_root.c | 6 - libc/sysdeps/linux/common/posix_fadvise.c | 3 +- libc/sysdeps/linux/common/posix_fadvise64.c | 3 +- libc/sysdeps/linux/common/query_module.c | 7 - libc/sysdeps/linux/common/sched_getaffinity.c | 6 - libc/sysdeps/linux/common/sched_setaffinity.c | 11 -- libc/sysdeps/linux/common/signalfd.c | 6 +- libc/sysdeps/linux/common/splice.c | 7 - libc/sysdeps/linux/common/stubs.c | 183 ++++++++++++++++++++++++++ libc/sysdeps/linux/common/sync_file_range.c | 6 - libc/sysdeps/linux/common/umount.c | 9 -- libc/sysdeps/linux/common/umount2.c | 6 - libc/sysdeps/linux/common/vmsplice.c | 7 - libc/sysdeps/linux/common/xattr.c | 78 ----------- libc/sysdeps/linux/i386/posix_fadvise64.S | 9 +- 30 files changed, 195 insertions(+), 266 deletions(-) create mode 100644 libc/sysdeps/linux/common/stubs.c (limited to 'libc') diff --git a/libc/sysdeps/linux/arm/posix_fadvise.c b/libc/sysdeps/linux/arm/posix_fadvise.c index 278bff981..80d3c5044 100644 --- a/libc/sysdeps/linux/arm/posix_fadvise.c +++ b/libc/sysdeps/linux/arm/posix_fadvise.c @@ -39,7 +39,7 @@ int posix_fadvise(int fd, off_t offset, off_t len, int advise) /* weak_alias(__libc_posix_fadvise, posix_fadvise); */ -#else +#elif defined __UCLIBC_HAS_STUBS__ int posix_fadvise(int fd attribute_unused, off_t offset attribute_unused, off_t len attribute_unused, int advice attribute_unused) { diff --git a/libc/sysdeps/linux/arm/posix_fadvise64.c b/libc/sysdeps/linux/arm/posix_fadvise64.c index 4b27381d1..678c42f90 100644 --- a/libc/sysdeps/linux/arm/posix_fadvise64.c +++ b/libc/sysdeps/linux/arm/posix_fadvise64.c @@ -47,7 +47,7 @@ int posix_fadvise64(int fd, __off64_t offset, __off64_t len, int advise) /* weak_alias(__libc_posix_fadvise64, posix_fadvise64); */ -#else +#elif defined __UCLIBC_HAS_STUBS__ int posix_fadvise64(int fd, __off64_t offset, __off64_t len, int advise) { diff --git a/libc/sysdeps/linux/common/__rt_sigtimedwait.c b/libc/sysdeps/linux/common/__rt_sigtimedwait.c index a7ab8fb61..26860d2d2 100644 --- a/libc/sysdeps/linux/common/__rt_sigtimedwait.c +++ b/libc/sysdeps/linux/common/__rt_sigtimedwait.c @@ -86,16 +86,6 @@ int attribute_hidden __sigtimedwait(const sigset_t * set, siginfo_t * info, return __rt_sigtimedwait(set, info, timeout, _NSIG / 8); } # endif /* !__UCLIBC_HAS_THREADS_NATIVE__ */ -#else -int attribute_hidden __sigtimedwait(const sigset_t * set, siginfo_t * info, - const struct timespec *timeout) -{ - if (set == NULL) - __set_errno(EINVAL); - else - __set_errno(ENOSYS); - return -1; -} -#endif weak_alias(__sigtimedwait,sigtimedwait) libc_hidden_weak(sigtimedwait) +#endif diff --git a/libc/sysdeps/linux/common/__rt_sigwaitinfo.c b/libc/sysdeps/linux/common/__rt_sigwaitinfo.c index 92a11c9b6..6b4332715 100644 --- a/libc/sysdeps/linux/common/__rt_sigwaitinfo.c +++ b/libc/sysdeps/linux/common/__rt_sigwaitinfo.c @@ -83,16 +83,7 @@ int attribute_hidden __sigwaitinfo(const sigset_t * set, siginfo_t * info) return __rt_sigwaitinfo(set, info, NULL, _NSIG / 8); } # endif -#else -int attribute_hidden __sigwaitinfo(const sigset_t * set, siginfo_t * info) -{ - if (set == NULL) - __set_errno(EINVAL); - else - __set_errno(ENOSYS); - return -1; -} -#endif libc_hidden_proto(sigwaitinfo) weak_alias (__sigwaitinfo, sigwaitinfo) libc_hidden_weak(sigwaitinfo) +#endif diff --git a/libc/sysdeps/linux/common/bdflush.c b/libc/sysdeps/linux/common/bdflush.c index 687a8f9a7..c2a05ed88 100644 --- a/libc/sysdeps/linux/common/bdflush.c +++ b/libc/sysdeps/linux/common/bdflush.c @@ -12,10 +12,4 @@ #ifdef __NR_bdflush _syscall2(int, bdflush, int, __func, long int, __data) -#else -int bdflush(int __func, long int __data) -{ - __set_errno(ENOSYS); - return -1; -} #endif diff --git a/libc/sysdeps/linux/common/capget.c b/libc/sysdeps/linux/common/capget.c index 361de845d..c3e8c5771 100644 --- a/libc/sysdeps/linux/common/capget.c +++ b/libc/sysdeps/linux/common/capget.c @@ -11,10 +11,4 @@ int capget(void *header, void *data); #ifdef __NR_capget _syscall2(int, capget, void *, header, void *, data) -#else -int capget(void *header, void *data) -{ - __set_errno(ENOSYS); - return -1; -} #endif diff --git a/libc/sysdeps/linux/common/capset.c b/libc/sysdeps/linux/common/capset.c index 0a77e05f4..c0cf5deb0 100644 --- a/libc/sysdeps/linux/common/capset.c +++ b/libc/sysdeps/linux/common/capset.c @@ -8,13 +8,8 @@ */ #include + int capset(void *header, const void *data); #ifdef __NR_capset _syscall2(int, capset, void *, header, const void *, data) -#elif defined __UCLIBC_HAS_STUBS__ -int capset(void *header, const void *data) -{ - __set_errno(ENOSYS); - return -1; -} #endif diff --git a/libc/sysdeps/linux/common/create_module.c b/libc/sysdeps/linux/common/create_module.c index d8f24466d..ddd7c4cff 100644 --- a/libc/sysdeps/linux/common/create_module.c +++ b/libc/sysdeps/linux/common/create_module.c @@ -49,11 +49,4 @@ unsigned long create_module(const char *name, size_t size) _syscall2(unsigned long, create_module, const char *, name, size_t, size) #endif -#else /* !__NR_create_module */ -caddr_t create_module(const char *name attribute_unused, size_t size attribute_unused); -caddr_t create_module(const char *name attribute_unused, size_t size attribute_unused) -{ - __set_errno(ENOSYS); - return (caddr_t)-1; -} #endif diff --git a/libc/sysdeps/linux/common/delete_module.c b/libc/sysdeps/linux/common/delete_module.c index 44f9b30ae..8ac6e559e 100644 --- a/libc/sysdeps/linux/common/delete_module.c +++ b/libc/sysdeps/linux/common/delete_module.c @@ -10,10 +10,4 @@ int delete_module(const char *name, unsigned int flags); #ifdef __NR_delete_module _syscall2(int, delete_module, const char *, name, unsigned int, flags) -#elif defined __UCLIBC_HAS_STUBS__ -int delete_module(const char *name, unsigned int flags) -{ - __set_errno(ENOSYS); - return -1; -} #endif diff --git a/libc/sysdeps/linux/common/epoll.c b/libc/sysdeps/linux/common/epoll.c index 86272d9aa..dda92282e 100644 --- a/libc/sysdeps/linux/common/epoll.c +++ b/libc/sysdeps/linux/common/epoll.c @@ -15,12 +15,6 @@ */ #ifdef __NR_epoll_create _syscall1(int, epoll_create, int, size) -#else -int epoll_create(int size) -{ - __set_errno(ENOSYS); - return -1; -} #endif /* @@ -28,12 +22,6 @@ int epoll_create(int size) */ #ifdef __NR_epoll_ctl _syscall4(int,epoll_ctl, int, epfd, int, op, int, fd, struct epoll_event *, event) -#else -int epoll_ctl(int epfd, int op, int fd, struct epoll_event *event) -{ - __set_errno(ENOSYS); - return -1; -} #endif /* @@ -41,10 +29,4 @@ int epoll_ctl(int epfd, int op, int fd, struct epoll_event *event) */ #ifdef __NR_epoll_wait _syscall4(int, epoll_wait, int, epfd, struct epoll_event *, events, int, maxevents, int, timeout) -#else -int epoll_wait(int epfd, struct epoll_event *events, int maxevents, int timeout) -{ - __set_errno(ENOSYS); - return -1; -} #endif diff --git a/libc/sysdeps/linux/common/fdatasync.c b/libc/sysdeps/linux/common/fdatasync.c index 19d37b6e0..e51c72365 100644 --- a/libc/sysdeps/linux/common/fdatasync.c +++ b/libc/sysdeps/linux/common/fdatasync.c @@ -40,11 +40,4 @@ int fdatasync(int fd) # endif } -#elif defined __UCLIBC_HAS_STUBS__ -/* no syscall available, so provide a stub */ -int fdatasync(int fd) -{ - __set_errno(ENOSYS); - return -1; -} #endif diff --git a/libc/sysdeps/linux/common/fork.c b/libc/sysdeps/linux/common/fork.c index f21ec35b8..14e00a2cd 100644 --- a/libc/sysdeps/linux/common/fork.c +++ b/libc/sysdeps/linux/common/fork.c @@ -20,16 +20,4 @@ weak_alias(__libc_fork,fork) libc_hidden_weak(fork) #endif -#elif defined __UCLIBC_HAS_STUBS__ - -extern __typeof(fork) __libc_fork; -pid_t __libc_fork(void) -{ - __set_errno(ENOSYS); - return -1; -} -weak_alias(__libc_fork,fork) -libc_hidden_weak(fork) -link_warning(fork, "fork: this function is not implemented on no-mmu systems") - #endif diff --git a/libc/sysdeps/linux/common/get_kernel_syms.c b/libc/sysdeps/linux/common/get_kernel_syms.c index d6595eaf5..6124a81d4 100644 --- a/libc/sysdeps/linux/common/get_kernel_syms.c +++ b/libc/sysdeps/linux/common/get_kernel_syms.c @@ -13,10 +13,4 @@ struct kernel_sym; int get_kernel_syms(struct kernel_sym *table attribute_unused); #ifdef __NR_get_kernel_syms _syscall1(int, get_kernel_syms, struct kernel_sym *, table) -#else -int get_kernel_syms(struct kernel_sym *table attribute_unused) -{ - __set_errno(ENOSYS); - return -1; -} #endif diff --git a/libc/sysdeps/linux/common/getpgrp.c b/libc/sysdeps/linux/common/getpgrp.c index 5d36ba155..80a53daee 100644 --- a/libc/sysdeps/linux/common/getpgrp.c +++ b/libc/sysdeps/linux/common/getpgrp.c @@ -19,10 +19,4 @@ pid_t getpgrp(void) { return getpgid(getpid()); } -#elif defined __UCLIBC_HAS_STUBS__ -pid_t getpgrp(void) -{ - __set_errno(ENOSYS); - return -1; -} #endif diff --git a/libc/sysdeps/linux/common/init_module.c b/libc/sysdeps/linux/common/init_module.c index 8a6e94199..cf6d74721 100644 --- a/libc/sysdeps/linux/common/init_module.c +++ b/libc/sysdeps/linux/common/init_module.c @@ -15,11 +15,5 @@ int init_module(void *first, void *second, void *third, void *fourth, void *fift * 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) -#else -int init_module(void *first, void *second, void *third, void *fourth, void *fifth) -{ - __set_errno(ENOSYS); - return -1; -} #endif diff --git a/libc/sysdeps/linux/common/pivot_root.c b/libc/sysdeps/linux/common/pivot_root.c index 3e9705903..0e738d53f 100644 --- a/libc/sysdeps/linux/common/pivot_root.c +++ b/libc/sysdeps/linux/common/pivot_root.c @@ -12,10 +12,4 @@ int pivot_root(const char *new_root, const char *put_old); #ifdef __NR_pivot_root _syscall2(int, pivot_root, const char *, new_root, const char *, put_old) -#else -int pivot_root(const char *new_root, const char *put_old) -{ - __set_errno(ENOSYS); - return -1; -} #endif diff --git a/libc/sysdeps/linux/common/posix_fadvise.c b/libc/sysdeps/linux/common/posix_fadvise.c index 7c43be959..17831c201 100644 --- a/libc/sysdeps/linux/common/posix_fadvise.c +++ b/libc/sysdeps/linux/common/posix_fadvise.c @@ -27,10 +27,9 @@ int posix_fadvise(int fd, off_t offset, off_t len, int advice) strong_alias(posix_fadvise,posix_fadvise64) #endif -#else +#elif defined __UCLIBC_HAS_STUBS__ int posix_fadvise(int fd attribute_unused, off_t offset attribute_unused, off_t len attribute_unused, int advice attribute_unused) { -#warning This is not correct as far as SUSv3 is concerned. return ENOSYS; } #endif diff --git a/libc/sysdeps/linux/common/posix_fadvise64.c b/libc/sysdeps/linux/common/posix_fadvise64.c index b53e64321..e8a530fdf 100644 --- a/libc/sysdeps/linux/common/posix_fadvise64.c +++ b/libc/sysdeps/linux/common/posix_fadvise64.c @@ -58,13 +58,12 @@ int posix_fadvise64(int fd, __off64_t offset, __off64_t len, int advice) #error your machine is neither 32 bit or 64 bit ... it must be magical #endif -#elif !defined __NR_fadvise64 +#elif !defined __NR_fadvise64 && defined __UCLIBC_HAS_STUBS__ /* This is declared as a strong alias in posix_fadvise.c if __NR_fadvise64 * is defined. */ int posix_fadvise64(int fd, __off64_t offset, __off64_t len, int advice) { -#warning This is not correct as far as SUSv3 is concerned. return ENOSYS; } #endif /* __NR_fadvise64_64 */ diff --git a/libc/sysdeps/linux/common/query_module.c b/libc/sysdeps/linux/common/query_module.c index 0f3d4700c..7c168df45 100644 --- a/libc/sysdeps/linux/common/query_module.c +++ b/libc/sysdeps/linux/common/query_module.c @@ -13,11 +13,4 @@ int query_module(const char *name attribute_unused, int which attribute_unused, #ifdef __NR_query_module _syscall5(int, query_module, const char *, name, int, which, void *, buf, size_t, bufsize, size_t *, ret) -#elif defined __UCLIBC_HAS_STUBS__ -int query_module(const char *name attribute_unused, int which attribute_unused, - void *buf attribute_unused, size_t bufsize attribute_unused, size_t * ret attribute_unused) -{ - __set_errno(ENOSYS); - return -1; -} #endif diff --git a/libc/sysdeps/linux/common/sched_getaffinity.c b/libc/sysdeps/linux/common/sched_getaffinity.c index 5d5e5b2c4..8982582cc 100644 --- a/libc/sysdeps/linux/common/sched_getaffinity.c +++ b/libc/sysdeps/linux/common/sched_getaffinity.c @@ -44,11 +44,5 @@ int sched_getaffinity(pid_t pid, size_t cpusetsize, cpu_set_t *cpuset) } return res; } -#elif defined __UCLIBC_HAS_STUBS__ -int sched_getaffinity(pid_t pid, size_t cpusetsize, cpu_set_t *cpuset) -{ - __set_errno(ENOSYS); - return -1; -} #endif #endif diff --git a/libc/sysdeps/linux/common/sched_setaffinity.c b/libc/sysdeps/linux/common/sched_setaffinity.c index 1a0f55f75..980c44199 100644 --- a/libc/sysdeps/linux/common/sched_setaffinity.c +++ b/libc/sysdeps/linux/common/sched_setaffinity.c @@ -70,16 +70,5 @@ int sched_setaffinity(pid_t pid, size_t cpusetsize, const cpu_set_t *cpuset) return INLINE_SYSCALL (sched_setaffinity, 3, pid, cpusetsize, cpuset); } -#else -#define ___HAVE_NO_sched_setaffinity #endif - -#if defined ___HAVE_NO_sched_setaffinity && defined __UCLIBC_HAS_STUBS__ -int sched_setaffinity(pid_t pid, size_t cpusetsize, const cpu_set_t *cpuset) -{ - __set_errno(ENOSYS); - return -1; -} -#endif - #endif /* __USE_GNU */ diff --git a/libc/sysdeps/linux/common/signalfd.c b/libc/sysdeps/linux/common/signalfd.c index 3d76e04c4..a0c995a89 100644 --- a/libc/sysdeps/linux/common/signalfd.c +++ b/libc/sysdeps/linux/common/signalfd.c @@ -21,8 +21,7 @@ static __inline__ _syscall3(int, __syscall_signalfd, int, fd, const sigset_t *, mask, size_t, sizemask) #endif -#if defined __NR_signalfd4 || defined __NR_signalfd \ - || defined __UCLIBC_HAS_STUBS__ +#if defined __NR_signalfd4 || defined __NR_signalfd int signalfd (int fd, const sigset_t *mask, int flags) { #if defined __NR___syscall_signalfd4 @@ -33,9 +32,6 @@ int signalfd (int fd, const sigset_t *mask, int flags) return -1; } return __syscall_signalfd(fd, mask, _NSIG / 8); -#elif defined __UCLIBC_HAS_STUBS__ - __set_errno(ENOSYS); - return -1; #endif } #endif diff --git a/libc/sysdeps/linux/common/splice.c b/libc/sysdeps/linux/common/splice.c index b21d10336..83f348a48 100644 --- a/libc/sysdeps/linux/common/splice.c +++ b/libc/sysdeps/linux/common/splice.c @@ -13,11 +13,4 @@ #ifdef __NR_splice _syscall6(ssize_t, splice, int, __fdin, __off64_t *, __offin, int, __fdout, __off64_t *, __offout, size_t, __len, unsigned int, __flags) -#else -ssize_t splice(int __fdin, __off64_t *__offin, int __fdout, - __off64_t *__offout, size_t __len, unsigned int __flags) -{ - __set_errno(ENOSYS); - return -1; -} #endif diff --git a/libc/sysdeps/linux/common/stubs.c b/libc/sysdeps/linux/common/stubs.c new file mode 100644 index 000000000..dd4a384f8 --- /dev/null +++ b/libc/sysdeps/linux/common/stubs.c @@ -0,0 +1,183 @@ +/* + * system call not available stub + * + * Copyright (C) 2009 Analog Devices Inc. + * + * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. + */ + +#include +#include + +#ifdef __UCLIBC_HAS_STUBS__ + +attribute_hidden int enosys_stub(void); +libc_hidden_proto(enosys_stub) + +attribute_hidden int enosys_stub(void) +{ + __set_errno(ENOSYS); + return -1; +} +libc_hidden_def(enosys_stub) + +#define make_stub(stub) \ + link_warning(stub, #stub ": this function is not implemented") \ + strong_alias(enosys_stub, stub) + +#ifndef __ARCH_USE_MMU__ +# undef __NR_fork +#endif + +#ifndef __UCLIBC_HAS_LFS__ +# undef __NR_fadvise64 +# undef __NR_fadvise64_64 +# undef __NR_sync_file_range +#endif + +#ifndef __NR_bdflush +make_stub(bdflush) +#endif + +#ifndef __NR_capget +make_stub(capget) +#endif + +#ifndef __NR_capset +make_stub(capset) +#endif + +#ifndef __NR_create_module +make_stub(create_module) +#endif + +#ifndef __NR_delete_module +make_stub(delete_module) +#endif + +#ifndef __NR_epoll_create +make_stub(epoll_create) +#endif + +#ifndef __NR_epoll_ctl +make_stub(epoll_ctl) +#endif + +#ifndef __NR_epoll_wait +make_stub(epoll_wait) +#endif + +#ifndef __NR_fdatasync +make_stub(fdatasync) +#endif + +#ifndef __NR_flistxattr +make_stub(flistxattr) +#endif + +#ifndef __NR_fork +make_stub(fork) +#endif + +#ifndef __NR_fgetxattr +make_stub(fgetxattr) +#endif + +#ifndef __NR_fremovexattr +make_stub(fremovexattr) +#endif + +#ifndef __NR_fsetxattr +make_stub(fsetxattr) +#endif + +#ifndef __NR_get_kernel_syms +make_stub(get_kernel_syms) +#endif + +#if !defined(__NR_getpgrp) && (defined(__NR_getpgid) && (defined(__NR_getpid) || defined(__NR_getxpid))) +make_stub(getpgrp) +#endif + +#ifndef __NR_getxattr +make_stub(getxattr) +#endif + +#ifndef __NR_init_module +make_stub(init_module) +#endif + +#ifndef __NR_lgetxattr +make_stub(lgetxattr) +#endif + +#ifndef __NR_listxattr +make_stub(listxattr) +#endif + +#ifndef __NR_llistxattr +make_stub(llistxattr) +#endif + +#ifndef __NR_lremovexattr +make_stub(lremovexattr) +#endif + +#ifndef __NR_lsetxattr +make_stub(lsetxattr) +#endif + +#ifndef __NR_pivot_root +make_stub(pivot_root) +#endif + +#ifndef __NR_query_module +make_stub(query_module) +#endif + +#ifndef __NR_removexattr +make_stub(removexattr) +#endif + +#ifndef __NR_sched_getaffinity +make_stub(sched_getaffinity) +#endif + +#ifndef __NR_sched_setaffinity +make_stub(sched_setaffinity) +#endif + +#ifndef __NR_setxattr +make_stub(setxattr) +#endif + +#if !defined(__NR_signalfd4) && !defined(__NR_signalfd) +make_stub(signalfd) +#endif + +#ifndef __NR_rt_sigtimedwait +make_stub(sigtimedwait) +make_stub(sigwaitinfo) +#endif + +#ifndef __NR_splice +make_stub(splice) +#endif + +#ifndef __NR_sync_file_range +make_stub(sync_file_range) +#endif + +#if !defined(__NR_umount) && !defined(__NR_umount2) +make_stub(umount) +#endif + +#ifndef __NR_umount2 +make_stub(umount2) +#endif + +#ifndef __NR_vmsplice +make_stub(vmsplice) +#endif + +#endif diff --git a/libc/sysdeps/linux/common/sync_file_range.c b/libc/sysdeps/linux/common/sync_file_range.c index 7e2deff41..d24403e1b 100644 --- a/libc/sysdeps/linux/common/sync_file_range.c +++ b/libc/sysdeps/linux/common/sync_file_range.c @@ -23,11 +23,5 @@ int sync_file_range(int fd, off64_t offset, off64_t nbytes, unsigned int flags) __LONG_LONG_PAIR((long)(nbytes >> 32), (long)(nbytes & 0xffffffff)), flags); } -#elif defined __UCLIBC_HAS_STUBS__ -int sync_file_range(int fd, __off64_t offset, __off64_t nbytes, unsigned int flags) -{ - __set_errno(ENOSYS); - return -1; -} #endif #endif diff --git a/libc/sysdeps/linux/common/umount.c b/libc/sysdeps/linux/common/umount.c index 453ecd27b..a084d29bd 100644 --- a/libc/sysdeps/linux/common/umount.c +++ b/libc/sysdeps/linux/common/umount.c @@ -28,14 +28,5 @@ int umount(const char *special_file) return (__syscall_umount2(special_file, 0)); } -/* arch doesn't provide any umount syscall !? */ -#else - -int umount(const char *special_file) -{ - __set_errno(ENOSYS); - return -1; -} - #endif #endif diff --git a/libc/sysdeps/linux/common/umount2.c b/libc/sysdeps/linux/common/umount2.c index bd44717d4..2cc4a2338 100644 --- a/libc/sysdeps/linux/common/umount2.c +++ b/libc/sysdeps/linux/common/umount2.c @@ -13,11 +13,5 @@ #include #ifdef __NR_umount2 /* Old kernels don't have umount2 */ _syscall2(int, umount2, const char *, special_file, int, flags) -#else -int umount2(const char *special_file, int flags) -{ - __set_errno(ENOSYS); - return -1; -} #endif #endif diff --git a/libc/sysdeps/linux/common/vmsplice.c b/libc/sysdeps/linux/common/vmsplice.c index c5fd6c7ed..dd0640e1e 100644 --- a/libc/sysdeps/linux/common/vmsplice.c +++ b/libc/sysdeps/linux/common/vmsplice.c @@ -13,11 +13,4 @@ #ifdef __NR_vmsplice _syscall4(ssize_t, vmsplice, int, __fdout, const struct iovec *, __iov, size_t, __count, unsigned int, __flags) -#else -ssize_t vmsplice(int __fdout, const struct iovec *__iov, size_t __count, - unsigned int __flags) -{ - __set_errno(ENOSYS); - return -1; -} #endif diff --git a/libc/sysdeps/linux/common/xattr.c b/libc/sysdeps/linux/common/xattr.c index 8a4e3be29..dea471ad6 100644 --- a/libc/sysdeps/linux/common/xattr.c +++ b/libc/sysdeps/linux/common/xattr.c @@ -29,136 +29,58 @@ #ifdef __NR_setxattr _syscall5(int, setxattr, const char *, path, const char *, name, const void *, value, size_t, size, int, flags) -#else -int setxattr(__const char *__path, __const char *__name, - __const void *__value, size_t __size, int __flags) -{ - __set_errno(ENOSYS); - return -1; -} #endif #ifdef __NR_lsetxattr _syscall5(int, lsetxattr, const char *, path, const char *, name, const void *, value, size_t, size, int, flags) -#else -int lsetxattr(__const char *__path, __const char *__name, - __const void *__value, size_t __size, int __flags) -{ - __set_errno(ENOSYS); - return -1; -} #endif #ifdef __NR_fsetxattr _syscall5(int, fsetxattr, int, filedes, const char *, name, const void *, value, size_t, size, int, flags) -#else -int fsetxattr(int __fd, __const char *__name, __const void *__value, - size_t __size, int __flags) -{ - __set_errno(ENOSYS); - return -1; -} #endif /* gets */ #ifdef __NR_getxattr _syscall4(ssize_t, getxattr, const char *, path, const char *, name, void *, value, size_t, size) -#else -ssize_t getxattr(__const char *__path, __const char *__name, void *__value, - size_t __size) -{ - __set_errno(ENOSYS); - return -1; -} #endif #ifdef __NR_lgetxattr _syscall4(ssize_t, lgetxattr, const char *, path, const char *, name, void *, value, size_t, size) -#else -ssize_t lgetxattr(__const char *__path, __const char *__name, - void *__value, size_t __size) -{ - __set_errno(ENOSYS); - return -1; -} #endif #ifdef __NR_fgetxattr _syscall4(ssize_t, fgetxattr, int, filedes, const char *, name, void *, value, size_t, size) -#else -ssize_t fgetxattr(int __fd, __const char *__name, void *__value, - size_t __size) -{ - __set_errno(ENOSYS); - return -1; -} #endif /* list */ #ifdef __NR_listxattr _syscall3(ssize_t, listxattr, const char *, path, char *, list, size_t, size) -#else -ssize_t listxattr(__const char *__path, char *__list, size_t __size) -{ - __set_errno(ENOSYS); - return -1; -} #endif #ifdef __NR_llistxattr _syscall3(ssize_t, llistxattr, const char *, path, char *, list, size_t, size) -#else -ssize_t llistxattr(__const char *__path, char *__list, size_t __size) -{ - __set_errno(ENOSYS); - return -1; -} #endif #ifdef __NR_flistxattr _syscall3(ssize_t, flistxattr, int, filedes, char *, list, size_t, size) -#else -ssize_t flistxattr(int __fd, char *__list, size_t __size) -{ - __set_errno(ENOSYS); - return -1; -} #endif /* remove */ #ifdef __NR_removexattr _syscall2(int, removexattr, const char *, path, const char *, name) -#else -int removexattr(__const char *__path, __const char *__name) -{ - __set_errno(ENOSYS); - return -1; -} #endif #ifdef __NR_lremovexattr _syscall2(int, lremovexattr, const char *, path, const char *, name) -#else -int lremovexattr(__const char *__path, __const char *__name) -{ - __set_errno(ENOSYS); - return -1; -} #endif #ifdef __NR_fremovexattr _syscall2(int, fremovexattr, int, filedes, const char *, name) -#else -int fremovexattr(int __fd, __const char *__name) -{ - __set_errno(ENOSYS); - return -1; -} #endif diff --git a/libc/sysdeps/linux/i386/posix_fadvise64.S b/libc/sysdeps/linux/i386/posix_fadvise64.S index 17f006aa8..b4aeff1f4 100644 --- a/libc/sysdeps/linux/i386/posix_fadvise64.S +++ b/libc/sysdeps/linux/i386/posix_fadvise64.S @@ -22,6 +22,8 @@ #include #include +#if defined __NR_fadvise64_64 + /* Was named __libc_posix_fadvise64 for some inexplicable reason. ** google says only uclibc has *__libc*_posix_fadviseXXX, ** so it cannot be compat with anything. @@ -33,7 +35,6 @@ .global posix_fadvise64 .type posix_fadvise64,%function posix_fadvise64: -#if defined __NR_fadvise64_64 /* Save regs */ pushl %ebp pushl %ebx @@ -91,10 +92,6 @@ overflow: /* Returns 0 on success, else an error code. */ negl %eax -#elif defined __UCLIBC_HAS_STUBS__ - movl $-ENOSYS, %eax - jmp __syscall_error -#endif /* Successful; return the syscall's value. */ ret @@ -106,3 +103,5 @@ overflow: ** weak_alias(__libc_posix_fadvise64,posix_fadvise64) ** #endif */ + +#endif -- cgit v1.2.3 From be88a80858ea4febcc621f87166fbf4c1753e513 Mon Sep 17 00:00:00 2001 From: Carmelo Amoroso Date: Mon, 7 Feb 2011 18:03:36 +0100 Subject: nptl:arm: add a wrapper for .cfi_sections pseudo-ops ARM disables by default the support for ASM CFI directives. Anyway using an old version of binutils that does not support some new pseudo-op, the build fails as below: AS libpthread/nptl/sysdeps/unix/sysv/linux/close.oS libpthread/nptl/sysdeps/unix/sysv/linux/close.S: Assembler messages: libpthread/nptl/sysdeps/unix/sysv/linux/close.S:9: Error: unknown pseudo-op: `.cfi_sections' The problem is that the .cfi_sections pseudo should be wrapped by a macro that expands to nothing when the CFI is off. Signed-off-by: Carmelo Amoroso CC: Khem Ray --- libc/sysdeps/linux/common/sysdep.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'libc') diff --git a/libc/sysdeps/linux/common/sysdep.h b/libc/sysdeps/linux/common/sysdep.h index a7ec95480..156e5711a 100644 --- a/libc/sysdeps/linux/common/sysdep.h +++ b/libc/sysdeps/linux/common/sysdep.h @@ -51,6 +51,7 @@ /* Macros to generate eh_frame unwind information. */ # ifdef HAVE_ASM_CFI_DIRECTIVES +# define cfi_sections(sect...) .cfi_sections sect # define cfi_startproc .cfi_startproc # define cfi_endproc .cfi_endproc # define cfi_def_cfa(reg, off) .cfi_def_cfa reg, off @@ -71,6 +72,7 @@ # define cfi_lsda(enc, exp) .cfi_lsda enc, exp # else +# define cfi_sections(sect...) # define cfi_startproc # define cfi_endproc # define cfi_def_cfa(reg, off) @@ -95,6 +97,8 @@ # ifdef HAVE_ASM_CFI_DIRECTIVES # define CFI_STRINGIFY(Name) CFI_STRINGIFY2 (Name) # define CFI_STRINGIFY2(Name) #Name +# define CFI_SECTIONS(sect...) \ + ".cfi_sections " CFI_STRINGIFY(sect) # define CFI_STARTPROC ".cfi_startproc" # define CFI_ENDPROC ".cfi_endproc" # define CFI_DEF_CFA(reg, off) \ @@ -128,6 +132,7 @@ # define CFI_LSDA(enc, exp) \ ".cfi_lsda " CFI_STRINGIFY(enc) "," CFI_STRINGIFY(exp) # else +# define CFI_SECTIONS(sect...) # define CFI_STARTPROC # define CFI_ENDPROC # define CFI_DEF_CFA(reg, off) -- cgit v1.2.3 From 9fa4711e364e9aa779d6b8d12220bbb63dbb1f3d Mon Sep 17 00:00:00 2001 From: "Peter S. Mazinger" Date: Sat, 26 Feb 2011 18:45:19 +0100 Subject: guard IPv6 stuff disable IPv6 related stuff if feature is disabled. Signed-off-by: Peter S. Mazinger --- libc/inet/getaddrinfo.c | 4 ++++ libc/inet/ifaddrs.c | 10 ++++++++++ libc/inet/rpc/sa_len.c | 4 ++++ 3 files changed, 18 insertions(+) (limited to 'libc') diff --git a/libc/inet/getaddrinfo.c b/libc/inet/getaddrinfo.c index cdfdb72cf..b3435a8b2 100644 --- a/libc/inet/getaddrinfo.c +++ b/libc/inet/getaddrinfo.c @@ -639,9 +639,13 @@ gaih_inet(const char *name, const struct gaih_service *service, tmpbuflen *= 2; tmpbuf = alloca(tmpbuflen); rc = gethostbyaddr_r(at2->addr, +#ifdef __UCLIBC_HAS_IPV6__ ((at2->family == AF_INET6) ? sizeof(struct in6_addr) : sizeof(struct in_addr)), +#else + sizeof(struct in_addr), +#endif at2->family, &th, tmpbuf, tmpbuflen, &h, &herrno); diff --git a/libc/inet/ifaddrs.c b/libc/inet/ifaddrs.c index 3b8b674c2..39729ef47 100644 --- a/libc/inet/ifaddrs.c +++ b/libc/inet/ifaddrs.c @@ -59,7 +59,9 @@ struct ifaddrs_storage struct sockaddr sa; struct sockaddr_ll sl; struct sockaddr_in s4; +#ifdef __UCLIBC_HAS_IPV6__ struct sockaddr_in6 s6; +#endif } addr, netmask, broadaddr; char name[IF_NAMESIZE + 1]; }; @@ -621,6 +623,7 @@ getifaddrs (struct ifaddrs **ifap) rta_data, rta_payload); break; +#ifdef __UCLIBC_HAS_IPV6__ case AF_INET6: /* Size must match that of an address for IPv6. */ if (rta_payload == 16) @@ -633,6 +636,7 @@ getifaddrs (struct ifaddrs **ifap) = ifam->ifa_index; } break; +#endif default: if (rta_payload <= sizeof (ifas[ifa_index].addr)) @@ -668,6 +672,7 @@ getifaddrs (struct ifaddrs **ifap) rta_data, rta_payload); break; +#ifdef __UCLIBC_HAS_IPV6__ case AF_INET6: /* Size must match that of an address for IPv6. */ if (rta_payload == 16) @@ -680,6 +685,7 @@ getifaddrs (struct ifaddrs **ifap) ifam->ifa_index; } break; +#endif default: if (rta_payload <= sizeof (ifas[ifa_index].addr)) @@ -709,6 +715,7 @@ getifaddrs (struct ifaddrs **ifap) rta_data, rta_payload); break; +#ifdef __UCLIBC_HAS_IPV6__ case AF_INET6: /* Size must match that of an address for IPv6. */ if (rta_payload == 16) @@ -721,6 +728,7 @@ getifaddrs (struct ifaddrs **ifap) = ifam->ifa_index; } break; +#endif default: if (rta_payload <= sizeof (ifas[ifa_index].addr)) @@ -777,10 +785,12 @@ getifaddrs (struct ifaddrs **ifap) max_prefixlen = 32; break; +#ifdef __UCLIBC_HAS_IPV6__ case AF_INET6: cp = (char *) &ifas[ifa_index].netmask.s6.sin6_addr; max_prefixlen = 128; break; +#endif } ifas[ifa_index].ifa.ifa_netmask->sa_family diff --git a/libc/inet/rpc/sa_len.c b/libc/inet/rpc/sa_len.c index 3b37eba44..5f258db1f 100644 --- a/libc/inet/rpc/sa_len.c +++ b/libc/inet/rpc/sa_len.c @@ -52,10 +52,14 @@ int __libc_sa_len (sa_family_t af) #endif case AF_INET: return sizeof (struct sockaddr_in); +#ifdef __UCLIBC_HAS_IPV6__ case AF_INET6: return sizeof (struct sockaddr_in6); +#endif +#if 0 case AF_IPX: return sizeof (struct sockaddr_ipx); +#endif case AF_LOCAL: return sizeof (struct sockaddr_un); } -- cgit v1.2.3 From de71e42c04a7d35cf663b1c84ac1de5b6b93b052 Mon Sep 17 00:00:00 2001 From: "Peter S. Mazinger" Date: Sat, 26 Feb 2011 19:26:30 +0100 Subject: syntax fixes Avoid compile warnings about the use of undefined constants Signed-off-by: Peter S. Mazinger --- libc/misc/ftw/ftw.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'libc') diff --git a/libc/misc/ftw/ftw.c b/libc/misc/ftw/ftw.c index 4a62e388a..9031e3589 100644 --- a/libc/misc/ftw/ftw.c +++ b/libc/misc/ftw/ftw.c @@ -752,7 +752,7 @@ ftw_startup (const char *dir, int is_nftw, void *func, int descriptors, /* Entry points. */ -#if __UCLIBC_HAS_FTW__ +#ifdef __UCLIBC_HAS_FTW__ int FTW_NAME (const char *path, FTW_FUNC_T func, int descriptors) { @@ -760,7 +760,7 @@ FTW_NAME (const char *path, FTW_FUNC_T func, int descriptors) } #endif -#if __UCLIBC_HAS_NFTW__ +#ifdef __UCLIBC_HAS_NFTW__ #ifndef _LIBC int NFTW_NAME (const char *path, NFTW_FUNC_T func, int descriptors, int flags) -- cgit v1.2.3 From d15e625b3c53c0059644d7b8323b49005f84fb36 Mon Sep 17 00:00:00 2001 From: "Peter S. Mazinger" Date: Sat, 26 Feb 2011 19:28:53 +0100 Subject: style update Style update avoiding compile warnings Signed-off-by: Peter S. Mazinger --- libc/stdlib/arc4random.c | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) (limited to 'libc') diff --git a/libc/stdlib/arc4random.c b/libc/stdlib/arc4random.c index 97f318a57..592c51ed5 100644 --- a/libc/stdlib/arc4random.c +++ b/libc/stdlib/arc4random.c @@ -54,8 +54,7 @@ static __inline__ uint8_t arc4_getbyte(struct arc4_stream *); static __inline__ uint32_t arc4_getword(struct arc4_stream *); static __inline__ void -arc4_init(as) - struct arc4_stream *as; +arc4_init(struct arc4_stream *as) { int n; @@ -66,10 +65,7 @@ arc4_init(as) } static __inline__ void -arc4_addrandom(as, dat, datlen) - struct arc4_stream *as; - u_char *dat; - int datlen; +arc4_addrandom(struct arc4_stream *as, u_char *dat, int datlen) { int n; uint8_t si; @@ -86,8 +82,7 @@ arc4_addrandom(as, dat, datlen) } static void -arc4_stir(as) - struct arc4_stream *as; +arc4_stir(struct arc4_stream *as) { int fd; struct { @@ -137,8 +132,7 @@ arc4_stir(as) } static __inline__ uint8_t -arc4_getbyte(as) - struct arc4_stream *as; +arc4_getbyte(struct arc4_stream *as) { uint8_t si, sj; @@ -152,8 +146,7 @@ arc4_getbyte(as) } static __inline__ uint32_t -arc4_getword(as) - struct arc4_stream *as; +arc4_getword(struct arc4_stream *as) { uint32_t val; val = arc4_getbyte(as) << 24; -- cgit v1.2.3 From 1fc68eae4846de4a1e276e68aee743ef731f3e91 Mon Sep 17 00:00:00 2001 From: "Peter S. Mazinger" Date: Sat, 26 Feb 2011 19:31:39 +0100 Subject: add missing prototypes Add some missing prototypes Signed-off-by: Peter S. Mazinger --- libc/misc/pthread/tsd.c | 1 + 1 file changed, 1 insertion(+) (limited to 'libc') diff --git a/libc/misc/pthread/tsd.c b/libc/misc/pthread/tsd.c index 835ee22ce..0c222e8e9 100644 --- a/libc/misc/pthread/tsd.c +++ b/libc/misc/pthread/tsd.c @@ -2,6 +2,7 @@ We define it here instead of in libpthread so t here instead of in libpthread so that it doesn't need to have a TLS segment of its own just for this one pointer. */ +void **__libc_dl_error_tsd(void) __attribute__ ((const)); void ** __attribute__ ((const)) __libc_dl_error_tsd (void) { -- cgit v1.2.3 From 380b5c5b31bdbf5e171ce035009e5e53b0ea230d Mon Sep 17 00:00:00 2001 From: "Peter S. Mazinger" Date: Sat, 26 Feb 2011 19:33:21 +0100 Subject: use common sigthread.h NPTL build did not use the correct bits/sigthread.h, use a common version avoiding this. Signed-off-by: Peter S. Mazinger --- libc/sysdeps/linux/common/bits/sigthread.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'libc') diff --git a/libc/sysdeps/linux/common/bits/sigthread.h b/libc/sysdeps/linux/common/bits/sigthread.h index 960bde18a..4f14b9f45 100644 --- a/libc/sysdeps/linux/common/bits/sigthread.h +++ b/libc/sysdeps/linux/common/bits/sigthread.h @@ -1,5 +1,5 @@ /* Signal handling function for threaded programs. - Copyright (C) 1998, 1999, 2000, 2002 Free Software Foundation, Inc. + Copyright (C) 1998, 1999, 2000, 2002, 2009 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 @@ -35,4 +35,10 @@ extern int pthread_sigmask (int __how, /* Send signal SIGNO to the given thread. */ extern int pthread_kill (pthread_t __threadid, int __signo) __THROW; +#if defined __USE_GNU && defined __UCLIBC_HAS_THREADS_NATIVE__ +/* Queue signal and data to a thread. */ +extern int pthread_sigqueue (pthread_t __threadid, int __signo, + const union sigval __value) __THROW; +#endif + #endif /* bits/sigthread.h */ -- cgit v1.2.3 From f00e553e4b084007781df5e4b5accc2e152da231 Mon Sep 17 00:00:00 2001 From: "Peter S. Mazinger" Date: Sat, 26 Feb 2011 19:41:29 +0100 Subject: add missing prototypes Add some missing prototypes Signed-off-by: Peter S. Mazinger --- libc/misc/internals/__uClibc_main.c | 7 +++++-- libc/sysdeps/linux/common/longjmp.c | 4 ++++ 2 files changed, 9 insertions(+), 2 deletions(-) (limited to 'libc') diff --git a/libc/misc/internals/__uClibc_main.c b/libc/misc/internals/__uClibc_main.c index 58f6643b2..da29ef69e 100644 --- a/libc/misc/internals/__uClibc_main.c +++ b/libc/misc/internals/__uClibc_main.c @@ -313,6 +313,11 @@ void __uClibc_fini(void) } libc_hidden_def(__uClibc_fini) +#ifndef SHARED +extern void __nptl_deallocate_tsd (void) __attribute ((weak)); +extern unsigned int __nptl_nthreads __attribute ((weak)); +#endif + /* __uClibc_main is the new main stub for uClibc. This function is * called from crt1 (version 0.9.28 or newer), after ALL shared libraries * are initialized, just before we call the application's main function. @@ -481,7 +486,6 @@ void __uClibc_main(int (*main)(int, char **, char **), int argc, # ifdef SHARED __libc_pthread_functions.ptr__nptl_deallocate_tsd (); # else - extern void __nptl_deallocate_tsd (void) __attribute ((weak)); __nptl_deallocate_tsd (); # endif @@ -491,7 +495,6 @@ void __uClibc_main(int (*main)(int, char **, char **), int argc, # ifdef SHARED unsigned int *const ptr = __libc_pthread_functions.ptr_nthreads; # else - extern unsigned int __nptl_nthreads __attribute ((weak)); unsigned int *const ptr = &__nptl_nthreads; # endif diff --git a/libc/sysdeps/linux/common/longjmp.c b/libc/sysdeps/linux/common/longjmp.c index 4d1442414..b07eced6a 100644 --- a/libc/sysdeps/linux/common/longjmp.c +++ b/libc/sysdeps/linux/common/longjmp.c @@ -24,6 +24,10 @@ extern void __longjmp (__jmp_buf __env, int __val) attribute_noreturn; libc_hidden_proto(__longjmp) +#if 0 +extern void _longjmp_unwind (jmp_buf env, int val); +#endif + extern __typeof(longjmp) __libc_longjmp attribute_noreturn; /* Set the signal mask to the one specified in ENV, and jump to the position specified in ENV, causing the setjmp -- cgit v1.2.3 From 2e9d2266c0cea250f7a87dc6aa2b02d0bd5a0aea Mon Sep 17 00:00:00 2001 From: "Peter S. Mazinger" Date: Sat, 26 Feb 2011 21:49:38 +0100 Subject: Correct ssp code Avoid using strong_alias in ssp, some archs dislike it. Make stack_chk_guard static. Export __stack_smash_handler only if compatibility option is enabled. Signed-off-by: Peter S. Mazinger --- libc/misc/internals/__uClibc_main.c | 25 +++++++------------------ libc/sysdeps/linux/common/ssp.c | 3 ++- 2 files changed, 9 insertions(+), 19 deletions(-) (limited to 'libc') diff --git a/libc/misc/internals/__uClibc_main.c b/libc/misc/internals/__uClibc_main.c index da29ef69e..315365a25 100644 --- a/libc/misc/internals/__uClibc_main.c +++ b/libc/misc/internals/__uClibc_main.c @@ -45,22 +45,15 @@ void *__libc_stack_end = NULL; # ifdef __UCLIBC_HAS_SSP__ # include +static uintptr_t stack_chk_guard; # ifndef THREAD_SET_STACK_GUARD /* Only exported for architectures that don't store the stack guard canary * in thread local area. */ -# include -uintptr_t stack_chk_guard; /* for gcc-4.1 non-TLS */ uintptr_t __stack_chk_guard attribute_relro; +# endif /* for gcc-3.x + Etoh ssp */ -# ifdef __UCLIBC_HAS_SSP_COMPAT__ -# ifdef __HAVE_SHARED__ -strong_alias(__stack_chk_guard,__guard) -# else -uintptr_t __guard attribute_relro; -# endif -# endif -# elif defined __UCLIBC_HAS_SSP_COMPAT__ +# ifdef __UCLIBC_HAS_SSP_COMPAT__ uintptr_t __guard attribute_relro; # endif # endif @@ -251,18 +244,14 @@ void __uClibc_init(void) #ifndef SHARED # ifdef __UCLIBC_HAS_SSP__ /* Set up the stack checker's canary. */ + stack_chk_guard = _dl_setup_stack_chk_guard(); # ifdef THREAD_SET_STACK_GUARD - uintptr_t stack_chk_guard = _dl_setup_stack_chk_guard(); THREAD_SET_STACK_GUARD (stack_chk_guard); -# ifdef __UCLIBC_HAS_SSP_COMPAT__ - stack_chk_guard = _dl_setup_stack_chk_guard(); - __guard = stack_chk_guard; -# endif # else __stack_chk_guard = stack_chk_guard; -# if !defined __HAVE_SHARED__ && defined __UCLIBC_HAS_SSP_COMPAT__ - __guard = stack_chk_guard; -# endif +# endif +# ifdef __UCLIBC_HAS_SSP_COMPAT__ + __guard = stack_chk_guard; # endif # endif #endif diff --git a/libc/sysdeps/linux/common/ssp.c b/libc/sysdeps/linux/common/ssp.c index a2d7ff2ca..d81c706f4 100644 --- a/libc/sysdeps/linux/common/ssp.c +++ b/libc/sysdeps/linux/common/ssp.c @@ -71,6 +71,7 @@ static attribute_noreturn void terminate(void) _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) { @@ -84,6 +85,7 @@ void __stack_smash_handler(char func[], int damaged) while(1) terminate(); } +#endif void __stack_chk_fail(void) attribute_noreturn __cold; void __stack_chk_fail(void) @@ -114,4 +116,3 @@ void __chk_fail(void) while(1) terminate(); } - -- cgit v1.2.3 From 370e40a5d94efb44d6b8adbca6fcaa1262793f0b Mon Sep 17 00:00:00 2001 From: "Peter S. Mazinger" Date: Sat, 26 Feb 2011 22:13:19 +0100 Subject: initialize 2 variables to get rid of compiler warning Signed-off-by: Peter S. Mazinger --- libc/misc/time/time.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'libc') diff --git a/libc/misc/time/time.c b/libc/misc/time/time.c index ff44892a8..096c3b6b4 100644 --- a/libc/misc/time/time.c +++ b/libc/misc/time/time.c @@ -1013,7 +1013,7 @@ size_t __XL_NPP(strftime)(char *__restrict s, size_t maxsize, const char *stack[MAX_PUSH]; size_t count; size_t o_count; - int field_val, i, j, lvl; + int field_val = 0, i = 0, j, lvl; int x[3]; /* wday, yday, year */ int isofm, days; char buf[__UIM_BUFLEN_LONG]; -- cgit v1.2.3 From 5ecbf1730329be5e04229fb1ea23f4bc0bc3d2a3 Mon Sep 17 00:00:00 2001 From: "Peter S. Mazinger" Date: Sun, 27 Feb 2011 00:20:58 +0100 Subject: fix stubs We use enosys_stub only in this file so make it static Signed-off-by: Peter S. Mazinger --- libc/sysdeps/linux/common/stubs.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'libc') diff --git a/libc/sysdeps/linux/common/stubs.c b/libc/sysdeps/linux/common/stubs.c index dd4a384f8..8688e98a1 100644 --- a/libc/sysdeps/linux/common/stubs.c +++ b/libc/sysdeps/linux/common/stubs.c @@ -11,15 +11,11 @@ #ifdef __UCLIBC_HAS_STUBS__ -attribute_hidden int enosys_stub(void); -libc_hidden_proto(enosys_stub) - -attribute_hidden int enosys_stub(void) +static int enosys_stub(void) { __set_errno(ENOSYS); return -1; } -libc_hidden_def(enosys_stub) #define make_stub(stub) \ link_warning(stub, #stub ": this function is not implemented") \ -- cgit v1.2.3 From 83c1854b97d79e2b67065b1a2651b0d11d8a8f6b Mon Sep 17 00:00:00 2001 From: "Peter S. Mazinger" Date: Wed, 2 Mar 2011 15:06:51 +0100 Subject: remove error handling from some syscalls Remove error handling from getegid/getgid/geteuid/getuid/getppid/getpid/getpgrp Use strong_alias if fallbacks are needed Signed-off-by: Peter S. Mazinger --- libc/sysdeps/linux/common/bits/syscalls-common.h | 1 + libc/sysdeps/linux/common/getegid.c | 22 +++++----------------- libc/sysdeps/linux/common/geteuid.c | 21 ++++----------------- libc/sysdeps/linux/common/getgid.c | 8 ++++++-- libc/sysdeps/linux/common/getpgrp.c | 2 +- libc/sysdeps/linux/common/getpid.c | 12 +++++++----- libc/sysdeps/linux/common/getppid.c | 8 ++------ libc/sysdeps/linux/common/getuid.c | 8 ++++++-- libc/sysdeps/linux/common/umask.c | 2 +- 9 files changed, 33 insertions(+), 51 deletions(-) (limited to 'libc') diff --git a/libc/sysdeps/linux/common/bits/syscalls-common.h b/libc/sysdeps/linux/common/bits/syscalls-common.h index 5e4e350c5..1b84d9e2b 100644 --- a/libc/sysdeps/linux/common/bits/syscalls-common.h +++ b/libc/sysdeps/linux/common/bits/syscalls-common.h @@ -97,6 +97,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) diff --git a/libc/sysdeps/linux/common/getegid.c b/libc/sysdeps/linux/common/getegid.c index f2b6401cf..80a8ac9bb 100644 --- a/libc/sysdeps/linux/common/getegid.c +++ b/libc/sysdeps/linux/common/getegid.c @@ -10,24 +10,12 @@ #include #include - -#if defined(__NR_getegid32) +#ifdef __NR_getegid32 # undef __NR_getegid # define __NR_getegid __NR_getegid32 -_syscall0(gid_t, getegid) - -#elif defined(__NR_getegid) -# define __NR___syscall_getegid __NR_getegid -static __inline__ _syscall0(int, __syscall_getegid) -gid_t getegid(void) -{ - return (__syscall_getegid()); -} -#else - -gid_t getegid(void) -{ - return (getgid()); -} #endif + +#ifdef __NR_getegid +_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 6111e5d1b..610fbc170 100644 --- a/libc/sysdeps/linux/common/geteuid.c +++ b/libc/sysdeps/linux/common/geteuid.c @@ -10,25 +10,12 @@ #include #include - -#if defined(__NR_geteuid32) +#ifdef __NR_geteuid32 # undef __NR_geteuid # define __NR_geteuid __NR_geteuid32 -_syscall0(uid_t, geteuid) - -#elif defined(__NR_geteuid) -# define __NR___syscall_geteuid __NR_geteuid -static __inline__ _syscall0(int, __syscall_geteuid) -uid_t geteuid(void) -{ - return (__syscall_geteuid()); -} - -#else -uid_t geteuid(void) -{ - return (getuid()); -} #endif +#ifdef __NR_geteuid +_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 80c60034e..ccfbfc067 100644 --- a/libc/sysdeps/linux/common/getgid.c +++ b/libc/sysdeps/linux/common/getgid.c @@ -10,7 +10,7 @@ #include #include -#if defined __NR_getxgid +#ifdef __NR_getxgid # undef __NR_getgid # define __NR_getgid __NR_getxgid #endif @@ -19,5 +19,9 @@ # define __NR_getgid __NR_getgid32 #endif -_syscall0(gid_t, getgid) +_syscall_noerr0(gid_t, getgid) libc_hidden_def(getgid) +#if !defined __NR_getegid32 && !defined __NR_getegid +strong_alias(getgid,getegid) +libc_hidden_def(getegid) +#endif diff --git a/libc/sysdeps/linux/common/getpgrp.c b/libc/sysdeps/linux/common/getpgrp.c index 80a53daee..0af9dc499 100644 --- a/libc/sysdeps/linux/common/getpgrp.c +++ b/libc/sysdeps/linux/common/getpgrp.c @@ -12,7 +12,7 @@ #ifdef __NR_getpgrp /* According to the manpage the POSIX.1 version is favoured */ -_syscall0(pid_t, getpgrp) +_syscall_noerr0(pid_t, getpgrp) #elif defined __NR_getpgid && (defined __NR_getpid || defined __NR_getxpid) /* IA64 doesn't have a getpgrp syscall */ pid_t getpgrp(void) diff --git a/libc/sysdeps/linux/common/getpid.c b/libc/sysdeps/linux/common/getpid.c index 8041022e7..d9a69084f 100644 --- a/libc/sysdeps/linux/common/getpid.c +++ b/libc/sysdeps/linux/common/getpid.c @@ -10,11 +10,13 @@ #include #include -extern __typeof(getpid) __libc_getpid; -#if defined __NR_getxpid +#ifdef __NR_getxpid +# undef __NR_getpid # define __NR_getpid __NR_getxpid #endif -#define __NR___libc_getpid __NR_getpid -_syscall0(pid_t, __libc_getpid) -weak_alias(__libc_getpid, getpid) + +_syscall_noerr0(pid_t, getpid) libc_hidden_weak(getpid) +#ifndef __NR_getppid +strong_alias(getpid,getppid) +#endif diff --git a/libc/sysdeps/linux/common/getppid.c b/libc/sysdeps/linux/common/getppid.c index 4f2b0e933..9d85661d9 100644 --- a/libc/sysdeps/linux/common/getppid.c +++ b/libc/sysdeps/linux/common/getppid.c @@ -9,11 +9,7 @@ #include #include + #ifdef __NR_getppid -_syscall0(pid_t, getppid) -#else -pid_t getppid(void) -{ - return getpid(); -} +_syscall_noerr0(pid_t, getppid) #endif diff --git a/libc/sysdeps/linux/common/getuid.c b/libc/sysdeps/linux/common/getuid.c index b6f813a06..f921acb2e 100644 --- a/libc/sysdeps/linux/common/getuid.c +++ b/libc/sysdeps/linux/common/getuid.c @@ -10,7 +10,7 @@ #include #include -#if defined __NR_getxuid +#ifdef __NR_getxuid # undef __NR_getuid # define __NR_getuid __NR_getxuid #endif @@ -19,5 +19,9 @@ # define __NR_getuid __NR_getuid32 #endif -_syscall0(uid_t, getuid) +_syscall_noerr0(uid_t, getuid) libc_hidden_def(getuid) +#if !defined __NR_geteuid32 && !defined __NR_geteuid +strong_alias(getuid,geteuid) +libc_hidden_def(geteuid) +#endif diff --git a/libc/sysdeps/linux/common/umask.c b/libc/sysdeps/linux/common/umask.c index ef9860e31..b838e1731 100644 --- a/libc/sysdeps/linux/common/umask.c +++ b/libc/sysdeps/linux/common/umask.c @@ -15,5 +15,5 @@ static __inline__ _syscall1(__kernel_mode_t, __syscall_umask, __kernel_mode_t, m mode_t umask(mode_t mode) { - return (__syscall_umask(mode)); + return __syscall_umask(mode); } -- cgit v1.2.3 From 8116ca7baec0ff8c9bc35a2920aa36549e6004a4 Mon Sep 17 00:00:00 2001 From: "Peter S. Mazinger" Date: Wed, 2 Mar 2011 15:31:00 +0100 Subject: make parse_printf_format() depend on UCLIBC_HAS_GLIBC_CUSTOM_PRINTF we already remove the printf.h header if this option is disabled Signed-off-by: Peter S. Mazinger --- libc/stdio/_vfprintf.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'libc') diff --git a/libc/stdio/_vfprintf.c b/libc/stdio/_vfprintf.c index fa5dc44fc..3db8cdf67 100644 --- a/libc/stdio/_vfprintf.c +++ b/libc/stdio/_vfprintf.c @@ -417,6 +417,8 @@ extern uintmax_t _load_inttype(int desttype, const void *src, int uflag) attribu /**********************************************************************/ #ifdef L_parse_printf_format +#ifdef __UCLIBC_HAS_GLIBC_CUSTOM_PRINTF__ + /* NOTE: This function differs from the glibc version in that parsing stops * upon encountering an invalid conversion specifier. Since this is the way * my printf functions work, I think it makes sense to do it that way here. @@ -484,6 +486,8 @@ size_t parse_printf_format(register const char *template, return count; } +#endif + #endif /**********************************************************************/ #ifdef L__ppfs_init -- cgit v1.2.3 From 5e22e71adfef5ad46119cea98fccf4ae998ad0d8 Mon Sep 17 00:00:00 2001 From: "Peter S. Mazinger" Date: Wed, 2 Mar 2011 21:59:58 +0100 Subject: remove ucontext.h and guard sigstack structure with SUSV4_LEGACY and STRICT_HEADERS Remove ucontext.h if SUSV4_LEGACY is not set and fix it's references. Guard sigstack structure with SUSV4_LEGACY and STRICT_HEADERS. Disable sigstack function prototype, it is not provided by uClibc. Signed-off-by: Peter S. Mazinger --- libc/sysdeps/linux/alpha/bits/sigstack.h | 2 ++ libc/sysdeps/linux/common/bits/sigstack.h | 2 ++ libc/sysdeps/linux/ia64/bits/sigstack.h | 2 ++ libc/sysdeps/linux/mips/bits/sigstack.h | 2 ++ libc/sysdeps/linux/sparc/bits/sigstack.h | 2 ++ 5 files changed, 10 insertions(+) (limited to 'libc') diff --git a/libc/sysdeps/linux/alpha/bits/sigstack.h b/libc/sysdeps/linux/alpha/bits/sigstack.h index 7faaf98d5..e9fbc6d6f 100644 --- a/libc/sysdeps/linux/alpha/bits/sigstack.h +++ b/libc/sysdeps/linux/alpha/bits/sigstack.h @@ -22,12 +22,14 @@ #endif +#if defined __UCLIBC_SUSV4_LEGACY__ || !defined __UCLIBC_STRICT_HEADERS__ /* Structure describing a signal stack (obsolete). */ struct sigstack { __ptr_t ss_sp; /* Signal stack pointer. */ int ss_onstack; /* Nonzero if executing on this stack. */ }; +#endif /* Possible values for `ss_flags.'. */ diff --git a/libc/sysdeps/linux/common/bits/sigstack.h b/libc/sysdeps/linux/common/bits/sigstack.h index 7f260367b..2b3b321bd 100644 --- a/libc/sysdeps/linux/common/bits/sigstack.h +++ b/libc/sysdeps/linux/common/bits/sigstack.h @@ -22,12 +22,14 @@ #endif +#if defined __UCLIBC_SUSV4_LEGACY__ || !defined __UCLIBC_STRICT_HEADERS__ /* Structure describing a signal stack (obsolete). */ struct sigstack { void *ss_sp; /* Signal stack pointer. */ int ss_onstack; /* Nonzero if executing on this stack. */ }; +#endif /* Possible values for `ss_flags.'. */ diff --git a/libc/sysdeps/linux/ia64/bits/sigstack.h b/libc/sysdeps/linux/ia64/bits/sigstack.h index c9c9d2fed..ea27a77bc 100644 --- a/libc/sysdeps/linux/ia64/bits/sigstack.h +++ b/libc/sysdeps/linux/ia64/bits/sigstack.h @@ -24,12 +24,14 @@ #ifndef _SIGSTACK_H #define _SIGSTACK_H 1 +#if defined __UCLIBC_SUSV4_LEGACY__ || !defined __UCLIBC_STRICT_HEADERS__ /* Structure describing a signal stack (obsolete). */ struct sigstack { __ptr_t ss_sp; /* Signal stack pointer. */ int ss_onstack; /* Nonzero if executing on this stack. */ }; +#endif /* Possible values for `ss_flags.'. */ diff --git a/libc/sysdeps/linux/mips/bits/sigstack.h b/libc/sysdeps/linux/mips/bits/sigstack.h index d2c855220..64643d1c5 100644 --- a/libc/sysdeps/linux/mips/bits/sigstack.h +++ b/libc/sysdeps/linux/mips/bits/sigstack.h @@ -22,12 +22,14 @@ #endif +#if defined __UCLIBC_SUSV4_LEGACY__ || !defined __UCLIBC_STRICT_HEADERS__ /* Structure describing a signal stack (obsolete). */ struct sigstack { void *ss_sp; /* Signal stack pointer. */ int ss_onstack; /* Nonzero if executing on this stack. */ }; +#endif /* Possible values for `ss_flags.'. */ diff --git a/libc/sysdeps/linux/sparc/bits/sigstack.h b/libc/sysdeps/linux/sparc/bits/sigstack.h index df4653949..432ec83b7 100644 --- a/libc/sysdeps/linux/sparc/bits/sigstack.h +++ b/libc/sysdeps/linux/sparc/bits/sigstack.h @@ -22,12 +22,14 @@ #endif +#if defined __UCLIBC_SUSV4_LEGACY__ || !defined __STRICT_HEADERS__ /* Structure describing a signal stack (obsolete). */ struct sigstack { void *ss_sp; /* Signal stack pointer. */ int ss_onstack; /* Nonzero if executing on this stack. */ }; +#endif /* Possible values for `ss_flags.'. */ -- cgit v1.2.3 From ca8f0d9cf39e60851e17f0c6dd5f3e4f51b64f5b Mon Sep 17 00:00:00 2001 From: "Peter S. Mazinger" Date: Wed, 2 Mar 2011 22:30:10 +0100 Subject: simplify guard of uClibc internals Simplify guard of uClibc internals, since _LIBC sections are removed on install. Signed-off-by: Peter S. Mazinger --- libc/sysdeps/linux/common/bits/uClibc_ctype.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'libc') diff --git a/libc/sysdeps/linux/common/bits/uClibc_ctype.h b/libc/sysdeps/linux/common/bits/uClibc_ctype.h index 3bf4e1b28..5ff281d8e 100644 --- a/libc/sysdeps/linux/common/bits/uClibc_ctype.h +++ b/libc/sysdeps/linux/common/bits/uClibc_ctype.h @@ -95,7 +95,7 @@ /**********************************************************************/ __BEGIN_DECLS -#if defined _LIBC && (defined NOT_IN_libc || defined IS_IN_libc) +#ifdef _LIBC /* These are uClibc-specific. */ # define __isdigit_char(c) ((unsigned char)((c) - '0') <= 9) # define __isdigit_int(c) ((unsigned int)((c) - '0') <= 9) -- cgit v1.2.3 From 152e66242f2af7cd26e29d59a31f8bb8479595e5 Mon Sep 17 00:00:00 2001 From: "Peter S. Mazinger" Date: Thu, 3 Mar 2011 00:37:29 +0100 Subject: update some headers Signed-off-by: Peter S. Mazinger --- libc/misc/locale/locale.c | 1 + 1 file changed, 1 insertion(+) (limited to 'libc') diff --git a/libc/misc/locale/locale.c b/libc/misc/locale/locale.c index 52055a2d2..255c10d61 100644 --- a/libc/misc/locale/locale.c +++ b/libc/misc/locale/locale.c @@ -1057,6 +1057,7 @@ libc_hidden_def(__XL_NPP(nl_langinfo)) /**********************************************************************/ #ifdef L_newlocale +#warning mask defines for extra locale categories #ifdef __UCLIBC_MJN3_ONLY__ #warning TODO: Move posix and utf8 strings. -- cgit v1.2.3 From b526c7807f0a54054c4b12edef58b521fe0ab4c7 Mon Sep 17 00:00:00 2001 From: "Peter S. Mazinger" Date: Thu, 3 Mar 2011 11:41:44 +0100 Subject: strcpy: remove unneeded includes from the generic version Signed-off-by: Peter S. Mazinger --- libc/string/generic/strcpy.c | 3 --- 1 file changed, 3 deletions(-) (limited to 'libc') diff --git a/libc/string/generic/strcpy.c b/libc/string/generic/strcpy.c index 4d070531f..ace6dea58 100644 --- a/libc/string/generic/strcpy.c +++ b/libc/string/generic/strcpy.c @@ -17,9 +17,6 @@ 02111-1307 USA. */ #include -#include - -#include "memcopy.h" /* Copy SRC to DEST. */ char *strcpy(char *dest, const char *src) -- cgit v1.2.3 From a36065a4fe6dcd6fc1847da9d063894e45c4a71e Mon Sep 17 00:00:00 2001 From: "Peter S. Mazinger" Date: Thu, 3 Mar 2011 13:20:21 +0100 Subject: sgtty.h is useless, remove it on STRICT_HEADERS Signed-off-by: Peter S. Mazinger --- libc/sysdeps/linux/powerpc/bits/termios.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'libc') diff --git a/libc/sysdeps/linux/powerpc/bits/termios.h b/libc/sysdeps/linux/powerpc/bits/termios.h index 7aac02dc5..12513e3ea 100644 --- a/libc/sysdeps/linux/powerpc/bits/termios.h +++ b/libc/sysdeps/linux/powerpc/bits/termios.h @@ -220,6 +220,7 @@ struct termios { #define TCSADRAIN 1 #define TCSAFLUSH 2 +#ifndef __UCLIBC_STRICT_HEADERS__ struct sgttyb { char sg_ispeed; char sg_ospeed; @@ -227,6 +228,7 @@ struct sgttyb { char sg_kill; short sg_flags; }; +#endif struct tchars { char t_intrc; -- cgit v1.2.3 From 96c9a8f7d00cdf6bb7968a2390b9d87da8a45e2d Mon Sep 17 00:00:00 2001 From: "Peter S. Mazinger" Date: Thu, 3 Mar 2011 15:06:47 +0100 Subject: add _dl_errno support to errno.h, cleanup Add support to use errno.h in ldso. Move __set_errno into _LIBC guard. Remove uClibc_errno.h, unused. Signed-off-by: Peter S. Mazinger --- libc/sysdeps/linux/common/bits/uClibc_errno.h | 43 --------------------------- 1 file changed, 43 deletions(-) delete mode 100644 libc/sysdeps/linux/common/bits/uClibc_errno.h (limited to 'libc') diff --git a/libc/sysdeps/linux/common/bits/uClibc_errno.h b/libc/sysdeps/linux/common/bits/uClibc_errno.h deleted file mode 100644 index 9c1561841..000000000 --- a/libc/sysdeps/linux/common/bits/uClibc_errno.h +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (C) 2000-2006 Erik Andersen - * - * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. - */ -#ifndef _BITS_UCLIBC_ERRNO_H -#define _BITS_UCLIBC_ERRNO_H 1 - -#ifdef IS_IN_rtld -# undef errno -# define errno _dl_errno -extern int _dl_errno; /* attribute_hidden; */ -#elif defined __UCLIBC_HAS_THREADS__ -# include -# if defined USE___THREAD && USE___THREAD -# undef errno -# ifndef NOT_IN_libc -# define errno __libc_errno -# else -# define errno errno -# endif -extern __thread int errno attribute_tls_model_ie; -# endif /* USE___THREAD */ -#endif /* IS_IN_rtld */ - -#define __set_errno(val) (errno = (val)) - -#ifndef __ASSEMBLER__ -extern int *__errno_location (void) __THROW __attribute__ ((__const__)) -# ifdef IS_IN_rtld - attribute_hidden -# endif -; -# if defined __UCLIBC_HAS_THREADS__ -# include -# if defined USE___THREAD && USE___THREAD -libc_hidden_proto(__errno_location) -# endif -# endif - -#endif /* !__ASSEMBLER__ */ - -#endif -- cgit v1.2.3 From 5ebef433698a13e5171f4b7dca04f2006bd92468 Mon Sep 17 00:00:00 2001 From: "Peter S. Mazinger" Date: Thu, 3 Mar 2011 16:04:03 +0100 Subject: provide internal hidden version of __fcntl_nocancel guard the prototype with _LIBC, it is only for internal use Signed-off-by: Peter S. Mazinger --- libc/sysdeps/linux/common/__syscall_fcntl.c | 1 + 1 file changed, 1 insertion(+) (limited to 'libc') diff --git a/libc/sysdeps/linux/common/__syscall_fcntl.c b/libc/sysdeps/linux/common/__syscall_fcntl.c index 5da3c5f32..6d4c339ab 100644 --- a/libc/sysdeps/linux/common/__syscall_fcntl.c +++ b/libc/sysdeps/linux/common/__syscall_fcntl.c @@ -40,6 +40,7 @@ int __fcntl_nocancel (int fd, int cmd, ...) # endif return INLINE_SYSCALL (fcntl, 3, fd, cmd, arg); } +libc_hidden_def(__fcntl_nocancel) int __libc_fcntl (int fd, int cmd, ...) { -- cgit v1.2.3 From f4eebb6146ea3f6917481d5d24f3d99e97236399 Mon Sep 17 00:00:00 2001 From: "Bernd Schmidt bernds_cb1@t-online.de" Date: Wed, 2 Mar 2011 18:22:01 +0100 Subject: Add Makefile support for DSBT ELF. 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 --- libc/Makefile.in | 1 + 1 file changed, 1 insertion(+) (limited to 'libc') diff --git a/libc/Makefile.in b/libc/Makefile.in index dd666ac7c..3b6a17b32 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__ -- cgit v1.2.3 From 95adc01517efce365da4e40e0d2a081ec4497928 Mon Sep 17 00:00:00 2001 From: Mark Salter Date: Wed, 23 Feb 2011 12:56:43 +0100 Subject: Add support for DSBT ELF to ld.so 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 --- libc/misc/elf/dl-iterate-phdr.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'libc') diff --git a/libc/misc/elf/dl-iterate-phdr.c b/libc/misc/elf/dl-iterate-phdr.c index a7677f11f..f0233ca37 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 -- cgit v1.2.3 From 46d6a24872b7fa2717f8f71b5e0598a14d38e1f6 Mon Sep 17 00:00:00 2001 From: Aurelien Jacquiot Date: Wed, 23 Feb 2011 13:04:59 +0100 Subject: The C6X port 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 --- libc/sysdeps/linux/c6x/Makefile | 13 ++ libc/sysdeps/linux/c6x/Makefile.arch | 15 ++ libc/sysdeps/linux/c6x/__longjmp.S | 47 +++++ libc/sysdeps/linux/c6x/_vfork.S | 55 +++++ libc/sysdeps/linux/c6x/bits/byteswap.h | 35 +++ libc/sysdeps/linux/c6x/bits/elf-dsbt.h | 123 +++++++++++ libc/sysdeps/linux/c6x/bits/endian.h | 11 + libc/sysdeps/linux/c6x/bits/fcntl.h | 235 +++++++++++++++++++++ libc/sysdeps/linux/c6x/bits/kernel_stat.h | 52 +++++ libc/sysdeps/linux/c6x/bits/kernel_types.h | 46 ++++ libc/sysdeps/linux/c6x/bits/mathdef.h | 39 ++++ libc/sysdeps/linux/c6x/bits/nan.h | 57 +++++ libc/sysdeps/linux/c6x/bits/poll.h | 43 ++++ libc/sysdeps/linux/c6x/bits/resource.h | 209 ++++++++++++++++++ libc/sysdeps/linux/c6x/bits/setjmp.h | 39 ++++ libc/sysdeps/linux/c6x/bits/sigcontextinfo.h | 26 +++ libc/sysdeps/linux/c6x/bits/stackinfo.h | 28 +++ libc/sysdeps/linux/c6x/bits/stat.h | 174 +++++++++++++++ libc/sysdeps/linux/c6x/bits/syscalls.h | 182 ++++++++++++++++ libc/sysdeps/linux/c6x/bits/uClibc_arch_features.h | 48 +++++ libc/sysdeps/linux/c6x/bits/wordsize.h | 19 ++ libc/sysdeps/linux/c6x/brk.c | 54 +++++ libc/sysdeps/linux/c6x/bsd-_setjmp.s | 48 +++++ libc/sysdeps/linux/c6x/bsd-setjmp.S | 67 ++++++ libc/sysdeps/linux/c6x/clone.S | 97 +++++++++ libc/sysdeps/linux/c6x/crt1.S | 67 ++++++ libc/sysdeps/linux/c6x/crti.S | 17 ++ libc/sysdeps/linux/c6x/crtn.S | 19 ++ libc/sysdeps/linux/c6x/prctl.c | 43 ++++ libc/sysdeps/linux/c6x/pread_write.c | 103 +++++++++ libc/sysdeps/linux/c6x/setjmp.s | 43 ++++ libc/sysdeps/linux/c6x/sigaction.c | 115 ++++++++++ libc/sysdeps/linux/c6x/sys/procfs.h | 122 +++++++++++ libc/sysdeps/linux/c6x/sys/reg.h | 26 +++ libc/sysdeps/linux/c6x/sys/ucontext.h | 39 ++++ libc/sysdeps/linux/c6x/sys/user.h | 28 +++ libc/sysdeps/linux/c6x/syscall.c | 49 +++++ libc/sysdeps/linux/c6x/vfork.c | 26 +++ libc/sysdeps/linux/common/Makefile.in | 1 + 39 files changed, 2460 insertions(+) create mode 100644 libc/sysdeps/linux/c6x/Makefile create mode 100644 libc/sysdeps/linux/c6x/Makefile.arch create mode 100644 libc/sysdeps/linux/c6x/__longjmp.S create mode 100644 libc/sysdeps/linux/c6x/_vfork.S create mode 100644 libc/sysdeps/linux/c6x/bits/byteswap.h create mode 100644 libc/sysdeps/linux/c6x/bits/elf-dsbt.h create mode 100644 libc/sysdeps/linux/c6x/bits/endian.h create mode 100644 libc/sysdeps/linux/c6x/bits/fcntl.h create mode 100644 libc/sysdeps/linux/c6x/bits/kernel_stat.h create mode 100644 libc/sysdeps/linux/c6x/bits/kernel_types.h create mode 100644 libc/sysdeps/linux/c6x/bits/mathdef.h create mode 100644 libc/sysdeps/linux/c6x/bits/nan.h create mode 100644 libc/sysdeps/linux/c6x/bits/poll.h create mode 100644 libc/sysdeps/linux/c6x/bits/resource.h create mode 100644 libc/sysdeps/linux/c6x/bits/setjmp.h create mode 100644 libc/sysdeps/linux/c6x/bits/sigcontextinfo.h create mode 100644 libc/sysdeps/linux/c6x/bits/stackinfo.h create mode 100644 libc/sysdeps/linux/c6x/bits/stat.h create mode 100644 libc/sysdeps/linux/c6x/bits/syscalls.h create mode 100644 libc/sysdeps/linux/c6x/bits/uClibc_arch_features.h create mode 100644 libc/sysdeps/linux/c6x/bits/wordsize.h create mode 100644 libc/sysdeps/linux/c6x/brk.c create mode 100644 libc/sysdeps/linux/c6x/bsd-_setjmp.s create mode 100644 libc/sysdeps/linux/c6x/bsd-setjmp.S create mode 100644 libc/sysdeps/linux/c6x/clone.S create mode 100644 libc/sysdeps/linux/c6x/crt1.S create mode 100644 libc/sysdeps/linux/c6x/crti.S create mode 100644 libc/sysdeps/linux/c6x/crtn.S create mode 100644 libc/sysdeps/linux/c6x/prctl.c create mode 100644 libc/sysdeps/linux/c6x/pread_write.c create mode 100644 libc/sysdeps/linux/c6x/setjmp.s create mode 100644 libc/sysdeps/linux/c6x/sigaction.c create mode 100644 libc/sysdeps/linux/c6x/sys/procfs.h create mode 100644 libc/sysdeps/linux/c6x/sys/reg.h create mode 100644 libc/sysdeps/linux/c6x/sys/ucontext.h create mode 100644 libc/sysdeps/linux/c6x/sys/user.h create mode 100644 libc/sysdeps/linux/c6x/syscall.c create mode 100644 libc/sysdeps/linux/c6x/vfork.c (limited to 'libc') diff --git a/libc/sysdeps/linux/c6x/Makefile b/libc/sysdeps/linux/c6x/Makefile new file mode 100644 index 000000000..633c91f3e --- /dev/null +++ b/libc/sysdeps/linux/c6x/Makefile @@ -0,0 +1,13 @@ +# Makefile for uClibc +# +# Copyright (C) 2000-2005 Erik Andersen +# +# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. +# + +top_srcdir=../../../../ +top_builddir=../../../../ +all: objs +include $(top_builddir)Rules.mak +include Makefile.arch +include $(top_srcdir)Makerules diff --git a/libc/sysdeps/linux/c6x/Makefile.arch b/libc/sysdeps/linux/c6x/Makefile.arch new file mode 100644 index 000000000..3e8dace07 --- /dev/null +++ b/libc/sysdeps/linux/c6x/Makefile.arch @@ -0,0 +1,15 @@ +# Makefile for uClibc +# +# Copyright (C) 2000-2005 Erik Andersen +# +# 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 := + +SSRC := __longjmp.S bsd-_setjmp.S bsd-setjmp.S clone.S setjmp.S _vfork.S +#SSRC := + +# libc-nonshared-y += $(ARCH_OUT)/_syscall.os + diff --git a/libc/sysdeps/linux/c6x/__longjmp.S b/libc/sysdeps/linux/c6x/__longjmp.S new file mode 100644 index 000000000..b9d9f9d9c --- /dev/null +++ b/libc/sysdeps/linux/c6x/__longjmp.S @@ -0,0 +1,47 @@ + ; + ; 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 + ; + + .global __longjmp + +__longjmp: + LDW .D1T1 *+A4(48),A3 ; return address + MV .D2X A4,B6 ; jmp_buf pointer +|| MV .D1 A4,A6 +|| MV .S2 B4,B2 ; val + + LDW .D1T1 *+A6(0),A10 +|| LDW .D2T2 *+B6(4),B10 +|| [B2] MV .S1X B4,A4 +||[!B2] MVK .L1 1,A4 ; return val or 1 + + LDW .D1T1 *+A6(8),A11 +|| LDW .D2T2 *+B6(12),B11 + LDW .D1T1 *+A6(16),A12 +|| LDW .D2T2 *+B6(20),B12 + LDW .D1T1 *+A6(24),A13 +|| LDW .D2T2 *+B6(28),B13 + LDW .D1T1 *+A6(32),A14 +|| LDW .D2T2 *+B6(36),B14 + LDW .D1T1 *+A6(40),A15 +|| LDW .D2T2 *+B6(44),B15 +|| B .S2X A3 + NOP 5 + +libc_hidden_def(__longjmp) diff --git a/libc/sysdeps/linux/c6x/_vfork.S b/libc/sysdeps/linux/c6x/_vfork.S new file mode 100644 index 000000000..20cb6a52f --- /dev/null +++ b/libc/sysdeps/linux/c6x/_vfork.S @@ -0,0 +1,55 @@ + ; + ; 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 + ; + +; .import __errno_location + .global __vfork + +__vfork: + MVK .S2 190,B0 ; __NR_vfork +#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 + NOP +#else + SWE +#endif + + 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 + NOP 3 + BNOP .S2 B3,3 + STW .D1T1 A5,*A4 + MVK .L1 -1,A4 + +weak_alias(__vfork,vfork) +libc_hidden_weak(vfork) diff --git a/libc/sysdeps/linux/c6x/bits/byteswap.h b/libc/sysdeps/linux/c6x/bits/byteswap.h new file mode 100644 index 000000000..eff26d54e --- /dev/null +++ b/libc/sysdeps/linux/c6x/bits/byteswap.h @@ -0,0 +1,35 @@ +/* + * 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 + * + */ + +#ifndef _ASM_BITS_BYTESWAP_H +#define _ASM_BITS_BYTESWAP_H 1 + +#if !defined _BYTESWAP_H && !defined _NETINET_IN_H +# error "Never use directly; include instead." +#endif + +#ifdef __GNUC__ +#define __bswap_non_constant_32(x) __builtin_bswap32(x) +#endif + +#include + +#endif diff --git a/libc/sysdeps/linux/c6x/bits/elf-dsbt.h b/libc/sysdeps/linux/c6x/bits/elf-dsbt.h new file mode 100644 index 000000000..ff8b24bd7 --- /dev/null +++ b/libc/sysdeps/linux/c6x/bits/elf-dsbt.h @@ -0,0 +1,123 @@ +/* Copyright (C) 2010 Texas Instruments Incorporated + +Borrowed heavily from frv arch: +Copyright 2003, 2004 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. + +In addition to the permissions in the GNU Lesser General Public +License, the Free Software Foundation gives you unlimited +permission to link the compiled version of this file with other +programs, and to distribute those programs without any restriction +coming from the use of this file. (The GNU Lesser General Public +License restrictions do apply in other respects; for example, they +cover modification of the file, and distribution when not linked +into another program.) + +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 Lesser General Public +License along with the GNU C Library; see the file COPYING.LIB. If +not, write to the Free Software Foundation, Inc., 675 Mass Ave, +Cambridge, MA 02139, USA. */ + +#ifndef _BITS_ELF_DSBT_H +#define _BITS_ELF_DSBT_H + +/* These data structures are described in the DSBT ABI. + The kernel passes a process a memory map of logical + load segments. For PIC code to work, all code segments + must be combined into a single mapping while maintaining + their relationship to one another. The same is true for + RW data segments. + + Furthermore, + segment there is an elf32_dsbt_loadseg entry. A pointer to an + elf32_dsbt_loadmap is passed in GR8 at start-up, and a pointer to + an additional such map is passed in GR9 for the interpreter, when + there is one. */ + +#include + +/* This data structure represents a PT_LOAD segment. */ +struct elf32_dsbt_loadseg +{ + /* Core address to which the segment is mapped. */ + Elf32_Addr addr; + /* VMA recorded in the program header. */ + Elf32_Addr p_vaddr; + /* Size of this segment in memory. */ + Elf32_Word p_memsz; +}; + +struct elf32_dsbt_loadmap { + /* Protocol version number, must be zero. */ + Elf32_Word version; + + /* Pointer to DSBT */ + unsigned *dsbt_table; + unsigned dsbt_size; + unsigned dsbt_index; + + /* number of segments */ + Elf32_Word nsegs; + + /* The actual memory map. */ + struct elf32_dsbt_loadseg segs[0]; +}; + +struct elf32_dsbt_loadaddr { + struct elf32_dsbt_loadmap *map; +}; + + +/* Map a pointer's VMA to its corresponding address according to the + load map. */ +static __always_inline void * +__reloc_pointer (void *p, + const struct elf32_dsbt_loadmap *map) +{ + int c; + +#if 0 + if (map->version != 0) + /* Crash. */ + ((void(*)())0)(); +#endif + + /* No special provision is made for NULL. We don't want NULL + addresses to go through relocation, so they shouldn't be in + .rofixup sections, and, if they're present in dynamic + relocations, they shall be mapped to the NULL address without + undergoing relocations. */ + + for (c = 0; c < map->nsegs; c++) + { + unsigned long offset = p - (void*)map->segs[c].p_vaddr; + /* We only check for one-past-the-end for the second segment, + assumed to be the data segment, because other cases are + ambiguous in the absence of padding between segments, and + rofixup already serves as padding between text and data. + Unfortunately, unless we special-case the second segment, + we fail to relocate the _end symbol. */ + if (offset < map->segs[c].p_memsz + || (offset == map->segs[c].p_memsz && c == 1)) + return (char*)map->segs[c].addr + offset; + } + + /* We might want to crash instead. */ + return (void*)-1; +} + +# define __RELOC_POINTER(ptr, loadaddr) \ + (__reloc_pointer ((void*)(ptr), \ + (loadaddr).map)) + +#endif /* _BITS_ELF_DSBT_H */ diff --git a/libc/sysdeps/linux/c6x/bits/endian.h b/libc/sysdeps/linux/c6x/bits/endian.h new file mode 100644 index 000000000..7297f9e2e --- /dev/null +++ b/libc/sysdeps/linux/c6x/bits/endian.h @@ -0,0 +1,11 @@ +/* c6x is little-endian by default. */ + +#ifndef _ENDIAN_H +# error "Never use directly; include instead." +#endif + +#ifdef _BIG_ENDIAN +#define __BYTE_ORDER __BIG_ENDIAN +#else +#define __BYTE_ORDER __LITTLE_ENDIAN +#endif diff --git a/libc/sysdeps/linux/c6x/bits/fcntl.h b/libc/sysdeps/linux/c6x/bits/fcntl.h new file mode 100644 index 000000000..6c0d5647f --- /dev/null +++ b/libc/sysdeps/linux/c6x/bits/fcntl.h @@ -0,0 +1,235 @@ +/* O_*, F_*, FD_* bit values for Linux. + Copyright (C) 2000 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 _FCNTL_H +# error "Never use directly; include instead." +#endif + + +#include +#ifdef __USE_GNU +# include +#endif + +/* open/fcntl - O_SYNC is only implemented on blocks devices and on files + located on an ext2 file system */ +#define O_ACCMODE 0003 +#define O_RDONLY 00 +#define O_WRONLY 01 +#define O_RDWR 02 +#define O_CREAT 0100 /* not fcntl */ +#define O_EXCL 0200 /* not fcntl */ +#define O_NOCTTY 0400 /* not fcntl */ +#define O_TRUNC 01000 /* not fcntl */ +#define O_APPEND 02000 +#define O_NONBLOCK 04000 +#define O_NDELAY O_NONBLOCK +#define O_SYNC 010000 +#define O_FSYNC O_SYNC +#define O_ASYNC 020000 +#define O_DIRECT 040000 + +#ifdef __USE_GNU +# define O_LARGEFILE 0100000 +# define O_DIRECTORY 0200000 /* Must be a directory. */ +# define O_NOFOLLOW 0400000 /* don't follow links */ +# define O_NOATIME 01000000 +# define O_CLOEXEC 02000000/* set close on exec */ +#endif + +/* For now Linux has synchronisity options for data and read operations. + We define the symbols here but let them do the same as O_SYNC since + this is a superset. */ +#if defined __USE_POSIX199309 || defined __USE_UNIX98 +# define O_DSYNC O_SYNC /* Synchronize data. */ +# define O_RSYNC O_SYNC /* Synchronize read operations. */ +#endif + +#ifdef __USE_LARGEFILE64 +# define O_LARGEFILE 0100000 +#endif + +/* Values for the second argument to `fcntl'. */ +#define F_DUPFD 0 /* Duplicate file descriptor. */ +#define F_GETFD 1 /* Get file descriptor flags. */ +#define F_SETFD 2 /* Set file descriptor flags. */ +#define F_GETFL 3 /* Get file status flags. */ +#define F_SETFL 4 /* Set file status flags. */ +#ifndef __USE_FILE_OFFSET64 +# define F_GETLK 5 /* Get record locking info. */ +# define F_SETLK 6 /* Set record locking info (non-blocking). */ +# define F_SETLKW 7 /* Set record locking info (blocking). */ +#else +# define F_GETLK F_GETLK64 /* Get record locking info. */ +# define F_SETLK F_SETLK64 /* Set record locking info (non-blocking).*/ +# define F_SETLKW F_SETLKW64 /* Set record locking info (blocking). */ +#endif +#define F_GETLK64 12 /* Get record locking info. */ +#define F_SETLK64 13 /* Set record locking info (non-blocking). */ +#define F_SETLKW64 14 /* Set record locking info (blocking). */ + +#if defined __USE_BSD || defined __USE_XOPEN2K +# define F_SETOWN 8 /* Get owner of socket (receiver of SIGIO). */ +# define F_GETOWN 9 /* Set owner of socket (receiver of SIGIO). */ +#endif + +#ifdef __USE_GNU +# define F_SETSIG 10 /* Set number of signal to be sent. */ +# define F_GETSIG 11 /* Get number of signal to be sent. */ +#endif + +#ifdef __USE_GNU +# define F_SETLEASE 1024 /* Set a lease. */ +# define F_GETLEASE 1025 /* Enquire what lease is active. */ +# define F_NOTIFY 1026 /* Request notfications on a directory. */ +#endif + +/* For F_[GET|SET]FL. */ +#define FD_CLOEXEC 1 /* actually anything with low bit set goes */ + +/* For posix fcntl() and `l_type' field of a `struct flock' for lockf(). */ +#define F_RDLCK 0 /* Read lock. */ +#define F_WRLCK 1 /* Write lock. */ +#define F_UNLCK 2 /* Remove lock. */ + +/* For old implementation of bsd flock(). */ +#define F_EXLCK 4 /* or 3 */ +#define F_SHLCK 8 /* or 4 */ + +#ifdef __USE_BSD +/* Operations for bsd flock(), also used by the kernel implementation. */ +# define LOCK_SH 1 /* shared lock */ +# define LOCK_EX 2 /* exclusive lock */ +# define LOCK_NB 4 /* or'd with one of the above to prevent + blocking */ +# define LOCK_UN 8 /* remove lock */ +#endif + +#ifdef __USE_GNU +# define LOCK_MAND 32 /* This is a mandatory flock: */ +# define LOCK_READ 64 /* ... which allows concurrent read operations. */ +# define LOCK_WRITE 128 /* ... which allows concurrent write operations. */ +# define LOCK_RW 192 /* ... Which allows concurrent read & write operations. */ +#endif + +#ifdef __USE_GNU +/* Types of directory notifications that may be requested with F_NOTIFY. */ +# define DN_ACCESS 0x00000001 /* File accessed. */ +# define DN_MODIFY 0x00000002 /* File modified. */ +# define DN_CREATE 0x00000004 /* File created. */ +# define DN_DELETE 0x00000008 /* File removed. */ +# define DN_RENAME 0x00000010 /* File renamed. */ +# define DN_ATTRIB 0x00000020 /* File changed attibutes. */ +# define DN_MULTISHOT 0x80000000 /* Don't remove notifier. */ +#endif + +struct flock + { + short int l_type; /* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK. */ + short int l_whence; /* Where `l_start' is relative to (like `lseek'). */ +#ifndef __USE_FILE_OFFSET64 + __off_t l_start; /* Offset where the lock begins. */ + __off_t l_len; /* Size of the locked area; zero means until EOF. */ +#else + __off64_t l_start; /* Offset where the lock begins. */ + __off64_t l_len; /* Size of the locked area; zero means until EOF. */ +#endif + __pid_t l_pid; /* Process holding the lock. */ + }; + +#ifdef __USE_LARGEFILE64 +struct flock64 + { + short int l_type; /* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK. */ + short int l_whence; /* Where `l_start' is relative to (like `lseek'). */ + __off64_t l_start; /* Offset where the lock begins. */ + __off64_t l_len; /* Size of the locked area; zero means until EOF. */ + __pid_t l_pid; /* Process holding the lock. */ + }; +#endif + +/* Define some more compatibility macros to be backward compatible with + BSD systems which did not managed to hide these kernel macros. */ +#ifdef __USE_BSD +# define FAPPEND O_APPEND +# define FFSYNC O_FSYNC +# define FASYNC O_ASYNC +# define FNONBLOCK O_NONBLOCK +# define FNDELAY O_NDELAY +#endif /* Use BSD. */ + +/* Advise to `posix_fadvise'. */ +#ifdef __USE_XOPEN2K +# define POSIX_FADV_NORMAL 0 /* No further special treatment. */ +# define POSIX_FADV_RANDOM 1 /* Expect random page references. */ +# define POSIX_FADV_SEQUENTIAL 2 /* Expect sequential page references. */ +# define POSIX_FADV_WILLNEED 3 /* Will need these pages. */ +# define POSIX_FADV_DONTNEED 4 /* Don't need these pages. */ +# define POSIX_FADV_NOREUSE 5 /* Data will be accessed once. */ +#endif + +#if defined __USE_GNU && defined __UCLIBC_LINUX_SPECIFIC__ +/* Flags for SYNC_FILE_RANGE. */ +# define SYNC_FILE_RANGE_WAIT_BEFORE 1 /* Wait upon writeout of all pages + in the range before performing the + write. */ +# define SYNC_FILE_RANGE_WRITE 2 /* Initiate writeout of all those + dirty pages in the range which are + not presently under writeback. */ +# define SYNC_FILE_RANGE_WAIT_AFTER 4 /* Wait upon writeout of all pages in + the range after performing the + write. */ + +/* Flags for SPLICE and VMSPLICE. */ +# define SPLICE_F_MOVE 1 /* Move pages instead of copying. */ +# define SPLICE_F_NONBLOCK 2 /* Don't block on the pipe splicing + (but we may still block on the fd + we splice from/to). */ +# define SPLICE_F_MORE 4 /* Expect more data. */ +# define SPLICE_F_GIFT 8 /* Pages passed in are a gift. */ +#endif + +__BEGIN_DECLS + +#if defined __USE_GNU && defined __UCLIBC_LINUX_SPECIFIC__ + +/* Provide kernel hint to read ahead. */ +extern ssize_t readahead (int __fd, __off64_t __offset, size_t __count) + __THROW; + + +/* Selective file content synch'ing. */ +extern int sync_file_range (int __fd, __off64_t __from, __off64_t __to, + unsigned int __flags); + +/* Splice address range into a pipe. */ +extern ssize_t vmsplice (int __fdout, const struct iovec *__iov, + size_t __count, unsigned int __flags); + +/* Splice two files together. */ +extern ssize_t splice (int __fdin, __off64_t *__offin, int __fdout, + __off64_t *__offout, size_t __len, + unsigned int __flags); + +/* In-kernel implementation of tee for pipe buffers. */ +extern ssize_t tee (int __fdin, int __fdout, size_t __len, + unsigned int __flags); + +#endif +__END_DECLS diff --git a/libc/sysdeps/linux/c6x/bits/kernel_stat.h b/libc/sysdeps/linux/c6x/bits/kernel_stat.h new file mode 100644 index 000000000..9c0bfa640 --- /dev/null +++ b/libc/sysdeps/linux/c6x/bits/kernel_stat.h @@ -0,0 +1,52 @@ +#ifndef _BITS_STAT_STRUCT_H +#define _BITS_STAT_STRUCT_H + +/* This file provides whatever this particular arch's kernel thinks + * struct kernel_stat should look like... It turns out each arch has a + * 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; + struct timespec st_atim; + struct timespec st_mtim; + struct timespec st_ctim; + unsigned long __unused4; + unsigned long __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. */ + struct timespec st_atim; + struct timespec st_mtim; + struct timespec st_ctim; + __off64_t st_ino; +}; + +#endif /* _BITS_STAT_STRUCT_H */ + diff --git a/libc/sysdeps/linux/c6x/bits/kernel_types.h b/libc/sysdeps/linux/c6x/bits/kernel_types.h new file mode 100644 index 000000000..5dbd2c226 --- /dev/null +++ b/libc/sysdeps/linux/c6x/bits/kernel_types.h @@ -0,0 +1,46 @@ +/* Note that we use the exact same include guard #define names + * as asm/posix_types.h. This will avoid gratuitous conflicts + * with the posix_types.h kernel header, and will ensure that + * our private content, and not the kernel header, will win. + * -Erik + */ +#ifndef __ASM_GENERIC_POSIX_TYPES_H +#define __ASM_GENERIC_POSIX_TYPES_H + +typedef unsigned short __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 int __kernel_pid_t; +typedef unsigned short __kernel_ipc_pid_t; +typedef unsigned short __kernel_uid_t; +typedef unsigned short __kernel_gid_t; +typedef unsigned int __kernel_size_t; +typedef int __kernel_ssize_t; +typedef int __kernel_ptrdiff_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 + int val[2]; +#else + int __val[2]; +#endif +} __kernel_fsid_t; + +#endif /* __ASM_GENERIC_POSIX_TYPES_H */ diff --git a/libc/sysdeps/linux/c6x/bits/mathdef.h b/libc/sysdeps/linux/c6x/bits/mathdef.h new file mode 100644 index 000000000..df12adf03 --- /dev/null +++ b/libc/sysdeps/linux/c6x/bits/mathdef.h @@ -0,0 +1,39 @@ +/* Copyright (C) 1997, 1998, 1999, 2000 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. */ + +#if !defined _MATH_H && !defined _COMPLEX_H +# error "Never use directly; include instead" +#endif + +#if defined __USE_ISOC99 && defined _MATH_H && !defined _MATH_H_MATHDEF +# define _MATH_H_MATHDEF 1 + +typedef float float_t; +typedef double double_t; + +/* The values returned by `ilogb' for 0 and NaN respectively. */ +# define FP_ILOGB0 (-2147483647 - 1) +# define FP_ILOGBNAN (2147483647) + +#endif /* ISO C99 */ + +#ifndef __NO_LONG_DOUBLE_MATH +/* Signal that we do not really have a `long double'. This disables the + declaration of all the `long double' function variants. */ +# define __NO_LONG_DOUBLE_MATH 1 +#endif diff --git a/libc/sysdeps/linux/c6x/bits/nan.h b/libc/sysdeps/linux/c6x/bits/nan.h new file mode 100644 index 000000000..85225da9f --- /dev/null +++ b/libc/sysdeps/linux/c6x/bits/nan.h @@ -0,0 +1,57 @@ +/* `NAN' constant for IEEE 754 machines. + Copyright (C) 1992,1996,1997,1999,2004,2006 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 _MATH_H +# error "Never use directly; include instead." +#endif + +/* IEEE Not A Number. */ + +/* + * Copied from the common code and modified for TI tool wrapper. + * Copyright (C) 2010 Texas Instruments Incorporated + */ + +#if __GNUC_PREREQ(3,3) + +# define NAN (__builtin_nanf ("")) + +#elif defined __GNUC__ && ! defined __TI_TOOL_WRAPPER__ + +# define NAN \ + (__extension__ \ + ((union { unsigned __l __attribute__ ((__mode__ (__SI__))); float __d; }) \ + { __l: 0x7fc00000UL }).__d) + +#else + +# include + +# if __BYTE_ORDER == __BIG_ENDIAN +# define __nan_bytes { 0x7f, 0xc0, 0, 0 } +# endif +# if __BYTE_ORDER == __LITTLE_ENDIAN +# define __nan_bytes { 0, 0, 0xc0, 0x7f } +# endif + +static union { unsigned char __c[4]; float __d; } __nan_union + = { __nan_bytes }; +# define NAN (__nan_union.__d) + +#endif /* GCC. */ diff --git a/libc/sysdeps/linux/c6x/bits/poll.h b/libc/sysdeps/linux/c6x/bits/poll.h new file mode 100644 index 000000000..f7a739315 --- /dev/null +++ b/libc/sysdeps/linux/c6x/bits/poll.h @@ -0,0 +1,43 @@ +/* Copyright (C) 1997, 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_POLL_H +# error "Never use directly; include instead." +#endif + +/* Event types that can be polled for. These bits may be set in `events' + to indicate the interesting event types; they will appear in `revents' + to indicate the status of the file descriptor. */ +#define POLLIN 0x001 /* There is data to read. */ +#define POLLPRI 0x002 /* There is urgent data to read. */ +#define POLLOUT 0x004 /* Writing now will not block. */ + +#ifdef __USE_XOPEN +/* These values are defined in XPG4.2. */ +# define POLLRDNORM 0x040 /* Normal data may be read. */ +# define POLLRDBAND 0x080 /* Priority data may be read. */ +# define POLLWRNORM POLLOUT /* Writing now will not block. */ +# define POLLWRBAND 0x100 /* Priority data may be written. */ +#endif + +/* Event types always implicitly polled for. These bits need not be set in + `events', but they will appear in `revents' to indicate the status of + the file descriptor. */ +#define POLLERR 0x008 /* Error condition. */ +#define POLLHUP 0x010 /* Hung up. */ +#define POLLNVAL 0x020 /* Invalid polling request. */ diff --git a/libc/sysdeps/linux/c6x/bits/resource.h b/libc/sysdeps/linux/c6x/bits/resource.h new file mode 100644 index 000000000..57d17821e --- /dev/null +++ b/libc/sysdeps/linux/c6x/bits/resource.h @@ -0,0 +1,209 @@ +/* Bit values & structures for resource limits. Linux/m68k version. + Copyright (C) 1994,1996,1997,1998,1999,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_RESOURCE_H +# error "Never use directly; include instead." +#endif + +#include + +/* Transmute defines to enumerations. The macro re-definitions are + necessary because some programs want to test for operating system + features with #ifdef RUSAGE_SELF. In ISO C the reflexive + definition is a no-op. */ + +/* Kinds of resource limit. */ +enum __rlimit_resource +{ + /* Per-process CPU limit, in seconds. */ + RLIMIT_CPU = 0, +#define RLIMIT_CPU RLIMIT_CPU + + /* Largest file that can be created, in bytes. */ + RLIMIT_FSIZE = 1, +#define RLIMIT_FSIZE RLIMIT_FSIZE + + /* Maximum size of data segment, in bytes. */ + RLIMIT_DATA = 2, +#define RLIMIT_DATA RLIMIT_DATA + + /* Maximum size of stack segment, in bytes. */ + RLIMIT_STACK = 3, +#define RLIMIT_STACK RLIMIT_STACK + + /* Largest core file that can be created, in bytes. */ + RLIMIT_CORE = 4, +#define RLIMIT_CORE RLIMIT_CORE + + /* Largest resident set size, in bytes. + This affects swapping; processes that are exceeding their + resident set size will be more likely to have physical memory + taken from them. */ + RLIMIT_RSS = 5, +#define RLIMIT_RSS RLIMIT_RSS + + /* Number of open files. */ + RLIMIT_NOFILE = 7, + RLIMIT_OFILE = RLIMIT_NOFILE, /* BSD name for same. */ +#define RLIMIT_NOFILE RLIMIT_NOFILE +#define RLIMIT_OFILE RLIMIT_OFILE + + /* Address space limit. */ + RLIMIT_AS = 9, +#define RLIMIT_AS RLIMIT_AS + + /* Number of processes. */ + RLIMIT_NPROC = 6, +#define RLIMIT_NPROC RLIMIT_NPROC + + /* Locked-in-memory address space. */ + RLIMIT_MEMLOCK = 8, +#define RLIMIT_MEMLOCK RLIMIT_MEMLOCK + + /* Maximum number of file locks. */ + RLIMIT_LOCKS = 10, +#define RLIMIT_LOCKS RLIMIT_LOCKS + + RLIMIT_NLIMITS = 11, + RLIM_NLIMITS = RLIMIT_NLIMITS +#define RLIMIT_NLIMITS RLIMIT_NLIMITS +#define RLIM_NLIMITS RLIM_NLIMITS +}; + +/* Value to indicate that there is no limit. */ +#ifndef __USE_FILE_OFFSET64 +# define RLIM_INFINITY ((unsigned long)(~0UL)) +#else +# define RLIM_INFINITY 0xffffffffffffffffuLL +#endif + +#ifdef __USE_LARGEFILE64 +# define RLIM64_INFINITY 0xffffffffffffffffuLL +#endif + +/* We can represent all limits. */ +#define RLIM_SAVED_MAX RLIM_INFINITY +#define RLIM_SAVED_CUR RLIM_INFINITY + + +/* Type for resource quantity measurement. */ +#ifndef __USE_FILE_OFFSET64 +typedef __rlim_t rlim_t; +#else +typedef __rlim64_t rlim_t; +#endif +#ifdef __USE_LARGEFILE64 +typedef __rlim64_t rlim64_t; +#endif + +struct rlimit + { + /* The current (soft) limit. */ + rlim_t rlim_cur; + /* The hard limit. */ + rlim_t rlim_max; + }; + +#ifdef __USE_LARGEFILE64 +struct rlimit64 + { + /* The current (soft) limit. */ + rlim64_t rlim_cur; + /* The hard limit. */ + rlim64_t rlim_max; + }; +#endif + +/* Whose usage statistics do you want? */ +enum __rusage_who +{ + /* The calling process. */ + RUSAGE_SELF = 0, +#define RUSAGE_SELF RUSAGE_SELF + + /* All of its terminated child processes. */ + RUSAGE_CHILDREN = -1, +#define RUSAGE_CHILDREN RUSAGE_CHILDREN + + /* Both. */ + RUSAGE_BOTH = -2 +#define RUSAGE_BOTH RUSAGE_BOTH +}; + +#define __need_timeval +#include /* For `struct timeval'. */ + +/* Structure which says how much of each resource has been used. */ +struct rusage + { + /* Total amount of user time used. */ + struct timeval ru_utime; + /* Total amount of system time used. */ + struct timeval ru_stime; + /* Maximum resident set size (in kilobytes). */ + long ru_maxrss; + /* Amount of sharing of text segment memory + with other processes (kilobyte-seconds). */ + long ru_ixrss; + /* Amount of data segment memory used (kilobyte-seconds). */ + long ru_idrss; + /* Amount of stack memory used (kilobyte-seconds). */ + long ru_isrss; + /* Number of soft page faults (i.e. those serviced by reclaiming + a page from the list of pages awaiting reallocation. */ + long ru_minflt; + /* Number of hard page faults (i.e. those that required I/O). */ + long ru_majflt; + /* Number of times a process was swapped out of physical memory. */ + long ru_nswap; + /* Number of input operations via the file system. Note: This + and `ru_oublock' do not include operations with the cache. */ + long ru_inblock; + /* Number of output operations via the file system. */ + long ru_oublock; + /* Number of IPC messages sent. */ + long ru_msgsnd; + /* Number of IPC messages received. */ + long ru_msgrcv; + /* Number of signals delivered. */ + long ru_nsignals; + /* Number of voluntary context switches, i.e. because the process + gave up the process before it had to (usually to wait for some + resource to be available). */ + long ru_nvcsw; + /* Number of involuntary context switches, i.e. a higher priority process + became runnable or the current process used up its time slice. */ + long ru_nivcsw; + }; + +/* Priority limits. */ +#define PRIO_MIN -20 /* Minimum priority a process can have. */ +#define PRIO_MAX 20 /* Maximum priority a process can have. */ + +/* The type of the WHICH argument to `getpriority' and `setpriority', + indicating what flavor of entity the WHO argument specifies. */ +enum __priority_which +{ + PRIO_PROCESS = 0, /* WHO is a process ID. */ +#define PRIO_PROCESS PRIO_PROCESS + PRIO_PGRP = 1, /* WHO is a process group ID. */ +#define PRIO_PGRP PRIO_PGRP + PRIO_USER = 2 /* WHO is a user ID. */ +#define PRIO_USER PRIO_USER +}; diff --git a/libc/sysdeps/linux/c6x/bits/setjmp.h b/libc/sysdeps/linux/c6x/bits/setjmp.h new file mode 100644 index 000000000..259e23b34 --- /dev/null +++ b/libc/sysdeps/linux/c6x/bits/setjmp.h @@ -0,0 +1,39 @@ +/* + * 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 + * + */ + +#ifndef _SETJMP_H +# error "Never include directly; use instead." +#endif + +typedef struct { + unsigned long __regs[12]; /* save A10,B10... A15,B15*/ + unsigned long __pc; /* the return address */ +} __jmp_buf[1]; + +/* the stack pointer (B15) */ +#define JP_SP 11 + +/* Test if longjmp to JMPBUF would unwind the frame + containing a local variable at ADDRESS. */ +#define _JMPBUF_UNWINDS(jmpbuf, address) \ + ((void *) (address) < (void *) (jmpbuf)->__regs[JP_SP]) + + diff --git a/libc/sysdeps/linux/c6x/bits/sigcontextinfo.h b/libc/sysdeps/linux/c6x/bits/sigcontextinfo.h new file mode 100644 index 000000000..b7e08cfc9 --- /dev/null +++ b/libc/sysdeps/linux/c6x/bits/sigcontextinfo.h @@ -0,0 +1,26 @@ +/* Copyright (C) 1998, 1999, 2001 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Andreas Schwab , 1998. + + 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. */ + +#define SIGCONTEXT int _code, struct sigcontext * +#define SIGCONTEXT_EXTRA_ARGS _code, +#define GET_PC(ctx) ((void *) (ctx)->sc_pc) +#define GET_FRAME(ctx) ((void *) __builtin_frame_address (1)) +#define GET_STACK(ctx) ((void *) (ctx)->sc_usp) +#define CALL_SIGHANDLER(handler, signo, ctx) \ + (handler)((signo), SIGCONTEXT_EXTRA_ARGS (ctx)) diff --git a/libc/sysdeps/linux/c6x/bits/stackinfo.h b/libc/sysdeps/linux/c6x/bits/stackinfo.h new file mode 100644 index 000000000..9dbf06ae6 --- /dev/null +++ b/libc/sysdeps/linux/c6x/bits/stackinfo.h @@ -0,0 +1,28 @@ +/* Copyright (C) 1999 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. */ + +/* This file contains a bit of information about the stack allocation + of the processor. */ + +#ifndef _STACKINFO_H +#define _STACKINFO_H 1 + +/* On c6x the stack grows down. */ +#define _STACK_GROWS_DOWN 1 + +#endif /* stackinfo.h */ diff --git a/libc/sysdeps/linux/c6x/bits/stat.h b/libc/sysdeps/linux/c6x/bits/stat.h new file mode 100644 index 000000000..eba31245d --- /dev/null +++ b/libc/sysdeps/linux/c6x/bits/stat.h @@ -0,0 +1,174 @@ +/* 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. */ diff --git a/libc/sysdeps/linux/c6x/bits/syscalls.h b/libc/sysdeps/linux/c6x/bits/syscalls.h new file mode 100644 index 000000000..382ec5124 --- /dev/null +++ b/libc/sysdeps/linux/c6x/bits/syscalls.h @@ -0,0 +1,182 @@ +#ifndef _BITS_SYSCALLS_H +#define _BITS_SYSCALLS_H +#ifndef _SYSCALL_H +# error "Never use directly; include instead." +#endif + +#ifndef __ASSEMBLER__ + +#include + +#define SYS_ify(syscall_name) (__NR_##syscall_name) + +#undef __SYSCALL_STRING +# define __SYSCALL_STRING \ + "swe\n\t" \ + "nop\n\t" + +# define __SYSCALL_RES_CHECK (__res < -255 || __res >= 0) + +#define __SYSCALL_CLOBBERS "cc", "memory" + +#define __SYSCALL_RETURN(type) \ + if (__SYSCALL_RES_CHECK) \ + return (type) __res; \ + __set_errno (-__res); \ + return (type) -1; + +#ifndef NOT_IN_libc +#define DEBUG_SYSCALL(name) { \ + char d[64];\ + write( 2, d, snprintf( d, 64, "syscall %d error %d\n", __NR_##name, _inline_sys_result)); \ +} +#else +#define DEBUG_SYSCALL(name) do{} while(0) +#endif + +#undef INLINE_SYSCALL +#define INLINE_SYSCALL(name, nr, args...) \ + ({ unsigned int _inline_sys_result = INTERNAL_SYSCALL (name, , nr, args); \ + if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (_inline_sys_result, ), 0)) \ + { \ + __set_errno (INTERNAL_SYSCALL_ERRNO (_inline_sys_result, )); \ + _inline_sys_result = (unsigned int) -1; \ + } \ + (int) _inline_sys_result; }) + +#undef INLINE_SYSCALL_NOERR +#define INLINE_SYSCALL_NOERR(name, nr, args...) \ + ({ unsigned int _inline_sys_result = INTERNAL_SYSCALL (name, , nr, args); \ + (int) _inline_sys_result; }) + +#undef INTERNAL_SYSCALL_DECL +#define INTERNAL_SYSCALL_DECL(err) do { } while (0) + + +#define INTERNAL_SYSCALL( name, err, nr, args...) \ + INTERNAL_SYSCALL_NCS( __NR_##name, err, nr, args ) + + +#define INTERNAL_SYSCALL_NCS(sys_num, err, nr, args...) \ + ({ \ + register long __A4 __asm__("A4"); \ + register long __b0 __asm__("B0") = sys_num; \ + LOAD_ARGS_##nr(args) \ + __asm__ __volatile__(__SYSCALL_STRING \ + : "=a" (__A4) \ + : "b" (__b0) ASM_ARGS_##nr \ + : __SYSCALL_CLOBBERS ); \ + (int)__A4; \ + }) + +#undef INTERNAL_SYSCALL_ERROR_P +#define INTERNAL_SYSCALL_ERROR_P(val, err) \ + ((unsigned int) (val) >= 0xfffff001u) + +#undef INTERNAL_SYSCALL_ERRNO +#define INTERNAL_SYSCALL_ERRNO(val, err) (-(val)) + +#if 0 +# define CALL_ERRNO_LOCATION "call __errno_location;" +#define __CLONE_SYSCALL_STRING \ + "ta 0x10;" \ + "bcs 2f;" \ + " sub %%o1, 1, %%o1;" \ + "and %%A4, %%o1, %%A4;" \ + "1:" \ + ".subsection 2;" \ + "2:" \ + "save %%sp, -192, %%sp;" \ + CALL_ERRNO_LOCATION \ + " nop;" \ + "st %%i0, [%%A4];" \ + "ba 1b;" \ + " restore %%g0, -1, %%A4;" \ + ".previous;" + +#define INLINE_CLONE_SYSCALL(arg1,arg2,arg3,arg4,arg5) \ +({ \ + register long __A4 __asm__ ("A4") = (long)(arg1); \ + register long __B4 __asm__ ("B4") = (long)(arg2); \ + register long __A6 __asm__ ("A6") = (long)(arg3); \ + register long __B6 __asm__ ("B6") = (long)(arg4); \ + register long __A8 __asm__ ("A8") = (long)(arg5); \ + register long __g1 __asm__ ("g1") = __NR_clone; \ + __asm __volatile (__CLONE_SYSCALL_STRING : \ + "=r" (__g1), "=r" (__A4), "=r" (__B4) : \ + "0" (__g1), "1" (__A4), "2" (__B4), \ + "r" (__A6), "r" (__B6), "r" (__A8) : \ + __SYSCALL_CLOBBERS); \ + __A4; \ +}) +#endif + +#define LOAD_ARGS_0() +#define ASM_ARGS_0 +#define LOAD_ARGS_1(A4) \ + __A4 = (int)A4; \ + LOAD_ARGS_0() +#define ASM_ARGS_1 ASM_ARGS_0, "a" (__A4) +#define LOAD_ARGS_2(A4, B4) \ + register int __B4 __asm__ ("B4") = (int) (B4); \ + LOAD_ARGS_1 (A4) +#define ASM_ARGS_2 ASM_ARGS_1, "b" (__B4) +#define LOAD_ARGS_3(A4, B4, A6) \ + register int __A6 __asm__ ("A6") = (int) (A6); \ + LOAD_ARGS_2 (A4, B4) +#define ASM_ARGS_3 ASM_ARGS_2, "a" (__A6) +#define LOAD_ARGS_4(A4, B4, A6, B6) \ + register int __B6 __asm__ ("B6") = (int) (B6); \ + LOAD_ARGS_3 (A4, B4, A6) +#define ASM_ARGS_4 ASM_ARGS_3, "b" (__B6) +#define LOAD_ARGS_5(A4, B4, A6, B6, A8) \ + register int __A8 __asm__ ("A8") = (int) (A8); \ + LOAD_ARGS_4 (A4, B4, A6, B6) +#define ASM_ARGS_5 ASM_ARGS_4, "a" (__A8) +#define LOAD_ARGS_6(A4, B4, A6, B6, A8, B8) \ + register int __B8 __asm__ ("B8") = (int) (B8); \ + LOAD_ARGS_5 (A4, B4, A6, B6, A8) +#define ASM_ARGS_6 ASM_ARGS_5, "b" (__B8) + +#ifndef _syscall0 + +#define C_DECL_ARGS_0() void +#define C_DECL_ARGS_1(t, v) t v +#define C_DECL_ARGS_2(t, v, args...) t v, C_DECL_ARGS_1(args) +#define C_DECL_ARGS_3(t, v, args...) t v, C_DECL_ARGS_2(args) +#define C_DECL_ARGS_4(t, v, args...) t v, C_DECL_ARGS_3(args) +#define C_DECL_ARGS_5(t, v, args...) t v, C_DECL_ARGS_4(args) +#define C_DECL_ARGS_6(t, v, args...) t v, C_DECL_ARGS_5(args) + +#define C_ARGS_0() +#define C_ARGS_1(t, v) v +#define C_ARGS_2(t, v, args...) v, C_ARGS_1(args) +#define C_ARGS_3(t, v, args...) v, C_ARGS_2(args) +#define C_ARGS_4(t, v, args...) v, C_ARGS_3(args) +#define C_ARGS_5(t, v, args...) v, C_ARGS_4(args) +#define C_ARGS_6(t, v, args...) v, C_ARGS_5(args) + +#define SYSCALL_FUNC(nargs, type, name, args...) \ +type name(C_DECL_ARGS_##nargs(args)) { \ + return (type)INLINE_SYSCALL(name, nargs, C_ARGS_##nargs(args)); \ +} + +#define SYSCALL_NOERR_FUNC(nargs, type, name, args...) \ +type name(C_DECL_ARGS_##nargs(args)) { \ + return (type)INLINE_SYSCALL_NOERR(name, nargs, C_ARGS_##nargs(args)); \ +} + +#define _syscall0(args...) SYSCALL_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) +#define _syscall3(args...) SYSCALL_FUNC(3, args) +#define _syscall4(args...) SYSCALL_FUNC(4, args) +#define _syscall5(args...) SYSCALL_FUNC(5, args) +#define _syscall6(args...) SYSCALL_FUNC(6, args) + +#endif /* _syscall0 */ + +#endif /* __ASSEMBLER__ */ +#endif /* _BITS_SYSCALLS_H */ + diff --git a/libc/sysdeps/linux/c6x/bits/uClibc_arch_features.h b/libc/sysdeps/linux/c6x/bits/uClibc_arch_features.h new file mode 100644 index 000000000..59e7de987 --- /dev/null +++ b/libc/sysdeps/linux/c6x/bits/uClibc_arch_features.h @@ -0,0 +1,48 @@ +/* + * Track misc arch-specific features that aren't config options + */ + +#ifndef _BITS_UCLIBC_ARCH_FEATURES_H +#define _BITS_UCLIBC_ARCH_FEATURES_H + +/* instruction used when calling abort() to kill yourself */ +/*#define __UCLIBC_ABORT_INSTRUCTION__ "asm instruction"*/ +#undef __UCLIBC_ABORT_INSTRUCTION__ + +/* can your target use syscall6() for mmap ? */ +#define __UCLIBC_MMAP_HAS_6_ARGS__ + +/* does your target use syscall4() for truncate64 ? (32bit arches only) */ +#undef __UCLIBC_TRUNCATE64_HAS_4_ARGS__ + +/* does your target have a broken create_module() ? */ +#undef __UCLIBC_BROKEN_CREATE_MODULE__ + +/* does your target have to worry about older [gs]etrlimit() ? */ +#undef __UCLIBC_HANDLE_OLDER_RLIMIT__ + +/* does your target have an asm .set ? */ +#define __UCLIBC_HAVE_ASM_SET_DIRECTIVE__ + +/* define if target doesn't like .global */ +#undef __UCLIBC_ASM_GLOBAL_DIRECTIVE__ + +/* define if target supports .weak */ +#define __UCLIBC_HAVE_ASM_WEAK_DIRECTIVE__ + +/* define if target supports .weakext */ +#undef __UCLIBC_HAVE_ASM_WEAKEXT_DIRECTIVE__ + +/* needed probably only for ppc64 */ +#undef __UCLIBC_HAVE_ASM_GLOBAL_DOT_NAME__ + +/* define if target supports CFI pseudo ops */ +#undef __UCLIBC_HAVE_ASM_CFI_DIRECTIVES__ + +/* define if target supports IEEE signed zero floats */ +#define __UCLIBC_HAVE_SIGNED_ZERO__ + +/* only weird assemblers generally need this */ +#define __UCLIBC_ASM_LINE_SEP__ @ + +#endif /* _BITS_UCLIBC_ARCH_FEATURES_H */ diff --git a/libc/sysdeps/linux/c6x/bits/wordsize.h b/libc/sysdeps/linux/c6x/bits/wordsize.h new file mode 100644 index 000000000..ba643b60a --- /dev/null +++ b/libc/sysdeps/linux/c6x/bits/wordsize.h @@ -0,0 +1,19 @@ +/* Copyright (C) 1999 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. */ + +#define __WORDSIZE 32 diff --git a/libc/sysdeps/linux/c6x/brk.c b/libc/sysdeps/linux/c6x/brk.c new file mode 100644 index 000000000..7eb486308 --- /dev/null +++ b/libc/sysdeps/linux/c6x/brk.c @@ -0,0 +1,54 @@ +/* + * 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 + * + */ + +#include +#include +#include + +libc_hidden_proto(brk) + +/* This must be initialized data because commons can't have aliases. */ +void * __curbrk attribute_hidden = 0; + +int brk (void *addr) +{ + void *newbrk; + + __asm__ __volatile__ ( \ + "mv .d1 %2, A4\n\t" \ + "mvk .s2 %1, B0\n\t" \ + "swe\n\t" \ + "nop\n\t" \ + "mv .d2 B0, %0" \ + : "=b" (newbrk) \ + : "i" (__NR_brk), \ + "a" (addr) \ + : "memory", "cc", "B0", "A4"); \ + + __curbrk = newbrk; + + if (newbrk < addr) { + __set_errno (ENOMEM); + return -1; + } + return 0; +} +libc_hidden_def(brk) diff --git a/libc/sysdeps/linux/c6x/bsd-_setjmp.s b/libc/sysdeps/linux/c6x/bsd-_setjmp.s new file mode 100644 index 000000000..566318a2a --- /dev/null +++ b/libc/sysdeps/linux/c6x/bsd-_setjmp.s @@ -0,0 +1,48 @@ + ; + ; 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 + ; + + .global _setjmp + +_setjmp: + MV .D2X A4,B4 ; jmp_buf address +|| STW .D1T2 B3,*+A4(48) ; return address + + STW .D1T1 A10,*+A4(0) +|| STW .D2T2 B10,*+B4(4) +|| ZERO .L1 A6 + + STW .D1T1 A6,*+A4(52) ; no signal mask set +|| B .S2 B3 ; returns in 5 cycles + + STW .D1T1 A11,*+A4(8) +|| STW .D2T2 B11,*+B4(12) + STW .D1T1 A12,*+A4(16) +|| STW .D2T2 B12,*+B4(20) + STW .D1T1 A13,*+A4(24) +|| STW .D2T2 B13,*+B4(28) + STW .D1T1 A14,*+A4(32) +|| STW .D2T2 B14,*+B4(36) + STW .D1T1 A15,*+A4(40) +|| STW .D2T2 B15,*+B4(44) +|| ZERO .L1 A4 ; return values + + + + diff --git a/libc/sysdeps/linux/c6x/bsd-setjmp.S b/libc/sysdeps/linux/c6x/bsd-setjmp.S new file mode 100644 index 000000000..3ab597d8e --- /dev/null +++ b/libc/sysdeps/linux/c6x/bsd-setjmp.S @@ -0,0 +1,67 @@ + ; + ; 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 + ; + + .global setjmp +setjmp: +#if 0 +.if 1 /* was: .if (CONFIG_UCLIBC_SHARED == 0) */ + + MVKL .S1 ___curr_eh_stack_entry,A6 +|| SUB .D1X A4,B15,A3 + MVKH .S1 ___curr_eh_stack_entry,A6 +|| CMPGT .L1 A3,4,A0 ; A0 set if C++ exceptions case + + LDW .D1T1 *A6,A2 +.else + MVKL .S2 (___curr_eh_stack_entry - $bss)/4,B6 +|| SUB .D1X A4,B15,A3 + MVKH .S2 (___curr_eh_stack_entry - $bss)/4,B6 +|| CMPGT .L1 A3,4,A0 ; A0 set if C++ exceptions case + + LDW .D2T1 *+B14[B6],A2 +.endif + NOP +#else + MVK .S1 0, A0 +#endif + + MVK .L2 1,B4 ; indicate to ___sigjmp_save to save signal mask +|| MV .D2X A4,B6 ; jmp_buf address +|| STW .D1T2 B3,*+A4(48) ; return address + + ADDAW .D1 A2,2,A2 + [A0] CMPEQ .L1 A4,A2,A0 ; A0 set if C++ exceptions case + + STW .D1T1 A10,*+A4(0) +|| STW .D2T2 B10,*+B6(4) +||[!A0] B .S1 __sigjmp_save ; branch to ___sigjmp_save in 5 cycles +||[A0] B .S2 B3 + + STW .D1T1 A11,*+A4(8) +|| STW .D2T2 B11,*+B6(12) + STW .D1T1 A12,*+A4(16) +|| STW .D2T2 B12,*+B6(20) + STW .D1T1 A13,*+A4(24) +|| STW .D2T2 B13,*+B6(28) + STW .D1T1 A14,*+A4(32) +|| STW .D2T2 B14,*+B6(36) + STW .D1T1 A15,*+A4(40) +|| STW .D2T2 B15,*+B6(44) +||[A0] ZERO .L1 A4 ; returns 0 for the C++ case diff --git a/libc/sysdeps/linux/c6x/clone.S b/libc/sysdeps/linux/c6x/clone.S new file mode 100644 index 000000000..8d9da4b49 --- /dev/null +++ b/libc/sysdeps/linux/c6x/clone.S @@ -0,0 +1,97 @@ + ; + ; 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 + ; + + ; int _clone(int (*fn)(void *arg), void *child_stack, int flags, void *arg); + +#include +#include + + .global __clone + .global clone + .global __errno_location + + ;Currently supports only + ;int clone(int (*fn)(void *arg), void *child_stack, int flags, void *arg) + ; + ;Requires update for supporting + ; int clone(int (*fn)(void *arg), void *child_stack, int flags, void *arg, + ; int *parent_tidptr, struct user_desc *newtls, int *child_pidptr) + +__clone: + ; index 1 points to the forth argument and is to be moved to B6 + LDW .D2T2 *+B15[1],B5 + NOP 4 + OR .D2X B4,A4,B2 ; sanity check arguments, no NULL function or stack pointers +|| MV .S2 B4,B9 +|| MV .D1 A4,A9 ; backup fn and child_stack pointers + + [!B2] B .S2 __syscall_error +||[!B2] MVK .S1 EINVAL,A4 + NOP 4 + + MV .D1 A6,A4 ; get flags as arg0, arg1 is the new stack +|| AND .D2 ~7,B4,B4 + + ; do the system call +|| MVK .S2 120,B0 ; __NR_clone +|| MV .L2 B5,B6 +0: +#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 + NOP +#else + SWE +#endif + + MV .D2 B9,B4 ; restore child stack + +|| CMPEQ .L1 0,A4,A2 +|| CMPLT .L2X A4,0,B2 + + [B2] B .S2 __syscall_error ; if syscall < 0, it is an error + NOP 5 + [A2] B .S2X A9 ; branch to function +|| [A2] MV .D1X B6,A4 ; set arg (B6 is preserved by syscall) + [!A2] B .S2 B3 ; otherwise (syscall result > 0) returns directly + [A2] ADDKPC .S2 __return_thread,B3, 4 + +__return_thread: + b .s2 HIDDEN_JUMPTARGET(_exit) + nop 5 + +__syscall_error: + 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 + +.set clone, __clone diff --git a/libc/sysdeps/linux/c6x/crt1.S b/libc/sysdeps/linux/c6x/crt1.S new file mode 100644 index 000000000..810f39557 --- /dev/null +++ b/libc/sysdeps/linux/c6x/crt1.S @@ -0,0 +1,67 @@ +; +; Port of uClibc for TMS320C6000 DSP architecture +; +; Copyright (C) 2010 Texas Instruments Incorporated +; 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 +; + + .text + + ;; On entry, the dynamic linker + ;; + ;; 0(sp) pad0 + ;; 4(sp) pad1 + ;; 8(sp) argc + ;; 12(sp) argv[0] + ;; ... + ;; (4*(argc+3))(sp) NULL + ;; (4*(argc+4))(sp) envp[0] + ;; ... + ;; NULL + + ;; Register values are unspecified, except: + ;; + ;; A4 --> pointer to rtld fini rountine + ;; B14 --> pointer to application DSBT table + + .global _start +_start: + .global _c_int00 +_c_int00: + ;; Things to do: + ;; + ;; * call __uClibc_main( + ;; int (*main)(int, char **, char **), A4 + ;; int argc, B4 + ;; char **argv, A6 + ;; void (*app_init)(void), B6 + ;; void (*app_fini)(void), A8 + ;; void (*rtld_fini)(void), B8 + ;; void *stack_end) A10 + + MV .D2X A4,B8 ; rtld_fini + + LDW .D2T1 *+B14($GOT(main)), A4 + LDW .D2T2 *+B14($GOT(_init)), B6 + B .S2 __uClibc_main +|| LDW .D2T1 *+B14($GOT(_fini)), A8 + + LDW .D2T2 *+B15(8),B4 ; argc + ADDAW .D1X B15,3,A6 ; **argv + MV .D1X B15,A10 ; stack_end +|| ZERO .L1 A15 ; clear FP + NOP 2 diff --git a/libc/sysdeps/linux/c6x/crti.S b/libc/sysdeps/linux/c6x/crti.S new file mode 100644 index 000000000..e689a04d1 --- /dev/null +++ b/libc/sysdeps/linux/c6x/crti.S @@ -0,0 +1,17 @@ +/* + * This file just supplies function prologues for the .init and .fini + * sections. It is linked in before crtbegin.o. + */ + + .section .init + .globl _init + .type _init,@function +_init: + add .l2 -8, B15, B15 + stw .d2t2 B3,*+B15(4) + .section .fini + .globl _fini + .type _fini,@function +_fini: + add .l2 -8, B15, B15 + stw .d2t2 B3,*+B15(4) diff --git a/libc/sysdeps/linux/c6x/crtn.S b/libc/sysdeps/linux/c6x/crtn.S new file mode 100644 index 000000000..37e799df3 --- /dev/null +++ b/libc/sysdeps/linux/c6x/crtn.S @@ -0,0 +1,19 @@ +/* + * This file supplies function epilogues for the .init and .fini sections. + * It is linked in after all other files. + */ + + .section .init + ldw .d2t2 *+B15(4), B3 + add .d2 B15, 8, B15 + nop 3 + ret .s2 B3 + nop 5 + + .section .fini + ldw .d2t2 *+B15(4), B3 + add .d2 B15, 8, B15 + nop 3 + ret .s2 B3 + nop 5 + diff --git a/libc/sysdeps/linux/c6x/prctl.c b/libc/sysdeps/linux/c6x/prctl.c new file mode 100644 index 000000000..fcf1f9d54 --- /dev/null +++ b/libc/sysdeps/linux/c6x/prctl.c @@ -0,0 +1,43 @@ +/* vi: set sw=4 ts=4: */ +/* + * prctl() for uClibc + * + * Copyright (C) 2000-2006 Erik Andersen + * + * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. + */ + +#include +#include +/* psm: including sys/prctl.h would depend on kernel headers */ + +#ifdef __NR_prctl +extern int prctl (int __option, ...); +int prctl (int __option, ...) +{ + register long no __asm__("B0"); + register long a __asm__("A4"); + register long b __asm__("B4"); + register long c __asm__("A6"); + register long d __asm__("B6"); + register long e __asm__("A8"); + int __res; + va_list ap; + + va_start( ap, __option); + a = __option; + b = va_arg( ap, long); + c = va_arg( ap, long); + d = va_arg( ap, long); + e = va_arg( ap, long); + va_end( ap ); + + no = __NR_prctl; + + __asm__ __volatile__ ("SWE" : "=a" (a) : "a" (a), "b" (b), "a" (c), "b" (d), "a" (e), "b" (no) + : "memory", "cc"); + + __res = a; + __SYSCALL_RETURN (int); +} +#endif diff --git a/libc/sysdeps/linux/c6x/pread_write.c b/libc/sysdeps/linux/c6x/pread_write.c new file mode 100644 index 000000000..f985b4374 --- /dev/null +++ b/libc/sysdeps/linux/c6x/pread_write.c @@ -0,0 +1,103 @@ +/* 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/c6x/setjmp.s b/libc/sysdeps/linux/c6x/setjmp.s new file mode 100644 index 000000000..28a4f0370 --- /dev/null +++ b/libc/sysdeps/linux/c6x/setjmp.s @@ -0,0 +1,43 @@ + ; + ; 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 + ; + + .global __sigsetjmp +; .ref __sigjmp_save + +__sigsetjmp: + MV .D2X A4,B6 ; jmp_buf address +|| STW .D1T2 B3,*+A4(48) ; return address + + STW .D1T1 A10,*+A4(0) +|| STW .D2T2 B10,*+B6(4) +|| B .S2 __sigjmp_save ; branch to ___sigjmp_save in 5 cycles + + STW .D1T1 A11,*+A4(8) +|| STW .D2T2 B11,*+B6(12) + STW .D1T1 A12,*+A4(16) +|| STW .D2T2 B12,*+B6(20) + STW .D1T1 A13,*+A4(24) +|| STW .D2T2 B13,*+B6(28) + STW .D1T1 A14,*+A4(32) +|| STW .D2T2 B14,*+B6(36) + STW .D1T1 A15,*+A4(40) +|| STW .D2T2 B15,*+B6(44) + + diff --git a/libc/sysdeps/linux/c6x/sigaction.c b/libc/sysdeps/linux/c6x/sigaction.c new file mode 100644 index 000000000..1865998ee --- /dev/null +++ b/libc/sysdeps/linux/c6x/sigaction.c @@ -0,0 +1,115 @@ +/* + Copyright (C) 2010 Texas Instruments Incorporated + Adapted from i386 version by Mark Salter + + Copyright (C) 1997, 1998, 1999, 2000 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. + + Totally hacked up for uClibc by Erik Andersen + */ + +#include +#include +#include +#include +#include + +#define SA_RESTORER 0x04000000 + +extern __typeof(sigaction) __libc_sigaction; + +extern void restore_rt(void) __asm__ ("__restore_rt") attribute_hidden; +extern void restore(void) __asm__ ("__restore") attribute_hidden; + +/* 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. */ +int __libc_sigaction (int sig, const struct sigaction *act, struct sigaction *oact) +{ + int result; + struct kernel_sigaction kact, koact; + +#ifdef SIGCANCEL + if (sig == SIGCANCEL) { + __set_errno (EINVAL); + return -1; + } +#endif + + if (act) { + kact.k_sa_handler = act->sa_handler; + memcpy (&kact.sa_mask, &act->sa_mask, sizeof (kact.sa_mask)); + kact.sa_flags = act->sa_flags; + + kact.sa_flags = act->sa_flags | SA_RESTORER; + kact.sa_restorer = ((act->sa_flags & SA_SIGINFO) + ? &restore_rt : &restore); + } + + /* XXX The size argument hopefully will have to be changed to the + real size of the user-level sigset_t. */ + result = __syscall_rt_sigaction(sig, act ? __ptrvalue (&kact) : NULL, + oact ? __ptrvalue (&koact) : NULL, _NSIG / 8); + + if (oact && result >= 0) { + oact->sa_handler = koact.k_sa_handler; + memcpy (&oact->sa_mask, &koact.sa_mask, sizeof (oact->sa_mask)); + oact->sa_flags = koact.sa_flags; + oact->sa_restorer = koact.sa_restorer; + } + return result; +} + +#ifndef LIBC_SIGACTION +weak_alias(__libc_sigaction,sigaction) +libc_hidden_weak(sigaction) +#endif + +/* NOTE: Please think twice before making any changes to the bits of + code below. GDB needs some intimate knowledge about it to + recognize them as signal trampolines, and make backtraces through + signal handlers work right. Important are both the names + (__restore and __restore_rt) and the exact instruction sequence. + If you ever feel the need to make any changes, please notify the + appropriate GDB maintainer. */ + +#define RESTORE(name, syscall) RESTORE2 (name, syscall) +#define RESTORE2(name, syscall) \ +__asm__ \ + ( \ + " .text\n" \ + " .global " #name "\n" \ + "__" #name ":\n" \ + " MVK " #syscall ",B0\n" \ + " SWE\n" \ + " NOP\n" \ + " NOP\n" \ + " NOP\n" \ + " NOP\n" \ + " NOP\n" \ + " NOP\n" \ + ); + +#ifdef __NR_rt_sigaction +/* The return code for realtime-signals. */ +RESTORE (restore_rt, __NR_rt_sigreturn) +#endif + +#ifdef __NR_sigreturn +/* For the boring old signals. */ +RESTORE (restore, __NR_sigreturn) +#endif diff --git a/libc/sysdeps/linux/c6x/sys/procfs.h b/libc/sysdeps/linux/c6x/sys/procfs.h new file mode 100644 index 000000000..41c2d0866 --- /dev/null +++ b/libc/sysdeps/linux/c6x/sys/procfs.h @@ -0,0 +1,122 @@ +/* Copyright (C) 1996, 1997, 1999, 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_PROCFS_H +#define _SYS_PROCFS_H 1 + +/* This is somewhat modelled after the file of the same name on SVR4 + systems. It provides a definition of the core file format for ELF + used on Linux. It doesn't have anything to do with the /proc file + system, even though Linux has one. + + Anyway, the whole purpose of this file is for GDB and GDB only. + Don't read too much into it. Don't use it for anything other than + GDB unless you know what you are doing. */ + +#include +#include +#include +#include + +__BEGIN_DECLS + +/* Type for a general-purpose register. */ +typedef unsigned long elf_greg_t; + +/* And the whole bunch of them. We could have used `struct + user_regs_struct' directly in the typedef, but tradition says that + the register set is an array, which does have some peculiar + semantics, so leave it that way. */ +#define ELF_NGREG 20 +typedef elf_greg_t elf_gregset_t[ELF_NGREG]; + +/* Signal info. */ +struct elf_siginfo + { + int si_signo; /* Signal number. */ + int si_code; /* Extra code. */ + int si_errno; /* Errno. */ + }; + + +/* Definitions to generate Intel SVR4-like core files. These mostly + have the same names as the SVR4 types with "elf_" tacked on the + front to prevent clashes with Linux definitions, and the typedef + forms have been avoided. This is mostly like the SVR4 structure, + but more Linuxy, with things that Linux does not support and which + GDB doesn't really use excluded. */ + +struct elf_prstatus + { + struct elf_siginfo pr_info; /* Info associated with signal. */ + short int pr_cursig; /* Current signal. */ + unsigned long int pr_sigpend; /* Set of pending signals. */ + unsigned long int pr_sighold; /* Set of held signals. */ + __pid_t pr_pid; + __pid_t pr_ppid; + __pid_t pr_pgrp; + __pid_t pr_sid; + struct timeval pr_utime; /* User time. */ + struct timeval pr_stime; /* System time. */ + struct timeval pr_cutime; /* Cumulative user time. */ + struct timeval pr_cstime; /* Cumulative system time. */ + elf_gregset_t pr_reg; /* GP registers. */ + int pr_fpvalid; /* True if math copro being used. */ + }; + + +#define ELF_PRARGSZ (80) /* Number of chars for args. */ + +struct elf_prpsinfo + { + char pr_state; /* Numeric process state. */ + char pr_sname; /* Char for pr_state. */ + char pr_zomb; /* Zombie. */ + char pr_nice; /* Nice val. */ + unsigned long int pr_flag; /* Flags. */ + unsigned short int pr_uid; + unsigned short int pr_gid; + int pr_pid, pr_ppid, pr_pgrp, pr_sid; + /* Lots missing */ + char pr_fname[16]; /* Filename of executable. */ + char pr_psargs[ELF_PRARGSZ]; /* Initial part of arg list. */ + }; + + +/* The rest of this file provides the types for emulation of the + Solaris interfaces that should be implemented by + users of libthread_db. */ + +/* Addresses. */ +typedef void *psaddr_t; + +/* Register sets. Linux has different names. */ +typedef elf_gregset_t prgregset_t; +typedef elf_gregset_t prfpregset_t; + +/* We don't have any differences between processes and threads, + therefore have only one PID type. */ +typedef __pid_t lwpid_t; + +/* Process status and info. In the end we do provide typedefs for them. */ +typedef struct elf_prstatus prstatus_t; +typedef struct elf_prpsinfo prpsinfo_t; + +__END_DECLS + +#endif /* sys/procfs.h */ diff --git a/libc/sysdeps/linux/c6x/sys/reg.h b/libc/sysdeps/linux/c6x/sys/reg.h new file mode 100644 index 000000000..46857ba71 --- /dev/null +++ b/libc/sysdeps/linux/c6x/sys/reg.h @@ -0,0 +1,26 @@ +/* + * 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 + * + */ +#ifndef _SYS_REG_H +#define _SYS_REG_H 1 + +#include + +#endif /* _SYS_REG_H */ diff --git a/libc/sysdeps/linux/c6x/sys/ucontext.h b/libc/sysdeps/linux/c6x/sys/ucontext.h new file mode 100644 index 000000000..9a3922a2e --- /dev/null +++ b/libc/sysdeps/linux/c6x/sys/ucontext.h @@ -0,0 +1,39 @@ +/* Copyright (C) 1997, 1999, 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_UCONTEXT_H +#define _SYS_UCONTEXT_H 1 + +#include +#include +#include + +/* A machine context is exactly a sigcontext. */ +typedef struct sigcontext mcontext_t; + +/* Userlevel context. */ +typedef struct ucontext +{ + unsigned long uc_flags; + struct ucontext *uc_link; + stack_t uc_stack; + mcontext_t uc_mcontext; + __sigset_t uc_sigmask; +} ucontext_t; + +#endif /* sys/ucontext.h */ diff --git a/libc/sysdeps/linux/c6x/sys/user.h b/libc/sysdeps/linux/c6x/sys/user.h new file mode 100644 index 000000000..8c0a99dd8 --- /dev/null +++ b/libc/sysdeps/linux/c6x/sys/user.h @@ -0,0 +1,28 @@ +/* Copyright (C) 2010 Texas Instruments Incorporated + 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_USER_H +#define _SYS_USER_H 1 + +/* The whole purpose of this file is for GDB and GDB only. Don't read + too much into it. Don't use it for anything other than GDB unless + you know what you are doing. */ + +/* Left blank as a placeholder for now */ + +#endif /* sys/user.h */ diff --git a/libc/sysdeps/linux/c6x/syscall.c b/libc/sysdeps/linux/c6x/syscall.c new file mode 100644 index 000000000..ea947b28e --- /dev/null +++ b/libc/sysdeps/linux/c6x/syscall.c @@ -0,0 +1,49 @@ +/* + * syscall.c + * + * Port on Texas Instruments TMS320C6x architecture + * + * Copyright (C) 2006, 2010 Texas Instruments Incorporated + * Author: Thomas Charleux (thomas.charleux@jaluna.com) + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ + +#include +#include +#include +#include +#include +#include + +long int syscall (long int __sysno, ...) +{ + register long no __asm__("B0"); + register long a __asm__("A4"); + register long b __asm__("B4"); + register long c __asm__("A6"); + register long d __asm__("B6"); + register long e __asm__("A8"); + register long f __asm__("B8"); + long __res; + va_list ap; + + va_start( ap, __sysno); + a = va_arg( ap, long); + b = va_arg( ap, long); + c = va_arg( ap, long); + d = va_arg( ap, long); + e = va_arg( ap, long); + f = va_arg( ap, long); + va_end( ap ); + + no = __sysno; + + __asm__ __volatile__ ("SWE" : "=a" (a) : "a" (a), "b" (b), "a" (c), "b" (d), "a" (e), "b" (f), "b" (no) + : "memory", "cc"); + + __res = a; + __SYSCALL_RETURN (long); +} diff --git a/libc/sysdeps/linux/c6x/vfork.c b/libc/sysdeps/linux/c6x/vfork.c new file mode 100644 index 000000000..f19dcd464 --- /dev/null +++ b/libc/sysdeps/linux/c6x/vfork.c @@ -0,0 +1,26 @@ +/* + * 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"); diff --git a/libc/sysdeps/linux/common/Makefile.in b/libc/sysdeps/linux/common/Makefile.in index 302fa6450..fd55333fc 100644 --- a/libc/sysdeps/linux/common/Makefile.in +++ b/libc/sysdeps/linux/common/Makefile.in @@ -50,6 +50,7 @@ CSRC-$(UCLIBC_HAS_EPOLL) += epoll.c CSRC-$(UCLIBC_HAS_XATTR) += xattr.c CSRC-$(UCLIBC_HAS_PROFILING) += noophooks.c #pcprofile.c CSRC-$(UCLIBC_SV4_DEPRECATED) += ustat.c +CSRC- += $(if $(findstring =c6x=,=$(TARGET_ARCH)=),vfork.c) CSRC- += $(if $(findstring =sh=,=$(TARGET_ARCH)=),longjmp.c vfork.c) CSRC- += $(if $(findstring =sparc=,=$(TARGET_ARCH)=),vfork.c) CSRC- += $(if $(findstring =i386=,=$(TARGET_ARCH)=),vfork.c) -- cgit v1.2.3 From 2a19c1339d6bf46fe0f90fbd4e8dca6646d111ed Mon Sep 17 00:00:00 2001 From: Bernd Schmidt Date: Wed, 23 Feb 2011 00:14:42 +0100 Subject: Implement ffsl and ffsll. 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 --- libc/inet/rpc/svc.c | 2 +- libc/string/ffs.c | 16 ++++++++++------ libc/string/ffsll.c | 40 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 51 insertions(+), 7 deletions(-) create mode 100644 libc/string/ffsll.c (limited to 'libc') diff --git a/libc/inet/rpc/svc.c b/libc/inet/rpc/svc.c index 0f5300c8b..03b406200 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 22efe4a1e..4a5336d47 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 000000000..29e9ba9d9 --- /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@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 -- cgit v1.2.3 From cda3f2658389330999ad35390ed2676a7dc37325 Mon Sep 17 00:00:00 2001 From: "Peter S. Mazinger" Date: Sun, 6 Mar 2011 17:08:38 +0100 Subject: simplify ffs* code Remove __libc_ffs*, unneeded Signed-off-by: Peter S. Mazinger --- libc/inet/rpc/svc.c | 3 ++- libc/string/ffs.c | 11 ++++------- libc/string/ffsll.c | 14 +++++--------- 3 files changed, 11 insertions(+), 17 deletions(-) (limited to 'libc') diff --git a/libc/inet/rpc/svc.c b/libc/inet/rpc/svc.c index 03b406200..b28485de3 100644 --- a/libc/inet/rpc/svc.c +++ b/libc/inet/rpc/svc.c @@ -41,6 +41,7 @@ #include #include +#include #include "rpc_private.h" #include #include @@ -452,7 +453,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 = __libc_ffs (mask)); mask ^= (1 << (bit - 1))) + for (mask = *maskp++; (bit = 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 4a5336d47..f39d304b7 100644 --- a/libc/string/ffs.c +++ b/libc/string/ffs.c @@ -6,11 +6,9 @@ */ #include -#define ffsl __something_else -#include "_string.h" -#undef ffsl +#include -int __libc_ffs(int i) +int ffs(int i) { #if 1 /* inlined binary search method */ @@ -51,8 +49,7 @@ int __libc_ffs(int i) return n; #endif } -libc_hidden_def(__libc_ffs) -weak_alias(__libc_ffs,ffs) +libc_hidden_def(ffs) #if ULONG_MAX == UINT_MAX -weak_alias (__libc_ffs, ffsl) +strong_alias_untyped(ffs, ffsl) #endif diff --git a/libc/string/ffsll.c b/libc/string/ffsll.c index 29e9ba9d9..a7662900b 100644 --- a/libc/string/ffsll.c +++ b/libc/string/ffsll.c @@ -18,23 +18,19 @@ 02111-1307 USA. */ #include -#define ffsl __something_else -#include "_string.h" -#undef ffsl +#include /* Find the first bit set in I. */ -int __libc_ffsll (long long int i) +int ffsll (long long int i) { unsigned long long int x = i & -i; if (x <= 0xffffffff) - return __libc_ffs (i); + return ffs (i); else - return 32 + __libc_ffs (i >> 32); + return 32 + ffs (i >> 32); } -libc_hidden_def(__libc_ffsll) -weak_alias (__libc_ffsll, ffsll) #if ULONG_MAX != UINT_MAX -weak_alias (__libc_ffsll, ffsl) +strong_alias_untyped(ffsll, ffsl) #endif -- cgit v1.2.3 From 19373021defb3b917ba9617c3f45b22ab8da26dd Mon Sep 17 00:00:00 2001 From: "Peter S. Mazinger" Date: Mon, 7 Mar 2011 17:28:57 +0100 Subject: locale.c, locale.h: no need for hidden duplocale Signed-off-by: Peter S. Mazinger --- libc/misc/locale/locale.c | 1 - 1 file changed, 1 deletion(-) (limited to 'libc') diff --git a/libc/misc/locale/locale.c b/libc/misc/locale/locale.c index 255c10d61..e49cd3ba5 100644 --- a/libc/misc/locale/locale.c +++ b/libc/misc/locale/locale.c @@ -1337,7 +1337,6 @@ __locale_t duplocale(__locale_t dataset) } return r; } -libc_hidden_def(duplocale) #endif /**********************************************************************/ -- cgit v1.2.3 From 5c38edaeca35c3b3631d28acc43c96f3970d9d48 Mon Sep 17 00:00:00 2001 From: "Peter S. Mazinger" Date: Mon, 7 Mar 2011 17:39:14 +0100 Subject: locale.c: export newlocale only if XLOCALE is defined newlocale is used by setlocale, so we need the hidden version even if XLOCALE is not defined Signed-off-by: Peter S. Mazinger --- libc/misc/locale/locale.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'libc') diff --git a/libc/misc/locale/locale.c b/libc/misc/locale/locale.c index e49cd3ba5..40303ab14 100644 --- a/libc/misc/locale/locale.c +++ b/libc/misc/locale/locale.c @@ -1303,7 +1303,9 @@ __locale_t newlocale(int category_mask, const char *locale, __locale_t base) return base; } +#ifdef __UCLIBC_HAS_XLOCALE__ libc_hidden_def(newlocale) +#endif #endif /**********************************************************************/ -- cgit v1.2.3 From eb68c5d7a4e76ab06443d42aaf2d9a72dd059a04 Mon Sep 17 00:00:00 2001 From: "Peter S. Mazinger" Date: Tue, 8 Mar 2011 17:23:30 +0100 Subject: shm.h: fix vax's bits/shm.h Do not use __ipc_pid_t, since that is not visible after install. Provide and use shmatt_t. Add missing __END_DECLS. Signed-off-by: Peter S. Mazinger --- libc/sysdeps/linux/vax/bits/shm.h | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'libc') diff --git a/libc/sysdeps/linux/vax/bits/shm.h b/libc/sysdeps/linux/vax/bits/shm.h index 191709f0e..f1a44c982 100644 --- a/libc/sysdeps/linux/vax/bits/shm.h +++ b/libc/sysdeps/linux/vax/bits/shm.h @@ -40,6 +40,10 @@ __BEGIN_DECLS #define SHMLBA (__getpagesize ()) extern int __getpagesize (void) __THROW __attribute__ ((__const__)); + +/* Type to count number of attaches. */ +typedef unsigned short int shmatt_t; + /* Data structure describing a set of semaphores. */ struct shmid_ds { @@ -48,9 +52,9 @@ struct shmid_ds __time_t shm_atime; /* time of last shmat() */ __time_t shm_dtime; /* time of last shmdt() */ __time_t shm_ctime; /* time of last change by shmctl() */ - __ipc_pid_t shm_cpid; /* pid of creator */ - __ipc_pid_t shm_lpid; /* pid of last shmop */ - unsigned short int shm_nattch; /* number of current attaches */ + __pid_t shm_cpid; /* pid of creator */ + __pid_t shm_lpid; /* pid of last shmop */ + shmatt_t shm_nattch; /* number of current attaches */ unsigned short int __shm_npages; /* size of segment (pages) */ unsigned long int *__shm_pages; /* array of ptrs to frames -> SHMMAX */ struct vm_area_struct *__attaches; /* descriptors for attaches */ @@ -86,3 +90,5 @@ struct shm_info }; #endif /* __USE_MISC */ + +__END_DECLS -- cgit v1.2.3 From eb9cca27b385873c6788b18a13d918c873540866 Mon Sep 17 00:00:00 2001 From: Tobias Klauser Date: Tue, 8 Mar 2011 09:34:25 +0100 Subject: nios2: Correct guard #defines in bits/kernel_types.h The guards in posix_types.h are called _ASM_NIOS2_POSIX_TYPES_H, so correctly use them here. Otherwise we wont be able to build uClibc with headers exported from the current nios2 kernel. Signed-off-by: Tobias Klauser Signed-off-by: Khem Raj --- libc/sysdeps/linux/nios2/bits/kernel_types.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'libc') diff --git a/libc/sysdeps/linux/nios2/bits/kernel_types.h b/libc/sysdeps/linux/nios2/bits/kernel_types.h index 3fcd1af05..8b86d796f 100644 --- a/libc/sysdeps/linux/nios2/bits/kernel_types.h +++ b/libc/sysdeps/linux/nios2/bits/kernel_types.h @@ -4,8 +4,8 @@ * our private content, and not the kernel header, will win. * -Erik */ -#ifndef __ARCH_NIOS2_POSIX_TYPES_H -#define __ARCH_NIOS2_POSIX_TYPES_H +#ifndef _ASM_NIOS2_POSIX_TYPES_H +#define _ASM_NIOS2_POSIX_TYPES_H typedef unsigned long __kernel_dev_t; typedef unsigned long __kernel_ino_t; @@ -41,4 +41,4 @@ typedef struct { #endif } __kernel_fsid_t; -#endif /* __ARCH_NIOS2_POSIX_TYPES_H */ +#endif /* _ASM_NIOS2_POSIX_TYPES_H */ -- cgit v1.2.3 From 82098ab9b853c33ee8ade61c9510b295cc696de1 Mon Sep 17 00:00:00 2001 From: "Peter S. Mazinger" Date: Wed, 9 Mar 2011 09:23:48 +0100 Subject: guard *_chk() related stuff with UCLIBC_HAS_FORTIFY Guard x86_64 memset_chk/memcpy_chk be guarded by UCLIBC_HAS_FORTIFY. Compile ssp.c if one of SSP/FORTIFY is defined. Guard __chk_fail() with UCLIBC_HAS_FORTIFY and move its prototype to libc-internal.h. Disable _FORTIFY_SOURCE if UCLIBC_HAS_FORTIFY is not set. The config option itself is omitted on purpose, headers need to be reviewed and generic *_chk() functions need to be first provided. Signed-off-by: Peter S. Mazinger --- libc/string/x86_64/memcpy.S | 4 +--- libc/string/x86_64/memset.S | 6 ++---- libc/sysdeps/linux/common/Makefile.in | 2 +- libc/sysdeps/linux/common/ssp.c | 6 +++++- 4 files changed, 9 insertions(+), 9 deletions(-) (limited to 'libc') diff --git a/libc/string/x86_64/memcpy.S b/libc/string/x86_64/memcpy.S index 6d941e0f2..9c8169b42 100644 --- a/libc/string/x86_64/memcpy.S +++ b/libc/string/x86_64/memcpy.S @@ -26,12 +26,10 @@ #define MEMPCPY_P (defined memcpy) .text -#if defined __PIC__ && !defined NOT_IN_libc +#if defined __PIC__ && !defined NOT_IN_libc && defined __UCLIBC_HAS_FORTIFY__ ENTRY (__memcpy_chk) cmpq %rdx, %rcx -#if defined __UCLIBC_HAS_SSP__ jb HIDDEN_JUMPTARGET (__chk_fail) -#endif END (__memcpy_chk) #endif ENTRY (BP_SYM (memcpy)) diff --git a/libc/string/x86_64/memset.S b/libc/string/x86_64/memset.S index df265f394..6b758ce3a 100644 --- a/libc/string/x86_64/memset.S +++ b/libc/string/x86_64/memset.S @@ -29,12 +29,10 @@ #define LARGE $120000 .text -#if defined __PIC__ && !defined NOT_IN_libc +#if defined __PIC__ && !defined NOT_IN_libc && defined __UCLIBC_HAS_FORTIFY__ ENTRY (__memset_chk) cmpq %rdx, %rcx -#if defined __UCLIBC_HAS_SSP__ jb HIDDEN_JUMPTARGET (__chk_fail) -#endif END (__memset_chk) #endif ENTRY (memset) @@ -144,6 +142,6 @@ END (memset) libc_hidden_def(memset) #endif -#if !BZERO_P && defined __PIC__ && !defined NOT_IN_libc +#if !BZERO_P && defined __PIC__ && !defined NOT_IN_libc && defined __UCLIBC_HAS_FORTIFY__ strong_alias (__memset_chk, __memset_zero_constant_len_parameter) #endif diff --git a/libc/sysdeps/linux/common/Makefile.in b/libc/sysdeps/linux/common/Makefile.in index fd55333fc..3f9791104 100644 --- a/libc/sysdeps/linux/common/Makefile.in +++ b/libc/sysdeps/linux/common/Makefile.in @@ -15,7 +15,7 @@ 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-$(UCLIBC_HAS_SSP) += ssp.c +CSRC-$(if $(or $(UCLIBC_HAS_SSP),$(UCLIBC_HAS_FORTIFY)),y) += ssp.c CSRC-$(UCLIBC_LINUX_MODULE_24) += create_module.c query_module.c \ get_kernel_syms.c # we need these internally: fstatfs.c statfs.c diff --git a/libc/sysdeps/linux/common/ssp.c b/libc/sysdeps/linux/common/ssp.c index d81c706f4..df242cc69 100644 --- a/libc/sysdeps/linux/common/ssp.c +++ b/libc/sysdeps/linux/common/ssp.c @@ -87,6 +87,7 @@ void __stack_smash_handler(char func[], int damaged) } #endif +#ifdef __UCLIBC_HAS_SSP__ void __stack_chk_fail(void) attribute_noreturn __cold; void __stack_chk_fail(void) { @@ -101,8 +102,9 @@ void __stack_chk_fail(void) while(1) terminate(); } +#endif -void __chk_fail(void) attribute_noreturn; +#ifdef __UCLIBC_HAS_FORTIFY__ void __chk_fail(void) { static const char msg1[] = "buffer overflow detected: "; @@ -116,3 +118,5 @@ void __chk_fail(void) while(1) terminate(); } +libc_hidden_def(__chk_fail) +#endif -- cgit v1.2.3 From 117fbd4310fa600d0449d4268b4e6ee833471e1a Mon Sep 17 00:00:00 2001 From: "Peter S. Mazinger" Date: Wed, 9 Mar 2011 09:54:15 +0100 Subject: types.h: remove __ipc_pid_t Remove __ipc_pid_t, not needed internally, we do not support pre glibc-2.2 version of shmid_ds structure. Signed-off-by: Peter S. Mazinger --- libc/sysdeps/linux/common/bits/types.h | 5 ----- 1 file changed, 5 deletions(-) (limited to 'libc') diff --git a/libc/sysdeps/linux/common/bits/types.h b/libc/sysdeps/linux/common/bits/types.h index 24d0056fb..c4c10e2ff 100644 --- a/libc/sysdeps/linux/common/bits/types.h +++ b/libc/sysdeps/linux/common/bits/types.h @@ -200,11 +200,6 @@ __STD_TYPE __U32_TYPE __socklen_t; #undef __STD_TYPE -#ifdef _LIBC -/* Used in `struct shmid_ds'. */ -typedef __kernel_ipc_pid_t __ipc_pid_t; -#endif - /* Now add the thread types. */ #if defined __UCLIBC_HAS_THREADS__ && (defined __USE_POSIX199506 || defined __USE_UNIX98) # include -- cgit v1.2.3 From 51349317457d45038d68464a02e8ccd6a5d4ca8d Mon Sep 17 00:00:00 2001 From: "Peter S. Mazinger" Date: Wed, 9 Mar 2011 12:20:28 +0100 Subject: bits/kernel_stat.h: use the same guard on all archs Signed-off-by: Peter S. Mazinger --- libc/sysdeps/linux/cris/bits/kernel_stat.h | 4 ++-- libc/sysdeps/linux/hppa/bits/kernel_stat.h | 4 ++-- libc/sysdeps/linux/ia64/bits/kernel_stat.h | 6 +++--- libc/sysdeps/linux/x86_64/bits/kernel_stat.h | 4 ++-- 4 files changed, 9 insertions(+), 9 deletions(-) (limited to 'libc') diff --git a/libc/sysdeps/linux/cris/bits/kernel_stat.h b/libc/sysdeps/linux/cris/bits/kernel_stat.h index b54f29210..ce22730fb 100644 --- a/libc/sysdeps/linux/cris/bits/kernel_stat.h +++ b/libc/sysdeps/linux/cris/bits/kernel_stat.h @@ -1,7 +1,7 @@ /* Taken from linux/include/asm-cris/stat.h */ -#ifndef _CRIS_STAT_H -#define _CRIS_STAT_H +#ifndef _BITS_STAT_STRUCT_H +#define _BITS_STAT_STRUCT_H #ifndef _LIBC #error bits/kernel_stat.h is for internal uClibc use only! diff --git a/libc/sysdeps/linux/hppa/bits/kernel_stat.h b/libc/sysdeps/linux/hppa/bits/kernel_stat.h index d33a7e720..c4432578f 100644 --- a/libc/sysdeps/linux/hppa/bits/kernel_stat.h +++ b/libc/sysdeps/linux/hppa/bits/kernel_stat.h @@ -1,8 +1,8 @@ /* Ripped from linux/include/asm-parisc/stat.h * and renamed 'struct stat' to 'struct kernel_stat' */ -#ifndef _PARISC_STAT_H -#define _PARISC_STAT_H +#ifndef _BITS_STAT_STRUCT_H +#define _BITS_STAT_STRUCT_H #ifndef _LIBC #error bits/kernel_stat.h is for internal uClibc use only! diff --git a/libc/sysdeps/linux/ia64/bits/kernel_stat.h b/libc/sysdeps/linux/ia64/bits/kernel_stat.h index 5af7e93a8..3d17d3912 100644 --- a/libc/sysdeps/linux/ia64/bits/kernel_stat.h +++ b/libc/sysdeps/linux/ia64/bits/kernel_stat.h @@ -1,8 +1,8 @@ /* Ripped from linux/include/asm-ia64/stat.h * and renamed 'struct stat' to 'struct kernel_stat' */ -#ifndef _ASM_IA64_STAT_H -#define _ASM_IA64_STAT_H +#ifndef _BITS_STAT_STRUCT_H +#define _BITS_STAT_STRUCT_H #ifndef _LIBC #error bits/kernel_stat.h is for internal uClibc use only! @@ -34,4 +34,4 @@ struct kernel_stat { /* ia64 stat64 is same as stat */ #define kernel_stat64 kernel_stat -#endif /* _ASM_IA64_STAT_H */ +#endif /* _BITS_STAT_STRUCT_H */ diff --git a/libc/sysdeps/linux/x86_64/bits/kernel_stat.h b/libc/sysdeps/linux/x86_64/bits/kernel_stat.h index 2c1deb0d9..b3a07f12e 100644 --- a/libc/sysdeps/linux/x86_64/bits/kernel_stat.h +++ b/libc/sysdeps/linux/x86_64/bits/kernel_stat.h @@ -1,8 +1,8 @@ /* Ripped from linux/include/asm-x86_64/stat.h * and renamed 'struct stat' to 'struct kernel_stat' */ -#ifndef _ASM_X86_64_STAT_H -#define _ASM_X86_64_STAT_H +#ifndef _BITS_STAT_STRUCT_H +#define _BITS_STAT_STRUCT_H #ifndef _LIBC #error bits/kernel_stat.h is for internal uClibc use only! -- cgit v1.2.3 From 41647059ec1945a258a9ee26638a1c0e4d181eaa Mon Sep 17 00:00:00 2001 From: "Peter S. Mazinger" Date: Wed, 9 Mar 2011 12:31:15 +0100 Subject: bits/kernel_stat.h: no need for _LIBC guard, the file is not installed on target Signed-off-by: Peter S. Mazinger --- libc/sysdeps/linux/alpha/bits/kernel_stat.h | 4 ---- libc/sysdeps/linux/arm/bits/kernel_stat.h | 4 ---- libc/sysdeps/linux/avr32/bits/kernel_stat.h | 4 ---- libc/sysdeps/linux/bfin/bits/kernel_stat.h | 4 ---- libc/sysdeps/linux/cris/bits/kernel_stat.h | 4 ---- libc/sysdeps/linux/e1/bits/kernel_stat.h | 4 ---- libc/sysdeps/linux/frv/bits/kernel_stat.h | 4 ---- libc/sysdeps/linux/h8300/bits/kernel_stat.h | 4 ---- libc/sysdeps/linux/hppa/bits/kernel_stat.h | 4 ---- libc/sysdeps/linux/i386/bits/kernel_stat.h | 4 ---- libc/sysdeps/linux/ia64/bits/kernel_stat.h | 4 ---- libc/sysdeps/linux/m68k/bits/kernel_stat.h | 4 ---- libc/sysdeps/linux/microblaze/bits/kernel_stat.h | 4 ---- libc/sysdeps/linux/mips/bits/kernel_stat.h | 4 ---- libc/sysdeps/linux/nios2/bits/kernel_stat.h | 4 ---- libc/sysdeps/linux/powerpc/bits/kernel_stat.h | 4 ---- libc/sysdeps/linux/sh/bits/kernel_stat.h | 4 ---- libc/sysdeps/linux/sh64/bits/kernel_stat.h | 4 ---- libc/sysdeps/linux/sparc/bits/kernel_stat.h | 4 ---- libc/sysdeps/linux/v850/bits/kernel_stat.h | 4 ---- libc/sysdeps/linux/vax/bits/kernel_stat.h | 4 ---- libc/sysdeps/linux/x86_64/bits/kernel_stat.h | 4 ---- libc/sysdeps/linux/xtensa/bits/kernel_stat.h | 4 ---- 23 files changed, 92 deletions(-) (limited to 'libc') diff --git a/libc/sysdeps/linux/alpha/bits/kernel_stat.h b/libc/sysdeps/linux/alpha/bits/kernel_stat.h index 8279a3915..e919b210d 100644 --- a/libc/sysdeps/linux/alpha/bits/kernel_stat.h +++ b/libc/sysdeps/linux/alpha/bits/kernel_stat.h @@ -1,10 +1,6 @@ #ifndef _BITS_STAT_STRUCT_H #define _BITS_STAT_STRUCT_H -#ifndef _LIBC -#error bits/kernel_stat.h is for internal uClibc use only! -#endif - /* This file provides whatever this particular arch's kernel thinks * struct kernel_stat should look like... It turns out each arch has a * different opinion on the subject... */ diff --git a/libc/sysdeps/linux/arm/bits/kernel_stat.h b/libc/sysdeps/linux/arm/bits/kernel_stat.h index 2ca63a223..7bd89f9ab 100644 --- a/libc/sysdeps/linux/arm/bits/kernel_stat.h +++ b/libc/sysdeps/linux/arm/bits/kernel_stat.h @@ -1,10 +1,6 @@ #ifndef _BITS_STAT_STRUCT_H #define _BITS_STAT_STRUCT_H -#ifndef _LIBC -#error bits/kernel_stat.h is for internal uClibc use only! -#endif - /* This file provides whatever this particular arch's kernel thinks * struct kernel_stat should look like... It turns out each arch has a * different opinion on the subject... */ diff --git a/libc/sysdeps/linux/avr32/bits/kernel_stat.h b/libc/sysdeps/linux/avr32/bits/kernel_stat.h index 8442c3c1c..d98c6cfef 100644 --- a/libc/sysdeps/linux/avr32/bits/kernel_stat.h +++ b/libc/sysdeps/linux/avr32/bits/kernel_stat.h @@ -1,10 +1,6 @@ #ifndef _BITS_STAT_STRUCT_H #define _BITS_STAT_STRUCT_H -#ifndef _LIBC -#error bits/kernel_stat.h is for internal uClibc use only! -#endif - /* * This file provides struct stat, taken from kernel 2.6.4. Verified * to match kernel 2.6.22. diff --git a/libc/sysdeps/linux/bfin/bits/kernel_stat.h b/libc/sysdeps/linux/bfin/bits/kernel_stat.h index b1a3251e5..7700d6109 100644 --- a/libc/sysdeps/linux/bfin/bits/kernel_stat.h +++ b/libc/sysdeps/linux/bfin/bits/kernel_stat.h @@ -1,10 +1,6 @@ #ifndef _BITS_STAT_STRUCT_H #define _BITS_STAT_STRUCT_H -#ifndef _LIBC -#error bits/kernel_stat.h is for internal uClibc use only! -#endif - /* This file provides whatever this particular arch's kernel thinks * struct kernel_stat should look like... It turns out each arch has a * different opinion on the subject... */ diff --git a/libc/sysdeps/linux/cris/bits/kernel_stat.h b/libc/sysdeps/linux/cris/bits/kernel_stat.h index ce22730fb..619f35e9e 100644 --- a/libc/sysdeps/linux/cris/bits/kernel_stat.h +++ b/libc/sysdeps/linux/cris/bits/kernel_stat.h @@ -3,10 +3,6 @@ #ifndef _BITS_STAT_STRUCT_H #define _BITS_STAT_STRUCT_H -#ifndef _LIBC -#error bits/kernel_stat.h is for internal uClibc use only! -#endif - struct kernel_stat { unsigned short st_dev; unsigned short __pad1; diff --git a/libc/sysdeps/linux/e1/bits/kernel_stat.h b/libc/sysdeps/linux/e1/bits/kernel_stat.h index 2b432cf52..99a6cba97 100644 --- a/libc/sysdeps/linux/e1/bits/kernel_stat.h +++ b/libc/sysdeps/linux/e1/bits/kernel_stat.h @@ -1,10 +1,6 @@ #ifndef _BITS_STAT_STRUCT_H #define _BITS_STAT_STRUCT_H -#ifndef _LIBC -#error bits/kernel_stat.h is for internal uClibc use only! -#endif - /* This file provides whatever this particular arch's kernel thinks * struct kernel_stat should look like... It turns out each arch has a * different opinion on the subject... */ diff --git a/libc/sysdeps/linux/frv/bits/kernel_stat.h b/libc/sysdeps/linux/frv/bits/kernel_stat.h index 634066df6..1cf521044 100644 --- a/libc/sysdeps/linux/frv/bits/kernel_stat.h +++ b/libc/sysdeps/linux/frv/bits/kernel_stat.h @@ -1,10 +1,6 @@ #ifndef _BITS_STAT_STRUCT_H #define _BITS_STAT_STRUCT_H -#ifndef _LIBC -#error bits/kernel_stat.h is for internal uClibc use only! -#endif - /* This file provides whatever this particular arch's kernel thinks * struct kernel_stat should look like... It turns out each arch has a * different opinion on the subject... */ diff --git a/libc/sysdeps/linux/h8300/bits/kernel_stat.h b/libc/sysdeps/linux/h8300/bits/kernel_stat.h index 2b95465b7..5f6c8ae50 100644 --- a/libc/sysdeps/linux/h8300/bits/kernel_stat.h +++ b/libc/sysdeps/linux/h8300/bits/kernel_stat.h @@ -1,10 +1,6 @@ #ifndef _BITS_STAT_STRUCT_H #define _BITS_STAT_STRUCT_H -#ifndef _LIBC -#error bits/kernel_stat.h is for internal uClibc use only! -#endif - /* This file provides whatever this particular arch's kernel thinks * struct kernel_stat should look like... It turns out each arch has a * different opinion on the subject... */ diff --git a/libc/sysdeps/linux/hppa/bits/kernel_stat.h b/libc/sysdeps/linux/hppa/bits/kernel_stat.h index c4432578f..097abfb40 100644 --- a/libc/sysdeps/linux/hppa/bits/kernel_stat.h +++ b/libc/sysdeps/linux/hppa/bits/kernel_stat.h @@ -4,10 +4,6 @@ #ifndef _BITS_STAT_STRUCT_H #define _BITS_STAT_STRUCT_H -#ifndef _LIBC -#error bits/kernel_stat.h is for internal uClibc use only! -#endif - struct kernel_stat { unsigned int st_dev; /* dev_t is 32 bits on parisc */ ino_t st_ino; /* 32 bits */ diff --git a/libc/sysdeps/linux/i386/bits/kernel_stat.h b/libc/sysdeps/linux/i386/bits/kernel_stat.h index decbeb915..231a984b4 100644 --- a/libc/sysdeps/linux/i386/bits/kernel_stat.h +++ b/libc/sysdeps/linux/i386/bits/kernel_stat.h @@ -1,10 +1,6 @@ #ifndef _BITS_STAT_STRUCT_H #define _BITS_STAT_STRUCT_H -#ifndef _LIBC -#error bits/kernel_stat.h is for internal uClibc use only! -#endif - /* This file provides whatever this particular arch's kernel thinks * struct stat should look like... It turns out each arch has a * different opinion on the subject... */ diff --git a/libc/sysdeps/linux/ia64/bits/kernel_stat.h b/libc/sysdeps/linux/ia64/bits/kernel_stat.h index 3d17d3912..28abc4bf5 100644 --- a/libc/sysdeps/linux/ia64/bits/kernel_stat.h +++ b/libc/sysdeps/linux/ia64/bits/kernel_stat.h @@ -4,10 +4,6 @@ #ifndef _BITS_STAT_STRUCT_H #define _BITS_STAT_STRUCT_H -#ifndef _LIBC -#error bits/kernel_stat.h is for internal uClibc use only! -#endif - /* * Modified 1998, 1999 * David Mosberger-Tang , Hewlett-Packard Co diff --git a/libc/sysdeps/linux/m68k/bits/kernel_stat.h b/libc/sysdeps/linux/m68k/bits/kernel_stat.h index 4cb06cc97..3911c9bbf 100644 --- a/libc/sysdeps/linux/m68k/bits/kernel_stat.h +++ b/libc/sysdeps/linux/m68k/bits/kernel_stat.h @@ -1,10 +1,6 @@ #ifndef _BITS_STAT_STRUCT_H #define _BITS_STAT_STRUCT_H -#ifndef _LIBC -#error bits/kernel_stat.h is for internal uClibc use only! -#endif - /* This file provides whatever this particular arch's kernel thinks * struct kernel_stat should look like... It turns out each arch has a * different opinion on the subject... */ diff --git a/libc/sysdeps/linux/microblaze/bits/kernel_stat.h b/libc/sysdeps/linux/microblaze/bits/kernel_stat.h index 2c5eb28af..c2695098d 100644 --- a/libc/sysdeps/linux/microblaze/bits/kernel_stat.h +++ b/libc/sysdeps/linux/microblaze/bits/kernel_stat.h @@ -3,10 +3,6 @@ #ifndef _BITS_STAT_STRUCT_H #define _BITS_STAT_STRUCT_H -#ifndef _LIBC -#error bits/kernel_stat.h is for internal uClibc use only! -#endif - struct kernel_stat { unsigned long st_dev; /* Device. */ diff --git a/libc/sysdeps/linux/mips/bits/kernel_stat.h b/libc/sysdeps/linux/mips/bits/kernel_stat.h index dc3565acc..655c089e0 100644 --- a/libc/sysdeps/linux/mips/bits/kernel_stat.h +++ b/libc/sysdeps/linux/mips/bits/kernel_stat.h @@ -1,10 +1,6 @@ #ifndef _BITS_STAT_STRUCT_H #define _BITS_STAT_STRUCT_H -#ifndef _LIBC -#error bits/kernel_stat.h is for internal uClibc use only! -#endif - /* This file provides whatever this particular arch's kernel thinks * struct kernel_stat should look like... It turns out each arch has a * different opinion on the subject... */ diff --git a/libc/sysdeps/linux/nios2/bits/kernel_stat.h b/libc/sysdeps/linux/nios2/bits/kernel_stat.h index 2b432cf52..99a6cba97 100644 --- a/libc/sysdeps/linux/nios2/bits/kernel_stat.h +++ b/libc/sysdeps/linux/nios2/bits/kernel_stat.h @@ -1,10 +1,6 @@ #ifndef _BITS_STAT_STRUCT_H #define _BITS_STAT_STRUCT_H -#ifndef _LIBC -#error bits/kernel_stat.h is for internal uClibc use only! -#endif - /* This file provides whatever this particular arch's kernel thinks * struct kernel_stat should look like... It turns out each arch has a * different opinion on the subject... */ diff --git a/libc/sysdeps/linux/powerpc/bits/kernel_stat.h b/libc/sysdeps/linux/powerpc/bits/kernel_stat.h index d8a9bc2e2..579b5b4e2 100644 --- a/libc/sysdeps/linux/powerpc/bits/kernel_stat.h +++ b/libc/sysdeps/linux/powerpc/bits/kernel_stat.h @@ -1,10 +1,6 @@ #ifndef _BITS_STAT_STRUCT_H #define _BITS_STAT_STRUCT_H -#ifndef _LIBC -#error bits/kernel_stat.h is for internal uClibc use only! -#endif - /* This file provides whatever this particular arch's kernel thinks * struct kernel_stat should look like... It turns out each arch has a * different opinion on the subject... */ diff --git a/libc/sysdeps/linux/sh/bits/kernel_stat.h b/libc/sysdeps/linux/sh/bits/kernel_stat.h index 8e6ffb498..5b51b3cd3 100644 --- a/libc/sysdeps/linux/sh/bits/kernel_stat.h +++ b/libc/sysdeps/linux/sh/bits/kernel_stat.h @@ -1,10 +1,6 @@ #ifndef _BITS_STAT_STRUCT_H #define _BITS_STAT_STRUCT_H -#ifndef _LIBC -#error bits/kernel_stat.h is for internal uClibc use only! -#endif - /* This file provides whatever this particular arch's kernel thinks * struct kernel_stat should look like... It turns out each arch has a * different opinion on the subject... */ diff --git a/libc/sysdeps/linux/sh64/bits/kernel_stat.h b/libc/sysdeps/linux/sh64/bits/kernel_stat.h index 57c16f473..1a29433e1 100644 --- a/libc/sysdeps/linux/sh64/bits/kernel_stat.h +++ b/libc/sysdeps/linux/sh64/bits/kernel_stat.h @@ -3,10 +3,6 @@ #ifndef _BITS_STAT_STRUCT_H #define _BITS_STAT_STRUCT_H -#ifndef _LIBC -#error bits/kernel_stat.h is for internal uClibc use only! -#endif - struct kernel_stat { unsigned short st_dev; unsigned short __pad1; diff --git a/libc/sysdeps/linux/sparc/bits/kernel_stat.h b/libc/sysdeps/linux/sparc/bits/kernel_stat.h index a9b5b534f..f09ae3734 100644 --- a/libc/sysdeps/linux/sparc/bits/kernel_stat.h +++ b/libc/sysdeps/linux/sparc/bits/kernel_stat.h @@ -1,10 +1,6 @@ #ifndef _BITS_STAT_STRUCT_H #define _BITS_STAT_STRUCT_H -#ifndef _LIBC -#error bits/kernel_stat.h is for internal uClibc use only! -#endif - /* This file provides whatever this particular arch's kernel thinks * struct kernel_stat should look like... It turns out each arch has a * different opinion on the subject... */ diff --git a/libc/sysdeps/linux/v850/bits/kernel_stat.h b/libc/sysdeps/linux/v850/bits/kernel_stat.h index a7c9a73bf..1b925ca77 100644 --- a/libc/sysdeps/linux/v850/bits/kernel_stat.h +++ b/libc/sysdeps/linux/v850/bits/kernel_stat.h @@ -3,10 +3,6 @@ #ifndef _BITS_STAT_STRUCT_H #define _BITS_STAT_STRUCT_H -#ifndef _LIBC -#error bits/kernel_stat.h is for internal uClibc use only! -#endif - struct kernel_stat { __kernel_dev_t st_dev; diff --git a/libc/sysdeps/linux/vax/bits/kernel_stat.h b/libc/sysdeps/linux/vax/bits/kernel_stat.h index 4636a139c..a6da833c4 100644 --- a/libc/sysdeps/linux/vax/bits/kernel_stat.h +++ b/libc/sysdeps/linux/vax/bits/kernel_stat.h @@ -1,10 +1,6 @@ #ifndef _BITS_STAT_STRUCT_H #define _BITS_STAT_STRUCT_H -#ifndef _LIBC -#error bits/kernel_stat.h is for internal uClibc use only! -#endif - /* This file provides whatever this particular arch's kernel thinks * struct stat should look like... It turns out each arch has a * different opinion on the subject... */ diff --git a/libc/sysdeps/linux/x86_64/bits/kernel_stat.h b/libc/sysdeps/linux/x86_64/bits/kernel_stat.h index b3a07f12e..e194a7f76 100644 --- a/libc/sysdeps/linux/x86_64/bits/kernel_stat.h +++ b/libc/sysdeps/linux/x86_64/bits/kernel_stat.h @@ -4,10 +4,6 @@ #ifndef _BITS_STAT_STRUCT_H #define _BITS_STAT_STRUCT_H -#ifndef _LIBC -#error bits/kernel_stat.h is for internal uClibc use only! -#endif - struct kernel_stat { unsigned long st_dev; unsigned long st_ino; diff --git a/libc/sysdeps/linux/xtensa/bits/kernel_stat.h b/libc/sysdeps/linux/xtensa/bits/kernel_stat.h index 10a35a23a..5e4f5c4e5 100644 --- a/libc/sysdeps/linux/xtensa/bits/kernel_stat.h +++ b/libc/sysdeps/linux/xtensa/bits/kernel_stat.h @@ -1,10 +1,6 @@ #ifndef _BITS_STAT_STRUCT_H #define _BITS_STAT_STRUCT_H -#ifndef _LIBC -#error bits/kernel_stat.h is for internal uClibc use only! -#endif - /* This file provides whatever this particular arch's kernel thinks * struct kernel_stat should look like... It turns out each arch has a * different opinion on the subject... */ -- cgit v1.2.3 From 369cc066a46fba5455be15e0403a7c8bcdd84c22 Mon Sep 17 00:00:00 2001 From: "Peter S. Mazinger" Date: Wed, 9 Mar 2011 12:35:27 +0100 Subject: bits/statvfs.h: the common one is good for alpha and sparc Signed-off-by: Peter S. Mazinger --- libc/sysdeps/linux/alpha/bits/statvfs.h | 96 ----------------------------- libc/sysdeps/linux/sparc/bits/statvfs.h | 106 -------------------------------- 2 files changed, 202 deletions(-) delete mode 100644 libc/sysdeps/linux/alpha/bits/statvfs.h delete mode 100644 libc/sysdeps/linux/sparc/bits/statvfs.h (limited to 'libc') diff --git a/libc/sysdeps/linux/alpha/bits/statvfs.h b/libc/sysdeps/linux/alpha/bits/statvfs.h deleted file mode 100644 index d37d0ffcb..000000000 --- a/libc/sysdeps/linux/alpha/bits/statvfs.h +++ /dev/null @@ -1,96 +0,0 @@ -/* Copyright (C) 1997, 1998, 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_STATVFS_H -# error "Never include directly; use instead." -#endif - -#include /* For __fsblkcnt_t and __fsfilcnt_t. */ - -struct statvfs - { - unsigned long int f_bsize; - unsigned long int f_frsize; -#ifndef __USE_FILE_OFFSET64 - __fsblkcnt_t f_blocks; - __fsblkcnt_t f_bfree; - __fsblkcnt_t f_bavail; - __fsfilcnt_t f_files; - __fsfilcnt_t f_ffree; - __fsfilcnt_t f_favail; -#else - __fsblkcnt64_t f_blocks; - __fsblkcnt64_t f_bfree; - __fsblkcnt64_t f_bavail; - __fsfilcnt64_t f_files; - __fsfilcnt64_t f_ffree; - __fsfilcnt64_t f_favail; -#endif - unsigned long int f_fsid; - unsigned long int f_flag; - unsigned long int f_namemax; - int __f_spare[6]; - }; - -#ifdef __USE_LARGEFILE64 -struct statvfs64 - { - unsigned long int f_bsize; - unsigned long int f_frsize; - __fsblkcnt64_t f_blocks; - __fsblkcnt64_t f_bfree; - __fsblkcnt64_t f_bavail; - __fsfilcnt64_t f_files; - __fsfilcnt64_t f_ffree; - __fsfilcnt64_t f_favail; - unsigned long int f_fsid; - unsigned long int f_flag; - unsigned long int f_namemax; - int __f_spare[6]; - }; -#endif - -/* Definitions for the flag in `f_flag'. These definitions should be - kept in sync which the definitions in . */ -enum -{ - ST_RDONLY = 1, /* Mount read-only. */ -#define ST_RDONLY ST_RDONLY - ST_NOSUID = 2, /* Ignore suid and sgid bits. */ -#define ST_NOSUID ST_NOSUID -#ifdef __USE_GNU - ST_NODEV = 4, /* Disallow access to device special files. */ -# define ST_NODEV ST_NODEV - ST_NOEXEC = 8, /* Disallow program execution. */ -# define ST_NOEXEC ST_NOEXEC - ST_SYNCHRONOUS = 16, /* Writes are synced at once. */ -# define ST_SYNCHRONOUS ST_SYNCHRONOUS - ST_MANDLOCK = 64, /* Allow mandatory locks on an FS. */ -# define ST_MANDLOCK ST_MANDLOCK - ST_WRITE = 128, /* Write on file/directory/symlink. */ -# define ST_WRITE ST_WRITE - ST_APPEND = 256, /* Append-only file. */ -# define ST_APPEND ST_APPEND - ST_IMMUTABLE = 512, /* Immutable file. */ -# define ST_IMMUTABLE ST_IMMUTABLE - ST_NOATIME = 1024, /* Do not update access times. */ -# define ST_NOATIME ST_NOATIME - ST_NODIRATIME /* Do not update directory access times. */ -# define ST_NODIRATIME ST_NODIRATIME -#endif /* Use GNU. */ -}; diff --git a/libc/sysdeps/linux/sparc/bits/statvfs.h b/libc/sysdeps/linux/sparc/bits/statvfs.h deleted file mode 100644 index 3dafcebf0..000000000 --- a/libc/sysdeps/linux/sparc/bits/statvfs.h +++ /dev/null @@ -1,106 +0,0 @@ -/* Copyright (C) 1997, 1998, 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_STATVFS_H -# error "Never include directly; use instead." -#endif - -#include /* For __fsblkcnt_t and __fsfilcnt_t. */ - -#if __WORDSIZE == 32 -#define _STATVFSBUF_F_UNUSED -#endif - -struct statvfs - { - unsigned long int f_bsize; - unsigned long int f_frsize; -#ifndef __USE_FILE_OFFSET64 - __fsblkcnt_t f_blocks; - __fsblkcnt_t f_bfree; - __fsblkcnt_t f_bavail; - __fsfilcnt_t f_files; - __fsfilcnt_t f_ffree; - __fsfilcnt_t f_favail; -#else - __fsblkcnt64_t f_blocks; - __fsblkcnt64_t f_bfree; - __fsblkcnt64_t f_bavail; - __fsfilcnt64_t f_files; - __fsfilcnt64_t f_ffree; - __fsfilcnt64_t f_favail; -#endif - unsigned long int f_fsid; -#ifdef _STATVFSBUF_F_UNUSED - int __f_unused; -#endif - unsigned long int f_flag; - unsigned long int f_namemax; - int __f_spare[6]; - }; - -#ifdef __USE_LARGEFILE64 -struct statvfs64 - { - unsigned long int f_bsize; - unsigned long int f_frsize; - __fsblkcnt64_t f_blocks; - __fsblkcnt64_t f_bfree; - __fsblkcnt64_t f_bavail; - __fsfilcnt64_t f_files; - __fsfilcnt64_t f_ffree; - __fsfilcnt64_t f_favail; - unsigned long int f_fsid; -#ifdef _STATVFSBUF_F_UNUSED - int __f_unused; -#endif - unsigned long int f_flag; - unsigned long int f_namemax; - int __f_spare[6]; - }; -#endif - -/* Definitions for the flag in `f_flag'. These definitions should be - kept in sync which the definitions in . */ -enum -{ - ST_RDONLY = 1, /* Mount read-only. */ -#define ST_RDONLY ST_RDONLY - ST_NOSUID = 2, /* Ignore suid and sgid bits. */ -#define ST_NOSUID ST_NOSUID -#ifdef __USE_GNU - ST_NODEV = 4, /* Disallow access to device special files. */ -# define ST_NODEV ST_NODEV - ST_NOEXEC = 8, /* Disallow program execution. */ -# define ST_NOEXEC ST_NOEXEC - ST_SYNCHRONOUS = 16, /* Writes are synced at once. */ -# define ST_SYNCHRONOUS ST_SYNCHRONOUS - ST_MANDLOCK = 64, /* Allow mandatory locks on an FS. */ -# define ST_MANDLOCK ST_MANDLOCK - ST_WRITE = 128, /* Write on file/directory/symlink. */ -# define ST_WRITE ST_WRITE - ST_APPEND = 256, /* Append-only file. */ -# define ST_APPEND ST_APPEND - ST_IMMUTABLE = 512, /* Immutable file. */ -# define ST_IMMUTABLE ST_IMMUTABLE - ST_NOATIME = 1024, /* Do not update access times. */ -# define ST_NOATIME ST_NOATIME - ST_NODIRATIME /* Do not update directory access times. */ -# define ST_NODIRATIME ST_NODIRATIME -#endif /* Use GNU. */ -}; -- cgit v1.2.3 From 26b1a5e02bc9702cd16c36ee980ed6a1cde3315a Mon Sep 17 00:00:00 2001 From: "Peter S. Mazinger" Date: Wed, 9 Mar 2011 13:07:05 +0100 Subject: add bits/atomic.h for hppa Signed-off-by: Peter S. Mazinger --- libc/sysdeps/linux/hppa/bits/atomic.h | 103 ++++++++++++++++++++++++++++++++++ 1 file changed, 103 insertions(+) create mode 100644 libc/sysdeps/linux/hppa/bits/atomic.h (limited to 'libc') diff --git a/libc/sysdeps/linux/hppa/bits/atomic.h b/libc/sysdeps/linux/hppa/bits/atomic.h new file mode 100644 index 000000000..87aeb84a0 --- /dev/null +++ b/libc/sysdeps/linux/hppa/bits/atomic.h @@ -0,0 +1,103 @@ +/* Copyright (C) 2003 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Carlos O'Donell , 2005. + + 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 +#include + +#define ABORT_INSTRUCTION __asm__(__UCLIBC_ABORT_INSTRUCTION__) + +/* We need EFAULT, ENOSYS */ +#if !defined EFAULT && !defined ENOSYS +#define EFAULT 14 +#define ENOSYS 251 +#endif + +#ifndef _BITS_ATOMIC_H +#define _BITS_ATOMIC_H 1 + +typedef int8_t atomic8_t; +typedef uint8_t uatomic8_t; +typedef int_fast8_t atomic_fast8_t; +typedef uint_fast8_t uatomic_fast8_t; + +typedef int32_t atomic32_t; +typedef uint32_t uatomic32_t; +typedef int_fast32_t atomic_fast32_t; +typedef uint_fast32_t uatomic_fast32_t; + +typedef intptr_t atomicptr_t; +typedef uintptr_t uatomicptr_t; +typedef intmax_t atomic_max_t; +typedef uintmax_t uatomic_max_t; + +/* prev = *addr; + if (prev == old) + *addr = new; + return prev; */ + +/* Use the kernel atomic light weight syscalls on hppa */ +#define LWS "0xb0" +#define LWS_CAS "0" +/* Note r31 is the link register */ +#define LWS_CLOBBER "r1", "r26", "r25", "r24", "r23", "r22", "r21", "r20", "r28", "r31", "memory" +#define ASM_EAGAIN "11" + +#if __ASSUME_LWS_CAS +/* The only basic operation needed is compare and exchange. */ +# define atomic_compare_and_exchange_val_acq(mem, newval, oldval) \ + ({ \ + volatile int lws_errno = EFAULT; \ + volatile int lws_ret = 0xdeadbeef; \ + __asm__ volatile( \ + "0: \n\t" \ + "copy %3, %%r26 \n\t" \ + "copy %4, %%r25 \n\t" \ + "copy %5, %%r24 \n\t" \ + "ble " LWS "(%%sr2, %%r0) \n\t" \ + "ldi " LWS_CAS ", %%r20 \n\t" \ + "cmpib,=,n " ASM_EAGAIN ",%%r21,0b \n\t" \ + "nop \n\t" \ + "stw %%r28, %0 \n\t" \ + "sub %%r0, %%r21, %%r21 \n\t" \ + "stw %%r21, %1 \n\t" \ + : "=m" (lws_ret), "=m" (lws_errno), "=m" (*mem) \ + : "r" (mem), "r" (oldval), "r" (newval) \ + : LWS_CLOBBER \ + ); \ + \ + if(lws_errno == EFAULT || lws_errno == ENOSYS) \ + ABORT_INSTRUCTION; \ + \ + lws_ret; \ + }) + +# define atomic_compare_and_exchange_bool_acq(mem, newval, oldval) \ + ({ \ + int ret; \ + ret = atomic_compare_and_exchange_val_acq(mem, newval, oldval); \ + /* Return 1 if it was already acquired */ \ + (ret != oldval); \ + }) +#else +# error __ASSUME_LWS_CAS is required to build uClibc. +#endif +/* __ASSUME_LWS_CAS */ + +#endif +/* _BITS_ATOMIC_H */ -- cgit v1.2.3 From 92895c04f3033834ee512942014a9e643ba579a5 Mon Sep 17 00:00:00 2001 From: "Peter S. Mazinger" Date: Wed, 9 Mar 2011 13:10:41 +0100 Subject: bits/statvfs.h: update, adding ST_RELATIME Signed-off-by: Peter S. Mazinger --- libc/sysdeps/linux/common/bits/statvfs.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'libc') diff --git a/libc/sysdeps/linux/common/bits/statvfs.h b/libc/sysdeps/linux/common/bits/statvfs.h index cca0871ac..84717c3d9 100644 --- a/libc/sysdeps/linux/common/bits/statvfs.h +++ b/libc/sysdeps/linux/common/bits/statvfs.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1997, 1998, 2000, 2001, 2002 Free Software Foundation, Inc. +/* Copyright (C) 1997,1998,2000,2001,2002,2006 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 @@ -101,7 +101,9 @@ enum # define ST_IMMUTABLE ST_IMMUTABLE ST_NOATIME = 1024, /* Do not update access times. */ # define ST_NOATIME ST_NOATIME - ST_NODIRATIME = 2048 /* Do not update directory access times. */ + ST_NODIRATIME = 2048, /* Do not update directory access times. */ # define ST_NODIRATIME ST_NODIRATIME + ST_RELATIME = 4096 /* Update atime relative to mtime/ctime. */ +# define ST_RELATIME ST_RELATIME #endif /* Use GNU. */ }; -- cgit v1.2.3 From 1dd9275091d6cbb14d6b149770fc90cef53577cf Mon Sep 17 00:00:00 2001 From: "Peter S. Mazinger" Date: Wed, 9 Mar 2011 13:32:30 +0100 Subject: remove trailing ';' from _syscallX() Signed-off-by: Peter S. Mazinger --- libc/misc/sysvipc/msgq.c | 2 +- libc/misc/sysvipc/sem.c | 2 +- libc/misc/sysvipc/shm.c | 2 +- libc/sysdeps/linux/common/sigsuspend.c | 2 +- libc/sysdeps/linux/sparc/sigaction.c | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) (limited to 'libc') diff --git a/libc/misc/sysvipc/msgq.c b/libc/misc/sysvipc/msgq.c index 27eb1ff92..185cd268b 100644 --- a/libc/misc/sysvipc/msgq.c +++ b/libc/misc/sysvipc/msgq.c @@ -12,7 +12,7 @@ #ifdef __NR_msgctl #define __NR___libc_msgctl __NR_msgctl -static __inline__ _syscall3(int, __libc_msgctl, int, msqid, int, cmd, struct msqid_ds *, buf); +static __inline__ _syscall3(int, __libc_msgctl, int, msqid, int, cmd, struct msqid_ds *, buf) #endif /* Message queue control operation. */ int msgctl(int msqid, int cmd, struct msqid_ds *buf) diff --git a/libc/misc/sysvipc/sem.c b/libc/misc/sysvipc/sem.c index e340216e9..cca4cdfcc 100644 --- a/libc/misc/sysvipc/sem.c +++ b/libc/misc/sysvipc/sem.c @@ -41,7 +41,7 @@ union semun { #ifdef __NR_semctl #define __NR___semctl __NR_semctl -static __inline__ _syscall4(int, __semctl, int, semid, int, semnum, int, cmd, void *, arg); +static __inline__ _syscall4(int, __semctl, int, semid, int, semnum, int, cmd, void *, arg) #endif int semctl(int semid, int semnum, int cmd, ...) diff --git a/libc/misc/sysvipc/shm.c b/libc/misc/sysvipc/shm.c index 4b7ea0753..27e871f27 100644 --- a/libc/misc/sysvipc/shm.c +++ b/libc/misc/sysvipc/shm.c @@ -55,7 +55,7 @@ void * shmat (int shmid, const void *shmaddr, int shmflg) /* 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); +static __inline__ _syscall3(int, __libc_shmctl, int, shmid, int, cmd, struct shmid_ds *, buf) #endif int shmctl(int shmid, int cmd, struct shmid_ds *buf) { diff --git a/libc/sysdeps/linux/common/sigsuspend.c b/libc/sysdeps/linux/common/sigsuspend.c index 789eeda89..ded2aad5b 100644 --- a/libc/sysdeps/linux/common/sigsuspend.c +++ b/libc/sysdeps/linux/common/sigsuspend.c @@ -38,7 +38,7 @@ int sigsuspend (const sigset_t *set) return result; } # else -static inline _syscall2(int, __rt_sigsuspend, const sigset_t *, mask, size_t, size); +static inline _syscall2(int, __rt_sigsuspend, const sigset_t *, mask, size_t, size) int sigsuspend(const sigset_t * mask) { diff --git a/libc/sysdeps/linux/sparc/sigaction.c b/libc/sysdeps/linux/sparc/sigaction.c index a22ac40af..3e6f7e408 100644 --- a/libc/sysdeps/linux/sparc/sigaction.c +++ b/libc/sysdeps/linux/sparc/sigaction.c @@ -30,7 +30,7 @@ #include -_syscall5(int, rt_sigaction, int, a, int, b, int, c, int, d, int, e); +_syscall5(int, rt_sigaction, int, a, int, b, int, c, int, d, int, e) static void __rt_sigreturn_stub(void); static void __sigreturn_stub(void); -- cgit v1.2.3 From 576b6864660aba3d65f0fb42b7aaeaaae3e6a478 Mon Sep 17 00:00:00 2001 From: "Peter S. Mazinger" Date: Wed, 9 Mar 2011 14:18:15 +0100 Subject: _strtod.c: only strtod hidden version is needed Do not provide hidden strtod_l, wcstod and wcstod_l Signed-off-by: Peter S. Mazinger --- libc/stdlib/_strtod.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'libc') diff --git a/libc/stdlib/_strtod.c b/libc/stdlib/_strtod.c index dc5d55743..4e7965f9a 100644 --- a/libc/stdlib/_strtod.c +++ b/libc/stdlib/_strtod.c @@ -544,7 +544,6 @@ libc_hidden_def(__XL_NPP(strtof)) #define Wchar char #endif -libc_hidden_proto(__XL_NPP(strtod)) double __XL_NPP(strtod)(const Wchar *__restrict str, Wchar **__restrict endptr __LOCALE_PARAM ) { @@ -562,7 +561,9 @@ double __XL_NPP(strtod)(const Wchar *__restrict str, return y; #endif } -libc_hidden_def(__XL_NPP(strtod)) +#ifdef L_strtod +libc_hidden_def(strtod) +#endif #endif #endif -- cgit v1.2.3 From 1903a3babc27a717dcc2de743c3e70f673178b9f Mon Sep 17 00:00:00 2001 From: "Peter S. Mazinger" Date: Wed, 9 Mar 2011 14:45:04 +0100 Subject: stdlib.c: remove duplicate libc_hidden_proto for strtoul/strtoul_l Signed-off-by: Peter S. Mazinger --- libc/stdlib/stdlib.c | 1 - 1 file changed, 1 deletion(-) (limited to 'libc') diff --git a/libc/stdlib/stdlib.c b/libc/stdlib/stdlib.c index 4d608eeac..1ed97abed 100644 --- a/libc/stdlib/stdlib.c +++ b/libc/stdlib/stdlib.c @@ -375,7 +375,6 @@ strong_alias(strtoll,strtoq) /**********************************************************************/ #if defined(L_strtoul) || defined(L_strtoul_l) -libc_hidden_proto(__XL_NPP(strtoul)) unsigned long __XL_NPP(strtoul)(const char * __restrict str, char ** __restrict endptr, int base __LOCALE_PARAM) -- cgit v1.2.3 From 7aea441c8a240bd5a0717ec09ae8efc4878cd377 Mon Sep 17 00:00:00 2001 From: "Peter S. Mazinger" Date: Wed, 9 Mar 2011 14:48:45 +0100 Subject: move prototype for __drand48_iterate and __libc_drand48_data to stdlib.h Move them to a common header guarded by _LIBC Signed-off-by: Peter S. Mazinger --- libc/stdlib/drand48-iter.c | 4 ---- libc/stdlib/drand48.c | 4 ---- libc/stdlib/erand48.c | 4 ---- libc/stdlib/erand48_r.c | 3 --- libc/stdlib/jrand48.c | 4 ---- libc/stdlib/jrand48_r.c | 3 --- libc/stdlib/lrand48.c | 4 ---- libc/stdlib/mrand48.c | 4 ---- libc/stdlib/nrand48.c | 4 ---- libc/stdlib/nrand48_r.c | 3 --- libc/stdlib/seed48.c | 4 ---- libc/stdlib/srand48.c | 4 ---- 12 files changed, 45 deletions(-) (limited to 'libc') diff --git a/libc/stdlib/drand48-iter.c b/libc/stdlib/drand48-iter.c index 221cbe08f..e0c1ce430 100644 --- a/libc/stdlib/drand48-iter.c +++ b/libc/stdlib/drand48-iter.c @@ -23,13 +23,9 @@ #include #include -/* Global state for non-reentrant functions. */ -struct drand48_data __libc_drand48_data attribute_hidden; - #ifdef __UCLIBC_MJN3_ONLY__ #warning turn int __drand48_iterate into void #endif /* __UCLIBC_MJN3_ONLY__ */ -int __drand48_iterate (unsigned short int xsubi[3], struct drand48_data *buffer) attribute_hidden; int __drand48_iterate (unsigned short int xsubi[3], struct drand48_data *buffer) { uint64_t X; diff --git a/libc/stdlib/drand48.c b/libc/stdlib/drand48.c index 8c9017b11..c53dcfbfc 100644 --- a/libc/stdlib/drand48.c +++ b/libc/stdlib/drand48.c @@ -19,10 +19,6 @@ #include - -/* Global state for non-reentrant functions. Defined in drand48-iter.c. */ -extern struct drand48_data __libc_drand48_data attribute_hidden; - double drand48 (void) { double result; diff --git a/libc/stdlib/erand48.c b/libc/stdlib/erand48.c index ee28d9635..f3603cde0 100644 --- a/libc/stdlib/erand48.c +++ b/libc/stdlib/erand48.c @@ -19,10 +19,6 @@ #include - -/* Global state for non-reentrant functions. Defined in drand48-iter.c. */ -extern struct drand48_data __libc_drand48_data attribute_hidden; - double erand48 (unsigned short int xsubi[3]) { double result; diff --git a/libc/stdlib/erand48_r.c b/libc/stdlib/erand48_r.c index e36e73eb2..bd40a3488 100644 --- a/libc/stdlib/erand48_r.c +++ b/libc/stdlib/erand48_r.c @@ -21,9 +21,6 @@ #include #include -extern int __drand48_iterate(unsigned short xsubi[3], - struct drand48_data *buffer) attribute_hidden; - int erand48_r (unsigned short int xsubi[3], struct drand48_data *buffer, double *result) { union ieee754_double temp; diff --git a/libc/stdlib/jrand48.c b/libc/stdlib/jrand48.c index 163c5408e..8a06ced56 100644 --- a/libc/stdlib/jrand48.c +++ b/libc/stdlib/jrand48.c @@ -19,10 +19,6 @@ #include - -/* Global state for non-reentrant functions. Defined in drand48-iter.c. */ -extern struct drand48_data __libc_drand48_data attribute_hidden; - long int jrand48 (unsigned short int xsubi[3]) { long int result; diff --git a/libc/stdlib/jrand48_r.c b/libc/stdlib/jrand48_r.c index 24f7075f5..5652d1016 100644 --- a/libc/stdlib/jrand48_r.c +++ b/libc/stdlib/jrand48_r.c @@ -19,9 +19,6 @@ #include -extern int __drand48_iterate(unsigned short xsubi[3], - struct drand48_data *buffer) attribute_hidden; - int jrand48_r (unsigned short int xsubi[3], struct drand48_data *buffer, long int *result) { /* Compute next state. */ diff --git a/libc/stdlib/lrand48.c b/libc/stdlib/lrand48.c index a0b15caff..915638b80 100644 --- a/libc/stdlib/lrand48.c +++ b/libc/stdlib/lrand48.c @@ -19,10 +19,6 @@ #include - -/* Global state for non-reentrant functions. Defined in drand48-iter.c. */ -extern struct drand48_data __libc_drand48_data attribute_hidden; - long int lrand48 (void) { long int result; diff --git a/libc/stdlib/mrand48.c b/libc/stdlib/mrand48.c index b209acd57..6f7cf734c 100644 --- a/libc/stdlib/mrand48.c +++ b/libc/stdlib/mrand48.c @@ -19,10 +19,6 @@ #include - -/* Global state for non-reentrant functions. Defined in drand48-iter.c. */ -extern struct drand48_data __libc_drand48_data attribute_hidden; - long int mrand48 (void) { long int result; diff --git a/libc/stdlib/nrand48.c b/libc/stdlib/nrand48.c index 97c197caa..5183484fa 100644 --- a/libc/stdlib/nrand48.c +++ b/libc/stdlib/nrand48.c @@ -19,10 +19,6 @@ #include - -/* Global state for non-reentrant functions. Defined in drand48-iter.c. */ -extern struct drand48_data __libc_drand48_data attribute_hidden; - long int nrand48 (unsigned short int xsubi[3]) { long int result; diff --git a/libc/stdlib/nrand48_r.c b/libc/stdlib/nrand48_r.c index 0710e90ef..b8ed0eb31 100644 --- a/libc/stdlib/nrand48_r.c +++ b/libc/stdlib/nrand48_r.c @@ -19,9 +19,6 @@ #include -extern int __drand48_iterate(unsigned short xsubi[3], - struct drand48_data *buffer) attribute_hidden; - int nrand48_r (unsigned short int xsubi[3], struct drand48_data *buffer, long int *result) { /* Compute next state. */ diff --git a/libc/stdlib/seed48.c b/libc/stdlib/seed48.c index 9ff8a480a..a62dc2e64 100644 --- a/libc/stdlib/seed48.c +++ b/libc/stdlib/seed48.c @@ -19,10 +19,6 @@ #include - -/* Global state for non-reentrant functions. Defined in drand48-iter.c. */ -extern struct drand48_data __libc_drand48_data attribute_hidden; - unsigned short int * seed48 (unsigned short int seed16v[3]) { diff --git a/libc/stdlib/srand48.c b/libc/stdlib/srand48.c index 817d068c3..f55374371 100644 --- a/libc/stdlib/srand48.c +++ b/libc/stdlib/srand48.c @@ -19,10 +19,6 @@ #include - -/* Global state for non-reentrant functions. Defined in drand48-iter.c. */ -extern struct drand48_data __libc_drand48_data attribute_hidden; - void srand48 (long seedval) { srand48_r (seedval, &__libc_drand48_data); -- cgit v1.2.3 From cf67a3699e98c57b3a06e5dd4c7e70baa648db6a Mon Sep 17 00:00:00 2001 From: "Peter S. Mazinger" Date: Wed, 9 Mar 2011 15:06:17 +0100 Subject: fnmatch.c: use MB_CUR_MAX from stdlib.h included earlier Signed-off-by: Peter S. Mazinger --- libc/misc/fnmatch/fnmatch.c | 5 ----- 1 file changed, 5 deletions(-) (limited to 'libc') diff --git a/libc/misc/fnmatch/fnmatch.c b/libc/misc/fnmatch/fnmatch.c index 0fa043bad..2874413ec 100644 --- a/libc/misc/fnmatch/fnmatch.c +++ b/libc/misc/fnmatch/fnmatch.c @@ -334,11 +334,6 @@ is_char_class (const wchar_t *wcs) # include "fnmatch_loop.c" # endif -#ifndef __UCLIBC_HAS_WCHAR__ -# undef MB_CUR_MAX -# define MB_CUR_MAX 1 -#endif - int fnmatch (const char *pattern, const char *string, int flags) { -- cgit v1.2.3 From 3fa004b7d2d9a3648aa95b093000259a123fa2d8 Mon Sep 17 00:00:00 2001 From: "Peter S. Mazinger" Date: Wed, 9 Mar 2011 15:14:48 +0100 Subject: regcomp.c, aeabi_mb_cur_max.c: use unconditionally MB_CUR_MAX from stdlib.h Signed-off-by: Peter S. Mazinger --- libc/misc/regex/regcomp.c | 4 ---- libc/sysdeps/linux/arm/aeabi_mb_cur_max.c | 4 ---- 2 files changed, 8 deletions(-) (limited to 'libc') diff --git a/libc/misc/regex/regcomp.c b/libc/misc/regex/regcomp.c index 8f2e18ce4..b25850ccd 100644 --- a/libc/misc/regex/regcomp.c +++ b/libc/misc/regex/regcomp.c @@ -819,11 +819,7 @@ init_dfa (re_dfa_t *dfa, size_t pat_len) dfa->state_table = calloc (sizeof (struct re_state_table_entry), table_size); dfa->state_hash_mask = table_size - 1; -#ifdef __UCLIBC_HAS_WCHAR__ dfa->mb_cur_max = MB_CUR_MAX; -#else - dfa->mb_cur_max = 1; -#endif #if 0 if (dfa->mb_cur_max == 6 && strcmp (_NL_CURRENT (LC_CTYPE, _NL_CTYPE_CODESET_NAME), "UTF-8") == 0) diff --git a/libc/sysdeps/linux/arm/aeabi_mb_cur_max.c b/libc/sysdeps/linux/arm/aeabi_mb_cur_max.c index f12309eaf..77e979a65 100644 --- a/libc/sysdeps/linux/arm/aeabi_mb_cur_max.c +++ b/libc/sysdeps/linux/arm/aeabi_mb_cur_max.c @@ -23,9 +23,5 @@ int __aeabi_MB_CUR_MAX (void) { -#ifdef __UCLIBC_HAS_WCHAR__ return MB_CUR_MAX; -#else - return 1; -#endif } -- cgit v1.2.3 From dad0315108b60d47af25aa46a7f11084c15d821f Mon Sep 17 00:00:00 2001 From: "Peter S. Mazinger" Date: Wed, 9 Mar 2011 15:19:10 +0100 Subject: arc4random.c, stdlib.h: get rid of hidden arc4random_stir The function is used only in one file, make an internal static version for this Signed-off-by: Peter S. Mazinger --- libc/stdlib/arc4random.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'libc') diff --git a/libc/stdlib/arc4random.c b/libc/stdlib/arc4random.c index 592c51ed5..c7aed66b6 100644 --- a/libc/stdlib/arc4random.c +++ b/libc/stdlib/arc4random.c @@ -156,8 +156,8 @@ arc4_getword(struct arc4_stream *as) return val; } -void -arc4random_stir(void) +static void +__arc4random_stir(void) { if (!rs_initialized) { arc4_init(&rs); @@ -165,13 +165,13 @@ arc4random_stir(void) } arc4_stir(&rs); } -libc_hidden_def(arc4random_stir) +strong_alias(__arc4random_stir,arc4random_stir) void arc4random_addrandom(u_char *dat, int datlen) { if (!rs_initialized) - arc4random_stir(); + __arc4random_stir(); arc4_addrandom(&rs, dat, datlen); } @@ -179,7 +179,7 @@ uint32_t arc4random(void) { if (!rs_initialized) - arc4random_stir(); + __arc4random_stir(); return arc4_getword(&rs); } -- cgit v1.2.3 From 3ae11e90f822a766cc0b97d7f5eb12556685e8f0 Mon Sep 17 00:00:00 2001 From: Bernd Schmidt Date: Wed, 9 Mar 2011 15:14:37 +0100 Subject: Add C6X-specific sys/ptrace.h 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 file changed, 176 insertions(+) create mode 100644 libc/sysdeps/linux/c6x/sys/ptrace.h (limited to 'libc') diff --git a/libc/sysdeps/linux/c6x/sys/ptrace.h b/libc/sysdeps/linux/c6x/sys/ptrace.h new file mode 100644 index 000000000..b8a7a49d5 --- /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 */ -- cgit v1.2.3 From cb96f5c1b34a36864b0da389599b95408cc9b4a2 Mon Sep 17 00:00:00 2001 From: Mark Salter Date: Thu, 9 Sep 2010 14:40:03 -0400 Subject: sunrpc: fix spurious fall-through 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(+) (limited to 'libc') diff --git a/libc/inet/rpc/clnt_tcp.c b/libc/inet/rpc/clnt_tcp.c index d01fc80d5..d8d7bb359 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 fe8b7f8e6..aca3e337b 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 c7756f700..9870149e9 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, -- cgit v1.2.3 From 0c31aab44ec14a3c287ce766676d9a6f495a0751 Mon Sep 17 00:00:00 2001 From: Mark Salter Date: Sat, 5 Mar 2011 11:13:16 -0500 Subject: remove unused vfork.c Signed-off-by: Mark Salter Signed-off-by: Bernd Schmidt --- libc/sysdeps/linux/c6x/vfork.c | 26 -------------------------- 1 file changed, 26 deletions(-) delete mode 100644 libc/sysdeps/linux/c6x/vfork.c (limited to 'libc') diff --git a/libc/sysdeps/linux/c6x/vfork.c b/libc/sysdeps/linux/c6x/vfork.c deleted file mode 100644 index f19dcd464..000000000 --- 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"); -- cgit v1.2.3 From 3992402e7a00ee4f617582c09215a855fb212bf9 Mon Sep 17 00:00:00 2001 From: Mark Salter Date: Sat, 5 Mar 2011 11:17:54 -0500 Subject: use clone syscall for vfork Signed-off-by: Mark Salter Signed-off-by: Bernd Schmidt --- libc/sysdeps/linux/c6x/_vfork.S | 93 +++++++++++++++++++++++------------------ 1 file changed, 52 insertions(+), 41 deletions(-) (limited to 'libc') diff --git a/libc/sysdeps/linux/c6x/_vfork.S b/libc/sysdeps/linux/c6x/_vfork.S index 20cb6a52f..d64dc504d 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) -- cgit v1.2.3 From 5f98b70a92187756a2b76eaaf679958c36d59d00 Mon Sep 17 00:00:00 2001 From: Mark Salter Date: Sat, 5 Mar 2011 22:03:21 -0500 Subject: support generic kernel posix_types.h Signed-off-by: Mark Salter Signed-off-by: Bernd Schmidt --- libc/sysdeps/linux/c6x/bits/kernel_types.h | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) (limited to 'libc') diff --git a/libc/sysdeps/linux/c6x/bits/kernel_types.h b/libc/sysdeps/linux/c6x/bits/kernel_types.h index 5dbd2c226..755730959 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 -- cgit v1.2.3 From be36fa013e821e6fba87bfbc8bdf4f5e73b545cb Mon Sep 17 00:00:00 2001 From: Mark Salter Date: Sat, 5 Mar 2011 19:46:48 -0500 Subject: support c6x kernel using generic stat.h 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 (limited to 'libc') diff --git a/libc/sysdeps/linux/c6x/bits/kernel_stat.h b/libc/sysdeps/linux/c6x/bits/kernel_stat.h index 9c0bfa640..f8381c703 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 eba31245d..000000000 --- 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. */ -- cgit v1.2.3 From e5d4a571e1e8850b36bbfb246270b63dab0c2a3d Mon Sep 17 00:00:00 2001 From: Mark Salter Date: Sun, 6 Mar 2011 17:44:00 -0500 Subject: cleanup hardcoded syscall numbers Signed-off-by: Mark Salter Signed-off-by: Bernd Schmidt --- libc/sysdeps/linux/c6x/clone.S | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'libc') diff --git a/libc/sysdeps/linux/c6x/clone.S b/libc/sysdeps/linux/c6x/clone.S index 8d9da4b49..6fba5bb98 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 -- cgit v1.2.3 From 3b5e53eaf0c94051969974aab6c0e89bdb424f9c Mon Sep 17 00:00:00 2001 From: Bernd Schmidt Date: Wed, 9 Mar 2011 16:05:33 +0100 Subject: Add a missing macro to C6X syscalls.h. We need _syscall_noerr0 to fix compilation of getuid.c. Signed-off-by: Bernd Schmidt --- libc/sysdeps/linux/c6x/bits/syscalls.h | 1 + 1 file changed, 1 insertion(+) (limited to 'libc') diff --git a/libc/sysdeps/linux/c6x/bits/syscalls.h b/libc/sysdeps/linux/c6x/bits/syscalls.h index 382ec5124..56a1667c3 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) -- cgit v1.2.3 From 98538deba691281535e3dc0839710b8630e02ac8 Mon Sep 17 00:00:00 2001 From: "Peter S. Mazinger" Date: Wed, 9 Mar 2011 20:19:49 +0100 Subject: stdlib.c, _strtod.c, stdlib.h: remove unused hidden functions Signed-off-by: Peter S. Mazinger --- libc/stdlib/_strtod.c | 2 -- libc/stdlib/stdlib.c | 27 ++++++--------------------- 2 files changed, 6 insertions(+), 23 deletions(-) (limited to 'libc') diff --git a/libc/stdlib/_strtod.c b/libc/stdlib/_strtod.c index 4e7965f9a..1d58258e7 100644 --- a/libc/stdlib/_strtod.c +++ b/libc/stdlib/_strtod.c @@ -581,7 +581,6 @@ libc_hidden_def(strtod) #define Wchar char #endif -libc_hidden_proto(__XL_NPP(strtold)) long double __XL_NPP(strtold) (const Wchar *str, Wchar **endptr __LOCALE_PARAM ) { #if FPMAX_TYPE == 3 @@ -598,7 +597,6 @@ long double __XL_NPP(strtold) (const Wchar *str, Wchar **endptr __LOCALE_PARAM return y; #endif } -libc_hidden_def(__XL_NPP(strtold)) #endif #endif diff --git a/libc/stdlib/stdlib.c b/libc/stdlib/stdlib.c index 1ed97abed..cd9a0cac6 100644 --- a/libc/stdlib/stdlib.c +++ b/libc/stdlib/stdlib.c @@ -286,11 +286,11 @@ long atol(const char *nptr) { return strtol(nptr, (char **) NULL, 10); } -libc_hidden_def(atol) #if UINT_MAX == ULONG_MAX #undef atoi extern __typeof(atol) atoi; +/* the one in stdlib.h is not enough due to prototype mismatch */ libc_hidden_proto(atoi) strong_alias(atol,atoi) libc_hidden_def(atoi) @@ -339,10 +339,13 @@ strong_alias(strtol,strtoimax) #undef strtoll #endif extern __typeof(__XL_NPP(strtol)) __XL_NPP(strtoll); +/* the one in stdlib.h is not enough due to prototype mismatch */ +#ifdef L_strtol libc_hidden_proto(__XL_NPP(strtoll)) +#endif strong_alias(__XL_NPP(strtol),__XL_NPP(strtoll)) +#ifdef L_strtol libc_hidden_def(__XL_NPP(strtoll)) -#if !defined(L_strtol_l) strong_alias(strtol,strtoq) #endif #endif @@ -353,16 +356,14 @@ strong_alias(strtol,strtoq) #if defined(ULLONG_MAX) && (LLONG_MAX > LONG_MAX) -libc_hidden_proto(__XL_NPP(strtoll)) long long __XL_NPP(strtoll)(const char * __restrict str, char ** __restrict endptr, int base __LOCALE_PARAM) { return (long long) __XL_NPP(_stdlib_strto_ll)(str, endptr, base, 1 __LOCALE_ARG); } +#ifdef L_strtoll libc_hidden_def(__XL_NPP(strtoll)) - -#if !defined(L_strtoll_l) #if (ULLONG_MAX == UINTMAX_MAX) strong_alias(strtoll,strtoimax) #endif @@ -394,9 +395,7 @@ strong_alias(strtoul,strtoumax) #undef strtoull #endif extern __typeof(__XL_NPP(strtoul)) __XL_NPP(strtoull); -libc_hidden_proto(__XL_NPP(strtoull)) strong_alias(__XL_NPP(strtoul),__XL_NPP(strtoull)) -libc_hidden_def(__XL_NPP(strtoull)) #if !defined(L_strtoul_l) strong_alias(strtoul,strtouq) #endif @@ -409,14 +408,12 @@ strong_alias(strtoul,strtouq) #if defined(ULLONG_MAX) && (LLONG_MAX > LONG_MAX) -libc_hidden_proto(__XL_NPP(strtoull)) unsigned long long __XL_NPP(strtoull)(const char * __restrict str, char ** __restrict endptr, int base __LOCALE_PARAM) { return __XL_NPP(_stdlib_strto_ll)(str, endptr, base, 0 __LOCALE_ARG); } -libc_hidden_def(__XL_NPP(strtoull)) #if !defined(L_strtoull_l) #if (ULLONG_MAX == UINTMAX_MAX) @@ -1046,13 +1043,11 @@ size_t wcstombs(char * __restrict s, const wchar_t * __restrict pwcs, size_t n) /**********************************************************************/ #if defined(L_wcstol) || defined(L_wcstol_l) -libc_hidden_proto(__XL_NPP(wcstol)) long __XL_NPP(wcstol)(const wchar_t * __restrict str, wchar_t ** __restrict endptr, int base __LOCALE_PARAM) { return __XL_NPP(_stdlib_wcsto_l)(str, endptr, base, 1 __LOCALE_ARG); } -libc_hidden_def(__XL_NPP(wcstol)) #if (ULONG_MAX == UINTMAX_MAX) && !defined(L_wcstol_l) strong_alias(wcstol,wcstoimax) @@ -1065,9 +1060,7 @@ strong_alias(wcstol,wcstoimax) #undef wcstoll #endif extern __typeof(__XL_NPP(wcstol)) __XL_NPP(wcstoll); -libc_hidden_proto(__XL_NPP(wcstoll)) strong_alias(__XL_NPP(wcstol),__XL_NPP(wcstoll)) -libc_hidden_def(__XL_NPP(wcstoll)) #endif #endif @@ -1076,14 +1069,12 @@ libc_hidden_def(__XL_NPP(wcstoll)) #if defined(ULLONG_MAX) && (LLONG_MAX > LONG_MAX) -libc_hidden_proto(__XL_NPP(wcstoll)) long long __XL_NPP(wcstoll)(const wchar_t * __restrict str, wchar_t ** __restrict endptr, int base __LOCALE_PARAM) { return (long long) __XL_NPP(_stdlib_wcsto_ll)(str, endptr, base, 1 __LOCALE_ARG); } -libc_hidden_def(__XL_NPP(wcstoll)) #if !defined(L_wcstoll_l) #if (ULLONG_MAX == UINTMAX_MAX) @@ -1098,14 +1089,12 @@ strong_alias(wcstoll,wcstoq) /**********************************************************************/ #if defined(L_wcstoul) || defined(L_wcstoul_l) -libc_hidden_proto(__XL_NPP(wcstoul)) unsigned long __XL_NPP(wcstoul)(const wchar_t * __restrict str, wchar_t ** __restrict endptr, int base __LOCALE_PARAM) { return __XL_NPP(_stdlib_wcsto_l)(str, endptr, base, 0 __LOCALE_ARG); } -libc_hidden_def(__XL_NPP(wcstoul)) #if (ULONG_MAX == UINTMAX_MAX) && !defined(L_wcstoul_l) strong_alias(wcstoul,wcstoumax) @@ -1118,9 +1107,7 @@ strong_alias(wcstoul,wcstoumax) #undef wcstoull #endif extern __typeof(__XL_NPP(wcstoul)) __XL_NPP(wcstoull); -libc_hidden_proto(__XL_NPP(wcstoull)) strong_alias(__XL_NPP(wcstoul),__XL_NPP(wcstoull)) -libc_hidden_def(__XL_NPP(wcstoull)) #endif #endif @@ -1129,14 +1116,12 @@ libc_hidden_def(__XL_NPP(wcstoull)) #if defined(ULLONG_MAX) && (LLONG_MAX > LONG_MAX) -libc_hidden_proto(__XL_NPP(wcstoull)) unsigned long long __XL_NPP(wcstoull)(const wchar_t * __restrict str, wchar_t ** __restrict endptr, int base __LOCALE_PARAM) { return __XL_NPP(_stdlib_wcsto_ll)(str, endptr, base, 0 __LOCALE_ARG); } -libc_hidden_def(__XL_NPP(wcstoull)) #if !defined(L_wcstoull_l) #if (ULLONG_MAX == UINTMAX_MAX) -- cgit v1.2.3 From f4ec824864b8ea68af8953669f789656cc05143d Mon Sep 17 00:00:00 2001 From: "Peter S. Mazinger" Date: Wed, 9 Mar 2011 21:11:47 +0100 Subject: ctype.c, _collate.c, str[n]casecmp.c, strlcpy.c: remove unused hidden functions Signed-off-by: Peter S. Mazinger --- libc/misc/ctype/ctype.c | 1 - libc/string/_collate.c | 7 ++++--- libc/string/strcasecmp.c | 4 ++++ libc/string/strlcpy.c | 2 -- libc/string/strncasecmp.c | 4 ++++ 5 files changed, 12 insertions(+), 6 deletions(-) (limited to 'libc') diff --git a/libc/misc/ctype/ctype.c b/libc/misc/ctype/ctype.c index e46f66b58..54cd21e87 100644 --- a/libc/misc/ctype/ctype.c +++ b/libc/misc/ctype/ctype.c @@ -346,7 +346,6 @@ int toupper_l(int c, __locale_t l) #endif return __UCLIBC_CTYPE_IN_TO_DOMAIN(c) ? l->__ctype_toupper[c] : c; } -libc_hidden_def(toupper_l) /*remove after 0.9.31. See ctype.h for why. *weak_alias (toupper_l, __toupper_l) */ diff --git a/libc/string/_collate.c b/libc/string/_collate.c index 77d9eb62c..58faa5a84 100644 --- a/libc/string/_collate.c +++ b/libc/string/_collate.c @@ -62,7 +62,6 @@ size_t wcsxfrm(Wchar *__restrict ws1, const Wchar *__restrict ws2, size_t n) { return wcsxfrm_l(ws1, ws2, n, __UCLIBC_CURLOCALE ); } -libc_hidden_def(wcsxfrm) #else /* defined(__UCLIBC_HAS_XLOCALE__) && !defined(__UCLIBC_DO_XLOCALE) */ @@ -541,7 +540,6 @@ libc_hidden_def(__XL_NPP(wcscoll)) extern size_t __wcslcpy(wchar_t *__restrict dst, const wchar_t *__restrict src, size_t n); -libc_hidden_proto(__XL_NPP(wcsxfrm)) size_t __XL_NPP(wcsxfrm)(wchar_t *__restrict ws1, const wchar_t *__restrict ws2, size_t n __LOCALE_PARAM ) { @@ -579,7 +577,9 @@ size_t __XL_NPP(wcsxfrm)(wchar_t *__restrict ws1, const wchar_t *__restrict ws2, } return count-1; } +#if defined L_strxfrm_l || defined L_wcsxfrm_l libc_hidden_def(__XL_NPP(wcsxfrm)) +#endif #else /* WANT_WIDE */ @@ -623,7 +623,6 @@ static size_t store(unsigned char *s, size_t count, size_t n, __uwchar_t weight) return r; } -libc_hidden_proto(__XL_NPP(strxfrm)) size_t __XL_NPP(strxfrm)(char *__restrict ws1, const char *__restrict ws2, size_t n __LOCALE_PARAM ) { @@ -661,7 +660,9 @@ size_t __XL_NPP(strxfrm)(char *__restrict ws1, const char *__restrict ws2, size_ } return count-1; } +#ifdef L_strxfrm_l libc_hidden_def(__XL_NPP(strxfrm)) +#endif #endif /* WANT_WIDE */ diff --git a/libc/string/strcasecmp.c b/libc/string/strcasecmp.c index 33e48fa22..8c95ac04b 100644 --- a/libc/string/strcasecmp.c +++ b/libc/string/strcasecmp.c @@ -31,7 +31,9 @@ int strcasecmp(register const Wchar *s1, register const Wchar *s2) { return strcasecmp_l(s1, s2, __UCLIBC_CURLOCALE); } +#ifndef WANT_WIDE libc_hidden_def(strcasecmp) +#endif #else /* defined(__UCLIBC_HAS_XLOCALE__) && !defined(__UCLIBC_DO_XLOCALE) */ @@ -59,6 +61,8 @@ int __XL_NPP(strcasecmp)(register const Wchar *s1, register const Wchar *s2 return r; #endif } +#ifndef WANT_WIDE libc_hidden_def(__XL_NPP(strcasecmp)) +#endif #endif /* defined(__UCLIBC_HAS_XLOCALE__) && !defined(__UCLIBC_DO_XLOCALE) */ diff --git a/libc/string/strlcpy.c b/libc/string/strlcpy.c index 0ccfc0e8a..049c92e0a 100644 --- a/libc/string/strlcpy.c +++ b/libc/string/strlcpy.c @@ -49,7 +49,6 @@ size_t Wstrlcpy(register Wchar *__restrict dst, #ifndef __UCLIBC_HAS_LOCALE__ strong_alias(__wcslcpy,wcsxfrm) -libc_hidden_def(wcsxfrm) #endif #else @@ -57,7 +56,6 @@ libc_hidden_def(wcsxfrm) libc_hidden_def(strlcpy) #ifndef __UCLIBC_HAS_LOCALE__ strong_alias(strlcpy,strxfrm) -libc_hidden_def(strxfrm) #endif #endif diff --git a/libc/string/strncasecmp.c b/libc/string/strncasecmp.c index 2af305e16..4de01143f 100644 --- a/libc/string/strncasecmp.c +++ b/libc/string/strncasecmp.c @@ -31,7 +31,9 @@ int strncasecmp(register const Wchar *s1, register const Wchar *s2, size_t n) { return strncasecmp_l(s1, s2, n, __UCLIBC_CURLOCALE); } +#ifndef WANT_WIDE libc_hidden_def(strncasecmp) +#endif #else /* defined(__UCLIBC_HAS_XLOCALE__) && !defined(__UCLIBC_DO_XLOCALE) */ @@ -62,6 +64,8 @@ int __XL_NPP(strncasecmp)(register const Wchar *s1, register const Wchar *s2, return r; #endif } +#ifndef WANT_WIDE libc_hidden_def(__XL_NPP(strncasecmp)) +#endif #endif /* defined(__UCLIBC_HAS_XLOCALE__) && !defined(__UCLIBC_DO_XLOCALE) */ -- cgit v1.2.3 From 1350fdff4b950d42771d6ea7b246e2d269e2bd72 Mon Sep 17 00:00:00 2001 From: "Peter S. Mazinger" Date: Wed, 9 Mar 2011 21:30:53 +0100 Subject: wchar.h, _collate.c, strlcpy.c: use a common prototype of __wcslcpy Signed-off-by: Peter S. Mazinger --- libc/string/_collate.c | 3 --- libc/string/strlcpy.c | 20 +++++--------------- 2 files changed, 5 insertions(+), 18 deletions(-) (limited to 'libc') diff --git a/libc/string/_collate.c b/libc/string/_collate.c index 58faa5a84..be1951301 100644 --- a/libc/string/_collate.c +++ b/libc/string/_collate.c @@ -537,9 +537,6 @@ libc_hidden_def(__XL_NPP(wcscoll)) #ifdef WANT_WIDE -extern size_t __wcslcpy(wchar_t *__restrict dst, - const wchar_t *__restrict src, size_t n); - size_t __XL_NPP(wcsxfrm)(wchar_t *__restrict ws1, const wchar_t *__restrict ws2, size_t n __LOCALE_PARAM ) { diff --git a/libc/string/strlcpy.c b/libc/string/strlcpy.c index 049c92e0a..83787049a 100644 --- a/libc/string/strlcpy.c +++ b/libc/string/strlcpy.c @@ -9,19 +9,16 @@ #ifdef WANT_WIDE # define Wstrlcpy __wcslcpy +# define Wstrxfrm wcsxfrm #else # define Wstrlcpy strlcpy +# define Wstrxfrm strxfrm #endif /* OpenBSD function: * Copy at most n-1 chars from src to dst and nul-terminate dst. * Returns strlen(src), so truncation occurred if the return value is >= n. */ -#ifdef WANT_WIDE -size_t Wstrlcpy(register Wchar *__restrict dst, - register const Wchar *__restrict src, - size_t n) attribute_hidden; -#endif size_t Wstrlcpy(register Wchar *__restrict dst, register const Wchar *__restrict src, size_t n) @@ -45,17 +42,10 @@ size_t Wstrlcpy(register Wchar *__restrict dst, return src - src0; } -#ifdef WANT_WIDE - -#ifndef __UCLIBC_HAS_LOCALE__ -strong_alias(__wcslcpy,wcsxfrm) -#endif - -#else - +#ifndef WANT_WIDE libc_hidden_def(strlcpy) -#ifndef __UCLIBC_HAS_LOCALE__ -strong_alias(strlcpy,strxfrm) #endif +#ifndef __UCLIBC_HAS_LOCALE__ +strong_alias(Wstrlcpy,Wstrxfrm) #endif -- cgit v1.2.3 From 01b480ad1454ee3664ffcb8b3ecf0d89ccb7d56b Mon Sep 17 00:00:00 2001 From: "Peter S. Mazinger" Date: Wed, 9 Mar 2011 21:40:01 +0100 Subject: _collate.c: remove duplicated libc_hidden_proto() for strcoll*/wcscoll* Signed-off-by: Peter S. Mazinger --- libc/string/_collate.c | 1 - 1 file changed, 1 deletion(-) (limited to 'libc') diff --git a/libc/string/_collate.c b/libc/string/_collate.c index be1951301..def56d260 100644 --- a/libc/string/_collate.c +++ b/libc/string/_collate.c @@ -499,7 +499,6 @@ static void next_weight(col_state_t *cs, int pass __LOCALE_PARAM ) } while (1); } -libc_hidden_proto(__XL_NPP(wcscoll)) int __XL_NPP(wcscoll) (const Wchar *s0, const Wchar *s1 __LOCALE_PARAM ) { col_state_t ws[2]; -- cgit v1.2.3 From e60342da428076ae6d3097950a3c5454bab84160 Mon Sep 17 00:00:00 2001 From: "Peter S. Mazinger" Date: Wed, 9 Mar 2011 21:55:39 +0100 Subject: memmem.c, string.h: remove unused hidden memmem It is used only by gen_collate, not included into libc. Signed-off-by: Peter S. Mazinger --- libc/string/generic/memmem.c | 1 - libc/string/memmem.c | 1 - 2 files changed, 2 deletions(-) (limited to 'libc') diff --git a/libc/string/generic/memmem.c b/libc/string/generic/memmem.c index 0fccac77f..97384978b 100644 --- a/libc/string/generic/memmem.c +++ b/libc/string/generic/memmem.c @@ -48,5 +48,4 @@ void *memmem (const void *haystack, size_t haystack_len, return NULL; } -libc_hidden_def(memmem) #endif diff --git a/libc/string/memmem.c b/libc/string/memmem.c index f568a4261..1b3a0bab6 100644 --- a/libc/string/memmem.c +++ b/libc/string/memmem.c @@ -37,5 +37,4 @@ void *memmem(const void *haystack, size_t haystacklen, return NULL; } -libc_hidden_def(memmem) #endif -- cgit v1.2.3 From 3ec2f90152de3b11266bc0d3f4fa6a41b3c52374 Mon Sep 17 00:00:00 2001 From: "Peter S. Mazinger" Date: Wed, 9 Mar 2011 22:37:05 +0100 Subject: frv/memset.S: add missing libc_hidden_def Signed-off-by: Peter S. Mazinger --- libc/string/frv/memset.S | 1 + 1 file changed, 1 insertion(+) (limited to 'libc') diff --git a/libc/string/frv/memset.S b/libc/string/frv/memset.S index a3e76c491..bc0f80db0 100644 --- a/libc/string/frv/memset.S +++ b/libc/string/frv/memset.S @@ -155,3 +155,4 @@ memset: bralr .size memset, .-memset +libc_hidden_def(memset) -- cgit v1.2.3 From abd6c6c29f82ddcc7c86c67519b79d2381622ed9 Mon Sep 17 00:00:00 2001 From: "Peter S. Mazinger" Date: Wed, 9 Mar 2011 23:20:16 +0100 Subject: remove unused hidden functions Signed-off-by: Peter S. Mazinger --- libc/stdio/_scanf.c | 1 - libc/stdio/fwprintf.c | 1 - libc/string/stpncpy.c | 4 ---- libc/string/strchr.c | 7 ++++--- libc/string/strchrnul.c | 2 ++ libc/string/strcpy.c | 4 +--- 6 files changed, 7 insertions(+), 12 deletions(-) (limited to 'libc') diff --git a/libc/stdio/_scanf.c b/libc/stdio/_scanf.c index 1ad81cbe3..f38e72b5c 100644 --- a/libc/stdio/_scanf.c +++ b/libc/stdio/_scanf.c @@ -198,7 +198,6 @@ int vscanf(const char * __restrict format, va_list arg) { return vfscanf(stdin, format, arg); } -libc_hidden_def(vscanf) #endif /**********************************************************************/ diff --git a/libc/stdio/fwprintf.c b/libc/stdio/fwprintf.c index 2f2dddc10..954970867 100644 --- a/libc/stdio/fwprintf.c +++ b/libc/stdio/fwprintf.c @@ -21,4 +21,3 @@ int fwprintf(FILE * __restrict stream, const wchar_t * __restrict format, ...) return rv; } -libc_hidden_def(fwprintf) diff --git a/libc/string/stpncpy.c b/libc/string/stpncpy.c index 088145dea..50d83a131 100644 --- a/libc/string/stpncpy.c +++ b/libc/string/stpncpy.c @@ -27,7 +27,3 @@ Wchar *Wstpncpy(register Wchar * __restrict s1, } return s1 + (s2 - p); } - -#ifndef WANT_WIDE -libc_hidden_def(stpncpy) -#endif diff --git a/libc/string/strchr.c b/libc/string/strchr.c index 462b7b1f1..7ea477362 100644 --- a/libc/string/strchr.c +++ b/libc/string/strchr.c @@ -23,8 +23,9 @@ Wchar *Wstrchr(register const Wchar *s, Wint c) return NULL; } -libc_hidden_def(Wstrchr) - -#if !defined WANT_WIDE && defined __UCLIBC_SUSV3_LEGACY__ +#ifndef WANT_WIDE +libc_hidden_def(strchr) +# ifdef __UCLIBC_SUSV3_LEGACY__ weak_alias(strchr,index) +# endif #endif diff --git a/libc/string/strchrnul.c b/libc/string/strchrnul.c index d2d7df307..4751971bc 100644 --- a/libc/string/strchrnul.c +++ b/libc/string/strchrnul.c @@ -21,5 +21,7 @@ Wchar *Wstrchrnul(register const Wchar *s, Wint c) while (*++s && (*s != ((Wchar)c))); return (Wchar *) s; } +# ifndef WANT_WIDE libc_hidden_def(Wstrchrnul) +# endif #endif diff --git a/libc/string/strcpy.c b/libc/string/strcpy.c index bb5a16872..549360c22 100644 --- a/libc/string/strcpy.c +++ b/libc/string/strcpy.c @@ -22,8 +22,6 @@ Wchar *Wstrcpy(Wchar * __restrict s1, const Wchar * __restrict s2) return s1; } -#ifdef WANT_WIDE -/* wcscpy does not need libc_hidden_def */ -#else +#ifndef WANT_WIDE libc_hidden_def(strcpy) #endif -- cgit v1.2.3 From 25a349893513aa257718aa92c3e8755b9d89eb7e Mon Sep 17 00:00:00 2001 From: "Peter S. Mazinger" Date: Thu, 10 Mar 2011 00:01:10 +0100 Subject: str[n]casecmp.c: fix hidden usage Provide visible str[n]casecmp[_l], wcs[n]casecmp[_l]. Signed-off-by: Peter S. Mazinger --- libc/string/strcasecmp.c | 2 +- libc/string/strncasecmp.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'libc') diff --git a/libc/string/strcasecmp.c b/libc/string/strcasecmp.c index 8c95ac04b..f894e426e 100644 --- a/libc/string/strcasecmp.c +++ b/libc/string/strcasecmp.c @@ -61,7 +61,7 @@ int __XL_NPP(strcasecmp)(register const Wchar *s1, register const Wchar *s2 return r; #endif } -#ifndef WANT_WIDE +#if !defined WANT_WIDE || (defined WANT_WIDE && defined __UCLIBC_DO_XLOCALE) libc_hidden_def(__XL_NPP(strcasecmp)) #endif diff --git a/libc/string/strncasecmp.c b/libc/string/strncasecmp.c index 4de01143f..2eac47dd4 100644 --- a/libc/string/strncasecmp.c +++ b/libc/string/strncasecmp.c @@ -64,7 +64,7 @@ int __XL_NPP(strncasecmp)(register const Wchar *s1, register const Wchar *s2, return r; #endif } -#ifndef WANT_WIDE +#if !defined WANT_WIDE || (defined WANT_WIDE && defined __UCLIBC_DO_XLOCALE) libc_hidden_def(__XL_NPP(strncasecmp)) #endif -- cgit v1.2.3 From 5ab9845ea03ba2c356e58617daeab6b306959380 Mon Sep 17 00:00:00 2001 From: "Peter S. Mazinger" Date: Thu, 10 Mar 2011 00:49:01 +0100 Subject: time.c, wchar.h: remove unused hidden wcsftime Signed-off-by: Peter S. Mazinger --- libc/misc/time/time.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'libc') diff --git a/libc/misc/time/time.c b/libc/misc/time/time.c index 096c3b6b4..ccfe3444d 100644 --- a/libc/misc/time/time.c +++ b/libc/misc/time/time.c @@ -2455,11 +2455,9 @@ size_t wcsftime(wchar_t *__restrict s, size_t maxsize, { return wcsftime_l(s, maxsize, format, timeptr, __UCLIBC_CURLOCALE); } -libc_hidden_def(wcsftime) #else /* defined(__UCLIBC_HAS_XLOCALE__) && !defined(__UCLIBC_DO_XLOCALE) */ -libc_hidden_proto(__XL_NPP(wcsftime)) size_t __XL_NPP(wcsftime)(wchar_t *__restrict s, size_t maxsize, const wchar_t *__restrict format, const struct tm *__restrict timeptr __LOCALE_PARAM ) @@ -2467,7 +2465,9 @@ size_t __XL_NPP(wcsftime)(wchar_t *__restrict s, size_t maxsize, #warning wcsftime always fails return 0; /* always fail */ } -libc_hidden_def(__XL_NPP(wcsftime)) +#ifdef L_wcsftime_l +libc_hidden_def(wcsftime_l) +#endif #endif /* defined(__UCLIBC_HAS_XLOCALE__) && !defined(__UCLIBC_DO_XLOCALE) */ -- cgit v1.2.3 From 3e223e6c18912091bf75b77f9c7ae2ded0063037 Mon Sep 17 00:00:00 2001 From: "Peter S. Mazinger" Date: Thu, 10 Mar 2011 10:50:01 +0100 Subject: _wctype.c, wctype.h: remove unused isw* and wctype_l hidden functions Signed-off-by: Peter S. Mazinger --- libc/misc/wctype/_wctype.c | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) (limited to 'libc') diff --git a/libc/misc/wctype/_wctype.c b/libc/misc/wctype/_wctype.c index 296293ff3..89269f45e 100644 --- a/libc/misc/wctype/_wctype.c +++ b/libc/misc/wctype/_wctype.c @@ -140,28 +140,27 @@ enum { #ifdef __UCLIBC_DO_XLOCALE #define ISW_FUNC_BODY(NAME) \ -libc_hidden_proto(__PASTE3(isw,NAME,_l)) \ int __PASTE3(isw,NAME,_l) (wint_t wc, __locale_t l) \ { \ return iswctype_l(wc, __PASTE2(_CTYPE_is,NAME), l); \ -} \ -libc_hidden_def(__PASTE3(isw,NAME,_l)) +} #else /* __UCLIBC_DO_XLOCALE */ #define ISW_FUNC_BODY(NAME) \ -libc_hidden_proto(__PASTE2(isw,NAME)) \ int __PASTE2(isw,NAME) (wint_t wc) \ { \ return iswctype(wc, __PASTE2(_CTYPE_is,NAME)); \ -} \ -libc_hidden_def(__PASTE2(isw,NAME)) +} #endif /* __UCLIBC_DO_XLOCALE */ /**********************************************************************/ #if defined(L_iswalnum) || defined(L_iswalnum_l) ISW_FUNC_BODY(alnum); +# ifdef L_iswalnum +libc_hidden_def(iswalnum) +# endif #endif /**********************************************************************/ @@ -198,6 +197,9 @@ ISW_FUNC_BODY(graph); #if defined(L_iswlower) || defined(L_iswlower_l) ISW_FUNC_BODY(lower); +# ifdef L_iswlower +libc_hidden_def(iswlower) +# endif #endif /**********************************************************************/ @@ -216,12 +218,20 @@ ISW_FUNC_BODY(punct); #if defined(L_iswspace) || defined(L_iswspace_l) ISW_FUNC_BODY(space); +# ifdef L_iswspace +libc_hidden_def(iswspace) +# else +libc_hidden_def(iswspace_l) +# endif #endif /**********************************************************************/ #if defined(L_iswupper) || defined(L_iswupper_l) ISW_FUNC_BODY(upper); +# ifdef L_iswupper +libc_hidden_def(iswupper) +# endif #endif /**********************************************************************/ @@ -461,7 +471,6 @@ wctype_t wctype_l (const char *property, __locale_t locale) { return wctype(property); } -libc_hidden_def(wctype_l) #endif /**********************************************************************/ -- cgit v1.2.3 From 14b0a648ca751773fe28dd98f2c031bf6287e52a Mon Sep 17 00:00:00 2001 From: "Peter S. Mazinger" Date: Thu, 10 Mar 2011 11:06:25 +0100 Subject: ctype.c, ctype.h: remove commented parts that were banned for removal after 0.9.31 Signed-off-by: Peter S. Mazinger --- libc/misc/ctype/ctype.c | 4 ---- 1 file changed, 4 deletions(-) (limited to 'libc') diff --git a/libc/misc/ctype/ctype.c b/libc/misc/ctype/ctype.c index 54cd21e87..1c40b244a 100644 --- a/libc/misc/ctype/ctype.c +++ b/libc/misc/ctype/ctype.c @@ -306,8 +306,6 @@ int tolower_l(int c, __locale_t l) return __UCLIBC_CTYPE_IN_TO_DOMAIN(c) ? l->__ctype_tolower[c] : c; } libc_hidden_def(tolower_l) -/*remove after 0.9.31. See ctype.h for why. - *weak_alias (tolower_l, __tolower_l) */ #endif /**********************************************************************/ @@ -346,8 +344,6 @@ int toupper_l(int c, __locale_t l) #endif return __UCLIBC_CTYPE_IN_TO_DOMAIN(c) ? l->__ctype_toupper[c] : c; } -/*remove after 0.9.31. See ctype.h for why. - *weak_alias (toupper_l, __toupper_l) */ #endif /**********************************************************************/ -- cgit v1.2.3 From fcde46eae5c16948c71f71d0b8fb82019f60f51f Mon Sep 17 00:00:00 2001 From: "Peter S. Mazinger" Date: Thu, 10 Mar 2011 11:33:51 +0100 Subject: nanosleep.c: remove duplicated libc_hidden_proto Signed-off-by: Peter S. Mazinger --- libc/sysdeps/linux/common/nanosleep.c | 1 - 1 file changed, 1 deletion(-) (limited to 'libc') diff --git a/libc/sysdeps/linux/common/nanosleep.c b/libc/sysdeps/linux/common/nanosleep.c index 0be59c511..26ce4a6c5 100644 --- a/libc/sysdeps/linux/common/nanosleep.c +++ b/libc/sysdeps/linux/common/nanosleep.c @@ -36,6 +36,5 @@ int __libc_nanosleep(const struct timespec *req, struct timespec *rem) #endif } -libc_hidden_proto(nanosleep) weak_alias(__libc_nanosleep,nanosleep) libc_hidden_weak(nanosleep) -- cgit v1.2.3 From 24a14a0bb867f02ba87b498ee64e3ed6ce33b27a Mon Sep 17 00:00:00 2001 From: "Peter S. Mazinger" Date: Thu, 10 Mar 2011 11:34:38 +0100 Subject: time.c, time.h: remove unused hidden strftime/strptime Signed-off-by: Peter S. Mazinger --- libc/misc/time/time.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'libc') diff --git a/libc/misc/time/time.c b/libc/misc/time/time.c index ccfe3444d..19d68e105 100644 --- a/libc/misc/time/time.c +++ b/libc/misc/time/time.c @@ -799,7 +799,6 @@ size_t strftime(char *__restrict s, size_t maxsize, { return strftime_l(s, maxsize, format, timeptr, __UCLIBC_CURLOCALE); } -libc_hidden_def(strftime) #else /* defined(__UCLIBC_HAS_XLOCALE__) && !defined(__UCLIBC_DO_XLOCALE) */ @@ -999,7 +998,6 @@ static int load_field(int k, const struct tm *__restrict timeptr) #warning TODO: Check multibyte format string validity. #endif -libc_hidden_proto(__XL_NPP(strftime)) size_t __XL_NPP(strftime)(char *__restrict s, size_t maxsize, const char *__restrict format, const struct tm *__restrict timeptr __LOCALE_PARAM ) @@ -1291,7 +1289,9 @@ OUTPUT: } goto LOOP; } -libc_hidden_def(__XL_NPP(strftime)) +# ifdef L_strftime_l +libc_hidden_def(strftime_l) +# endif #endif /* defined(__UCLIBC_HAS_XLOCALE__) && !defined(__UCLIBC_DO_XLOCALE) */ @@ -1314,7 +1314,6 @@ char *strptime(const char *__restrict buf, const char *__restrict format, { return strptime_l(buf, format, tm, __UCLIBC_CURLOCALE); } -libc_hidden_def(strptime) #else /* defined(__UCLIBC_HAS_XLOCALE__) && !defined(__UCLIBC_DO_XLOCALE) */ @@ -1460,7 +1459,6 @@ static const unsigned char spec[] = { #define MAX_PUSH 4 -libc_hidden_proto(__XL_NPP(strptime)) char *__XL_NPP(strptime)(const char *__restrict buf, const char *__restrict format, struct tm *__restrict tm __LOCALE_PARAM) { @@ -1671,7 +1669,9 @@ LOOP: } return NULL; } -libc_hidden_def(__XL_NPP(strptime)) +# ifdef L_strptime_l +libc_hidden_def(strptime_l) +# endif #endif /* defined(__UCLIBC_HAS_XLOCALE__) && !defined(__UCLIBC_DO_XLOCALE) */ -- cgit v1.2.3 From e2cea9b9edabe885b9bf2586f9541ffb8fe93f3f Mon Sep 17 00:00:00 2001 From: "Peter S. Mazinger" Date: Thu, 10 Mar 2011 11:43:07 +0100 Subject: missing prototype of __libc_drand48_data fixed Signed-off-by: Peter S. Mazinger --- libc/stdlib/drand48-iter.c | 1 + 1 file changed, 1 insertion(+) (limited to 'libc') diff --git a/libc/stdlib/drand48-iter.c b/libc/stdlib/drand48-iter.c index e0c1ce430..612cfd0d9 100644 --- a/libc/stdlib/drand48-iter.c +++ b/libc/stdlib/drand48-iter.c @@ -21,6 +21,7 @@ #include #include #include +#include #include #ifdef __UCLIBC_MJN3_ONLY__ -- cgit v1.2.3 From c725e8ba5f049686ed7318d6b4710308677462c9 Mon Sep 17 00:00:00 2001 From: "Peter S. Mazinger" Date: Thu, 10 Mar 2011 12:59:15 +0100 Subject: Revert "missing prototype of __libc_drand48_data fixed" This reverts commit e2cea9b9edabe885b9bf2586f9541ffb8fe93f3f. Signed-off-by: Peter S. Mazinger --- libc/stdlib/drand48-iter.c | 1 - 1 file changed, 1 deletion(-) (limited to 'libc') diff --git a/libc/stdlib/drand48-iter.c b/libc/stdlib/drand48-iter.c index 612cfd0d9..e0c1ce430 100644 --- a/libc/stdlib/drand48-iter.c +++ b/libc/stdlib/drand48-iter.c @@ -21,7 +21,6 @@ #include #include #include -#include #include #ifdef __UCLIBC_MJN3_ONLY__ -- cgit v1.2.3 From 6f633b7aef2af2801d059acda48b424fc12c71ac Mon Sep 17 00:00:00 2001 From: "Peter S. Mazinger" Date: Thu, 10 Mar 2011 13:02:19 +0100 Subject: really fix missing __libc_drand48_data Signed-off-by: Peter S. Mazinger --- libc/stdlib/drand48-iter.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'libc') diff --git a/libc/stdlib/drand48-iter.c b/libc/stdlib/drand48-iter.c index e0c1ce430..7d705adca 100644 --- a/libc/stdlib/drand48-iter.c +++ b/libc/stdlib/drand48-iter.c @@ -21,8 +21,12 @@ #include #include #include +#include #include +/* Global state for non-reentrant functions. */ +struct drand48_data __libc_drand48_data; + #ifdef __UCLIBC_MJN3_ONLY__ #warning turn int __drand48_iterate into void #endif /* __UCLIBC_MJN3_ONLY__ */ -- cgit v1.2.3 From e25a95a7a3c9f5bb3a38106422b12f83bf58d119 Mon Sep 17 00:00:00 2001 From: Khem Raj Date: Mon, 14 Mar 2011 22:45:33 -0700 Subject: arm/bits/atomic.h: Include common/bit/atomic.h for thumb1 This restores the behavior for thumb1 builds and yet uses the new atomic.h for arm and thumb2 modes. Signed-off-by: Khem Raj --- libc/sysdeps/linux/arm/bits/atomic.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'libc') diff --git a/libc/sysdeps/linux/arm/bits/atomic.h b/libc/sysdeps/linux/arm/bits/atomic.h index 07101fbe8..0b90330dd 100644 --- a/libc/sysdeps/linux/arm/bits/atomic.h +++ b/libc/sysdeps/linux/arm/bits/atomic.h @@ -16,6 +16,9 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ +#if defined __thumb__ && !defined __thumb2__ +#include_next +#else #include #include @@ -129,3 +132,5 @@ void __arm_link_error (void); #define __arch_compare_and_exchange_val_64_acq(mem, newval, oldval) \ ({ __arm_link_error (); oldval; }) + +#endif -- cgit v1.2.3 From 2f9445814cb01b460a1426d41e05c738a4a37f86 Mon Sep 17 00:00:00 2001 From: Bernhard Reutner-Fischer Date: Wed, 16 Mar 2011 20:09:43 +0100 Subject: memalign: include sys/param.h for MAX libc/stdlib/malloc/memalign.c:22:1: warning: "MAX" redefined In file included from ./libpthread/nptl/sysdeps/unix/sysv/linux/i386/lowlevellock.h:25, from ./include/bits/libc-lock.h:36, from ./include/bits/stdio-lock.h:23, from ./include/bits/uClibc_mutex.h:71, from libc/stdlib/malloc/malloc.h:135, from libc/stdlib/malloc/memalign.c:18: ./include/sys/param.h:75:1: warning: this is the location of the previous definition Signed-off-by: Bernhard Reutner-Fischer --- libc/stdlib/malloc/memalign.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'libc') diff --git a/libc/stdlib/malloc/memalign.c b/libc/stdlib/malloc/memalign.c index 6826d623a..5edd6e1cd 100644 --- a/libc/stdlib/malloc/memalign.c +++ b/libc/stdlib/malloc/memalign.c @@ -14,13 +14,12 @@ #include #include #include +#include /* MAX */ #include "malloc.h" #include "heap.h" -#define MAX(x,y) ((x) > (y) ? (x) : (y)) - /* ______________________ TOTAL _________________________ / \ -- cgit v1.2.3 From 251f2266bf24b1b396f59eef60d0acf41fdd02e4 Mon Sep 17 00:00:00 2001 From: "Peter S. Mazinger" Date: Fri, 18 Mar 2011 15:37:35 +0100 Subject: lutimes.c, stubs.c: fix compiling lutimes, if __NR_utimensat is not defined while there, provide stubs for functions depending on utimensat syscall. Reported-by: Sedat Dilek Signed-off-by: Peter S. Mazinger Signed-off-by: Khem Raj --- libc/sysdeps/linux/common/lutimes.c | 2 +- libc/sysdeps/linux/common/stubs.c | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) (limited to 'libc') diff --git a/libc/sysdeps/linux/common/lutimes.c b/libc/sysdeps/linux/common/lutimes.c index 0b4a8ea45..e01d40efd 100644 --- a/libc/sysdeps/linux/common/lutimes.c +++ b/libc/sysdeps/linux/common/lutimes.c @@ -12,7 +12,7 @@ #ifdef __NR_lutimes _syscall2(int, lutimes, const char *, file, const struct timeval *, tvp) -#else +#elif defined __NR_utimensat #include #include diff --git a/libc/sysdeps/linux/common/stubs.c b/libc/sysdeps/linux/common/stubs.c index 8688e98a1..655c64001 100644 --- a/libc/sysdeps/linux/common/stubs.c +++ b/libc/sysdeps/linux/common/stubs.c @@ -172,6 +172,14 @@ make_stub(umount) make_stub(umount2) #endif +#ifndef __NR_utimensat +make_stub(futimens) +make_stub(utimensat) +# ifndef __NR_lutimes +make_stub(lutimes) +# endif +#endif + #ifndef __NR_vmsplice make_stub(vmsplice) #endif -- cgit v1.2.3 From 9b5df2295b4a3cfc63a15b6490f2b61dcf7c1be9 Mon Sep 17 00:00:00 2001 From: Thorsten Glaser Date: Sat, 26 Mar 2011 15:11:51 +0000 Subject: cris: add provide arch-specific vfork implementation 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 deletion(-) create mode 100644 libc/sysdeps/linux/cris/vfork.S (limited to 'libc') diff --git a/libc/sysdeps/linux/cris/Makefile.arch b/libc/sysdeps/linux/cris/Makefile.arch index 43e191205..8a682b0b6 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 000000000..ea8a81d82 --- /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) -- cgit v1.2.3